aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/checks.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-04-24 16:49:08 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-04-24 16:49:08 +0200
commit0d5fbf52732b39f55714baad348c3269db8bb1b9 (patch)
tree2e0534b116d60294d01b70485a5da625a229e180 /gcc/ada/checks.adb
parent3d67b2397ae7eb4d2c384a093cbcac138cf068c7 (diff)
downloadgcc-0d5fbf52732b39f55714baad348c3269db8bb1b9.zip
gcc-0d5fbf52732b39f55714baad348c3269db8bb1b9.tar.gz
gcc-0d5fbf52732b39f55714baad348c3269db8bb1b9.tar.bz2
[multiple changes]
2013-04-24 Robert Dewar <dewar@adacore.com> * sem_type.adb, exp_attr.adb, exp_ch4.adb: Minor reformatting. 2013-04-24 Robert Dewar <dewar@adacore.com> * gnat_rm.texi: Document 'Update attribute. * sem_attr.adb (Analyze_Attribute, case Update): Remove call to S14_Attribute (S14_Attribute): removed. 2013-04-24 Robert Dewar <dewar@adacore.com> * interfac.ads: Add size clauses for IEEE_Float_32/64 2013-04-24 Claire Dross <dross@adacore.com> * gnat1drv.adb (Adjust_Global_Switches): Remove special assignment of Use_Expression_With_Actions for SPARK_Mode. 2013-04-24 Hristian Kirtchev <kirtchev@adacore.com> * checks.adb (Apply_Predicate_Check): Check for the presence of the dynamic predicate aspect when trying to determine if the predicate of a type is non-static. * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Check for the presence of the dynamic predicate aspect when trying to determine if the predicate of a type is non- static. * sem_ch13.adb (Add_Call): Capture the nature of the inherited ancestor predicate. (Build_Predicate_Functions): Update comments. Rewrite the checks on static predicate application. Complain about the form of a non-static expression only when the type is static. 2013-04-24 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb: Add guard to tree traversal. 2013-04-24 Vincent Celier <celier@adacore.com> * clean.adb (Clean): Remove local variable Root_Environment, use Makeutl.Root_Environment instead. * gnatcmd.adb: Remove local variable Root_Environment, use Makeutl.Root_Environment instead. * make.adb (Gnatmake): Remove local variable Root_Environment, use Makeutl.Root_Environment instead. * prj-makr.adb: Remove local variable Root_Environment, use Makeutl.Root_Environment instead. From-SVN: r198243
Diffstat (limited to 'gcc/ada/checks.adb')
-rw-r--r--gcc/ada/checks.adb32
1 files changed, 18 insertions, 14 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 8302b97..3cb1f95 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -2499,26 +2499,30 @@ package body Checks is
Make_Raise_Storage_Error (Sloc (N),
Reason => SE_Infinite_Recursion));
- -- Here for normal case of predicate active.
+ -- Here for normal case of predicate active
else
-- If the predicate is a static predicate and the operand is
-- static, the predicate must be evaluated statically. If the
-- evaluation fails this is a static constraint error. This check
-- is disabled in -gnatc mode, because the compiler is incapable
- -- of evaluating static expressions in that case.
-
- if Is_OK_Static_Expression (N) then
- if Present (Static_Predicate (Typ)) then
- if Operating_Mode < Generate_Code
- or else Eval_Static_Predicate_Check (N, Typ)
- then
- return;
- else
- Error_Msg_NE
- ("static expression fails static predicate check on&",
- N, Typ);
- end if;
+ -- of evaluating static expressions in that case. Note that when
+ -- inherited predicates are involved, a type may have both static
+ -- and dynamic forms. Check the presence of a dynamic predicate
+ -- aspect.
+
+ if Is_OK_Static_Expression (N)
+ and then Present (Static_Predicate (Typ))
+ and then not Has_Dynamic_Predicate_Aspect (Typ)
+ then
+ if Operating_Mode < Generate_Code
+ or else Eval_Static_Predicate_Check (N, Typ)
+ then
+ return;
+ else
+ Error_Msg_NE
+ ("static expression fails static predicate check on&",
+ N, Typ);
end if;
end if;