From 3abbc5c2409fae926307f5321debdf6191cd2152 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 13 Jan 2017 11:38:56 +0100 Subject: [PATCH] [multiple changes] 2017-01-13 Yannick Moy * inline.adb: Code cleanup. * sem_util.adb (Is_OK_Volatile_Context): Add expression in delay statement as OK for volatile context. 2017-01-13 Ed Schonberg * sem_aggr.adb (Resolve_Array_Aggregate): In normal compilation mode a choice that is a subtype with a static predicate is replaced by the values it covers. This transformation must not be performed in ASIS mode, to preserve the source for analysis. 2017-01-13 Justin Squirek * nlists.ads: Correct minor typo. From-SVN: r244411 --- gcc/ada/ChangeLog | 17 +++++++++++++++++ gcc/ada/inline.adb | 11 +++-------- gcc/ada/nlists.ads | 4 ++-- gcc/ada/sem_aggr.adb | 7 ++++++- gcc/ada/sem_util.adb | 5 +++++ 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1ec581c459e..d4e330180a6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,20 @@ +2017-01-13 Yannick Moy + + * inline.adb: Code cleanup. + * sem_util.adb (Is_OK_Volatile_Context): Add + expression in delay statement as OK for volatile context. + +2017-01-13 Ed Schonberg + + * sem_aggr.adb (Resolve_Array_Aggregate): In normal compilation + mode a choice that is a subtype with a static predicate is + replaced by the values it covers. This transformation must not + be performed in ASIS mode, to preserve the source for analysis. + +2017-01-13 Justin Squirek + + * nlists.ads: Correct minor typo. + 2017-01-13 Gary Dismukes * sem_ch13.adb: Minor reformatting and typo fix. diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 7389105966a..d0f8a8c363f 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -3200,17 +3200,12 @@ package body Inline is then pragma Assert (not (Is_By_Reference_Type (Etype (A)))); pragma Assert (not (Is_Limited_Type (Etype (A)))); - Decl := + Append_To (Decls, Make_Object_Declaration (Loc, - Defining_Identifier => Temp, + Defining_Identifier => Make_Temporary (Loc, 'C'), Constant_Present => True, Object_Definition => New_Occurrence_Of (Temp_Typ, Loc), - Expression => New_Copy_Tree (New_A)); - Append (Decl, Decls); - - -- Create another name for the renaming - - Temp := Make_Temporary (Loc, 'C'); + Expression => New_Copy_Tree (New_A))); end if; Decl := diff --git a/gcc/ada/nlists.ads b/gcc/ada/nlists.ads index 1cdcee6aff0..90d5e7edf7f 100644 --- a/gcc/ada/nlists.ads +++ b/gcc/ada/nlists.ads @@ -302,13 +302,13 @@ package Nlists is -- Like Prepend_List, but arguments are the other way round procedure Prepend_New (Node : Node_Or_Entity_Id; To : in out List_Id); - pragma Inline (Append_New); + pragma Inline (Prepend_New); -- Prepends Node at the end of node list To. If To is non-existent list, a -- list is created. Node must be a non-empty node that is not already a -- member of a node list, and To must be a node list. procedure Prepend_New_To (To : in out List_Id; Node : Node_Or_Entity_Id); - pragma Inline (Append_New_To); + pragma Inline (Prepend_New_To); -- Like Prepend_New, but the arguments are in reverse order procedure Prepend_To diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 1b9f0affa8d..9481c455b8c 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -1809,8 +1809,13 @@ package body Sem_Aggr is -- If the subtype has a static predicate, replace the -- original choice with the list of individual values -- covered by the predicate. + -- Do not perform this transformation if we need to + -- preserve the source for ASIS use. + -- This should be deferred to expansion time ??? - if Present (Static_Discrete_Predicate (E)) then + if Present (Static_Discrete_Predicate (E)) + and then not ASIS_Mode + then Delete_Choice := True; New_Cs := New_List; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 3b90fe82c7e..b90b00791f5 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -13726,6 +13726,11 @@ package body Sem_Util is then return True; + -- The volatile object appears as the expression in a delay statement + + elsif Nkind (Context) in N_Delay_Statement then + return True; + -- Allow references to volatile objects in various checks. This is not a -- direct SPARK 2014 requirement. -- 2.30.2