diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-08 16:54:32 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-08 16:54:32 +0200 |
commit | ed57136d4a6bbf190126322a818175debee588b4 (patch) | |
tree | 1c12ec670540ac16c3dca88dd113ff65931217ec /gcc | |
parent | ef7c5692f12132cb8672a61c67070deef4fd600e (diff) | |
download | gcc-ed57136d4a6bbf190126322a818175debee588b4.zip gcc-ed57136d4a6bbf190126322a818175debee588b4.tar.gz gcc-ed57136d4a6bbf190126322a818175debee588b4.tar.bz2 |
[multiple changes]
2009-04-08 Ed Schonberg <schonberg@adacore.com>
* sem_util.adb (Is_Protected_Self_Reference): Add guard to check for
presence of entity.
* usage.adb, gnat_ugn.texi: add info on -gnatyO: overriding indicators
2009-04-08 Vincent Celier <celier@adacore.com>
* vms_data.ads: Add VMS equivalent for -gnatyO (OVERRIDING_INDICATORS)
2009-04-08 Thomas Quinot <quinot@adacore.com>
* checks.ads: Minor reformatting
2009-04-08 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Update documentation of pragma Obsolescent
* sem_prag.adb (Analyze_Pragma, case Obsolescent): Allow identifiers to
be omitted, and allow Entity parameter to be omitted.
From-SVN: r145745
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 22 | ||||
-rw-r--r-- | gcc/ada/checks.ads | 10 | ||||
-rw-r--r-- | gcc/ada/gnat_rm.texi | 58 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 5 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 30 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 7 | ||||
-rw-r--r-- | gcc/ada/usage.adb | 1 | ||||
-rw-r--r-- | gcc/ada/vms_data.ads | 2 |
8 files changed, 88 insertions, 47 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6530050..b02ec43 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,25 @@ +2009-04-08 Ed Schonberg <schonberg@adacore.com> + + * sem_util.adb (Is_Protected_Self_Reference): Add guard to check for + presence of entity. + + * usage.adb, gnat_ugn.texi: add info on -gnatyO: overriding indicators + +2009-04-08 Vincent Celier <celier@adacore.com> + + * vms_data.ads: Add VMS equivalent for -gnatyO (OVERRIDING_INDICATORS) + +2009-04-08 Thomas Quinot <quinot@adacore.com> + + * checks.ads: Minor reformatting + +2009-04-08 Robert Dewar <dewar@adacore.com> + + * gnat_rm.texi: Update documentation of pragma Obsolescent + + * sem_prag.adb (Analyze_Pragma, case Obsolescent): Allow identifiers to + be omitted, and allow Entity parameter to be omitted. + 2009-04-08 Thomas Quinot <quinot@adacore.com> * exp_util.adb: Minor comment fix diff --git a/gcc/ada/checks.ads b/gcc/ada/checks.ads index 1b88dc1..07ac272 100644 --- a/gcc/ada/checks.ads +++ b/gcc/ada/checks.ads @@ -32,7 +32,7 @@ -- checks, is to attempt to detect at compilation time that a constraint -- error will occur. If this is detected a warning or error is issued and the -- offending expression or statement replaced with a constraint error node. --- This always occurs whether checks are suppressed or not. Dynamic range +-- This always occurs whether checks are suppressed or not. Dynamic range -- checks are, of course, not inserted if checks are suppressed. with Namet; use Namet; @@ -233,9 +233,9 @@ package Checks is -- First this routine determines if an overflow check is needed by doing -- an appropriate range check. If a check is not needed, then the call -- has no effect. If a check is needed then this routine sets the flag - -- Set Do_Overflow_Check in node N to True, unless it can be determined - -- that the check is not needed. The only condition under which this is - -- the case is if there was an identical check earlier on. + -- Do_Overflow_Check in node N to True, unless it can be determined that + -- the check is not needed. The only condition under which this is the + -- case is if there was an identical check earlier on. procedure Enable_Range_Check (N : Node_Id); -- Set Do_Range_Check flag in node N True, unless it can be determined @@ -445,7 +445,7 @@ package Checks is -- Some of the earlier processing for checks results in temporarily setting -- the Do_Range_Check flag rather than actually generating checks. Now we -- are moving the generation of such checks into the front end for reasons - -- of efficiency and simplicity (there were difficutlies in handling this + -- of efficiency and simplicity (there were difficulties in handling this -- in the back end when side effects were present in the expressions being -- checked). diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 36ea82f..5f344b0 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -3463,19 +3463,26 @@ will always generate an invalid value if one exists. Syntax: @smallexample @c ada -pragma Obsolescent - [([Entity =>] NAME - [,[Message =>] static_string_EXPRESSION - [,[Version =>] Ada_05]])]; +pragma Obsolescent; + +pragma Obsolescent ( + [Message =>] static_string_EXPRESSION +[,[Version =>] Ada_05]]); + +pragma Obsolescent ( + [Entity =>] NAME +[,[Message =>] static_string_EXPRESSION +[,[Version =>] Ada_05]] ); @end smallexample @noindent This pragma can occur immediately following a declaration of an entity, -including the case of a record component, and usually the Entity name -must match the name of the entity declared by this declaration. -Alternatively, the pragma can immediately follow an -enumeration type declaration, where the entity argument names one of the -enumeration literals. +including the case of a record component. If no Entity argument is present, +then this declaration is the one to which the pragma applies. If an Entity +parameter is present, it must either match the name of the entity in this +declaration, or alternatively, the pragma can immediately follow an enumeration +type declaration, where the Entity argument names one of the enumeration +literals. This pragma is used to indicate that the named entity is considered obsolescent and should not be used. Typically this is @@ -3484,13 +3491,12 @@ existing subprograms or other entities. The pragma can be used at an intermediate stage when the entity is still present, but will be removed later. -The effect of this pragma is to output a warning message on -a call to a program thus marked that the -subprogram is obsolescent if the appropriate warning option in the -compiler is activated. If the string parameter is present, then a second -warning message is given containing this text. -In addition, a call to such a program is considered a violation of -pragma Restrictions (No_Obsolescent_Features). +The effect of this pragma is to output a warning message on a reference to +an entity thus marked that the subprogram is obsolescent if the appropriate +warning option in the compiler is activated. If the Message parameter is +present, then a second warning message is given containing this text. In +addition, a reference to the eneity is considered to be a violation of pragma +Restrictions (No_Obsolescent_Features). This pragma can also be used as a program unit pragma for a package, in which case the entity name is the name of the package, and the @@ -3499,7 +3505,7 @@ obsolescent. In this case a client @code{with}'ing such a package violates the restriction, and the @code{with} statement is flagged with warnings if the warning option is set. -If the optional third parameter is present (which must be exactly +If the Version parameter is present (which must be exactly the identifier Ada_05, no other argument is allowed), then the indication of obsolescence applies only when compiling in Ada 2005 mode. This is primarily intended for dealing with the situations @@ -3511,15 +3517,12 @@ The following examples show typical uses of this pragma: @smallexample @c ada package p is - pragma Obsolescent - (Entity => p, Message => "use pp instead of p"); + pragma Obsolescent (p, Message => "use pp instead of p"); end p; package q is procedure q2; - pragma Obsolescent - (Entity => q2, - Message => "use q2new instead"); + pragma Obsolescent ("use q2new instead"); type R is new integer; pragma Obsolescent @@ -3530,7 +3533,7 @@ package q is type M is record F1 : Integer; F2 : Integer; - pragma Obsolescent (Entity => F2); + pragma Obsolescent; F3 : Integer; end record; @@ -3545,11 +3548,10 @@ end; @end smallexample @noindent -In an earlier version of GNAT, the Entity parameter was not required, -and this form is still accepted for compatibility purposes. If the -Entity parameter is omitted, then the pragma applies to the declaration -immediately preceding the pragma (this form cannot be used for the -enumeration literal case). +Note that, as for all pragmas, if you use a pragma argument identifier, +then all subsequent parameters must also use a pragma argument identifier. +So if you specify "Entity =>" for the Entity argument, and a Message +argument is present, it must be preceded by "Message =>". @node Pragma Optimize_Alignment @unnumberedsec Pragma Optimize_Alignment diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 50ccad4..6d4390d 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -6059,6 +6059,11 @@ of letters, except that if there is a trailing numeric suffix, then the value of this suffix is used in the ordering (e.g.@: Junk2 comes before Junk10). +@item ^O^OVERRIDING_INDICATORS^ +@emph{Check that overriding subprograms are explicitly marked as such.} +The declaration of a primitive operation of a type extension that overrides +an inherited operation must carry an overriding indicator. + @item ^p^PRAGMA^ @emph{Check pragma casing.} Pragma names must be written in mixed case, that is, the diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index b8b5ed5..c9500f8 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -9058,10 +9058,16 @@ package body Sem_Prag is -- Obsolescent -- ----------------- - -- pragma Obsolescent [( - -- [Entity => NAME,] - -- [Message => static_string_EXPRESSION - -- [,[Version => Ada_05]] )]; + -- pragma Obsolescent; + + -- pragma Obsolescent ( + -- [Message =>] static_string_EXPRESSION + -- [,[Version =>] Ada_05]]); + + -- pragma Obsolescent ( + -- [Entity =>] NAME + -- [,[Message =>] static_string_EXPRESSION + -- [,[Version =>] Ada_05]] ); when Pragma_Obsolescent => Obsolescent : declare Ename : Node_Id; @@ -9186,19 +9192,15 @@ package body Sem_Prag is -- See if first argument specifies an entity name if Arg_Count >= 1 - and then Chars (Arg1) = Name_Entity + and then + (Chars (Arg1) = Name_Entity + or else + Nkind_In (Get_Pragma_Arg (Arg1), N_Character_Literal, + N_Identifier, + N_Operator_Symbol)) then Ename := Get_Pragma_Arg (Arg1); - if Nkind (Ename) /= N_Character_Literal - and then - Nkind (Ename) /= N_Identifier - and then - Nkind (Ename) /= N_Operator_Symbol - then - Error_Pragma_Arg ("entity name expected for pragma%", Arg1); - end if; - -- Eliminate first argument, so we can share processing Arg1 := Arg2; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 34ad212..b265155 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -6411,8 +6411,15 @@ package body Sem_Util is -- Start of processing for Is_Protected_Self_Reference begin + -- Verify that prefix is analyzed and has the proper form. Note that + -- the attributes Elab_Spec, Elab_Body, and UET_Address, which also + -- produce the address of an entity, do not analyze their prefix + -- because they denote entities that are not necessarily visible. + -- Neither of them can apply to a protected type. + return Ada_Version >= Ada_05 and then Is_Entity_Name (N) + and then Present (Entity (N)) and then Is_Protected_Type (Entity (N)) and then In_Open_Scopes (Entity (N)) and then not In_Access_Definition (N); diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index 3d14ce3..e69695b 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -525,6 +525,7 @@ begin Write_Line (" Mnn check line length <= nn characters"); Write_Line (" N turn off all checks"); Write_Line (" o check subprogram bodies in alphabetical order"); + Write_Line (" O check overriding indicators"); Write_Line (" p check pragma casing"); Write_Line (" r check casing for identifier references"); Write_Line (" s check separate subprogram specs present"); diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads index 6af3479..91f7647 100644 --- a/gcc/ada/vms_data.ads +++ b/gcc/ada/vms_data.ads @@ -2242,6 +2242,8 @@ package VMS_Data is "-gnaty-n " & "ORDERED_SUBPROGRAMS " & "-gnatyo " & + "OVERRIDING_INDICATORS " & + "-gnatyO " & "NOORDERED_SUBPROGRAMS " & "-gnaty-o " & "PRAGMA " & |