public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1512] [Ada] Cleanup related to volatile objects in restricted contexts
Date: Wed, 16 Jun 2021 08:45:23 +0000 (GMT)	[thread overview]
Message-ID: <20210616084523.A6506398B154@sourceware.org> (raw)

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);


                 reply	other threads:[~2021-06-16  8:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210616084523.A6506398B154@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).