From patchwork Tue Jul 5 08:30:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1652357 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=PsruGX/I; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LcbfW6FDPz9s1l for ; Tue, 5 Jul 2022 18:38:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B467C385354B for ; Tue, 5 Jul 2022 08:38:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B467C385354B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657010289; bh=hmzidp9qR0tSn5LsHlHFtIU/XjcmGl8PEXVjY+7bBRM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=PsruGX/ILI1LXNmGfhcIGym+ozvawsPkidlpUXj064EAYTPcO51pyQAt0+ep4HSdH V0UCd84oXiUU6KQKRxBzpVcvNTuuHP6M+/adE/QZONjA8NovV3JZM7mH3Ls7bwwKkt Z3eHBzPOX8GME7XVYRuffbIrjeE8TIAy0wCBlYyU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 35258385416F for ; Tue, 5 Jul 2022 08:30:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 35258385416F Received: by mail-wm1-x334.google.com with SMTP id l68so6582212wml.3 for ; Tue, 05 Jul 2022 01:30:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=hmzidp9qR0tSn5LsHlHFtIU/XjcmGl8PEXVjY+7bBRM=; b=XwW1OHkxVwyuluhFmNxO1pY9NpAGWceCN0IwcrIlUGpqN3BHV6YZvdGMMQT3Sc3qTe pT39e9vxPVRHe6uCIskX1eszQZdpmpdWbXFyxvBYYP7mrNMCOVxy57HetJt+bs9iidlU dMelVJ5E9KBV/bm/LdzpOduPmx0y/Kp8No732vVn7ke+cn5l/dfKw1LuCEu9/cqTv6C5 qNt0uxxfAJi6ytM32fRNKa8UwHeYJzQ2ZB2OWVGIcgHdDiZ42KcDiyynPiTh2+3VtY5v Ays1OI/n70WzWkBsBIyCJSE6DtUpJTsmsD3YJPhdOKBJoso8+pgwFhwYRZMEOFoYoS6m QSsw== X-Gm-Message-State: AJIora9V7JrNElisYwi4D34GFC+YnKJ5YYtEfZn0/8tH1+LMpUXi9RKQ XdNb0mZea/HZ9GBHeo1Z0QVnADuzj1IEYg== X-Google-Smtp-Source: AGRyM1t4u4z0gMTNIF4Bkllf0rvRfdUunesuplhXRUhyL41SpHh1xngdwxTYncE5xR5n1KMNtgDXtw== X-Received: by 2002:a1c:7719:0:b0:3a0:31a6:4469 with SMTP id t25-20020a1c7719000000b003a031a64469mr35253024wmi.20.1657009803746; Tue, 05 Jul 2022 01:30:03 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id v17-20020a5d5911000000b0021bbdc3375fsm8421335wrd.68.2022.07.05.01.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 01:30:03 -0700 (PDT) Date: Tue, 5 Jul 2022 08:30:02 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Reuse Get_Pragma_Arg to handle pragma argument associations Message-ID: <20220705083002.GA3193761@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Code cleanup related to looking at pragma Thread_Local_Storage. Semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch3.adb (Build_Init_Statements): Reuse Get_Pragma_Arg. * exp_prag.adb (Arg_N): Likewise. diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb --- 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 --- 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;