Do not suggest -fsanitize=all (PR driver/78863).
authorMartin Liska <marxin@gcc.gnu.org>
Wed, 21 Dec 2016 15:05:10 +0000 (15:05 +0000)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 21 Dec 2016 15:05:10 +0000 (15:05 +0000)
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
gcc/gcc.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/spellcheck-options-13.c [new file with mode: 0644]

index 81d2165d8f91bbca19151b793abc2f2576ebecc7..8b2af2a1440612380466263faef39a540a9acfbf 100644 (file)
@@ -1,3 +1,10 @@
+2016-12-21  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.
+
 2016-12-21  Alexander Monakov  <amonakov@ispras.ru>
 
        PR target/78831
index f78acd68606ceba08cd096ccee972a6b3336c681..6908948434094346dde51c738cd865077fab8de1 100644 (file)
--- 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,
index 825aa18cb0c4fd1d9b5a1f0045e9220dbbd99f1d..a6599d7708fc61dc4e554a289cfb07e740948a6a 100644 (file)
@@ -1,3 +1,8 @@
+2016-12-21  Martin Liska  <mliska@suse.cz>
+
+       PR driver/78863
+       * gcc.dg/spellcheck-options-13.c: New test.
+
 2016-12-21  Alexander Monakov  <amonakov@ispras.ru>
 
        * 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 (file)
index 0000000..19b63af
--- /dev/null
@@ -0,0 +1,5 @@
+/* PR driver/78863.  */
+
+/* { dg-do compile } */
+/* { dg-options "-fsanitize" } */
+/* { dg-error "unrecognized command line option .-fsanitize..$" "" { target *-*-* } 0 } */