* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200769
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
@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:
@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
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) :=
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;
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),