From: "Martin Liška" <mliska@suse.cz>
To: Jakub Jelinek <jakub@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
David Malcolm <dmalcolm@redhat.com>
Subject: Re: [PATCH] Do not suggest -fsanitize=all (PR driver/78863).
Date: Wed, 21 Dec 2016 10:22:00 -0000 [thread overview]
Message-ID: <bd710cf5-d7f4-6df0-36e9-a849b9b191a6@suse.cz> (raw)
In-Reply-To: <20161221100020.GT21933@tucnak>
[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]
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
[-- Attachment #2: 0001-Do-not-suggest-fsanitize-all-PR-driver-78863-v2.patch --]
[-- Type: text/x-patch, Size: 1954 bytes --]
From 2533c19b4bbd2d9900b043973b504be07343d05c Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
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 <jakub@redhat.com>
Martin Liska <mliska@suse.cz>
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 <mliska@suse.cz>
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
next prev parent reply other threads:[~2016-12-21 10:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-21 9:40 Martin Liška
2016-12-21 10:05 ` Jakub Jelinek
2016-12-21 10:22 ` Martin Liška [this message]
2016-12-21 10:33 ` Jakub Jelinek
2016-12-21 15:05 ` Martin Liška
2017-01-02 12:52 ` Martin Liška
2017-01-02 12:55 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bd710cf5-d7f4-6df0-36e9-a849b9b191a6@suse.cz \
--to=mliska@suse.cz \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).