This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Help! Regarding Bug 17896
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- Cc: Mikhail Maltsev <maltsevm at gmail dot com>, Prasad Ghangal <prasad dot ghangal at gmail dot com>, gcc Mailing List <gcc at gcc dot gnu dot org>
- Date: Mon, 25 Jan 2016 19:27:26 -0500
- Subject: Re: Help! Regarding Bug 17896
- Authentication-results: sourceware.org; auth=none
- References: <CAE+uiWZ46B6OffCFU38rgL7DExd=BCQ9VPo4KQwnLLooJT1Grw at mail dot gmail dot com> <56A682DA dot 7030804 at gmail dot com> <CAESRpQAF03a=7MKgsbafadgp7e2gfgVjwt_dZDC8LJJv11onOw at mail dot gmail dot com>
On Mon, 2016-01-25 at 21:54 +0000, Manuel LÃpez-IbÃÃez wrote:
> On 25 January 2016 at 20:17, Mikhail Maltsev <maltsevm@gmail.com> wrote:
> > As I understand, the bug report suggests that we say "suggest || instead of |
> > when joining booleans" instead. We now have the API to show fix-it hints, so it
> > would be nice to output something like
> >
> > test.c:17:21: warning: suggest || instead of | when joining booleans
> > foo ((a == b) | b == c);
> > ^
> > ||
> >
> > Grep 'set_fixit_hint' in the source code to see an example of it's usage.
>
> I think you should focus on one single very simple thing for a first
> patch, either adding fix-it hints to the existing warning or adding
> the alternative text. I would in fact suggest to add fix-it hints
> without touching anything else, since this is probably less
> controversial [*] and more straightforward. How?
>
> 1) Grep 'set_fixit_hint' in gcc/* gcc/cp/* gcc/c/* gcc/c-family/* and
> see how it is used.
I agree with Manu's advice, though as it happens, grepping for
"set_fixit_hint" will show you the *implementation* of fixit hints,
whereas Manu is suggesting you look at *users* of fixit hints.
You could grep for "add_fixit", instead, though currently we only have
one usage in the tree. You might also want to look at these patches:
https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01933.html
https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01935.html
https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01936.html
https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01934.html
(these ones missed the feature freeze for gcc 6).
Hope this is helpful; good luck!
Dave