From 48b08b187f27bfe437479ae68a54508cb59251b5 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 27 Jan 2014 17:31:19 +0100 Subject: [PATCH] [multiple changes] 2014-01-27 Ben Brosgol * gnat_rm.texi: Minor clarifications. 2014-01-27 Robert Dewar * sem_elab.adb (Check_Internal_Call_Continue): Avoid complaining about call that is generated as part of an Initial_Condition check. * sem_prag.adb: Minor spelling correction. From-SVN: r207136 --- gcc/ada/ChangeLog | 11 +++++++++++ gcc/ada/gnat_rm.texi | 20 +++++++++----------- gcc/ada/sem_elab.adb | 46 ++++++++++++++++++++++++++++++++++++++++------ gcc/ada/sem_prag.adb | 2 +- 4 files changed, 61 insertions(+), 18 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 64dc2e9..af3418f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2014-01-27 Ben Brosgol + + * gnat_rm.texi: Minor clarifications. + +2014-01-27 Robert Dewar + + * sem_elab.adb (Check_Internal_Call_Continue): Avoid complaining + about call that is generated as part of an Initial_Condition + check. + * sem_prag.adb: Minor spelling correction. + 2014-01-27 Robert Dewar * sem_prag.adb (Set_Convention_From_Pragma): Check that diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 210ed23..54edf04 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -26,8 +26,6 @@ included in the section entitled ``GNU Free Documentation License''. @end copying @set EDITION GNAT -@set DEFAULTLANGUAGEVERSION Ada 2005 -@set NONDEFAULTLANGUAGEVERSION Ada 95 @settitle GNAT Reference Manual @@ -697,15 +695,15 @@ This manual contains useful information in writing programs using the characteristics of @value{EDITION}, including all the information required by Annex M of the Ada language standard. -@value{EDITION} implements Ada 95 and Ada 2005, and it may also be invoked in -Ada 83 compatibility mode. -By default, @value{EDITION} assumes @value{DEFAULTLANGUAGEVERSION}, +@value{EDITION} implements Ada 95, Ada 2005 and Ada 2012, and it may also be +invoked in Ada 83 compatibility mode. +By default, @value{EDITION} assumes Ada 2012, but you can override with a compiler switch to explicitly specify the language version. (Please refer to @ref{Compiling Different Versions of Ada,,, gnat_ugn, @value{EDITION} User's Guide}, for details on these switches.) Throughout this manual, references to ``Ada'' without a year suffix -apply to both the Ada 95 and Ada 2005 versions of the language. +apply to all the Ada versions of the language. Ada is designed to be highly portable. In general, a program will have the same effect even when compiled by @@ -2972,11 +2970,11 @@ You can use this pragma either to access a predefined @code{System} extension supplied with the compiler, for example @code{Aux_DEC} or you can construct your own extension unit following the above definition. Note that such a package is a child of @code{System} -and thus is considered part of the implementation. To compile -it you will have to use the appropriate switch for compiling -system units. -@xref{Top, @value{EDITION} User's Guide, About This Guide, gnat_ugn, @value{EDITION} User's Guide}, -for details. +and thus is considered part of the implementation. +To compile it you will have to use the @option{-gnatg} switch, +or the @option{/GNAT_INTERNAL} qualifier on OpenVMS, +for compiling System units, as explained in the +@value{EDITION} User's Guide. @node Pragma Extensions_Allowed @unnumberedsec Pragma Extensions_Allowed diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index b0b4534..8447be1 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -2155,18 +2155,52 @@ package body Sem_Elab is declare P : Node_Id; + O : Node_Id; + begin P := Parent (N); loop + -- Keep looking at parents if we are still in the subexpression + if Nkind (P) in N_Subexpr then P := Parent (P); - elsif Nkind (P) = N_If_Statement - and then Nkind (Original_Node (P)) = N_Pragma - and then Present (Corresponding_Aspect (Original_Node (P))) - then - return; + + -- Here P is the parent of the expression, check for special case + else - exit; + O := Original_Node (P); + + -- Definitely not the special case if orig node is not a pragma + + exit when Nkind (O) /= N_Pragma; + + -- Check we have an If statement or a null statement (happens + -- when the If has been expanded to be True). + + exit when not Nkind_In (P, N_If_Statement, N_Null_Statement); + + -- Our special case will be indicated either by the pragma + -- coming from an aspect ... + + if Present (Corresponding_Aspect (O)) then + return; + + -- Or, in the case of an initial condition, specifically by a + -- Check pragma specifying an Initial_Condition check. + + elsif Pragma_Name (O) = Name_Check + and then + Chars + (Expression (First (Pragma_Argument_Associations (O)))) = + Name_Initial_Condition + then + return; + + -- For anything else, we have an error + + else + exit; + end if; end if; end loop; end; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 624bf43..42f3c3f 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -2358,7 +2358,7 @@ package body Sem_Prag is end if; -- The expression is preanalyzed because it has not been moved to its - -- final place yet. A direct analysis may generate sife effects and this + -- final place yet. A direct analysis may generate side effects and this -- is not desired at this point. Preanalyze_And_Resolve (Expr, Standard_Boolean); -- 2.7.4