sem_ch3.adb (Process_Range_Expr_In_Decl): Add comments on generation of _FIRST and...
authorRobert Dewar <dewar@adacore.com>
Thu, 31 Jul 2014 12:43:28 +0000 (12:43 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 31 Jul 2014 12:43:28 +0000 (14:43 +0200)
2014-07-31  Robert Dewar  <dewar@adacore.com>

* 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
gcc/ada/gnat_ugn.texi
gcc/ada/sem_ch3.adb
gcc/ada/sem_prag.adb

index 0a587652834a8bf592645dff4b7d45f502b99709..f48ceedd10251b1c38598a06364fa5999bf92fe8 100644 (file)
@@ -1,3 +1,11 @@
+2014-07-31  Robert Dewar  <dewar@adacore.com>
+
+       * 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  <obry@adacore.com>
 
        * s-fileio.adb: Remove obsolete comment.
index 8147f4a4141030828362373b756178363d28a296..19b4ecc03c7346845138f618e2d7a39896462b4a 100644 (file)
@@ -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.
 
index 2d5a430d4359ade741ec5a94705186f8da2577d4..8836038b0bfcc387305c3ffdf3abd9b687fc08ab 100644 (file)
@@ -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
index 1e46ac775db485f6c8d8dc06a5b7b29d43ffd745..bab3a4d89a29b8d0702de24a8240c4292b5e1657 100644 (file)
@@ -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;
 
       ------------------