aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-01-23 18:06:29 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2014-01-23 18:06:29 +0100
commitea0f1fc8e4414c655d03febbb63536ab9225e250 (patch)
tree940269d4a068a80cd066a98d66f485dd89bd2769 /gcc/ada/sem_util.adb
parent19992053df788e3280ae25dc272a43e8384b8db1 (diff)
downloadgcc-ea0f1fc8e4414c655d03febbb63536ab9225e250.zip
gcc-ea0f1fc8e4414c655d03febbb63536ab9225e250.tar.gz
gcc-ea0f1fc8e4414c655d03febbb63536ab9225e250.tar.bz2
[multiple changes]
2014-01-23 Robert Dewar <dewar@adacore.com> * opt.adb (Register_Opt_Config_Switches): Save SPARK_Mode_Pragma setting. 2014-01-23 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (Is_Potentially_Unevaluated): Predicate only applies to expressions that come from source. * sem_attr.adb (Analyze_Attribute, case 'Old): Improve error message. (Analyze_Attribute, case 'Loop_Entry): Apply SPARK 2014 legality rule regarding potentially unevaluated expressions, to prefix of attribute. From-SVN: r206993
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r--gcc/ada/sem_util.adb8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index be59c9b..9a8428d 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -10334,7 +10334,13 @@ package body Sem_Util is
Expr := Par;
Par := Parent (Par);
- if Nkind (Par) not in N_Subexpr then
+ -- If the context is not an expression, or if is the result of
+ -- expansion of an enclosing construct (such as another attribute)
+ -- the predicate does not apply.
+
+ if Nkind (Par) not in N_Subexpr
+ or else not Comes_From_Source (Par)
+ then
return False;
end if;
end loop;