From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9562 invoked by alias); 6 Jan 2015 09:32:21 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 9551 invoked by uid 89); 6 Jan 2015 09:32:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 06 Jan 2015 09:32:19 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 7BB67116431; Tue, 6 Jan 2015 04:32:17 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id YNpO9xedOT78; Tue, 6 Jan 2015 04:32:17 -0500 (EST) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 6985911630C; Tue, 6 Jan 2015 04:32:17 -0500 (EST) Received: by kwai.gnat.com (Postfix, from userid 4192) id 673F391A7D; Tue, 6 Jan 2015 04:32:17 -0500 (EST) Date: Tue, 06 Jan 2015 09:32:00 -0000 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Robert Dewar Subject: [Ada] Preliminary work for new restriction No_Use_Of_Entity Message-ID: <20150106093217.GA11293@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="azLHFNyN32YCQGCU" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-01/txt/msg00212.txt.bz2 --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 504 This checkin is preliminary work for a new restriction No_Use_Of_Entity. No test needed, since no external effect yet! Tested on x86_64-pc-linux-gnu, committed on trunk 2015-01-06 Robert Dewar * namet.ads: Document use of Boolean2 for No_Use_Of_Entity. * restrict.ads (No_Use_Of_Entity): New table. * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings): Ignore No_Use_Of_Entity (will be processed in parser). * snames.ads-tmpl: Add entry for Name_No_Use_Of_Entity. --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=difs Content-length: 5724 Index: sem_prag.adb =================================================================== --- sem_prag.adb (revision 219230) +++ sem_prag.adb (working copy) @@ -8857,7 +8857,7 @@ raise Pragma_Exit; end if; - -- Case of No_Specification_Of_Aspect => Identifier. + -- Case of No_Specification_Of_Aspect => aspect-identifier elsif Id = Name_No_Specification_Of_Aspect then declare @@ -8877,6 +8877,8 @@ end if; end; + -- Case of No_Use_Of_Attribute => attribute-identifier + elsif Id = Name_No_Use_Of_Attribute then if Nkind (Expr) /= N_Identifier or else not Is_Attribute_Name (Chars (Expr)) @@ -8887,6 +8889,15 @@ Set_Restriction_No_Use_Of_Attribute (Expr, Warn); end if; + -- Case of No_Use_Of_Entity => fully-qualified-name. Note that the + -- parser already processed this case commpletely, including error + -- checking and making an entry in the No_Use_Of_Entity table. + + elsif Id = Name_No_Use_Of_Entity then + null; + + -- Case of No_Use_Of_Pragma => pragma-identifier + elsif Id = Name_No_Use_Of_Pragma then if Nkind (Expr) /= N_Identifier or else not Is_Pragma_Name (Chars (Expr)) Index: restrict.ads =================================================================== --- restrict.ads (revision 219191) +++ restrict.ads (working copy) @@ -51,8 +51,8 @@ -- set from package Standard by the processing in Targparm. Restriction_Profile_Name : array (All_Restrictions) of Profile_Name; - -- Entries in this array are valid only if the corresponding restriction - -- in Restrictions set. The value is the corresponding profile name if the + -- Entries in this array are valid only if the corresponding restriction in + -- Restrictions is set. The value is the corresponding profile name if the -- restriction was set by a Profile or Profile_Warnings pragma. The value -- is No_Profile in all other cases. @@ -148,6 +148,10 @@ SPARK_05 => True, others => False); + -------------------------- + -- No_Dependences Table -- + -------------------------- + -- The following table records entries made by Restrictions pragmas -- that specify a parameter for No_Dependence. Each such pragma makes -- an entry in this table. @@ -179,6 +183,43 @@ Table_Increment => 200, Table_Name => "Name_No_Dependences"); + ---------------------------- + -- No_Use_Of_Entity Table -- + ---------------------------- + + -- The following table records entries made by Restrictions pragmas + -- that specify a parameter for No_Use_Of_Entity. Each such pragma makes + -- an entry in this table. + + -- Note: we have chosen to implement this restriction in the "syntactic" + -- form, where we allow arbitrary fully qualified names to be specified. + + type NE_Entry is record + Entity : Node_Id; + -- The entity parameter from the No_Use_Of_Entity pragma. This is in + -- the form of a selected component, since that is the way the parser + -- processes it, and we don't further analyze it. + + Warn : Boolean; + -- True if from Restriction_Warnings, False if from Restrictions + + Profile : Profile_Name; + -- Set to name of profile from which No_Use_Of_Entity entry came, or to + -- No_Profile if a pragma Restriction set the No_Use_Of_Entity entry. + end record; + + package No_Use_Of_Entity is new Table.Table ( + Table_Component_Type => NE_Entry, + Table_Index_Type => Int, + Table_Low_Bound => 0, + Table_Initial => 200, + Table_Increment => 200, + Table_Name => "Name_No_Use_Of_Entity"); + + -- Note that in addition to making an entry in this table, we also set the + -- Boolean2 flag of the Name_Table entry for the simple name of the entity. + -- This is used to avoid most useless searches of this table. + ----------------- -- Subprograms -- ----------------- Index: namet.ads =================================================================== --- namet.ads (revision 219231) +++ namet.ads (working copy) @@ -131,8 +131,12 @@ -- The Boolean1 field is used to mark address clauses to optimize the -- performance of the Exp_Util.Following_Address_Clause function. --- The Boolean2/Boolean3 fields are not used +-- The Boolean2 field is used to mark simple names that appear in +-- Restriction[_Warning]s pragmas for No_Use_Of_Entity. This avoids most +-- unnecessary searches of the No_Use_Of_Entity table. +-- The Boolean3 field is not used + -- In the binder, we have the following uses: -- The Int field is used in various ways depending on the name involved, Index: snames.ads-tmpl =================================================================== --- snames.ads-tmpl (revision 219191) +++ snames.ads-tmpl (working copy) @@ -751,6 +751,7 @@ Name_No_Task_Attributes : constant Name_Id := N + $; Name_No_Task_Attributes_Package : constant Name_Id := N + $; Name_No_Use_Of_Attribute : constant Name_Id := N + $; + Name_No_Use_Of_Entity : constant Name_Id := N + $; Name_No_Use_Of_Pragma : constant Name_Id := N + $; Name_No_Unroll : constant Name_Id := N + $; Name_No_Vector : constant Name_Id := N + $; --azLHFNyN32YCQGCU--