aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2014-02-24 16:56:25 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-02-24 17:56:25 +0100
commit2810861847cca82646c1c7e14249fe198acbbc0f (patch)
treecf5b52ce97f629ef9f3b3321d2176e94767a0e74 /gcc
parent3e5b1f324798b549d61995939bf09e1728bacb95 (diff)
downloadgcc-2810861847cca82646c1c7e14249fe198acbbc0f.zip
gcc-2810861847cca82646c1c7e14249fe198acbbc0f.tar.gz
gcc-2810861847cca82646c1c7e14249fe198acbbc0f.tar.bz2
sem_ch5.adb (Analyze_Loop_Parameter_Specification): If the domain of iteration is an attribute reference 'Old...
2014-02-24 Ed Schonberg <schonberg@adacore.com> * sem_ch5.adb (Analyze_Loop_Parameter_Specification): If the domain of iteration is an attribute reference 'Old, this is an Ada 2012 iterator and the loop must be rewritten as such. From-SVN: r208080
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/sem_ch5.adb13
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index e31ec1e..126bce3 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-24 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch5.adb (Analyze_Loop_Parameter_Specification): If the
+ domain of iteration is an attribute reference 'Old, this is an
+ Ada 2012 iterator and the loop must be rewritten as such.
+
2014-02-24 Thomas Quinot <quinot@adacore.com>
* s-fileio.adb (Errno_Message): Remove, use shared version from
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 2126f70..ead28bf 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -2362,12 +2362,21 @@ package body Sem_Ch5 is
Set_Parent (DS_Copy, Parent (DS));
Preanalyze_Range (DS_Copy);
- -- Ada 2012: If the domain of iteration is a function call, it is the
- -- new iterator form.
+ -- Ada 2012: If the domain of iteration is:
+
+ -- a) a function call,
+ -- b) an identifier that is not a type,
+ -- c) an attribute reference 'Old (within a postcondition)
+
+ -- then it is an iteration over a container. It was classified as
+ -- a loop specification by the parser, and must be rewritten now
+ -- to activate container iteration.
if Nkind (DS_Copy) = N_Function_Call
or else (Is_Entity_Name (DS_Copy)
and then not Is_Type (Entity (DS_Copy)))
+ or else (Nkind (DS_Copy) = N_Attribute_Reference
+ and then Attribute_Name (DS_Copy) = Name_Old)
then
-- This is an iterator specification. Rewrite it as such and
-- analyze it to capture function calls that may require