From patchwork Mon Nov 14 13:52:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 60591 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 12D6B38AA271 for ; Mon, 14 Nov 2022 13:54:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12D6B38AA271 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668434078; bh=bvogHHSHBRAa33HuMX6AV+O10TzOf0qEESOaFuwL7z8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=pOyQpLHckfaHDQOCXXff4SCaQaWnQKVtgaRRvuVAXEF3eq98KOTTkA6rvtpT1SY6d wd0LsNC/6EIRe1t/ST2sdpSqIVXXy1lwE2CFjbaSLfoX9tt9GgC2TgnQzG5YEN9S11 dpYHdbF/uc+KAcKNZtH1WYYqO1ydTqtJUV4zNSVw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 8C7433858035 for ; Mon, 14 Nov 2022 13:52:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8C7433858035 Received: by mail-wm1-x331.google.com with SMTP id 129-20020a1c0287000000b003cfe48519a6so1023631wmc.0 for ; Mon, 14 Nov 2022 05:52:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bvogHHSHBRAa33HuMX6AV+O10TzOf0qEESOaFuwL7z8=; b=RUs79KEgt29/1LWqhB2+x05tx4bWOR6VjKQoBACJ5zgTo6MsO9PMiGgvxFrIlia/mm gyyAXrVqiI9X28ROUGjiXf0WZJVj6swZimryB+SU5x0bhUiaS5XHRdALFxkYbU1fjkZM tnGJo0yDSbqUBi3/CY8NXpO+7IDZMTOd7IGk0AoIyrRvEeOzi9wmpvIITAWiVh5Sp1ip OsH67HWAu1lrmB9burg5kIoSkcj7vHQzmm0T+eSe56SBg2Lue1VP8OPfO0ktZyTOAu9V zfwGDJfw8QS+rJ8Z9w86F91pYpW/6EPzQgvsiN7o3j3hA01vCJu2oX8vCcpV3r0Wpufs 4viw== X-Gm-Message-State: ANoB5pnLJtEjbZzmXipRmEiEPJ0akHaE63ocSyaxBxw7Eje/uX8HdItd gimDWO1TcoiKFISwMafTngeoI687WD2moQ== X-Google-Smtp-Source: AA0mqf7Yw3Exvr6pK3IknkmDWRt+9i73OZuQ69o22DVxCtG2SWcXvmZ293ZK6U2E63yTDZoNDR0aAw== X-Received: by 2002:a05:600c:2258:b0:3cf:cf89:90f with SMTP id a24-20020a05600c225800b003cfcf89090fmr8194510wmm.186.1668433942294; Mon, 14 Nov 2022 05:52:22 -0800 (PST) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id k16-20020adff5d0000000b002383edcde09sm9594391wrp.59.2022.11.14.05.52.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 05:52:21 -0800 (PST) To: gcc-patches@gcc.gnu.org Cc: Yannick Moy Subject: [COMMITTED] ada: Fix error on SPARK_Mode on library-level separate body Date: Mon, 14 Nov 2022 14:52:19 +0100 Message-Id: <20221114135219.52903-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 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 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: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Yannick Moy When applying explicitly SPARK_Mode on a separate library-level spec and body for which a contract needs to be checked, compilation with -gnata was failing on a spurious error related to SPARK_Mode placement. Now fixed. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Add special case for the special local subprogram created for contracts. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 615c6d2110c..77fcb1c505f 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -23424,10 +23424,14 @@ package body Sem_Prag is Spec_Id : constant Entity_Id := Unique_Defining_Entity (Decl); begin - -- Ignore pragma when applied to the special body created for - -- inlining, recognized by its internal name _Parent. + -- Ignore pragma when applied to the special body created + -- for inlining, recognized by its internal name _Parent; or + -- when applied to the special body created for contracts, + -- recognized by its internal name _Wrapped_Statements. - if Chars (Body_Id) = Name_uParent then + if Chars (Body_Id) in Name_uParent + | Name_uWrapped_Statements + then return; end if;