From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x331.google.com with SMTP id 129-20020a1c0287000000b003cfe48519a6so1023631wmc.0 for ; Mon, 14 Nov 2022 05:52:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bvogHHSHBRAa33HuMX6AV+O10TzOf0qEESOaFuwL7z8=; b=iun+ecqh25dSiIap7sM2rLbKMRq1CpJZJQRnWldR7i+2YZMfTdRHC0ZjRDp3H0aV04 1DiKEgWsOPgJObZ9d7B5NLqtPy8GaY+n5XAjGfArzjfitCJeCuya1wobWrQb3rSkNLd9 8jCXAYXplvq/8HVGssWfg12FonHOu5JeQYwfEgCz/Cm9479dFtH5nWFXhfa8jQz0MHST D02YdvDbJFMWoDkcPPbRAO25ywbHTk66djpAgYinDKWBh1AOjxWt5ZGRoVQzAJ2f8TYK K7X0hB5Ce3bZCFUVZLiOQb9lm6sdlNwU7Ypc8e7caIXlRg/H39D0qq5CUBclyIehRPkJ BclQ== 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) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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; -- 2.34.1