From: Arnaud Charlet Date: Wed, 30 Jul 2014 14:53:56 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=63a4aa4375a94ca120752f77fc1376f03144722c;p=gcc.git [multiple changes] 2014-07-30 Robert Dewar * 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 * gnat_ugn.texi: Document --rep-clauses switch. From-SVN: r213290 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2fda6e88e4c..c240e201e67 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2014-07-30 Robert Dewar + + * 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 + + * gnat_ugn.texi: Document --rep-clauses switch. + 2014-07-30 Ed Schonberg * sem_ch13.adb (Analyze_Aspect_Specifications): Default_Value and diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index bd8be559061..9a17ec14a11 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 - 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 + +... + +... + +... +@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 473d2cf899b..8acd6033277 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 47416616b69..26869ba8dc8 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;