From 851e9f19e27e1f840f9a978fc7103397043d8826 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Mon, 25 Sep 2017 10:07:11 +0000 Subject: [multiple changes] 2017-09-25 Justin Squirek * aspects.adb, bindgen.adb, clean.adb, erroutc.adb, exp_ch13.adb, exp_dbug.adb, exp_unst.adb, exp_util.adb, frontend.adb, gnat1drv.adb, gnatdll.adb, gnatlink.adb, gnatls.adb, gnatname.adb, gnatxref.adb, gnatfind.adb, libgnat/a-cfhama.ads, libgnat/a-exetim__mingw.adb, libgnat/a-strmap.adb, libgnat/a-teioed.adb, libgnat/g-alvety.ads, libgnat/g-expect.adb, libgnat/g-regist.adb, libgnat/g-socket.adb, libgnat/g-socthi__mingw.ads, libgnat/s-stausa.adb, libgnat/s-tsmona__linux.adb, libgnat/s-tsmona__mingw.adb, libgnarl/s-taenca.adb, libgnarl/s-tassta.adb, libgnarl/s-tarest.adb, libgnarl/s-tpobop.adb, make.adb, makeusg.adb, namet.adb, output.ads, put_scos.adb, repinfo.adb, rtsfind.adb, scn.ads, sem_attr.adb, sem_aux.ads, sem_warn.ads, targparm.adb, xr_tabls.adb, xref_lib.adb: Removal of ineffective use-clauses. * exp_ch9.adb (Is_Simple_Barrier_Name): Check for false positives with constant folded barriers. * ghost.adb, sprint.adb, sem_ch10.adb, sem_warn.adb: Change access to Subtype_Marks and Names list in use-clause nodes to their new singular counterparts (e.g. Subtype_Mark, Name). * par.adb, par-ch8.adb (Append_Use_Clause): Created to set Prev_Ids and More_Ids in use-clause nodes. (P_Use_Clause): Modify to take a list as a parameter. (P_Use_Package_Clause, P_Use_Type_Clause): Divide names and subtype_marks within an aggregate use-clauses into individual clauses. * par-ch3.adb, par-ch10.adb, par-ch12.adb: Trivally modify call to P_Use_Clause to match its new behavior. * sem.adb (Analyze): Mark use clauses for non-overloaded entities. * sem_ch4.adb (Try_One_Interp): Add sanity check to handle previous errors. * sem_ch6.adb (Analyze_Generic_Subprogram_Body, Analyze_Subprogram_Body_Helper): Update use clause chain at the end of the declarative region. * sem_ch7.adb (Analyze_Package_Body_Helper): Update use clause chain after analysis (Analyze_Package_Specification): Update use clause chain when there is no body. * sem_ch8.ads, sem_ch8.adb (Analyze_Use_Package, Analyze_Use_Type): Add parameter to determine weither the installation of scopes should also propagate on the use-clause "chain". (Mark_Use_Clauses): Created to traverse use-clause chains and determine what constitutes a valid "use" of a clause. (Update_Use_Clause_Chain): Created to aggregate common machinary used to clean up use-clause chains (and warn on ineffectiveness) at the end of declaritive regions. * sem_ch8.adb (Analyze_Package_Name): Created to perform analysis on a package name from a use-package clause. (Analyze_Package_Name_List): Created to perform analysis on a list of package names (similar to Analyze_Package_Name). (Find_Most_Prev): Created to traverse to the beginning of a given use-clause chain. (Most_Decendant_Use_Clause): Create to identify which clause from a given set is highest in scope (not always the most prev). (Use_One_Package, Use_One_Type): Major cleanup and reorganization to handle the new chaining algorithm, also many changes related to redundant clauses. A new parameter has also been added to force installation to handle certain cases. * sem_ch9.adb (Analyze_Entry_Body, Analyze_Protected_Body, Analyze_Task_Body): Mark use clauses on relevant entities. * sem_ch10.adb, sem_ch10.ads (Install_Context_Clauses, Install_Parents): Add parameter to determine weither the installation of scopes should also propagate on the use-clause "chain". * sem_ch12.adb (Inline_Instance_Body): Add flag in call to Install_Context to avoid redundant chaining of use-clauses. * sem_ch13.adb: Minor reformatting. * sem_res.adb (Resolve): Mark use clauses on operators. (Resolve_Call, Resolve_Entity_Name): Mark use clauses on relevant entities. * sinfo.adb, sinfo.ads (Is_Effective_Use_Clause, Set_Is_Effective_Use_Clause): Add new flag to N_Use_Clause nodes to represent any given clause's usage/reference/necessity. (Prev_Use_Clause, Set_Prev_Use_Clause): Add new field to N_Use_Clause nodes to allow loose chaining of redundant clauses. (Set_Used_Operations, Set_Subtype_Mark, Set_Prev_Ids, Set_Names, Set_More_Ids, Set_Name): Modify set procedure calls to reflect reorganization in node fields. * types.ads (Source_File_Index): Adjust index bounds. (No_Access_To_Source_File): New constant. 2017-09-25 Ed Schonberg * sem_ch13.adb (Analyze_One_Aspect): In ASIS mode make a full copy of the expression to be used in the generated attribute specification (rather than relocating it) to avoid resolving a potentially malformed tree when the expression is resolved through an ASIS-specific call to Resolve_Aspect_Expressions. This manifests itself as a crash on a function with parameter associations. From-SVN: r253144 --- gcc/ada/sinfo.adb | 86 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 20 deletions(-) (limited to 'gcc/ada/sinfo.adb') diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb index 4a902e8..4eb1c8c 100644 --- a/gcc/ada/sinfo.adb +++ b/gcc/ada/sinfo.adb @@ -298,7 +298,8 @@ package body Sinfo is or else NT (N).Nkind in N_Has_Entity or else NT (N).Nkind = N_Aggregate or else NT (N).Nkind = N_Extension_Aggregate - or else NT (N).Nkind = N_Selected_Component); + or else NT (N).Nkind = N_Selected_Component + or else NT (N).Nkind = N_Use_Package_Clause); return Node4 (N); end Associated_Node; @@ -1646,7 +1647,7 @@ package body Sinfo is pragma Assert (False or else NT (N).Nkind = N_Use_Package_Clause or else NT (N).Nkind = N_Use_Type_Clause); - return Elist4 (N); + return Elist5 (N); end Hidden_By_Use_Clause; function High_Bound @@ -1882,6 +1883,15 @@ package body Sinfo is return Flag18 (N); end Is_Dynamic_Coextension; + function Is_Effective_Use_Clause + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Use_Package_Clause + or else NT (N).Nkind = N_Use_Type_Clause); + return Flag1 (N); + end Is_Effective_Use_Clause; + function Is_Elsif (N : Node_Id) return Boolean is begin @@ -2254,7 +2264,9 @@ package body Sinfo is or else NT (N).Nkind = N_Formal_Object_Declaration or else NT (N).Nkind = N_Number_Declaration or else NT (N).Nkind = N_Object_Declaration - or else NT (N).Nkind = N_Parameter_Specification); + or else NT (N).Nkind = N_Parameter_Specification + or else NT (N).Nkind = N_Use_Package_Clause + or else NT (N).Nkind = N_Use_Type_Clause); return Flag5 (N); end More_Ids; @@ -2328,6 +2340,7 @@ package body Sinfo is or else NT (N).Nkind = N_Requeue_Statement or else NT (N).Nkind = N_Subprogram_Renaming_Declaration or else NT (N).Nkind = N_Subunit + or else NT (N).Nkind = N_Use_Package_Clause or else NT (N).Nkind = N_Variant_Part or else NT (N).Nkind = N_With_Clause); return Node2 (N); @@ -2337,8 +2350,7 @@ package body Sinfo is (N : Node_Id) return List_Id is begin pragma Assert (False - or else NT (N).Nkind = N_Abort_Statement - or else NT (N).Nkind = N_Use_Package_Clause); + or else NT (N).Nkind = N_Abort_Statement); return List2 (N); end Names; @@ -2723,10 +2735,21 @@ package body Sinfo is or else NT (N).Nkind = N_Formal_Object_Declaration or else NT (N).Nkind = N_Number_Declaration or else NT (N).Nkind = N_Object_Declaration - or else NT (N).Nkind = N_Parameter_Specification); + or else NT (N).Nkind = N_Parameter_Specification + or else NT (N).Nkind = N_Use_Package_Clause + or else NT (N).Nkind = N_Use_Type_Clause); return Flag6 (N); end Prev_Ids; + function Prev_Use_Clause + (N : Node_Id) return Node_Id is + begin + pragma Assert (False + or else NT (N).Nkind = N_Use_Package_Clause + or else NT (N).Nkind = N_Use_Type_Clause); + return Node1 (N); + end Prev_Use_Clause; + function Print_In_Hex (N : Node_Id) return Boolean is begin @@ -3133,7 +3156,8 @@ package body Sinfo is or else NT (N).Nkind = N_Qualified_Expression or else NT (N).Nkind = N_Subtype_Indication or else NT (N).Nkind = N_Type_Conversion - or else NT (N).Nkind = N_Unchecked_Type_Conversion); + or else NT (N).Nkind = N_Unchecked_Type_Conversion + or else NT (N).Nkind = N_Use_Type_Clause); return Node4 (N); end Subtype_Mark; @@ -3141,8 +3165,7 @@ package body Sinfo is (N : Node_Id) return List_Id is begin pragma Assert (False - or else NT (N).Nkind = N_Unconstrained_Array_Definition - or else NT (N).Nkind = N_Use_Type_Clause); + or else NT (N).Nkind = N_Unconstrained_Array_Definition); return List2 (N); end Subtype_Marks; @@ -3338,7 +3361,7 @@ package body Sinfo is begin pragma Assert (False or else NT (N).Nkind = N_Use_Type_Clause); - return Elist5 (N); + return Elist2 (N); end Used_Operations; function Was_Expression_Function @@ -3609,7 +3632,8 @@ package body Sinfo is or else NT (N).Nkind in N_Has_Entity or else NT (N).Nkind = N_Aggregate or else NT (N).Nkind = N_Extension_Aggregate - or else NT (N).Nkind = N_Selected_Component); + or else NT (N).Nkind = N_Selected_Component + or else NT (N).Nkind = N_Use_Package_Clause); Set_Node4 (N, Val); -- semantic field, no parent set end Set_Associated_Node; @@ -4948,7 +4972,7 @@ package body Sinfo is pragma Assert (False or else NT (N).Nkind = N_Use_Package_Clause or else NT (N).Nkind = N_Use_Type_Clause); - Set_Elist4 (N, Val); + Set_Elist5 (N, Val); end Set_Hidden_By_Use_Clause; procedure Set_High_Bound @@ -5184,6 +5208,15 @@ package body Sinfo is Set_Flag18 (N, Val); end Set_Is_Dynamic_Coextension; + procedure Set_Is_Effective_Use_Clause + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Use_Package_Clause + or else NT (N).Nkind = N_Use_Type_Clause); + Set_Flag1 (N, Val); + end Set_Is_Effective_Use_Clause; + procedure Set_Is_Elsif (N : Node_Id; Val : Boolean := True) is begin @@ -5556,7 +5589,9 @@ package body Sinfo is or else NT (N).Nkind = N_Formal_Object_Declaration or else NT (N).Nkind = N_Number_Declaration or else NT (N).Nkind = N_Object_Declaration - or else NT (N).Nkind = N_Parameter_Specification); + or else NT (N).Nkind = N_Parameter_Specification + or else NT (N).Nkind = N_Use_Package_Clause + or else NT (N).Nkind = N_Use_Type_Clause); Set_Flag5 (N, Val); end Set_More_Ids; @@ -5630,6 +5665,7 @@ package body Sinfo is or else NT (N).Nkind = N_Requeue_Statement or else NT (N).Nkind = N_Subprogram_Renaming_Declaration or else NT (N).Nkind = N_Subunit + or else NT (N).Nkind = N_Use_Package_Clause or else NT (N).Nkind = N_Variant_Part or else NT (N).Nkind = N_With_Clause); Set_Node2_With_Parent (N, Val); @@ -5639,8 +5675,7 @@ package body Sinfo is (N : Node_Id; Val : List_Id) is begin pragma Assert (False - or else NT (N).Nkind = N_Abort_Statement - or else NT (N).Nkind = N_Use_Package_Clause); + or else NT (N).Nkind = N_Abort_Statement); Set_List2_With_Parent (N, Val); end Set_Names; @@ -6025,10 +6060,21 @@ package body Sinfo is or else NT (N).Nkind = N_Formal_Object_Declaration or else NT (N).Nkind = N_Number_Declaration or else NT (N).Nkind = N_Object_Declaration - or else NT (N).Nkind = N_Parameter_Specification); + or else NT (N).Nkind = N_Parameter_Specification + or else NT (N).Nkind = N_Use_Package_Clause + or else NT (N).Nkind = N_Use_Type_Clause); Set_Flag6 (N, Val); end Set_Prev_Ids; + procedure Set_Prev_Use_Clause + (N : Node_Id; Val : Node_Id) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Use_Package_Clause + or else NT (N).Nkind = N_Use_Type_Clause); + Set_Node1 (N, Val); -- semantic field, no parent set + end Set_Prev_Use_Clause; + procedure Set_Print_In_Hex (N : Node_Id; Val : Boolean := True) is begin @@ -6418,7 +6464,8 @@ package body Sinfo is or else NT (N).Nkind = N_Qualified_Expression or else NT (N).Nkind = N_Subtype_Indication or else NT (N).Nkind = N_Type_Conversion - or else NT (N).Nkind = N_Unchecked_Type_Conversion); + or else NT (N).Nkind = N_Unchecked_Type_Conversion + or else NT (N).Nkind = N_Use_Type_Clause); Set_Node4_With_Parent (N, Val); end Set_Subtype_Mark; @@ -6426,8 +6473,7 @@ package body Sinfo is (N : Node_Id; Val : List_Id) is begin pragma Assert (False - or else NT (N).Nkind = N_Unconstrained_Array_Definition - or else NT (N).Nkind = N_Use_Type_Clause); + or else NT (N).Nkind = N_Unconstrained_Array_Definition); Set_List2_With_Parent (N, Val); end Set_Subtype_Marks; @@ -6640,7 +6686,7 @@ package body Sinfo is begin pragma Assert (False or else NT (N).Nkind = N_Use_Type_Clause); - Set_Elist5 (N, Val); + Set_Elist2 (N, Val); end Set_Used_Operations; procedure Set_Was_Expression_Function -- cgit v1.1