From: Piotr Trojanek Date: Sat, 22 Jan 2022 13:51:27 +0000 (+0100) Subject: [Ada] Prevent search for references in postconditions from going too far X-Git-Tag: basepoints/gcc-14~6964 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=35f10dc04029e7125c322acbbd71dd30e3c8f54f;p=thirdparty%2Fgcc.git [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. --- diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 31ba4d1e903..d1f2036e100 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);