aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-01-30 15:59:21 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2015-01-30 15:59:21 +0100
commit48b0da2d24cfd3c918f85007e569f69ccd4cf1c4 (patch)
treee0ba84fc74ec8b2a7354130d6403f4cdf0c82746
parent95d0610c1730425dae8bfcb5a685bdc3c29c8ced (diff)
downloadgcc-48b0da2d24cfd3c918f85007e569f69ccd4cf1c4.zip
gcc-48b0da2d24cfd3c918f85007e569f69ccd4cf1c4.tar.gz
gcc-48b0da2d24cfd3c918f85007e569f69ccd4cf1c4.tar.bz2
[multiple changes]
2015-01-30 Hristian Kirtchev <kirtchev@adacore.com> * sem_attr.adb (Analyze_Attribute): Ensure that the check concerning Refined_Post takes precedence over the other cases. 2015-01-30 Gary Dismukes <dismukes@adacore.com> * sem_prag.adb: Minor typo fixes and reformatting. From-SVN: r220282
-rw-r--r--gcc/ada/ChangeLog10
-rw-r--r--gcc/ada/sem_attr.adb54
-rw-r--r--gcc/ada/sem_prag.adb6
3 files changed, 40 insertions, 30 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 56b0c13..c703eb9 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,13 @@
+2015-01-30 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_attr.adb (Analyze_Attribute): Ensure that
+ the check concerning Refined_Post takes precedence over the
+ other cases.
+
+2015-01-30 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_prag.adb: Minor typo fixes and reformatting.
+
2015-01-30 Yannick Moy <moy@adacore.com>
* sem_attr.adb: Code clean up.
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index cf1ff9c..36ee0d2 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -4572,6 +4572,32 @@ package body Sem_Attr is
CS := Scope (CS);
end loop;
+ -- Check the legality of attribute 'Old when it appears inside pragma
+ -- Refined_Post. These specialized checks are required only when code
+ -- generation is disabled. In the general case pragma Refined_Post is
+ -- transformed into pragma Check by Process_PPCs which in turn is
+ -- relocated to procedure _Postconditions. From then on the legality
+ -- of 'Old is determined as usual.
+
+ if not Expander_Active and then In_Refined_Post then
+ Preanalyze_And_Resolve (P);
+ Check_References_In_Prefix (CS);
+ P_Type := Etype (P);
+ Set_Etype (N, P_Type);
+
+ if Is_Limited_Type (P_Type) then
+ Error_Attr ("attribute % cannot apply to limited objects", P);
+ end if;
+
+ if Is_Entity_Name (P)
+ and then Is_Constant_Object (Entity (P))
+ then
+ Error_Msg_N
+ ("??attribute Old applied to constant has no effect", P);
+ end if;
+
+ return;
+
-- A Contract_Cases, Postcondition or Test_Case pragma is in the
-- process of being preanalyzed. Perform the semantic checks now
-- before the pragma is relocated and/or expanded.
@@ -4579,7 +4605,7 @@ package body Sem_Attr is
-- For a generic subprogram, postconditions are preanalyzed as well
-- for name capture, and still appear within an aspect spec.
- if In_Spec_Expression or Inside_A_Generic then
+ elsif In_Spec_Expression or Inside_A_Generic then
Prag := N;
while Present (Prag)
and then not Nkind_In (Prag, N_Aspect_Specification,
@@ -4625,32 +4651,6 @@ package body Sem_Attr is
end case;
end if;
- -- Check the legality of attribute 'Old when it appears inside pragma
- -- Refined_Post. These specialized checks are required only when code
- -- generation is disabled. In the general case pragma Refined_Post is
- -- transformed into pragma Check by Process_PPCs which in turn is
- -- relocated to procedure _Postconditions. From then on the legality
- -- of 'Old is determined as usual.
-
- elsif not Expander_Active and then In_Refined_Post then
- Preanalyze_And_Resolve (P);
- Check_References_In_Prefix (CS);
- P_Type := Etype (P);
- Set_Etype (N, P_Type);
-
- if Is_Limited_Type (P_Type) then
- Error_Attr ("attribute % cannot apply to limited objects", P);
- end if;
-
- if Is_Entity_Name (P)
- and then Is_Constant_Object (Entity (P))
- then
- Error_Msg_N
- ("??attribute Old applied to constant has no effect", P);
- end if;
-
- return;
-
-- Body case, where we must be inside a generated _Postconditions
-- procedure, or else the attribute use is definitely misplaced. The
-- postcondition itself may have generated transient scopes, and is
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index acae793..4a3bb21 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -17846,8 +17846,8 @@ package body Sem_Prag is
or else (Is_Generic_Type (Ent) and then Is_Derived_Type (Ent))
-- AI05-0028: The pragma applies to all composite types. Note
- -- that we apply this binding intepretation to previous verions
- -- of Ada so there is no Ada 2012 guard. Seems a reasonable
+ -- that we apply this binding interpretation to earlier versions
+ -- of Ada, so there is no Ada 2012 guard. Seems a reasonable
-- choice since there are other compilers that do the same.
or else Is_Composite_Type (Ent)