From patchwork Tue Nov 22 12:36:46 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: 60974 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 6D605384F6F8 for ; Tue, 22 Nov 2022 12:37:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D605384F6F8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669120641; bh=IZb9FxkDFHj1Nc1xCvr1+2K6I7rklEBMLx1PgqZS/5c=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ftUy69nGlI4WlHRUJKyfCHRX4IvqoRVBSatnP8ZI8OQ/UsUXLoaJD6puZmlNrWEJS lM0/5dpir3r1mWwHf0Q28PmihKsYah3Y2JhGiG5tAeXQYE+P+7a7wSRQcDswgeonRb P8Tb09xSlWCNn00RQ/EiwckCJWlZpr/foKIhOm9c= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id F03F63858281 for ; Tue, 22 Nov 2022 12:36:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F03F63858281 Received: by mail-wr1-x432.google.com with SMTP id z4so9909952wrr.3 for ; Tue, 22 Nov 2022 04:36:49 -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=IZb9FxkDFHj1Nc1xCvr1+2K6I7rklEBMLx1PgqZS/5c=; b=HLwrEQivYsHqlbKM/PzlXVRCDLY2L7ejvz/OcyHqt2g9X6kDy2MBRQmCVoUKzfNWU0 5XsOw1FVVgp+9KOoQuLAa1rl0waGld61wL9p/nbvCjCL7qCfKexTarj1zeG0dmvi15kP Ph2ZvVfiYfpKXWxEDlqFE9kvW0FMw2w1hl8cjoyJIpyZAABzQIVVrFSSULoUWCoGsWmK CEwc5/87jU8RP8qwvu0E2235m0bVC7OARgYxWx2f7WfluoC2uWb5xnvBXZlmMZdY95sp 81bVT/kXiqrOfBrmJOpNkjQyWNOKuMdTeCjA847WXSzL0NnmgM2QVVSnD/PRCpO5WbFx I34w== X-Gm-Message-State: ANoB5plzn3tQHxLaoEnjOlCCahM/BLoUcSNrJgvPCZhYmrNZAu13RR3a xLJDP7rp3u+NuBE83dR2aTLdzNEdlRDUug== X-Google-Smtp-Source: AA0mqf4OTLQoFiJA18tj1eAsFMR+9eqAIQVMHKhaA1PkvL3oGGIA3nYuzFosAxUzFHYHrYHh6QqgJQ== X-Received: by 2002:adf:fc82:0:b0:241:de59:74ed with SMTP id g2-20020adffc82000000b00241de5974edmr3643179wrr.122.1669120608809; Tue, 22 Nov 2022 04:36:48 -0800 (PST) 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 bg28-20020a05600c3c9c00b003cfaae07f68sm24244612wmb.17.2022.11.22.04.36.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 04:36:48 -0800 (PST) To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Adjust number of errors when removing warning in dead code Date: Tue, 22 Nov 2022 13:36:46 +0100 Message-Id: <20221122123646.336327-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: Piotr Trojanek When a warning about a runtime exception is emitted for a code in generic instance, we add continuation warnings "in instantiation ..." and only the original message increase the total number of errors. When removing these messages, e.g. after detecting that the code inside generic instance is dead, we must decrease the total number of errors, as otherwise the compiler exit status might stop gnatmake or gprbuild. gcc/ada/ * errout.adb (To_Be_Removed): Decrease total number of errors when removing a warning that has been escalated into error. * erroutc.adb (dmsg): Print Warn_Runtime_Raise flag. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/errout.adb | 11 +++++++++++ gcc/ada/erroutc.adb | 35 ++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index afa30674fa3..b30e8b51d15 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -3351,6 +3351,17 @@ package body Errout is Warning_Info_Messages := Warning_Info_Messages - 1; end if; + -- When warning about a runtime exception has been escalated + -- into error, the starting message has increased the total + -- errors counter, so here we decrease this counter. + + if Errors.Table (E).Warn_Runtime_Raise + and then not Errors.Table (E).Msg_Cont + and then Warning_Mode = Treat_Run_Time_Warnings_As_Errors + then + Total_Errors_Detected := Total_Errors_Detected - 1; + end if; + return True; -- No removal required diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb index 7766c972730..d40c668be8a 100644 --- a/gcc/ada/erroutc.adb +++ b/gcc/ada/erroutc.adb @@ -312,32 +312,33 @@ package body Erroutc is begin w ("Dumping error message, Id = ", Int (Id)); - w (" Text = ", E.Text.all); - w (" Next = ", Int (E.Next)); - w (" Prev = ", Int (E.Prev)); - w (" Sfile = ", Int (E.Sfile)); + w (" Text = ", E.Text.all); + w (" Next = ", Int (E.Next)); + w (" Prev = ", Int (E.Prev)); + w (" Sfile = ", Int (E.Sfile)); Write_Str - (" Sptr = "); + (" Sptr = "); Write_Location (E.Sptr.Ptr); -- ??? Do not write the full span for now Write_Eol; Write_Str - (" Optr = "); + (" Optr = "); Write_Location (E.Optr.Ptr); Write_Eol; - w (" Line = ", Int (E.Line)); - w (" Col = ", Int (E.Col)); - w (" Warn = ", E.Warn); - w (" Warn_Err = ", E.Warn_Err); - w (" Warn_Chr = '" & E.Warn_Chr & '''); - w (" Style = ", E.Style); - w (" Serious = ", E.Serious); - w (" Uncond = ", E.Uncond); - w (" Msg_Cont = ", E.Msg_Cont); - w (" Deleted = ", E.Deleted); - w (" Node = ", Int (E.Node)); + w (" Line = ", Int (E.Line)); + w (" Col = ", Int (E.Col)); + w (" Warn = ", E.Warn); + w (" Warn_Err = ", E.Warn_Err); + w (" Warn_Runtime_Raise = ", E.Warn_Runtime_Raise); + w (" Warn_Chr = '" & E.Warn_Chr & '''); + w (" Style = ", E.Style); + w (" Serious = ", E.Serious); + w (" Uncond = ", E.Uncond); + w (" Msg_Cont = ", E.Msg_Cont); + w (" Deleted = ", E.Deleted); + w (" Node = ", Int (E.Node)); Write_Eol; end dmsg;