From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128846 invoked by alias); 7 Feb 2018 18:28:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 128837 invoked by uid 89); 7 Feb 2018 18:28:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KAM_SHORT,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:2789, offer, reserved X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Feb 2018 18:28:14 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E752B4B90 for ; Wed, 7 Feb 2018 18:28:12 +0000 (UTC) Received: from ovpn-116-223.phx2.redhat.com (ovpn-116-223.phx2.redhat.com [10.3.116.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E2C75C885; Wed, 7 Feb 2018 18:28:12 +0000 (UTC) Message-ID: <1518028091.26503.74.camel@redhat.com> Subject: Re: [PATCH] C++: avoid most reserved words as misspelling suggestions (PR c++/81610 and PR c++/80567) From: David Malcolm To: Jason Merrill Cc: gcc-patches List Date: Wed, 07 Feb 2018 18:28:00 -0000 In-Reply-To: References: <1511365007-22684-1-git-send-email-dmalcolm@redhat.com> <1516990335.26503.18.camel@redhat.com> <1518027125.26503.71.camel@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg00345.txt.bz2 On Wed, 2018-02-07 at 13:22 -0500, Jason Merrill wrote: > On Wed, Feb 7, 2018 at 1:12 PM, David Malcolm > wrote: > > On Wed, 2018-02-07 at 12:21 -0500, Jason Merrill wrote: > > > On Fri, Jan 26, 2018 at 1:12 PM, David Malcolm > > om> > > > wrote: > > > > On Mon, 2017-12-11 at 17:24 -0500, Jason Merrill wrote: > > > > > On Wed, Nov 22, 2017 at 10:36 AM, David Malcolm > > > > hat. > > > > > 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) > > > > > > Yes. > > > > Thanks; committed (r257456). > > > > FWIW, I've filed PR c++/84269 so I remember to fix the missing > > suggestion for "memset" (in gcc 9 stage1). > > Did you have a reaction to my comment about the suggested keyword > being pretty far from the actual identifier? Do we want to lower the > cutoff for suggestions at all? I've played around with tweaking how the cutoff works, [1] in response to e.g. PR c/82967 ('"did you mean" suggestions are way too suggestive'), but I've not yet come up with a version I prefer to the current implementation.