aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-10-22 12:19:58 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-22 12:19:58 +0200
commit229db35122a3015db205e642f515593ed1841a00 (patch)
tree9ef7cb8b3a3114393fa1cbd08628522c8260c6ef /gcc/ada/sem_attr.adb
parent23c799b1580c919c709a8144c27b53e013cd65e7 (diff)
downloadgcc-229db35122a3015db205e642f515593ed1841a00.zip
gcc-229db35122a3015db205e642f515593ed1841a00.tar.gz
gcc-229db35122a3015db205e642f515593ed1841a00.tar.bz2
[multiple changes]
2010-10-22 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (May_Be_Lvalue): An actual in a function call can be an lvalue in Ada2012, if the function has in-out parameters. 2010-10-22 Robert Dewar <dewar@adacore.com> * cstand.adb, einfo.adb, exp_attr.adb, sem_prag.adb, sem_vfpt.adb, sem_ch10.adb: Minor reformatting. 2010-10-22 Sergey Rybin <rybin@adacore.com> * gnat_ugn.texi: Remove most of the content of gnatcheck chapter. 2010-10-22 Ed Schonberg <schonberg@adacore.com> * sem_attr.adb: Handle indexed P'old. From-SVN: r165817
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb32
1 files changed, 24 insertions, 8 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index e62e55c..819de42 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -3645,6 +3645,23 @@ package body Sem_Attr is
---------
when Attribute_Old =>
+ -- The attribute reference is a primary. If expressions follow, the
+ -- attribute reference is an indexable object, so rewrite the node
+ -- accordingly.
+
+ if Present (E1) then
+ Rewrite (N,
+ Make_Indexed_Component (Loc,
+ Prefix =>
+ Make_Attribute_Reference (Loc,
+ Prefix => Relocate_Node (Prefix (N)),
+ Attribute_Name => Name_Old),
+ Expressions => Expressions (N)));
+
+ Analyze (N);
+ return;
+ end if;
+
Check_E0;
Set_Etype (N, P_Type);
@@ -3669,8 +3686,8 @@ package body Sem_Attr is
Subp : Entity_Id := Current_Subprogram;
function Process (N : Node_Id) return Traverse_Result;
- -- Check that N does not contain references to local variables
- -- or other local entities of Subp.
+ -- Check that N does not contain references to local variables or
+ -- other local entities of Subp.
-------------
-- Process --
@@ -3706,10 +3723,10 @@ package body Sem_Attr is
if Present (Enclosing_Subprogram (Current_Subprogram)) then
-- Check that there is no reference to the enclosing
- -- subprogram local variables. Otherwise, we might end
- -- up being called from the enclosing subprogram and thus
- -- using 'Old on a local variable which is not defined
- -- at entry time.
+ -- subprogram local variables. Otherwise, we might end up
+ -- being called from the enclosing subprogram and thus using
+ -- 'Old on a local variable which is not defined at entry
+ -- time.
Subp := Enclosing_Subprogram (Current_Subprogram);
Check_No_Local (P);
@@ -3755,8 +3772,7 @@ package body Sem_Attr is
elsif Is_Entity_Name (P)
and then Is_Pure (Entity (P))
then
- Error_Attr_P
- ("prefix of % attribute must not be declared pure");
+ Error_Attr_P ("prefix of% attribute must not be declared pure");
end if;
end if;