On Mon, 2016-01-25 at 21:54 +0000, Manuel López-Ibáñez wrote:
> On 25 January 2016 at 20:17, Mikhail Maltsev <malts...@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

Reply via email to