aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2023-03-04 18:07:55 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-05-25 09:44:17 +0200
commit845d4419da1abe839431af7e6bf5aaecec932486 (patch)
treec6f0e625095b95c787e7e6125348e890672df643
parent54d8dbebf1b1b7f2ff5dcaa50a7b17c116ddb60f (diff)
downloadgcc-845d4419da1abe839431af7e6bf5aaecec932486.zip
gcc-845d4419da1abe839431af7e6bf5aaecec932486.tar.gz
gcc-845d4419da1abe839431af7e6bf5aaecec932486.tar.bz2
ada: Prevent search of calls in preconditions from going too far
When determining whether a call to protected function appears within a pragma expression we can safely stop at the subprogram body. Cleanup related to recently added support for a new SPARK aspects, whose implementation was based on Contract_Cases. gcc/ada/ * sem_util.adb (Check_Internal_Protected_Use): Add standard protection against search going too far.
-rw-r--r--gcc/ada/sem_util.adb5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 2e2fb91..bfe1b9f 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -3501,6 +3501,11 @@ package body Sem_Util is
("internal call cannot appear in default for formal of "
& "protected operation", N);
return;
+
+ -- Prevent the search from going too far
+
+ elsif Is_Body_Or_Package_Declaration (P) then
+ exit;
end if;
P := Parent (P);