This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C++: avoid most reserved words as misspelling suggestions (PR c++/81610 and PR c++/80567)
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 26 Jan 2018 13:12:15 -0500
- Subject: Re: [PATCH] C++: avoid most reserved words as misspelling suggestions (PR c++/81610 and PR c++/80567)
- Authentication-results: sourceware.org; auth=none
- References: <1511365007-22684-1-git-send-email-dmalcolm@redhat.com> <CADzB+2=WefN3G5v7Eo2KBRAFLNsw2N3P-73BjmjBizebmuXbEA@mail.gmail.com>
On Mon, 2017-12-11 at 17:24 -0500, Jason Merrill wrote:
> On Wed, Nov 22, 2017 at 10:36 AM, David Malcolm <dmalcolm@redhat.com>
> wrote:
Original post:
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg02048.html
> > PR c++/81610 and PR c++/80567 report problems where the C++
> > frontend
> > suggested "if", "for" and "else" as corrections for misspelled
> > variable
> > names.
I've now marked these PRs as regressions: the nonsensical suggestions
are only offered by trunk, not by gcc 7 and earlier.
> Hmm, what about cases where people are actually misspelling keywords?
> Don't we want to handle that?
>
> fi (true) { }
> retrun 42;
I'd prefer not to.
gcc 7 and earlier don't attempt to correct the spelling of the "fi" and
"retrun" above.
trunk currently does offer "return" as a suggestion, but it was by
accident, and I'm wary of attempting to support these corrections: is
"fi" meant to be an "if", or a function call that's missing its decl,
or a name lookup issue? ...etc
> In the PRs you mention, the actual identifiers are 1) missing
> includes, which we should check first, and 2) pretty far from the
> suggested keywords.
The C++ FE is missing a suggestion about which #include to use for
"memset", but I'd prefer to treat that as a follow-up patch (and
probably for next stage 1).
In the meantime, is this patch OK for trunk? (as a regression fix)
Thanks
Dave