From: Piotr Trojanek Date: Mon, 1 Mar 2021 15:36:08 +0000 (+0100) Subject: [Ada] Cleanup related to volatile objects in restricted contexts X-Git-Tag: basepoints/gcc-13~6801 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7f37ed649417925dee12e099dbb3227a3be30c2;p=thirdparty%2Fgcc.git [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. --- diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index e043085fbb97..69c3c13fec7e 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);