From db761fee4caf7ceb652dc6224428a675de7b1cb3 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 6 Jan 2015 10:32:06 +0100 Subject: [PATCH] [multiple changes] 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. 2015-01-06 Vincent Celier * prj-tree.adb (Imported_Or_Extended_Project_Of): Do not try to check for an extended project, if a project does not have yet a project declaration. From-SVN: r219235 --- gcc/ada/ChangeLog | 14 +++++++++++++ gcc/ada/namet.ads | 6 +++++- gcc/ada/prj-tree.adb | 12 ++++++++--- gcc/ada/restrict.ads | 45 +++++++++++++++++++++++++++++++++++++++-- gcc/ada/sem_prag.adb | 13 +++++++++++- gcc/ada/snames.ads-tmpl | 1 + 6 files changed, 84 insertions(+), 7 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 93bbd583132..a64555ef5f9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +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. + +2015-01-06 Vincent Celier + + * prj-tree.adb (Imported_Or_Extended_Project_Of): Do not try + to check for an extended project, if a project does not have + yet a project declaration. + 2015-01-06 Pierre-Marie Derodat * scos.ads: Update documentation about the SCO table build diff --git a/gcc/ada/namet.ads b/gcc/ada/namet.ads index b4b68788dc5..6074575070c 100644 --- a/gcc/ada/namet.ads +++ b/gcc/ada/namet.ads @@ -131,7 +131,11 @@ package Namet is -- 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: diff --git a/gcc/ada/prj-tree.adb b/gcc/ada/prj-tree.adb index 205c23411b3..75def1c06ef 100644 --- a/gcc/ada/prj-tree.adb +++ b/gcc/ada/prj-tree.adb @@ -1151,6 +1151,7 @@ package body Prj.Tree is is With_Clause : Project_Node_Id; Result : Project_Node_Id := Empty_Node; + Decl : Project_Node_Id; begin -- First check all the imported projects @@ -1167,9 +1168,14 @@ package body Prj.Tree is return Result; end if; - Result := - Extended_Project_Of - (Project_Declaration_Of (Result, In_Tree), In_Tree); + Decl := Project_Declaration_Of (Result, In_Tree); + + -- Do not try to check for an extended project, if the project + -- does not have yet a project declaration. + + exit when Decl = Empty_Node; + + Result := Extended_Project_Of (Decl, In_Tree); end loop; With_Clause := Next_With_Clause_Of (With_Clause, In_Tree); diff --git a/gcc/ada/restrict.ads b/gcc/ada/restrict.ads index b16e674b9d2..a25dceed1c5 100644 --- a/gcc/ada/restrict.ads +++ b/gcc/ada/restrict.ads @@ -51,8 +51,8 @@ package Restrict is -- 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 @@ package Restrict is 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 @@ package Restrict is 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 -- ----------------- diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 91dd6848a81..2c4d531f9e0 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -8857,7 +8857,7 @@ package body Sem_Prag is 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 @@ package body Sem_Prag is 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 @@ package body Sem_Prag is 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)) diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl index 16ebf6ab142..673a7530cd2 100644 --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -751,6 +751,7 @@ package Snames is 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 + $; -- 2.30.2