From patchwork Mon May 22 08:50:39 2023 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: 97203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1306286vqo; Mon, 22 May 2023 02:06:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+TalalLNbd8C2ICN/olYWOk9AgMjBMr3YEUNevjMtGHeuoljfKJ60hoUSHNrvzzELR+H7 X-Received: by 2002:a05:6402:6c6:b0:50b:f70b:9928 with SMTP id n6-20020a05640206c600b0050bf70b9928mr7558722edy.18.1684746387724; Mon, 22 May 2023 02:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684746387; cv=none; d=google.com; s=arc-20160816; b=my5pTeZbtOFURDmTUEA9ogiRkJepmXqlzV01F+ZlZpuZOUPiA7MuBkvl5V3bvvVXWE XwOA7VqUnqjlUFJdbsRTOWnwujjXRdLXtZzwnH/DuBTML3OLVno1enQbOQOojhAsYcQb 7u94sxS578ZGHlye3xq4DB2F4KLexNhDZr2xSYZxC8vtCue9cPg6pfOSDOwZI0sj4jbw aagTD5HjC08N754+rF12sY9Ihr0mskfUdGpnhXxgdI5pplLGDfYMD6jYnz27lkzg5OzH dX1tOWzwlorE19OV4ioeuFqM+dtKNBl0GWsq+W+v98YjaxnIp6dE6nPPoLBS6F5l3DBB MSHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=yZLJfjHqJ8fuMlRaFbXrAxfbpB9zwEQoThdHVeTJZE4=; b=SWuXs6ImUooeCQJJirHVFoHo+SW6WjWE2YdX8vXDA7Dd4QVCKQl9Wi3sQS5zImXI7I 4tyrlST68f0a3HZ4JgX32CWBgnluFq1ayYHXIrpNUzMoiHb8n55cq4lXA9aUBbwe3QnG bDekrmfJaVk1L+V0LErHPTcllc7VBDfLAxdtrYGh2nQ4zZdm/R8+2odfWGIS8t942n/H hVmwmJARD+iM67IcLYZ50rVHcRp1VkfVpETX9zoESJBMZTUw5Of80wWdQiZjYetBWBGN H56tCoQDgwxFQxMQzsT7dO7nwLeyzKiH9HUhvtTqCZ6H54I4XQNl7qaI3T6ONV97ejb5 OPCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Dir07nDG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id j2-20020aa7c402000000b0050bc68cf1acsi3791863edq.514.2023.05.22.02.06.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 02:06:27 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Dir07nDG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 34B02395C078 for ; Mon, 22 May 2023 08:58:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34B02395C078 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684745886; bh=yZLJfjHqJ8fuMlRaFbXrAxfbpB9zwEQoThdHVeTJZE4=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Dir07nDGUU9teis7XD2zRFkrz47FjiGdQcrRCmbw8WYoouGjKy8K9qF0GIMNBSh4v CHgM07CwR0u4e+OEZVO5QGrEjJtm1feua6UThT7cpslu9Yi2zqVvpmmLPjUguSmaSu pSswyo5k46qL+zis2XXOrZ3ZeVRxd86mugsQaFwg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 49FF23857707 for ; Mon, 22 May 2023 08:50:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49FF23857707 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3f417ea5252so38736575e9.0 for ; Mon, 22 May 2023 01:50:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684745441; x=1687337441; 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=yZLJfjHqJ8fuMlRaFbXrAxfbpB9zwEQoThdHVeTJZE4=; b=Dz/70ySxid6urXXPJv6GC4HPQ8PjdTwPehlIdanvXyBB1sVDrZYaeGS+js2R9VSuT5 x51vX9NGomfZ1B/XQ64tlX2W+PaYzyaooIEM8pP6XN/oE7vjguWkgem/4CAWItpGpBDc AnHNVOsPXpUidlsKMvh4vHOZyWc3m+V8sAc+kekWiHZ4VCLdu1VIHqTBa+4yYls7elIl uEv+EmBGbQ4o2AxvzjBRJrf1Xgt0bFb58sNNI0TjLjfkQel9gxSbGFPTSGNwS502ubR/ dMoJOugR1vUxu1b84lBCuN13+G2JNwmmQLClg5BFq/RK2196FkUFf5t4F8xoWqVclgss DV9A== X-Gm-Message-State: AC+VfDwTHB5dxLFVM7uzJGiPZjEugC04e8S3w7Pss0fEGg2ELQKE8dFe g8g2A1yZ51gHB2m5nPdSbQRKMzHBgsiNKFiwa5OU7w== X-Received: by 2002:a1c:7315:0:b0:3f5:9ba:442d with SMTP id d21-20020a1c7315000000b003f509ba442dmr7293646wmb.33.1684745441171; Mon, 22 May 2023 01:50:41 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id h19-20020a05600c28d300b003f427cba193sm10783559wmd.41.2023.05.22.01.50.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 01:50:40 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Fix spurious warning on Inline_Always and contracts Date: Mon, 22 May 2023 10:50:39 +0200 Message-Id: <20230522085039.1726481-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 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: =?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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766584628471654357?= X-GMAIL-MSGID: =?utf-8?q?1766584628471654357?= From: Piotr Trojanek Warnings about pre/postconditions being ignored with Inline_Always were only true for the obsolete frontend inlining. With the current backend pre/postconditions work fine with Inline_Always. gcc/ada/ * sem_prag.adb (Check_Postcondition_Use_In_Inlined_Subprogram): Only emit warning when frontend inlining is enabled. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_prag.adb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index b6c78dbd559..dbc8584e211 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -210,7 +210,7 @@ package body Sem_Prag is -- Subsidiary to the analysis of pragmas Contract_Cases, Postcondition, -- Precondition, Refined_Post, and Test_Case. Emit a warning when pragma -- Prag is associated with subprogram Spec_Id subject to Inline_Always, - -- and assertions are enabled. + -- assertions are enabled and inling is done in the frontend. procedure Check_State_And_Constituent_Use (States : Elist_Id; @@ -30304,6 +30304,7 @@ package body Sem_Prag is if Warn_On_Redundant_Constructs and then Has_Pragma_Inline_Always (Spec_Id) and then Assertions_Enabled + and then not Back_End_Inlining then Error_Msg_Name_1 := Original_Aspect_Pragma_Name (Prag);