public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1512] [Ada] Cleanup related to volatile objects in restricted contexts
@ 2021-06-16  8:45 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-16  8:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f7f37ed649417925dee12e099dbb3227a3be30c2

commit r12-1512-gf7f37ed649417925dee12e099dbb3227a3be30c2
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Mon Mar 1 16:36:08 2021 +0100

    [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:
---
 gcc/ada/sem_res.adb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index e043085fbb9..69c3c13fec7 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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-16  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16  8:45 [gcc r12-1512] [Ada] Cleanup related to volatile objects in restricted contexts Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).