Message ID | 87wnkam8qx.fsf@autistici.org |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> 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 381813857C44 for <patchwork@sourceware.org>; Sun, 12 Dec 2021 10:13:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 381813857C44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1639304024; bh=fQK1L6U0eym47bLTtpQo/A/MM9hZtcDZOLOLEJwP8xM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=NmQ4MnQRuE8tCM2N1JV4bFZEjZ6E/4y/EjEXOY9KDn4lH3JmU3PYXyK+lilM706g1 s71d9I50X8iSp/eESD6Qu7y3bE8K9mKQH2l6qjVcaO6/h7ZOyz712m2DwLeNWCAl4M wi0IJ6jeiNbB2TmHx41KEzIqXATNSxo0zWqkJk70= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from latitanza.investici.org (latitanza.investici.org [IPv6:2001:888:2000:56::19]) by sourceware.org (Postfix) with ESMTPS id 8732C385840C for <gcc-patches@gcc.gnu.org>; Sun, 12 Dec 2021 10:13:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8732C385840C Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4JBgSl5P3KzGp4t for <gcc-patches@gcc.gnu.org>; Sun, 12 Dec 2021 10:13:11 +0000 (UTC) Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: andrea.monaco@autistici.org) by localhost (Postfix) with ESMTPSA id 4JBgSl4Sx2zGp4Q for <gcc-patches@gcc.gnu.org>; Sun, 12 Dec 2021 10:13:11 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] gcc/diagnostic.c: make -Werror message more helpful Date: Sun, 12 Dec 2021 11:13:10 +0100 Message-ID: <87wnkam8qx.fsf@autistici.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Andrea Monaco via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Andrea Monaco <andrea.monaco@autistici.org> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
gcc/diagnostic.c: make -Werror message more helpful
|
|
Commit Message
Andrea Monaco
Dec. 12, 2021, 10:13 a.m. UTC
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 :) Andrea Monaco
Comments
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). > 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 >
On Mon, Dec 13, 2021 at 1:17 PM Martin Sebor via Gcc-patches <gcc-patches@gcc.gnu.org> 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... > > 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 > > >
On Tue, Dec 14, 2021 at 1:33 PM Eric Gallager <egall@gwmail.gwu.edu> wrote: > > On Mon, Dec 13, 2021 at 1:17 PM Martin Sebor via Gcc-patches > <gcc-patches@gcc.gnu.org> 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 > > > > >
Martin Sebor via Gcc-patches <gcc-patches@gcc.gnu.org> writes: > 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? Printing -Werror=foo might give the impression that that was the option that was actually passed. The message is the same if -Werror=foo was passed and if -Werror was passed (or something in between, for groups of options). The final “all warnings being treated as errors” line is only printed for -Werror, not -Werror=foo, so I think including -Werror there makes sense, and is more consistent with the individual error messages. So personally I think we should take the patch. Thanks, Richard > 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). > >> 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 >>
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)"), progname); /* At least one -Werror= was given. */ else