public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-3720] ada: Simplify detection of pragmas in the context items
Date: Mon,  7 Nov 2022 08:38:11 +0000 (GMT)	[thread overview]
Message-ID: <20221107083811.554253858C2F@sourceware.org> (raw)

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

commit r13-3720-gffe889d7ffcc7e8150413d4de38e066940fb7881
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Wed Sep 7 16:02:42 2022 +0200

    ada: Simplify detection of pragmas in the context items
    
    Code cleanup; semantics is unaffected.
    
    gcc/ada/
    
            * sem_prag.adb (Is_In_Context_Clause): Rewrite without negations
            and inequalities.

Diff:
---
 gcc/ada/sem_prag.adb | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 471ef870fa7..f33d858062d 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -7315,22 +7315,16 @@ package body Sem_Prag is
          Parent_Node : Node_Id;
 
       begin
-         if not Is_List_Member (N) then
-            return False;
-
-         else
+         if Is_List_Member (N) then
             Plist := List_Containing (N);
             Parent_Node := Parent (Plist);
 
-            if Parent_Node = Empty
-              or else Nkind (Parent_Node) /= N_Compilation_Unit
-              or else Context_Items (Parent_Node) /= Plist
-            then
-               return False;
-            end if;
+            return Present (Parent_Node)
+              and then Nkind (Parent_Node) = N_Compilation_Unit
+              and then Context_Items (Parent_Node) = Plist;
          end if;
 
-         return True;
+         return False;
       end Is_In_Context_Clause;
 
       ---------------------------------

                 reply	other threads:[~2022-11-07  8:38 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=20221107083811.554253858C2F@sourceware.org \
    --to=dkm@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).