From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 45A843860C3D for ; Tue, 14 Dec 2021 21:35:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 45A843860C3D Received: by mail-wr1-x432.google.com with SMTP id j9so2595676wrc.0 for ; Tue, 14 Dec 2021 13:35:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ghogXE8MkJ0uhIWzoswsC5nrV2m6OeGT1d+srCHp23w=; b=NGOsb5x7vkgk178wpxpqGgvJTWKeqKYo5qzcHb3XuCZb2HqreVTnO/QyPtQtE1xJ5m 7PNGenJsFIvaX8TSAt3+IDOBh0n//cSSbj6lLugKCphubjV3q9bUuL0IlWCJ1+aTzKF9 t9tUoeQKt2s1JumiMryB/pQgQtJJz34eQGgW+5V8Q1qDUZ1WyiFOZ1Jw9hTsj+/Msjbm qtgwUJGcervBNheJbWkdvZs1MX1y5CoalPmUsLvbfn6kf1U1I1fVdXMpfb7ih6+Z6/wL q0/x5eZUMsLu9nBzzcyV0haSKkcqHBbHIloScbmqjh0B4Ni/7EfPUQenDYxSxM8ofhTM LRng== X-Gm-Message-State: AOAM531idgX/uzICO4kD4framXnIN71y8PLXDXxFPXEhitFeODw4TMMp zM8tlnXUnTZCK6o8NHcBo8ZevEdgSL9wfSIz942wxw== X-Google-Smtp-Source: ABdhPJzeZd5xRZkTE2hHY31fRfaoJZVuELEsHguWt9o20xtMEdr0TqXK/BH+P5fTltXbHVHYVZSYRKYp3esBt/BN/9s= X-Received: by 2002:adf:a1d4:: with SMTP id v20mr1687947wrv.190.1639517740068; Tue, 14 Dec 2021 13:35:40 -0800 (PST) MIME-Version: 1.0 References: <87wnkam8qx.fsf@autistici.org> In-Reply-To: From: Eric Gallager Date: Tue, 14 Dec 2021 16:35:28 -0500 Message-ID: Subject: Re: [PATCH] gcc/diagnostic.c: make -Werror message more helpful To: Martin Sebor Cc: Andrea Monaco , gcc-patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Tue, 14 Dec 2021 21:35:43 -0000 On Tue, Dec 14, 2021 at 1:33 PM Eric Gallager wrote: > > On Mon, Dec 13, 2021 at 1:17 PM Martin Sebor via Gcc-patches > wrote: > > > > On 12/12/21 3:13 AM, Andrea Monaco via Gcc-patches wrote: > > > > > > Hello. > > > > > > > > > I propose to make that message more verbose. It sure would have helped > > > me once. You don't always have a Web search available :) > > > > Warnings turned into errors have the [-Werror=...] tag at the end > > so I'm not sure I see when reiterating -Werror at the end of output > > would be helpful. Can you explain the circumstances when it would > > have helped you? > > > > For what it's worth, a change here that I think might be more useful > > is printing the number of diagnostics of each kind (e.g., 2 warnings > > and 5 errors found). > > > > I swear we already had a bug open for this suggestion, but after much > searching I can't seem to find it anymore, so if anyone has any ideas > of what keywords I forgot to try, feel free to send them... Never mind, I managed to find it after all: it's bug 26061: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26061 > > > Andrea Monaco > > > > > > > > > > > > diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c > > > index 4ded1760705..8b67662390e 100644 > > > --- a/gcc/diagnostic.c > > > +++ b/gcc/diagnostic.c > > > @@ -156,7 +156,7 @@ default_diagnostic_final_cb (diagnostic_context *context) > > > /* -Werror was given. */ > > > if (context->warning_as_error_requested) > > > pp_verbatim (context->printer, > > > - _("%s: all warnings being treated as errors"), > > > + _("%s: all warnings being treated as errors (-Werror; disable with -Wno-error)"), > > > > If this change should move forward, -Werror needs to be quoted > > (e.g., passed as an argument to %qs or surrounded in a pair of > > %< and %> directives). The "disable with -Wno-error" part > > is superfluous and would not be entirely accurate for warnings > > promoted to errors by #pragma GCC diagnostic (those cannot be > > demoted back to warnings by -Wno-error). > > > > Martin > > > > > progname); > > > /* At least one -Werror= was given. */ > > > else > > > > >