From b0a3329db0bbb9394131f28ebb03c9f33060771a Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 21 Dec 2016 15:05:10 +0000 Subject: [PATCH] Do not suggest -fsanitize=all (PR driver/78863). PR driver/78863 * gcc.c (driver::build_option_suggestions): Do not add -fsanitize=all as a suggestion candidate. PR driver/78863 * gcc.dg/spellcheck-options-13.c: New test. From-SVN: r243857 --- gcc/ChangeLog | 7 +++++++ gcc/gcc.c | 11 +++++++++++ gcc/testsuite/ChangeLog | 5 +++++ 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/ChangeLog b/gcc/ChangeLog index 81d2165d8f9..8b2af2a1440 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-12-21 Jakub Jelinek + Martin Liska + + PR driver/78863 + * gcc.c (driver::build_option_suggestions): Do not add + -fsanitize=all as a suggestion candidate. + 2016-12-21 Alexander Monakov PR target/78831 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/ChangeLog b/gcc/testsuite/ChangeLog index 825aa18cb0c..a6599d7708f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-21 Martin Liska + + PR driver/78863 + * gcc.dg/spellcheck-options-13.c: New test. + 2016-12-21 Alexander Monakov * gcc.target/nvptx/decl-shared.c (v_common): Add 'common' attribute to 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.30.2