Enhance option suggestion for options expected an argument (PR driver/89861).
authorMartin Liska <mliska@suse.cz>
Mon, 1 Apr 2019 07:17:38 +0000 (09:17 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 1 Apr 2019 07:17:38 +0000 (07:17 +0000)
2019-04-01  Martin Liska  <mliska@suse.cz>

PR driver/89861
* opt-suggestions.c (option_proposer::build_option_suggestions):
Add variant without any argument in order to provide better
hints.
2019-04-01  Martin Liska  <mliska@suse.cz>

PR driver/89861
* gcc.dg/spellcheck-options-18.c: New test.
* gcc.dg/spellcheck-options-19.c: New test.
* gcc.dg/spellcheck-options-20.c: New test.
* gcc.dg/spellcheck-options-13.c: Adjust expected output.
* gcc.dg/completion-2.c: Add one variant with no argument.

From-SVN: r270053

gcc/ChangeLog
gcc/opt-suggestions.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/completion-2.c
gcc/testsuite/gcc.dg/spellcheck-options-13.c
gcc/testsuite/gcc.dg/spellcheck-options-18.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/spellcheck-options-19.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/spellcheck-options-20.c [new file with mode: 0644]

index 6982daaab18aab1817e24078a3e2ce75d843c735..e123db0fe9c013b25f6a1b40467427e3975d2a70 100644 (file)
@@ -1,3 +1,10 @@
+2019-04-01  Martin Liska  <mliska@suse.cz>
+
+       PR driver/89861
+       * opt-suggestions.c (option_proposer::build_option_suggestions):
+       Add variant without any argument in order to provide better
+       hints.
+
 2019-04-01  Richard Biener  <rguenther@suse.de>
 
        PR c/71598
index c14c29d3083c89663488248eda61356b3b91bc72..415dcc9fc45c5925baead2c71c7aa9c37e8b67b5 100644 (file)
@@ -134,6 +134,10 @@ option_proposer::build_option_suggestions (const char *prefix)
                                              with_arg);
                  free (with_arg);
                }
+
+             /* Add also variant without an option argument.  */
+             add_misspelling_candidates (m_option_suggestions, option,
+                                         opt_text);
            }
          else
            {
@@ -172,6 +176,10 @@ option_proposer::build_option_suggestions (const char *prefix)
               "-fsanitize=address"
             rather than to "-Wframe-address" (PR driver/69265).  */
          {
+           /* Add also variant without an option argument.  */
+           add_misspelling_candidates (m_option_suggestions, option,
+                                       opt_text);
+
            for (int j = 0; sanitizer_opts[j].name != NULL; ++j)
              {
                struct cl_option optb;
index a6ac581f74484ee695c53062aeae392a50316b89..15b32a254d169fb75cfbd0bb7f799b936832189b 100644 (file)
@@ -1,3 +1,12 @@
+2019-04-01  Martin Liska  <mliska@suse.cz>
+
+       PR driver/89861
+       * gcc.dg/spellcheck-options-18.c: New test.
+       * gcc.dg/spellcheck-options-19.c: New test.
+       * gcc.dg/spellcheck-options-20.c: New test.
+       * gcc.dg/spellcheck-options-13.c: Adjust expected output.
+       * gcc.dg/completion-2.c: Add one variant with no argument.
+
 2019-04-01  Richard Biener  <rguenther@suse.de>
 
        PR c/71598
index ac7508591dea7aa94585f21beb8895716c1dcb57..166bfdc1424dcfdb05c46db8650c10e1715f7426 100644 (file)
@@ -7,4 +7,5 @@
 -flto-partition=max
 -flto-partition=none
 -flto-partition=one
+-flto-partition=
    { dg-end-multiline-output "" } */
index 19b63af565b96af9a9950cd2fcd66344dab47187..0d00642d87ea27152d3778da84f65c4b3d11bfca 100644 (file)
@@ -2,4 +2,4 @@
 
 /* { dg-do compile } */
 /* { dg-options "-fsanitize" } */
-/* { dg-error "unrecognized command line option .-fsanitize..$" "" { target *-*-* } 0 } */
+/* { dg-error "unrecognized command line option '-fsanitize'; did you mean '-fsanitize='?"  "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-18.c b/gcc/testsuite/gcc.dg/spellcheck-options-18.c
new file mode 100644 (file)
index 0000000..387d04e
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-fprofile-update" } */
+/* { dg-error "unrecognized command line option '-fprofile-update'; did you mean '-fprofile-update='?"  "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-19.c b/gcc/testsuite/gcc.dg/spellcheck-options-19.c
new file mode 100644 (file)
index 0000000..5a10476
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-sanitize" } */
+/* { dg-error "unrecognized command line option '-fno-sanitize'; did you mean '-fno-sanitize='?"  "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/spellcheck-options-20.c b/gcc/testsuite/gcc.dg/spellcheck-options-20.c
new file mode 100644 (file)
index 0000000..dfc6149
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "-Walloc-size-larger-than" } */
+/* { dg-error "unrecognized command line option '-Walloc-size-larger-than'; did you mean '-Walloc-size-larger-than='?"  "" { target *-*-* } 0 } */