From 35f10dc04029e7125c322acbbd71dd30e3c8f54f Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Sat, 22 Jan 2022 14:51:27 +0100 Subject: [PATCH] [Ada] Prevent search for references in postconditions from going too far Add a standard prevention against climbing the entire compilation unit. Cleanup only; behaviour of the compiler is unaffected. gcc/ada/ * sem_warn.adb (Within_Postcondition): Guard against search going too far. --- gcc/ada/sem_warn.adb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 31ba4d1..d1f2036 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -2007,6 +2007,11 @@ package body Sem_Warn is then return True; end if; + + -- Prevent the search from going too far + + elsif Is_Body_Or_Package_Declaration (Nod) then + exit; end if; Nod := Parent (Nod); -- 2.7.4