From d8d7e809d6c6ce977e188f99e104097b5ece31d8 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 20 Nov 2014 15:24:21 +0100 Subject: [PATCH] [multiple changes] 2014-11-20 Bob Duff * debug.adb: Minor comment fix. 2014-11-20 Arnaud Charlet * a-ciorma.adb: Minor update: move pragma Annotate up. * a-cfdlli.adb: Skip codepeer analysis on this body. 2014-11-20 Robert Dewar * sem_prag.adb (Analyze_Pragma, case No_Elaboration_Code_All): Allow use of this pragma with generic unit (package or subprogram). * gnat_rm.texi: Clarify that pragma No_Elaboration_Code_All can be applied to generics. 2014-11-20 Ed Schonberg * sem_aggr.adb (Valid_Limited_Ancestor): Ancestor part of extension aggregate can itself be an extension aggregate, as well as a call that is rewritten as a reference. 2014-11-20 Eric Botcazou * inline.adb (Add_Inlined_Subprogram): Insert all programs generated as a body or whose declaration was provided along with the body. 2014-11-20 Javier Miranda * sem.adb (Semantics): Disable expansion if we are compiling a separate unit under configurable runtime. By default separate units are compiled with expansion disabled but under configurable runtime we enable the expansion to get error messages about missing entities. From-SVN: r217855 --- gcc/ada/ChangeLog | 36 ++++++++++++++++++++++++++++++++++++ gcc/ada/a-cfdlli.adb | 1 + gcc/ada/a-ciorma.adb | 3 +-- gcc/ada/debug.adb | 2 +- gcc/ada/gnat_rm.texi | 1 + gcc/ada/inline.adb | 8 ++++++-- gcc/ada/sem.adb | 8 +++++--- gcc/ada/sem_aggr.adb | 13 ++++++++++--- gcc/ada/sem_prag.adb | 4 +++- 9 files changed, 64 insertions(+), 12 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f93275bfd3f..4455049e43a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,39 @@ +2014-11-20 Bob Duff + + * debug.adb: Minor comment fix. + +2014-11-20 Arnaud Charlet + + * a-ciorma.adb: Minor update: move pragma Annotate up. + * a-cfdlli.adb: Skip codepeer analysis on this body. + +2014-11-20 Robert Dewar + + * sem_prag.adb (Analyze_Pragma, case No_Elaboration_Code_All): + Allow use of this pragma with generic unit (package or subprogram). + * gnat_rm.texi: Clarify that pragma No_Elaboration_Code_All can + be applied to generics. + +2014-11-20 Ed Schonberg + + * sem_aggr.adb (Valid_Limited_Ancestor): Ancestor part of + extension aggregate can itself be an extension aggregate, as + well as a call that is rewritten as a reference. + +2014-11-20 Eric Botcazou + + * inline.adb (Add_Inlined_Subprogram): Insert all programs + generated as a body or whose declaration was provided along with + the body. + +2014-11-20 Javier Miranda + + * sem.adb (Semantics): Disable expansion if we are compiling a + separate unit under configurable runtime. By default separate + units are compiled with expansion disabled but under configurable + runtime we enable the expansion to get error messages about + missing entities. + 2014-11-20 Robert Dewar * sem_ch13.adb: Minor reformatting. diff --git a/gcc/ada/a-cfdlli.adb b/gcc/ada/a-cfdlli.adb index 2fc5d64ad26..2e8676b4495 100644 --- a/gcc/ada/a-cfdlli.adb +++ b/gcc/ada/a-cfdlli.adb @@ -30,6 +30,7 @@ with System; use type System.Address; package body Ada.Containers.Formal_Doubly_Linked_Lists with SPARK_Mode => Off is + pragma Annotate (CodePeer, Skip_Analysis); ----------------------- -- Local Subprograms -- diff --git a/gcc/ada/a-ciorma.adb b/gcc/ada/a-ciorma.adb index 3dde307d160..d06d8fedc1d 100644 --- a/gcc/ada/a-ciorma.adb +++ b/gcc/ada/a-ciorma.adb @@ -38,9 +38,8 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys); with System; use type System.Address; package body Ada.Containers.Indefinite_Ordered_Maps is - pragma Suppress (All_Checks); - pragma Annotate (CodePeer, Skip_Analysis); + pragma Suppress (All_Checks); ----------------------------- -- Node Access Subprograms -- diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index 47371e33614..31c3972f7c2 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -249,7 +249,7 @@ package body Debug is -- output (dt) or recreated source output (dg,do,ds) includes only -- the main unit. If df is set, then the output in either case -- includes all compiled units (see also dg,do,ds,dt). Note that to - -- be effective, this swich must be used in combination with one or + -- be effective, this switch must be used in combination with one or -- more of dt, dg, do or ds. -- dg Print the source recreated from the generated tree. In the case diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 0320a0b46d0..923957edf4e 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -4701,6 +4701,7 @@ the current unit and any extended main source units (body and subunits. It also has has the effect of enforcing a transitive application of this aspect, so that if any unit is implicitly or explicitly WITH'ed by the current unit, it must also have the No_Elaboration_Code_All aspect set. +It may be applied to package or subprogram specs or their generic versions. @node Pragma No_Inline @unnumberedsec Pragma No_Inline diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index d5e9ae99e8d..ca84a1f2268 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -454,6 +454,7 @@ package body Inline is procedure Add_Inlined_Subprogram (Index : Subp_Index) is E : constant Entity_Id := Inlined.Table (Index).Name; + Decl : constant Node_Id := Parent (Declaration_Node (E)); Pack : constant Entity_Id := Get_Code_Unit_Entity (E); procedure Register_Backend_Inlined_Subprogram (Subp : Entity_Id); @@ -486,14 +487,17 @@ package body Inline is begin -- If the subprogram is to be inlined, and if its unit is known to be -- inlined or is an instance whose body will be analyzed anyway or the - -- subprogram has been generated by the compiler, and if it is declared + -- subprogram was generated as a body by the compiler (for example an + -- initialization procedure) or its declaration was provided along with + -- the body (for example an expression function), and if it is declared -- at the library level not in the main unit, and if it can be inlined -- by the back-end, then insert it in the list of inlined subprograms. if Is_Inlined (E) and then (Is_Inlined (Pack) or else Is_Generic_Instance (Pack) - or else Is_Internal (E)) + or else Nkind (Decl) = N_Subprogram_Body + or else Present (Corresponding_Body (Decl))) and then not In_Main_Unit_Or_Subunit (E) and then not Is_Nested (E) and then not Has_Initialized_Type (E) diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index f1dd3665731..442e89737ed 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -1433,11 +1433,13 @@ package body Sem is -- error messages about missing entities in the run-time even -- if we are compiling in -gnatc (no code generation) mode. -- Similar processing applies to No_Run_Time_Mode. However, - -- don't do this if debug flag -gnatd.Z is set (this is to handle - -- a situation where this new processing causes trouble). + -- don't do this if debug flag -gnatd.Z is set or when we are + -- compiling a separate unit (this is to handle a situation + -- where this new processing causes trouble). or else ((Configurable_Run_Time_Mode or No_Run_Time_Mode) - and not Debug_Flag_Dot_ZZ)); + and not Debug_Flag_Dot_ZZ + and Nkind (Unit (Cunit (Main_Unit))) /= N_Subunit)); end if; Full_Analysis := True; diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 654f413c088..82d6ce09430 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -2663,12 +2663,19 @@ package body Sem_Aggr is function Valid_Limited_Ancestor (Anc : Node_Id) return Boolean is begin - if Is_Entity_Name (Anc) - and then Is_Type (Entity (Anc)) + if Is_Entity_Name (Anc) and then Is_Type (Entity (Anc)) then + return True; + + -- The ancestor must be a call or an aggregate, but a call may + -- have been expanded into a temporary, so check original node. + + elsif Nkind_In (Anc, N_Aggregate, + N_Extension_Aggregate, + N_Function_Call) then return True; - elsif Nkind_In (Anc, N_Aggregate, N_Function_Call) then + elsif Nkind (Original_Node (Anc)) = N_Function_Call then return True; elsif Nkind (Anc) = N_Attribute_Reference diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index aed0d21cde1..d155b06bc59 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -16729,9 +16729,11 @@ package body Sem_Prag is return; end if; - -- Must appear for a spec + -- Must appear for a spec or generic spec if not Nkind_In (Unit (Cunit (Current_Sem_Unit)), + N_Generic_Package_Declaration, + N_Generic_Subprogram_Declaration, N_Package_Declaration, N_Subprogram_Declaration) then -- 2.30.2