From patchwork Wed Dec 21 09:34:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 88705 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp2171777qgi; Wed, 21 Dec 2016 01:34:39 -0800 (PST) X-Received: by 10.99.143.72 with SMTP id r8mr6192004pgn.128.1482312879700; Wed, 21 Dec 2016 01:34:39 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z21si25940007pgc.193.2016.12.21.01.34.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Dec 2016 01:34:39 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444890-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-444890-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444890-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:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=cMGkT7ioeEJqfbLWDnsSwNueWRoJHQTD6iS4e8/QpGufsaz6XX rjUoBf9NStoFun3BB3UqyTRBjokVxYxn/7xkE2eKhbTxJC+HqLRb3+vvyxE7c34n dDXHNI6d+0CztfAN6mDqBoMs0gifqoUt0YrNXRyHcH7TEFuJXqJhG+0xU= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=bpPqChbQqD6Q7RHmhbBA9TA1TR4=; b=gETHHVZYqjfJleU50OlW +XZqM8zO8+/ymGTuczytQQWWuVG5aOa4td8WjbykYs4B2RQW/MGp9OxNgFZcLfXq 2M0fuAcFrwcFnvpTjA2FTxmqvz2qv0/rfOn0hmKfYM4VLXfMqLVjdQZbhY6K+ssH gBdF9TXVhVjRsIUw+MAMgso= Received: (qmail 16266 invoked by alias); 21 Dec 2016 09:34:27 -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 16254 invoked by uid 89); 21 Dec 2016 09:34:26 -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= 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 09:34:16 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4A3A2AAE8; Wed, 21 Dec 2016 09:34:14 +0000 (UTC) To: GCC Patches Cc: David Malcolm From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] Do not suggest -fsanitize=all (PR driver/78863). Message-ID: <726a6397-65a6-e8e2-1c55-abe04a56460a@suse.cz> Date: Wed, 21 Dec 2016 10:34:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 X-IsSubscribed: yes 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? Martin >From 1a2d5614e9a0515659f50b457ef031c1f80f4a7c 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 Martin Liska PR driver/78863 * gcc.c (driver::build_option_suggestions): Call remove_misspelling_candidate for -fsanitize=all. * opts-common.c (remove_misspelling_candidate): New function. * opts.h (remove_misspelling_candidate): Likewise. gcc/testsuite/ChangeLog: 2016-12-20 Martin Liska PR driver/78863 * gcc.dg/spellcheck-options-13.c: New test. --- gcc/gcc.c | 4 ++++ gcc/opts-common.c | 17 +++++++++++++++++ gcc/opts.h | 2 ++ gcc/testsuite/gcc.dg/spellcheck-options-13.c | 5 +++++ 4 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/spellcheck-options-13.c diff --git a/gcc/gcc.c b/gcc/gcc.c index f78acd68606..1240e8a176b 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -7748,6 +7748,10 @@ driver::build_option_suggestions (void) break; } } + + /* PR driver/78863: skip -fsanitize=all. */ + remove_misspelling_candidate (m_option_suggestions, "fsanitize=all"); + remove_misspelling_candidate (m_option_suggestions, "-sanitize=all"); } /* Helper function for driver::handle_unrecognized_options. diff --git a/gcc/opts-common.c b/gcc/opts-common.c index e9d1c20a1f3..d5d81de8a5f 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -413,6 +413,23 @@ add_misspelling_candidates (auto_vec *candidates, } } +/* Helper function for gcc.c's driver which removes OPT_TEXT from + list of CANDIDATES. */ + +void +remove_misspelling_candidate (auto_vec *candidates, + const char *opt_text) +{ + for (unsigned i = 0; i < candidates->length (); i++) + { + if (strcmp ((*candidates)[i], opt_text) == 0) + { + candidates->ordered_remove (i); + return; + } + } +} + /* Decode the switch beginning at ARGV for the language indicated by LANG_MASK (including CL_COMMON and CL_TARGET if applicable), into the structure *DECODED. Returns the number of switches diff --git a/gcc/opts.h b/gcc/opts.h index b3e64353c8a..052aa54cee4 100644 --- a/gcc/opts.h +++ b/gcc/opts.h @@ -420,6 +420,8 @@ extern const struct sanitizer_opts_s extern void add_misspelling_candidates (auto_vec *candidates, const struct cl_option *option, const char *base_option); +extern void remove_misspelling_candidate (auto_vec *candidates, + const char *opt_text); extern const char *candidates_list_and_hint (const char *arg, char *&str, const auto_vec & candidates); 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