diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-30 16:53:56 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-30 16:53:56 +0200 |
commit | 63a4aa4375a94ca120752f77fc1376f03144722c (patch) | |
tree | 25b8900d59eee4e3fea016395ad2eb380055f1de | |
parent | 33c9f9af6c9f46541270211bb88360b842c162fe (diff) | |
download | gcc-63a4aa4375a94ca120752f77fc1376f03144722c.zip gcc-63a4aa4375a94ca120752f77fc1376f03144722c.tar.gz gcc-63a4aa4375a94ca120752f77fc1376f03144722c.tar.bz2 |
[multiple changes]
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.
From-SVN: r213290
-rw-r--r-- | gcc/ada/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 43 | ||||
-rw-r--r-- | gcc/ada/sem_ch3.adb | 6 | ||||
-rw-r--r-- | gcc/ada/tbuild.ads | 36 |
4 files changed, 83 insertions, 14 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2fda6e8..c240e20 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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 diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index bd8be55..9a17ec1 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -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 diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 473d2cf..8acd603 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -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, diff --git a/gcc/ada/tbuild.ads b/gcc/ada/tbuild.ads index 4741661..26869ba 100644 --- a/gcc/ada/tbuild.ads +++ b/gcc/ada/tbuild.ads @@ -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; |