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 r13-1490] [Ada] Reuse Get_Pragma_Arg to handle pragma argument associations
Date: Tue,  5 Jul 2022 08:30:44 +0000 (GMT)	[thread overview]
Message-ID: <20220705083044.795F0385C311@sourceware.org> (raw)

https://gcc.gnu.org/g:0aa855e5eb274a7279693879b45b73b28b72aaef

commit r13-1490-g0aa855e5eb274a7279693879b45b73b28b72aaef
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Tue Jun 7 13:19:35 2022 +0200

    [Ada] Reuse Get_Pragma_Arg to handle pragma argument associations
    
    Code cleanup related to looking at pragma Thread_Local_Storage.
    Semantics is unaffected.
    
    gcc/ada/
    
            * exp_ch3.adb (Build_Init_Statements): Reuse Get_Pragma_Arg.
            * exp_prag.adb (Arg_N): Likewise.

Diff:
---
 gcc/ada/exp_ch3.adb  | 8 +++-----
 gcc/ada/exp_prag.adb | 8 +++-----
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index eea37dcf9da..c9f0bfd9302 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -3319,11 +3319,9 @@ package body Exp_Ch3 is
                         --  Pragma case
 
                         if Nkind (Ritem) = N_Pragma then
-                           Exp := First (Pragma_Argument_Associations (Ritem));
-
-                           if Nkind (Exp) = N_Pragma_Argument_Association then
-                              Exp := Expression (Exp);
-                           end if;
+                           Exp :=
+                             Get_Pragma_Arg
+                               (First (Pragma_Argument_Associations (Ritem)));
 
                            --  Conversion for Priority expression
 
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index 5f1308777e8..0631172ea18 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -105,12 +105,10 @@ package body Exp_Prag is
          end if;
       end loop;
 
-      if Present (Arg)
-        and then Nkind (Arg) = N_Pragma_Argument_Association
-      then
-         return Expression (Arg);
+      if Present (Arg) then
+         return Get_Pragma_Arg (Arg);
       else
-         return Arg;
+         return Empty;
       end if;
    end Arg_N;


                 reply	other threads:[~2022-07-05  8:30 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=20220705083044.795F0385C311@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).