From 16b5e0b7c5ddfe3d8722b1ffcfa6d66047f8228f Mon Sep 17 00:00:00 2001 From: Robert Dewar Date: Thu, 31 Jul 2014 12:43:28 +0000 Subject: sem_ch3.adb (Process_Range_Expr_In_Decl): Add comments on generation of _FIRST and _LAST variables even in GNATprove_Mode. 2014-07-31 Robert Dewar * sem_ch3.adb (Process_Range_Expr_In_Decl): Add comments on generation of _FIRST and _LAST variables even in GNATprove_Mode. * gnat_ugn.texi: Minor editing. * sem_prag.adb (Ensure_Aggregate_Form): Make sure generated aggregate is marked Comes_From_Source if argument is CFS. From-SVN: r213351 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/gnat_ugn.texi | 2 +- gcc/ada/sem_ch3.adb | 14 +++++++++++--- gcc/ada/sem_prag.adb | 12 +++++++++++- 4 files changed, 31 insertions(+), 5 deletions(-) (limited to 'gcc/ada') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0a58765..f48ceed 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2014-07-31 Robert Dewar + + * sem_ch3.adb (Process_Range_Expr_In_Decl): Add comments on + generation of _FIRST and _LAST variables even in GNATprove_Mode. + * gnat_ugn.texi: Minor editing. + * sem_prag.adb (Ensure_Aggregate_Form): Make sure generated + aggregate is marked Comes_From_Source if argument is CFS. + 2014-07-31 Pascal Obry * s-fileio.adb: Remove obsolete comment. diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 8147f4a..19b4ecc 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -18054,7 +18054,7 @@ pragma Linker_Options ("-lmy_lib"); @end itemize Note that you may also load a library dynamically at -run time given its filename, as illustrated in the GNAT ``plugins'' example +run time given its filename, as illustrated in the GNAT @file{plugins} example in the directory @file{share/examples/gnat/plugins} within the GNAT install area. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 2d5a430..8836038b 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -19169,18 +19169,26 @@ package body Sem_Ch3 is -- If a subtype is given, then we capture the bounds if they -- are not known at compile time, using constant identifiers - -- xxxL and xxxH where xxx is the name of the subtype. No need - -- to do that if they are already references to constants. + -- xxx_FIRST and xxx_LAST where xxx is the name of the subtype. + + -- Note: we do this transformation even if expansion is not + -- active, and in particular we do it in GNATprove_Mode since + -- the transformation is in general required to ensure that the + -- resulting tree has proper Ada semantics. -- Historical note: We used to just do Force_Evaluation calls -- in all cases, but it is better to capture the bounds with - -- proper non-serialized names, since these will be accesse + -- proper non-serialized names, since these will be accessed -- from other units, and hence may be public, and also we can -- then expand 'First and 'Last references to be references to -- these special names. else if not Compile_Time_Known_Value (Lo) + + -- No need to capture bounds if they already are + -- references to constants. + and then not (Is_Entity_Name (Lo) and then Is_Constant_Object (Entity (Lo))) then diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 1e46ac7..bab3a4d 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -5721,6 +5721,9 @@ package body Sem_Prag is Comps : List_Id := No_List; Exprs : List_Id := No_List; + CFSD : constant Boolean := Get_Comes_From_Source_Default; + -- Used to restore Comes_From_Source_Default + begin -- The argument is already in aggregate form, but the presence of a -- name causes this to be interpreted as a named association which in @@ -5746,6 +5749,10 @@ package body Sem_Prag is return; end if; + -- Everything comes from source if the original comes from source + + Set_Comes_From_Source_Default (Comes_From_Source (Arg)); + -- Positional argument is transformed into an aggregate with an -- Expressions list. @@ -5760,7 +5767,6 @@ package body Sem_Prag is Make_Component_Association (Loc, Choices => New_List (Make_Identifier (Loc, Chars (Arg))), Expression => Relocate_Node (Expr))); - end if; -- Remove the pragma argument name as this information has been @@ -5772,6 +5778,10 @@ package body Sem_Prag is Make_Aggregate (Loc, Component_Associations => Comps, Expressions => Exprs)); + + -- Restore Comes_From_Source default + + Set_Comes_From_Source_Default (CFSD); end Ensure_Aggregate_Form; ------------------ -- cgit v1.1