2014-07-30 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 Jul 2014 14:53:56 +0000 (14:53 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 Jul 2014 14:53:56 +0000 (14:53 +0000)
* sem_ch3.adb (Process_Range_Expr_In_Decl): Use _FIRST/_LAST
as name suffixes rather than L/H for subtype bounds.
* tbuild.ads: Minor comment improvements and fixes
(Make_External_Name): Document that suffix can start with an
underscore.

2014-07-30  Bob Duff  <duff@adacore.com>

* gnat_ugn.texi: Document --rep-clauses switch.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213290 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gnat_ugn.texi
gcc/ada/sem_ch3.adb
gcc/ada/tbuild.ads

index 2fda6e8..c240e20 100644 (file)
@@ -1,3 +1,15 @@
+2014-07-30  Robert Dewar  <dewar@adacore.com>
+
+       * sem_ch3.adb (Process_Range_Expr_In_Decl): Use _FIRST/_LAST
+       as name suffixes rather than L/H for subtype bounds.
+       * tbuild.ads: Minor comment improvements and fixes
+       (Make_External_Name): Document that suffix can start with an
+       underscore.
+
+2014-07-30  Bob Duff  <duff@adacore.com>
+
+       * gnat_ugn.texi: Document --rep-clauses switch.
+
 2014-07-30  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_ch13.adb (Analyze_Aspect_Specifications): Default_Value and
index bd8be55..9a17ec1 100644 (file)
@@ -15269,6 +15269,7 @@ Ada source code into XML.
 * Switches for gnat2xml::
 * Other Programs::
 * Structure of the XML::
+* Generating Representation Clauses::
 @end menu
 
 @node Switches for gnat2xml
@@ -15323,13 +15324,16 @@ options:
       output.)
 
 -I <include-dir>
-    directories to search for dependencies
-    You can also set the ADA_INCLUDE_PATH environment variable for this.
+      directories to search for dependencies
+      You can also set the ADA_INCLUDE_PATH environment variable for this.
 
 --compact -- debugging version, with interspersed source, and a more
       compact representation of "sloc". This version does not conform
       to any schema.
 
+--rep-clauses -- generate representation clauses (see ``Generating
+      Representation Clauses'' below).
+
 -files=filename - the name of a text file containing a list
                   of Ada source files to process
 
@@ -15676,10 +15680,43 @@ formal_function
 formal_package
 formal_package_declaration_with_box
 @end smallexample
+
+@node Generating Representation Clauses
+@section Generating Representation Clauses
+
+@noindent
+If the @option{--rep-clauses} switch is given, @command{gnat2xml} will
+generate representation clauses for certain types showing the
+representation chosen by the compiler. The information is produced by
+the ASIS ``Data Decomposition'' facility --- see the
+@code{Asis.Data_Decomposition} package for details.
+
+Not all types are supported. For example, @code{Type_Model_Kind} must
+be @code{A_Simple_Static_Model}. Types declared within generic units
+have no representation. The clauses that are generated include
+@code{attribute_definition_clauses} for @code{Size} and
+@code{Component_Size}, as well as
+@code{record_representation_clauses}.
+
+There is no guarantee that the generated representation clauses could
+have actually come from legal Ada code; Ada has some restrictions that
+are not necessarily obeyed by the generated clauses.
+
+The representation clauses are surrounded by comment elements to
+indicate that they are automatically generated, something like this:
+
+@smallexample
+<comment text="--gen+">
+...
+<attribute_definition_clause>
+...
+<comment text="--gen-">
+...
+@end smallexample
+
 @end ifclear
 @end ifclear
 
-
 @ifclear FSFEDITION
 @c *********************************
 @node The GNAT Metrics Tool gnatmetric
index 473d2cf..8acd603 100644 (file)
@@ -19174,7 +19174,8 @@ package body Sem_Ch3 is
                         Loc : constant Source_Ptr := Sloc (Lo);
                         Lov : constant Entity_Id  :=
                           Make_Defining_Identifier (Loc,
-                            Chars => New_External_Name (Chars (Subtyp), 'L'));
+                            Chars =>
+                              New_External_Name (Chars (Subtyp), "_FIRST"));
                      begin
                         Insert_Action (R,
                           Make_Object_Declaration (Loc,
@@ -19195,7 +19196,8 @@ package body Sem_Ch3 is
                         Loc : constant Source_Ptr := Sloc (Hi);
                         Hiv : constant Entity_Id  :=
                           Make_Defining_Identifier (Loc,
-                            Chars => New_External_Name (Chars (Subtyp), 'H'));
+                            Chars =>
+                              New_External_Name (Chars (Subtyp), "_LAST"));
                      begin
                         Insert_Action (R,
                           Make_Object_Declaration (Loc,
index 4741661..26869ba 100644 (file)
@@ -250,14 +250,21 @@ package Tbuild is
    --  positive, or if Suffix_Index is negative 1, then a unique serialized
    --  suffix is added. If Suffix_Index is zero, then no index is appended.
 
-   --  Suffix is also a single upper case letter other than O,Q,U,W,X and is a
-   --  required parameter (T is permitted). The constructed name is stored
-   --  using Name_Find so that it can be located using a subsequent Name_Find
-   --  operation (i.e. it is properly hashed into the names table). The upper
-   --  case letter given as the Suffix argument ensures that the name does
-   --  not clash with any Ada identifier name. These generated names are
-   --  permitted, but not required, to be made public by setting the flag
-   --  Is_Public in the associated entity.
+   --  Suffix is also a single upper case letter other than O,Q,U,W,X (T is
+   --  allowed in this context), or a string of such upper case letters. In
+   --  the case of a string, an initial underscore may be given.
+   --
+   --  The constructed name is stored using Name_Find so that it can be located
+   --  using a subsequent Name_Find operation (i.e. it is properly hashed into
+   --  the names table). The upper case letter given as the Suffix argument
+   --  ensures that the name does not clash with any Ada identifier name. These
+   --  generated names are permitted, but not required, to be made public by
+   --  setting the flag Is_Public in the associated entity.
+   --
+   --  Note: it is dubious to make them public if they have serial numbers,
+   --  since we are counting on the serial numbers being the same for the
+   --  clients with'ing a package and the actual compilation of the package
+   --  with full expansion. This is a dubious assumption ???
 
    function New_External_Name
      (Suffix       : Character;
@@ -272,6 +279,11 @@ package Tbuild is
    --  not clash with any Ada identifier name. These generated names are
    --  permitted, but not required, to be made public by setting the flag
    --  Is_Public in the associated entity.
+   --
+   --  Note: it is dubious to make these public since they have serial numbers,
+   --  which means we are counting on the serial numbers being the same for the
+   --  clients with'ing a package and the actual compilation of the package
+   --  with full expansion. This is a dubious assumption ???
 
    function New_Internal_Name (Id_Char : Character) return Name_Id;
    --  Id_Char is an upper case letter other than O,Q,U,W (which are reserved
@@ -287,11 +299,17 @@ package Tbuild is
    --  the Name_Find procedure later on. Names created by New_Internal_Name
    --  are guaranteed to be consistent from one compilation to another (i.e.
    --  if the identical unit is compiled with a semantically consistent set
-   --  of sources, the numbers will be consistent. This means that it is fine
+   --  of sources, the numbers will be consistent). This means that it is fine
    --  to use these as public symbols.
    --
    --  Note: Nearly all uses of this function are via calls to Make_Temporary,
    --  but there are just a few cases where it is called directly.
+   --
+   --  Note: despite the guarantee of consistency stated above, it is dubious
+   --  to make these public since they have serial numbers, which means we are
+   --  counting on the serial numbers being the same for the clients with'ing
+   --  a package and the actual compilation of the package with full expansion.
+   --  This is a dubious assumption ???
 
    function New_Occurrence_Of
      (Def_Id : Entity_Id;