Add missing target options (PR middle-end/90258).
authorMartin Liska <mliska@suse.cz>
Sat, 27 Apr 2019 06:33:29 +0000 (08:33 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Sat, 27 Apr 2019 06:33:29 +0000 (06:33 +0000)
2019-04-27  Martin Liska  <mliska@suse.cz>

PR middle-end/90258
* opt-suggestions.c (option_proposer::build_option_suggestions):
When get_valid_option_values returns empty values, add the
misspelling candidate.
2019-04-27  Martin Liska  <mliska@suse.cz>

PR middle-end/90258
* gcc.dg/completion-5.c: New test.
* gcc.target/i386/spellcheck-options-5.c: New test.

From-SVN: r270622

gcc/ChangeLog
gcc/opt-suggestions.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/completion-5.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/spellcheck-options-5.c [new file with mode: 0644]

index e5de2dfaac3f2559db6bc6466b6a586105b2a186..5d5f03cfcff9adfb8a6e7569fe207776c96e0dcc 100644 (file)
@@ -1,3 +1,10 @@
+2019-04-27  Martin Liska  <mliska@suse.cz>
+
+       PR middle-end/90258
+       * opt-suggestions.c (option_proposer::build_option_suggestions):
+       When get_valid_option_values returns empty values, add the
+       misspelling candidate.
+
 2019-04-26  Jim Wilson  <jimw@sifive.com>
 
        * config/riscv/riscv-protos.h (riscv_move_integer): Add machine_mode
index 415dcc9fc45c5925baead2c71c7aa9c37e8b67b5..a820c78ff56fe985dc53e3d9edc16f64297cc650 100644 (file)
@@ -141,12 +141,14 @@ option_proposer::build_option_suggestions (const char *prefix)
            }
          else
            {
+             bool option_added = false;
              if (option->flags & CL_TARGET)
                {
                  vec<const char *> option_values
                    = targetm_common.get_valid_option_values (i, prefix);
                  if (!option_values.is_empty ())
                    {
+                     option_added = true;
                      for (unsigned j = 0; j < option_values.length (); j++)
                        {
                          char *with_arg = concat (opt_text, option_values[j],
@@ -158,7 +160,8 @@ option_proposer::build_option_suggestions (const char *prefix)
                    }
                  option_values.release ();
                }
-             else
+
+             if (!option_added)
                add_misspelling_candidates (m_option_suggestions, option,
                                            opt_text);
            }
index 4c68148e67be177e1b9dbba2ee7e4fb2358e10be..6a52a9b1102b7b036ac121310f9c1c284300a6e0 100644 (file)
@@ -1,3 +1,9 @@
+2019-04-27  Martin Liska  <mliska@suse.cz>
+
+       PR middle-end/90258
+       * gcc.dg/completion-5.c: New test.
+       * gcc.target/i386/spellcheck-options-5.c: New test.
+
 2019-04-26  Jim Wilson  <jimw@sifive.com>
 
        * gcc.target/riscv/load-immediate.c: New.
diff --git a/gcc/testsuite/gcc.dg/completion-5.c b/gcc/testsuite/gcc.dg/completion-5.c
new file mode 100644 (file)
index 0000000..6719cfb
--- /dev/null
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-options "--completion=-mfm" } */
+
+/* { dg-begin-multiline-output "" }
+-mfma
+-mfma4
+   { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.target/i386/spellcheck-options-5.c b/gcc/testsuite/gcc.target/i386/spellcheck-options-5.c
new file mode 100644 (file)
index 0000000..4a878ba
--- /dev/null
@@ -0,0 +1,5 @@
+/* PR middle-end/90258.  */
+
+/* { dg-do compile } */
+/* { dg-options "-mandroidX" } */
+/* { dg-error "unrecognized command line option '-mandroidX'; did you mean '-mandroid'"  "" { target *-*-* } 0 } */