Add a standard prevention against climbing the entire compilation unit.
Cleanup only; behaviour of the compiler is unaffected.
Tested on x86_64-pc-linux-gnu, committed on trunk
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
--- 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);