From b70514811c6e42a34d54fe0b67600782538c1d57 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 12 Sep 2017 12:15:46 +0200 Subject: [PATCH] [multiple changes] 2017-09-12 Bob Duff * sem_warn.adb: Minor comment. 2017-09-12 Bob Duff * libgnat/a-cbdlli.adb, libgnat/a-cbhama.adb, libgnat/a-cbmutr.adb, libgnat/a-cborma.adb: Rename New_Item to be Default_Initialized_Item, and apply pragma Unmodified to it, to suppress the warning. 2017-09-12 Eric Botcazou * exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Add early return for access types. 2017-09-12 Yannick Moy * gnat1drv.adb (Adjust_Global_Switches): Consider Refined_Global together with Global when ignoring one in CodePeer mode. 2017-09-12 Javier Miranda * sem_ch3.adb (Analyze_Declarations): In nested package declarations that have a private part enable missing check of the RM rule 13.1.1(11/3): usage names in aspect definitions are resolved at the end of the immediately enclosing declaration list. From-SVN: r252001 --- gcc/ada/ChangeLog | 28 ++++++++++++++++++++++++++++ gcc/ada/gnat1drv.adb | 10 +++++++--- gcc/ada/libgnat/a-cbdlli.adb | 10 +++++++--- gcc/ada/libgnat/a-cbhama.adb | 8 +++++--- gcc/ada/libgnat/a-cbmutr.adb | 11 +++++++---- gcc/ada/libgnat/a-cborma.adb | 8 +++++--- gcc/ada/sem_ch3.adb | 11 ++++------- gcc/ada/sem_warn.adb | 1 + 8 files changed, 64 insertions(+), 23 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 988f2ef55dc..afa7b1b3f9b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,31 @@ +2017-09-12 Bob Duff + + * sem_warn.adb: Minor comment. + +2017-09-12 Bob Duff + + * libgnat/a-cbdlli.adb, libgnat/a-cbhama.adb, + libgnat/a-cbmutr.adb, libgnat/a-cborma.adb: Rename New_Item to + be Default_Initialized_Item, and apply pragma Unmodified to it, + to suppress the warning. + +2017-09-12 Eric Botcazou + + * exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Add early return + for access types. + +2017-09-12 Yannick Moy + + * gnat1drv.adb (Adjust_Global_Switches): Consider Refined_Global + together with Global when ignoring one in CodePeer mode. + +2017-09-12 Javier Miranda + + * sem_ch3.adb (Analyze_Declarations): In nested + package declarations that have a private part enable missing check + of the RM rule 13.1.1(11/3): usage names in aspect definitions are + resolved at the end of the immediately enclosing declaration list. + 2017-09-12 Bob Duff * sem_ch6.adb (Analyze_Expression_Function): Initialize Def_Id to diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index 197c6053d78..b493d53115a 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -66,7 +66,7 @@ with Sem_Type; with Set_Targ; with Sinfo; use Sinfo; with Sinput.L; use Sinput.L; -with Snames; +with Snames; use Snames; with Sprint; use Sprint; with Stringt; with Stylesw; use Stylesw; @@ -272,9 +272,13 @@ procedure Gnat1drv is Restrict.Restrictions.Set (Max_Asynchronous_Select_Nesting) := True; Restrict.Restrictions.Value (Max_Asynchronous_Select_Nesting) := 0; - -- Enable pragma Ignore_Pragma (Global) to support legacy code + -- Enable pragma Ignore_Pragma (Global) to support legacy code. As a + -- consequence, Refined_Global pragma should be ignored as well, as + -- it is only allowed on a body when pragma Global is given for the + -- spec. - Set_Name_Table_Boolean3 (Name_Id'(Name_Find ("global")), True); + Set_Name_Table_Boolean3 (Name_Global, True); + Set_Name_Table_Boolean3 (Name_Refined_Global, True); -- Suppress division by zero checks since they are handled -- implicitly by CodePeer. diff --git a/gcc/ada/libgnat/a-cbdlli.adb b/gcc/ada/libgnat/a-cbdlli.adb index 8f7b5374901..3dc22e3fb89 100644 --- a/gcc/ada/libgnat/a-cbdlli.adb +++ b/gcc/ada/libgnat/a-cbdlli.adb @@ -1016,9 +1016,13 @@ package body Ada.Containers.Bounded_Doubly_Linked_Lists is Count : Count_Type := 1) is pragma Warnings (Off); - New_Item : Element_Type; + Default_Initialized_Item : Element_Type; + pragma Unmodified (Default_Initialized_Item); -- OK to reference, see below. Note that we need to suppress both the - -- front end warning and the back end warning. + -- front end warning and the back end warning. In addition, pragma + -- Unmodified is needed to suppress the warning ``actual type for + -- "Element_Type" should be fully initialized type'' on certain + -- instantiations. begin -- There is no explicit element provided, but in an instance the element @@ -1027,7 +1031,7 @@ package body Ada.Containers.Bounded_Doubly_Linked_Lists is -- initialization, so insert the specified number of possibly -- initialized elements at the given position. - Insert (Container, Before, New_Item, Position, Count); + Insert (Container, Before, Default_Initialized_Item, Position, Count); pragma Warnings (On); end Insert; diff --git a/gcc/ada/libgnat/a-cbhama.adb b/gcc/ada/libgnat/a-cbhama.adb index 57948d23b3b..825babe3e2c 100644 --- a/gcc/ada/libgnat/a-cbhama.adb +++ b/gcc/ada/libgnat/a-cbhama.adb @@ -578,8 +578,9 @@ package body Ada.Containers.Bounded_Hashed_Maps is ----------------- procedure Assign_Key (Node : in out Node_Type) is - New_Item : Element_Type; - pragma Unmodified (New_Item); + pragma Warnings (Off); + Default_Initialized_Item : Element_Type; + pragma Unmodified (Default_Initialized_Item); -- Default-initialized element (ok to reference, see below) begin @@ -591,7 +592,8 @@ package body Ada.Containers.Bounded_Hashed_Maps is -- default initialization, so insert a possibly initialized element -- under the given key. - Node.Element := New_Item; + Node.Element := Default_Initialized_Item; + pragma Warnings (On); end Assign_Key; -------------- diff --git a/gcc/ada/libgnat/a-cbmutr.adb b/gcc/ada/libgnat/a-cbmutr.adb index f1145de89bb..00e394c2100 100644 --- a/gcc/ada/libgnat/a-cbmutr.adb +++ b/gcc/ada/libgnat/a-cbmutr.adb @@ -1581,8 +1581,9 @@ package body Ada.Containers.Bounded_Multiway_Trees is First : Count_Type; Last : Count_Type; - New_Item : Element_Type; - pragma Unmodified (New_Item); + pragma Warnings (Off); + Default_Initialized_Item : Element_Type; + pragma Unmodified (Default_Initialized_Item); -- OK to reference, see below begin @@ -1629,12 +1630,13 @@ package body Ada.Containers.Bounded_Multiway_Trees is -- initialization, so insert the specified number of possibly -- initialized elements at the given position. - Allocate_Node (Container, New_Item, First); + Allocate_Node (Container, Default_Initialized_Item, First); Nodes (First).Parent := Parent.Node; Last := First; for J in Count_Type'(2) .. Count loop - Allocate_Node (Container, New_Item, Nodes (Last).Next); + Allocate_Node + (Container, Default_Initialized_Item, Nodes (Last).Next); Nodes (Nodes (Last).Next).Parent := Parent.Node; Nodes (Nodes (Last).Next).Prev := Last; @@ -1651,6 +1653,7 @@ package body Ada.Containers.Bounded_Multiway_Trees is Container.Count := Container.Count + Count; Position := Cursor'(Parent.Container, First); + pragma Warnings (On); end Insert_Child; ------------------------- diff --git a/gcc/ada/libgnat/a-cborma.adb b/gcc/ada/libgnat/a-cborma.adb index 7dca13b3aee..1bff46d9cc3 100644 --- a/gcc/ada/libgnat/a-cborma.adb +++ b/gcc/ada/libgnat/a-cborma.adb @@ -851,8 +851,9 @@ package body Ada.Containers.Bounded_Ordered_Maps is ------------ procedure Assign (Node : in out Node_Type) is - New_Item : Element_Type; - pragma Unmodified (New_Item); + pragma Warnings (Off); + Default_Initialized_Item : Element_Type; + pragma Unmodified (Default_Initialized_Item); -- Default-initialized element (ok to reference, see below) begin @@ -863,7 +864,8 @@ package body Ada.Containers.Bounded_Ordered_Maps is -- with such a scalar component or with defaulted components, so insert -- possibly initialized elements at the given position. - Node.Element := New_Item; + Node.Element := Default_Initialized_Item; + pragma Warnings (On); end Assign; -------------- diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index a1d8f8b8714..46d83494883 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -2676,14 +2676,11 @@ package body Sem_Ch3 is and then not Is_Child_Unit (Current_Scope) and then No (Generic_Parent (Parent (L))) then - -- This is needed in all cases to catch visibility errors in - -- aspect expressions, but several large user tests are now - -- rejected. Pending notification we restrict this call to - -- ASIS mode. + -- ARM rule 13.1.1(11/3): usage names in aspect definitions are + -- resolved at the end of the immediately enclosing declaration + -- list (AI05-0183-1). - if ASIS_Mode then - Resolve_Aspects; - end if; + Resolve_Aspects; elsif L /= Visible_Declarations (Parent (L)) or else No (Private_Declarations (Parent (L))) diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index f6adb7c7bfa..278d6b6bd21 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -2798,6 +2798,7 @@ package body Sem_Warn is -- Note: use of OR instead of OR ELSE here is deliberate, we want -- to mess with Unmodified flags on both body and spec entities. + -- Has_Unmodified has side effects! return Has_Unmodified (E) or -- 2.30.2