aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-03-01 16:36:08 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-16 04:43:02 -0400
commitf7f37ed649417925dee12e099dbb3227a3be30c2 (patch)
treea6bcc48cd11e74d029a67749bde29e4bb951b6ab
parent788fed4b39a228f5a3ebc4cd3d825ab8ebdfdfba (diff)
downloadgcc-f7f37ed649417925dee12e099dbb3227a3be30c2.zip
gcc-f7f37ed649417925dee12e099dbb3227a3be30c2.tar.gz
gcc-f7f37ed649417925dee12e099dbb3227a3be30c2.tar.bz2
[Ada] Cleanup related to volatile objects in restricted contexts
gcc/ada/ * sem_res.adb (Is_Assignment_Or_Object_Expression): Whitespace cleanup. (Is_Attribute_Expression): Prevent AST climbing from going to the root of the compilation unit.
-rw-r--r--gcc/ada/sem_res.adb8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index e043085..69c3c13 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -7701,8 +7701,7 @@ package body Sem_Res is
Expr : Node_Id) return Boolean
is
begin
- if Nkind (Context) in
- N_Assignment_Statement | N_Object_Declaration
+ if Nkind (Context) in N_Assignment_Statement | N_Object_Declaration
and then Expression (Context) = Expr
then
return True;
@@ -7744,6 +7743,11 @@ package body Sem_Res is
while Present (N) loop
if Nkind (N) = N_Attribute_Reference then
return True;
+
+ -- Prevent the search from going too far
+
+ elsif Is_Body_Or_Package_Declaration (N) then
+ return False;
end if;
N := Parent (N);