From patchwork Wed Dec 21 10:20:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 88713 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp2190561qgi; Wed, 21 Dec 2016 02:21:09 -0800 (PST) X-Received: by 10.84.135.34 with SMTP id 31mr7402507pli.50.1482315669628; Wed, 21 Dec 2016 02:21:09 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id c186si26082781pga.181.2016.12.21.02.21.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Dec 2016 02:21:09 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444901-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-444901-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444901-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=oXdaav8q9aHSdRyrY 6okacVo8aFnkqnPPVRuCZU4V5F0HSUEMc1MoNdh/TQK5Gv5t+Y/MpQUeLGbPmmQm uf99NFxqIWVdzpe4+sWwnNSk4QyEkFU5Li7vyFeikw0tNiFNq2rbRYdzZI+KCEbC +2jEbsZSj2ozOiyB1BIB/QjHLE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=INlIW+z9WV9AD6N/DfYg1dj Oitk=; b=tnEh2mYoJV4rZOWLJ44A4uxijpTQWxAXPfUbSmlAl3+rUj2+KR4kMqb nxsLgqEc21I72CkaEj1mLc8EYUyPiYLIo/1Fy5goMMe7vaX+cDXNv6WCkH6n26cc 9IAr5ginq6zGEJ3XB+852ybtNzyToLao91fDFaLiWellh9Gj7pfs= Received: (qmail 85720 invoked by alias); 21 Dec 2016 10:20:47 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 85706 invoked by uid 89); 21 Dec 2016 10:20:46 -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, SPF_PASS autolearn=ham version=3.3.2 spammy=2016-12-21 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Dec 2016 10:20:36 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D339DABB4; Wed, 21 Dec 2016 10:20:33 +0000 (UTC) Subject: Re: [PATCH] Do not suggest -fsanitize=all (PR driver/78863). To: Jakub Jelinek References: <726a6397-65a6-e8e2-1c55-abe04a56460a@suse.cz> <20161221100020.GT21933@tucnak> Cc: GCC Patches , David Malcolm From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: Date: Wed, 21 Dec 2016 11:20:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161221100020.GT21933@tucnak> X-IsSubscribed: yes On 12/21/2016 11:00 AM, Jakub Jelinek wrote: > On Wed, Dec 21, 2016 at 10:34:13AM +0100, Martin Liška wrote: >> As mentioned in the PR, we should not suggest option that is not allowed. >> Fixed by explicit removal of suggestions that are not acceptable. >> >> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. >> >> Ready to be installed? > > Wouldn't it be better not to register those? Like (untested): > > --- gcc/gcc.c.jj 2016-11-14 19:57:10.000000000 +0100 > +++ gcc/gcc.c 2016-12-21 10:58:29.739873850 +0100 > @@ -7733,6 +7733,17 @@ driver::build_option_suggestions (void) > { > for (int j = 0; sanitizer_opts[j].name != NULL; ++j) > { > + struct cl_option optb; > + /* -fsanitize=all is not valid, only -fno-sanitize=all. > + So don't register the positive misspelling candidates > + for it. */ > + if (sanitizer_opts[j].flag == ~0U && i == OPT_fsanitize_) > + { > + optb = *option; > + optb.opt_text = opt_text = "-fno-sanitize="; > + optb.cl_reject_negative = true; > + option = &optb; > + } > /* Get one arg at a time e.g. "-fsanitize=address". */ > char *with_arg = concat (opt_text, > sanitizer_opts[j].name, > > > Jakub > I like your approach! make check -k -j10 RUNTESTFLAGS="dg.exp=spellcheck-options-*" works fine. Am I install the patch after it survives proper regression tests? Thanks, Martin >From 2533c19b4bbd2d9900b043973b504be07343d05c Mon Sep 17 00:00:00 2001 From: marxin Date: Tue, 20 Dec 2016 12:16:02 +0100 Subject: [PATCH] Do not suggest -fsanitize=all (PR driver/78863). gcc/ChangeLog: 2016-12-20 Jakub Jelinek Martin Liska PR driver/78863 * gcc.c (driver::build_option_suggestions): Do not add -fsanitize=all as a suggestion candidate. gcc/testsuite/ChangeLog: 2016-12-20 Martin Liska PR driver/78863 * gcc.dg/spellcheck-options-13.c: New test. --- gcc/gcc.c | 11 +++++++++++ gcc/testsuite/gcc.dg/spellcheck-options-13.c | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/spellcheck-options-13.c diff --git a/gcc/gcc.c b/gcc/gcc.c index f78acd68606..69089484340 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -7733,6 +7733,17 @@ driver::build_option_suggestions (void) { for (int j = 0; sanitizer_opts[j].name != NULL; ++j) { + struct cl_option optb; + /* -fsanitize=all is not valid, only -fno-sanitize=all. + So don't register the positive misspelling candidates + for it. */ + if (sanitizer_opts[j].flag == ~0U && i == OPT_fsanitize_) + { + optb = *option; + optb.opt_text = opt_text = "-fno-sanitize="; + optb.cl_reject_negative = true; + option = &optb; + } /* Get one arg at a time e.g. "-fsanitize=address". */ char *with_arg = concat (opt_text, sanitizer_opts[j].name, diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-13.c b/gcc/testsuite/gcc.dg/spellcheck-options-13.c new file mode 100644 index 00000000000..19b63af565b --- /dev/null +++ b/gcc/testsuite/gcc.dg/spellcheck-options-13.c @@ -0,0 +1,5 @@ +/* PR driver/78863. */ + +/* { dg-do compile } */ +/* { dg-options "-fsanitize" } */ +/* { dg-error "unrecognized command line option .-fsanitize..$" "" { target *-*-* } 0 } */ -- 2.11.0