diff options
author | Bob Duff <duff@adacore.com> | 2020-05-19 09:23:21 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-07-08 10:55:52 -0400 |
commit | 6091c2e0fa1836c6607562d273a529db5535c3d8 (patch) | |
tree | b5bfe6beb62605b3d500194fd6091b415b1e48bd /gcc | |
parent | 64b15a17a15e1cf06894d4825dba25b94dc365ff (diff) | |
download | gcc-6091c2e0fa1836c6607562d273a529db5535c3d8.zip gcc-6091c2e0fa1836c6607562d273a529db5535c3d8.tar.gz gcc-6091c2e0fa1836c6607562d273a529db5535c3d8.tar.bz2 |
[Ada] Disallow Predicate_Failure without predicate
gcc/ada/
* sem_ch13.adb (Predicate_Failure): Check that the type has
predicates. Remove the setting of Has_Delayed_Aspects and
Freeze_Node, because (if the code is legal) it should have
already been done by the predicate aspect.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_ch13.adb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index e440069..2131bb3 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -3120,6 +3120,12 @@ package body Sem_Ch13 is Error_Msg_N ("predicate cannot apply to incomplete view", Aspect); goto Continue; + + elsif not Has_Predicates (E) then + Error_Msg_N + ("Predicate_Failure requires previous predicate" & + " specification", Aspect); + goto Continue; end if; -- Construct the pragma @@ -3132,16 +3138,6 @@ package body Sem_Ch13 is Expression => Relocate_Node (Expr))), Pragma_Name => Name_Predicate_Failure); - -- If the type is private, indicate that its completion - -- has a freeze node, because that is the one that will - -- be visible at freeze time. - - if Is_Private_Type (E) and then Present (Full_View (E)) then - Set_Has_Predicates (Full_View (E)); - Set_Has_Delayed_Aspects (Full_View (E)); - Ensure_Freeze_Node (Full_View (E)); - end if; - -- Case 2b: Aspects corresponding to pragmas with two -- arguments, where the second argument is a local name -- referring to the entity, and the first argument is the |