From patchwork Tue Jun 22 12:15:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 56466 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id C4BDFB6F1B for ; Tue, 22 Jun 2010 22:15:54 +1000 (EST) Received: (qmail 17877 invoked by alias); 22 Jun 2010 12:15:51 -0000 Received: (qmail 17777 invoked by uid 22791); 22 Jun 2010 12:15:48 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Jun 2010 12:15:40 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 98DAFCB0290; Tue, 22 Jun 2010 14:15:41 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2nLe7zRnaNwq; Tue, 22 Jun 2010 14:15:41 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id 814D4CB0266; Tue, 22 Jun 2010 14:15:41 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 7436AD9B31; Tue, 22 Jun 2010 14:15:41 +0200 (CEST) Date: Tue, 22 Jun 2010 14:15:41 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Robert Dewar Subject: [Ada] Allow 'Mod attribute in Ada 95 mode Message-ID: <20100622121541.GA32760@adacore.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch allows 'Mod to be recognized and properly processed in Ada 95 mode as an implementation defined attribute. The following program now compiles quietly in either Ada 95 or Ada 2005 mode: package mod95a is type r is mod 2 ** 16; b : constant := r'mod (1); end; The following program compiles quietly in Ada 2005 mode, but in Ada 95 mode gets a message complaining that 'Mod violates the restriction: pragma Restrictions (No_Implementation_Attributes); package mod95b is type r is mod 2 ** 16; b : constant := r'mod (1); end; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-22 Robert Dewar * par-ch4.adb (P_Name): Recognize 'Mod attribute in Ada 95 mode * sem_attr.adb (Attribute_05): Add Name_Mod so that 'Mod recognized in Ada 95 mode as an implementation defined attribute. Index: par-ch4.adb =================================================================== --- par-ch4.adb (revision 161073) +++ par-ch4.adb (working copy) @@ -437,7 +437,7 @@ package body Ch4 is elsif Token = Tok_Access then Attr_Name := Name_Access; - elsif Token = Tok_Mod and then Ada_Version = Ada_05 then + elsif Token = Tok_Mod and then Ada_Version >= Ada_95 then Attr_Name := Name_Mod; elsif Apostrophe_Should_Be_Semicolon then Index: sem_attr.adb =================================================================== --- sem_attr.adb (revision 161136) +++ sem_attr.adb (working copy) @@ -136,6 +136,7 @@ package body Sem_Attr is Attribute_05 : constant Attribute_Class_Array := Attribute_Class_Array'( Attribute_Machine_Rounding | + Attribute_Mod | Attribute_Priority | Attribute_Stream_Size | Attribute_Wide_Wide_Width => True,