From 7640ef8abab4715c572a2400a3f345aef583cf8b Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 2 Oct 2012 14:25:44 +0200 Subject: [PATCH] [multiple changes] 2012-10-02 Eric Botcazou * types.h (N_Return_Statement): Delete. * gcc-interface/trans.c (gnat_to_gnu): Replace N_Return_Statement with N_Simple_Return_Statement. 2012-10-02 Ed Schonberg * freeze.adb (Freeze_Entity): in a generic context, aspects must be analyzed because they may be queried subsequently within the generic unit, even if no other freezing actions are generated for an entity. * sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): iterator aspects must be analyzed because they are delayed aspects and the corresponding attribute definition clause may not have been analyzed yet. 2012-10-02 Yannick Moy * gnat_rm.texi: Minor editing. From-SVN: r191975 --- gcc/ada/ChangeLog | 21 +++++++++++++++++++++ gcc/ada/freeze.adb | 7 +++++++ gcc/ada/gcc-interface/trans.c | 2 +- gcc/ada/gnat_rm.texi | 27 ++++++++++++++++----------- gcc/ada/sem_ch13.adb | 9 +++++++++ gcc/ada/types.h | 3 --- 6 files changed, 54 insertions(+), 15 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9fac94cfcf2..436651cfe97 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,24 @@ +2012-10-02 Eric Botcazou + + * types.h (N_Return_Statement): Delete. + * gcc-interface/trans.c (gnat_to_gnu): Replace N_Return_Statement with + N_Simple_Return_Statement. + +2012-10-02 Ed Schonberg + + * freeze.adb (Freeze_Entity): in a generic context, aspects must + be analyzed because they may be queried subsequently within the + generic unit, even if no other freezing actions are generated + for an entity. + * sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): iterator + aspects must be analyzed because they are delayed aspects and + the corresponding attribute definition clause may not have been + analyzed yet. + +2012-10-02 Yannick Moy + + * gnat_rm.texi: Minor editing. + 2012-10-02 Robert Dewar * sinfo.adb, sinfo.ads, sem_util.adb, sem_util.ads, types.h, diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 98b8eadfe88..039325afbcf 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -2571,8 +2571,15 @@ package body Freeze is -- It is improper to freeze an external entity within a generic because -- its freeze node will appear in a non-valid context. The entity will -- be frozen in the proper scope after the current generic is analyzed. + -- However, aspects must be analyzed because they may be queried later + -- within the generic itself, and the corresponding pragma or attribute + -- definition has not been analyzed yet. elsif Inside_A_Generic and then External_Ref_In_Generic (Test_E) then + if Has_Delayed_Aspects (E) then + Analyze_Aspects_At_Freeze_Point (E); + end if; + return No_List; -- AI05-0213: A formal incomplete type does not freeze the actual. In diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index d88f6bafcda..aac483cafaa 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -6241,7 +6241,7 @@ gnat_to_gnu (Node_Id gnat_node) : VEC_last (loop_info, gnu_loop_stack)->label)); break; - case N_Return_Statement: + case N_Simple_Return_Statement: { tree gnu_ret_obj, gnu_ret_val; diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 9a79713f526..5f2270f164e 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -1921,7 +1921,7 @@ where @var{T} is a limited record type imported from C++ with pragma The first two forms import the default constructor, used when an object of type @var{T} is created on the Ada side with no explicit constructor. The latter two forms cover all the non-default constructors of the type. -See the GNAT users guide for details. +See the @value{EDITION} User's Guide for details. If no constructors are imported, it is impossible to create any objects on the Ada side and the type is implicitly declared abstract. @@ -3101,8 +3101,8 @@ initialize with invalid values (similar to Normalize_Scalars, though for Initialize_Scalars it is not always possible to determine the invalid values in complex cases like signed component fields with non-standard sizes). You can also initialize with high or -low values, or with a specified bit pattern. See the users guide for binder -options for specifying these cases. +low values, or with a specified bit pattern. See the @value{EDITION} +User's Guide for binder options for specifying these cases. This means that you can compile a program, and then without having to recompile the program, you can run it with different values being used @@ -3113,13 +3113,14 @@ uninitialized value. It is even possible to change the value at execution time eliminating even the need to rebind with a different switch using an environment variable. -See the GNAT users guide for details. +See the @value{EDITION} User's Guide for details. Note that pragma @code{Initialize_Scalars} is particularly useful in conjunction with the enhanced validity checking that is now provided in GNAT, which checks for invalid values under more conditions. Using this feature (see description of the @option{-gnatV} flag in the -users guide) in conjunction with pragma @code{Initialize_Scalars} +@value{EDITION} User's Guide) in conjunction with +pragma @code{Initialize_Scalars} provides a powerful new tool to assist in the detection of problems caused by uninitialized variables. @@ -3127,8 +3128,8 @@ Note: the use of @code{Initialize_Scalars} has a fairly extensive effect on the generated code. This may cause your code to be substantially larger. It may also cause an increase in the amount of stack required, so it is probably a good idea to turn on stack -checking (see description of stack checking in the GNAT users guide) -when using this pragma. +checking (see description of stack checking in the @value{EDITION} +User's Guide) when using this pragma. @node Pragma Inline_Always @unnumberedsec Pragma Inline_Always @@ -4147,8 +4148,8 @@ MODE ::= SUPPRESSED | CHECKED | MINIMIZED | ELIMINATED @noindent This pragma sets the current overflow mode to the given mode. For details of the meaning of these modes, see section on overflow checking in the -GNAT users guide. If only the @code{General} parameter is present, the -given mode applies to all expressions. If both parameters are present, +@value{EDITION} User's Guide. If only the @code{General} parameter is present, +the given mode applies to all expressions. If both parameters are present, the @code{General} mode applies to expressions outside assertions, and the @code{Eliminated} mode applies to expressions within assertions. @@ -4164,14 +4165,18 @@ remaining declarations and statements in that scope. The pragma @code{Suppress (Overflow_Check)} sets mode +@smallexample @c ada General => Suppressed +@end smallexample suppressing all overflow checking within and outside assertions. The pragam @code{Unsuppress (Overflow_Check)} sets mode +@smallexample @c ada General => Checked +@end smallexample which causes overflow checking of all intermediate overflows. This applies both inside and outside assertions. @@ -5787,8 +5792,8 @@ activated. The validity checks are first set to include only the default reference manual settings, and then a string of letters in the string specifies the exact set of options required. The form of this string is exactly as described for the @option{-gnatVx} compiler switch (see the -GNAT users guide for details). For example the following two methods -can be used to enable validity checking for mode @code{in} and +@value{EDITION} User's Guide for details). For example the following two +methods can be used to enable validity checking for mode @code{in} and @code{in out} subprogram parameters: @itemize @bullet diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 87a456ad5e1..d75b70b68d2 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -888,6 +888,15 @@ package body Sem_Ch13 is Aspect_Default_Component_Value => Analyze_Aspect_Default_Value (ASN); + -- Ditto for iterator aspects, because the corresponding + -- attributes may not have been analyzed yet. + + when Aspect_Constant_Indexing | + Aspect_Variable_Indexing | + Aspect_Default_Iterator | + Aspect_Iterator_Element => + Analyze (Expression (ASN)); + when others => null; end case; diff --git a/gcc/ada/types.h b/gcc/ada/types.h index a4fa6cc7fa3..a0f28910d11 100644 --- a/gcc/ada/types.h +++ b/gcc/ada/types.h @@ -384,6 +384,3 @@ typedef Int Mechanism_Type; #define SE_Object_Too_Large 34 #define LAST_REASON_CODE 34 - -#define N_Return_Statement N_Simple_Return_Statement -/* temporary synonym for transition */