diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-07-08 10:11:50 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-07-08 10:11:50 +0200 |
commit | d7a3e18ca87744c3bd293396952a7ff36412d1ce (patch) | |
tree | 00beb7041cf1daae8aa1a3f22f973ec78eb0472e /gcc/ada | |
parent | 046f1eeec356d116ef3dcfc512d0ef8085efc8bf (diff) | |
download | gcc-d7a3e18ca87744c3bd293396952a7ff36412d1ce.zip gcc-d7a3e18ca87744c3bd293396952a7ff36412d1ce.tar.gz gcc-d7a3e18ca87744c3bd293396952a7ff36412d1ce.tar.bz2 |
[multiple changes]
2013-07-08 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Add documentation for Img returning a function.
* par-prag.adb: Minor reformatting.
* restrict.adb: Minor reformatting and code reorganization.
2013-07-08 Ed Schonberg <schonberg@adacore.com>
* sem_res.adb: add guard to ASIS transform.
From-SVN: r200769
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/ada/gnat_rm.texi | 10 | ||||
-rw-r--r-- | gcc/ada/par-prag.adb | 6 | ||||
-rw-r--r-- | gcc/ada/restrict.adb | 18 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 5 |
5 files changed, 30 insertions, 19 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a463f6a..0ce9b2e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2013-07-08 Robert Dewar <dewar@adacore.com> + + * gnat_rm.texi: Add documentation for Img returning a function. + * par-prag.adb: Minor reformatting. + * restrict.adb: Minor reformatting and code reorganization. + +2013-07-08 Ed Schonberg <schonberg@adacore.com> + + * sem_res.adb: add guard to ASIS transform. + 2013-07-08 Ed Schonberg <schonberg@adacore.com> * exp_ch9.adb (Expand_N_Asynchronous_Select): If the trigger diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 89db117..85bc98f 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -8057,8 +8057,8 @@ indicates whether or not the corresponding actual type has discriminants. @unnumberedsec Attribute Img @findex Img @noindent -The @code{Img} attribute differs from @code{Image} in that it may be -applied to objects as well as types, in which case it gives the +The @code{Img} attribute differs from @code{Image} in that it is applied +directly to an object, and yields the same result as @code{Image} for the subtype of the object. This is convenient for debugging: @@ -8076,6 +8076,12 @@ Put_Line ("X = " & @var{T}'Image (X)); @noindent where @var{T} is the (sub)type of the object @code{X}. +Note that technically, in analogy to @code{Image}, +@code{X'Img} returns a parameterless function +that returns the appropriate string when called. This means that +@code{X'Img} can be renamed as a function-returning-string, or used +in an instantiation as a function parameter. + @node Attribute Integer_Value @unnumberedsec Attribute Integer_Value @findex Integer_Value diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb index 762f433..4d01db0 100644 --- a/gcc/ada/par-prag.adb +++ b/gcc/ada/par-prag.adb @@ -232,10 +232,8 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is Id := Chars (Arg); Expr := Expression (Arg); - if Id = No_Name - and then Nkind (Expr) = N_Identifier - then - case Chars (Expr) is + if Id = No_Name and then Nkind (Expr) = N_Identifier then + case Chars (Expr) is when Name_No_Obsolescent_Features => Set_Restriction (No_Obsolescent_Features, Pragma_Node); Restriction_Warnings (No_Obsolescent_Features) := diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb index f78236a..a90cf1a 100644 --- a/gcc/ada/restrict.adb +++ b/gcc/ada/restrict.adb @@ -1171,20 +1171,16 @@ package body Restrict is function Same_Unit (U1, U2 : Node_Id) return Boolean is begin - if Nkind (U1) = N_Identifier then - return Nkind (U2) = N_Identifier and then Chars (U1) = Chars (U2); + if Nkind (U1) = N_Identifier and then Nkind (U2) = N_Identifier then + return Chars (U1) = Chars (U2); - elsif Nkind (U2) = N_Identifier then - return False; - - elsif (Nkind (U1) = N_Selected_Component - or else Nkind (U1) = N_Expanded_Name) - and then - (Nkind (U2) = N_Selected_Component - or else Nkind (U2) = N_Expanded_Name) + elsif Nkind_In (U1, N_Selected_Component, N_Expanded_Name) + and then + Nkind_In (U2, N_Selected_Component, N_Expanded_Name) then return Same_Unit (Prefix (U1), Prefix (U2)) - and then Same_Unit (Selector_Name (U1), Selector_Name (U2)); + and then + Same_Unit (Selector_Name (U1), Selector_Name (U2)); else return False; end if; diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 9b26f09..61f7712 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -1578,9 +1578,10 @@ package body Sem_Res is end if; -- If in ASIS_Mode, propagate operand types to original actuals of - -- function call, which would otherwise not be fully resolved. + -- function call, which would otherwise not be fully resolved. If + -- the call has already been constant-folded, nothing to do. - if ASIS_Mode then + if ASIS_Mode and then Nkind (N) in N_Op then if Is_Binary then Set_Parameter_Associations (Original_Node (N), |