aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2012-12-05 11:10:04 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2012-12-05 11:10:04 +0100
commit97948f419d8f77bbf30e402016c865d9de333b7f (patch)
tree2b357d89eb666107253f06a3c8aa831d07c304af /gcc/ada/sem_attr.adb
parent739e7bbf1bcd96174b51012936bf9fd5e2b0d82d (diff)
downloadgcc-97948f419d8f77bbf30e402016c865d9de333b7f.zip
gcc-97948f419d8f77bbf30e402016c865d9de333b7f.tar.gz
gcc-97948f419d8f77bbf30e402016c865d9de333b7f.tar.bz2
[multiple changes]
2012-12-05 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Build_Derived_Private_Type): Handle properly a completion in a grand-child unit when the parent type is itself a private type in a child unit whose full view is itself a derivation from a private type. 2012-12-05 Gary Dismukes <dismukes@adacore.com> * exp_attr.adb (Expand_N_Attribute_Reference, case Attribute_Valid): Remove code for issuing warning on Valid within a predicate. Moved to Sem_Attr. Remove with and use of Errout. * sem_attr.adb (Analyze_Attribute, case Attribute_Valid): Test for prefix's subtype having a predicate and issue warning about infinite recursion if Valid occurs within the subtype's predicate. Warning moved here from Exp_Attr. 2012-12-05 Yannick Moy <moy@adacore.com> * debug.adb: Minor comment addition. 2012-12-05 Yannick Moy <moy@adacore.com> * gnat1drv.adb (Adjust_Global_Switches): In CodePeer mode, check overflows by default, even when the user suppresses overflow checks. From-SVN: r194190
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index cfb0983..773b502 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -5557,6 +5557,21 @@ package body Sem_Attr is
Error_Attr_P ("object for % attribute must be of scalar type");
end if;
+ -- If the attribute appears within the subtype's own predicate
+ -- function, then issue a warning that this will cause infinite
+ -- recursion.
+
+ declare
+ Pred_Func : constant Entity_Id := Predicate_Function (P_Type);
+
+ begin
+ if Present (Pred_Func) and then Current_Scope = Pred_Func then
+ Error_Msg_N
+ ("attribute Valid requires a predicate check?", N);
+ Error_Msg_N ("\and will result in infinite recursion?", N);
+ end if;
+ end;
+
Set_Etype (N, Standard_Boolean);
-------------------