aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-01-22 14:51:27 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-10 08:19:27 +0000
commit35f10dc04029e7125c322acbbd71dd30e3c8f54f (patch)
tree15fd5bf13e7e565e455382d710053eeb9e77deed /gcc
parent8cec0688df7258e16b7c9d2614e16b5b9346da1d (diff)
downloadgcc-35f10dc04029e7125c322acbbd71dd30e3c8f54f.zip
gcc-35f10dc04029e7125c322acbbd71dd30e3c8f54f.tar.gz
gcc-35f10dc04029e7125c322acbbd71dd30e3c8f54f.tar.bz2
[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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_warn.adb5
1 files changed, 5 insertions, 0 deletions
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);