public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: David Malcolm <dmalcolm@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] RFC: elide repeated source locations (PR other/84889)
Date: Mon, 12 Nov 2018 20:38:00 -0000	[thread overview]
Message-ID: <37cb2057-f9dd-828d-5428-46f85e1c3c83@gmail.com> (raw)
In-Reply-To: <1541990633-4614-1-git-send-email-dmalcolm@redhat.com>

On 11/11/2018 07:43 PM, David Malcolm wrote:
> We often emit more than one diagnostic at the same source location.
> For example, the C++ frontend can emit many diagnostics at
> the same source location when suggesting overload candidates.
>
> For example:
>
> ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C: In function 'int test_3(s, t)':
> ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C:38:18: error: no match for 'operator&&' (operand types are 's' and 't')
>    38 |   return param_s && param_t;
>       |          ~~~~~~~~^~~~~~~~~~
> ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C:38:18: note: candidate: 'operator&&(bool, bool)' <built-in>
> ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C:38:18: note:   no known conversion for argument 2 from 't' to 'bool'
>
> This is overly verbose.  Note how the same location has been printed
> three times, obscuring the pertinent messages.
>
> This patch add a new "elide" value to -fdiagnostics-show-location=
> and makes it the default (previously it was "once").  With elision
> the above is printed as:
>
> ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C: In function 'int test_3(s, t)':
> ../../src/gcc/testsuite/g++.dg/diagnostic/bad-binary-ops.C:38:18: error: no match for 'operator&&' (operand types are 's' and 't')
>    38 |   return param_s && param_t;
>       |          ~~~~~~~~^~~~~~~~~~
>       = note: candidate: 'operator&&(bool, bool)' <built-in>
>       = note:   no known conversion for argument 2 from 't' to 'bool'
>
> where the followup notes are printed with a '=' lined up with
> the source code margin.
>
> Thoughts?

I agree the long pathname in the notes is at first glance redundant
but I'm not sure about using '=' as a shorthand for it.  I have
written many scripts to parse GCC output to extract all diagnostics
(including notes) and publish those on a Web page somewhere, as I'm
sure must have others.  All those scripts would stop working with
this change and require changes to the build system to work again.
Making those changes can be a substantial undertaking in some
organizations.

Have you considered printing just the file name instead?  Or any
other alternatives?

Martin

  reply	other threads:[~2018-11-12 20:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12  1:56 David Malcolm
2018-11-12 20:38 ` Martin Sebor [this message]
2018-11-14 21:13   ` David Malcolm
2018-11-15 17:35     ` Martin Sebor
2018-11-15 19:31       ` Eric Gallager

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37cb2057-f9dd-828d-5428-46f85e1c3c83@gmail.com \
    --to=msebor@gmail.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).