From 23ab63504249add3ac588fe44a4214d36812eeeb Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Sat, 27 Apr 2019 08:33:29 +0200 Subject: [PATCH] Add missing target options (PR middle-end/90258). 2019-04-27 Martin Liska 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 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 | 7 +++++++ gcc/opt-suggestions.c | 5 ++++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/completion-5.c | 7 +++++++ gcc/testsuite/gcc.target/i386/spellcheck-options-5.c | 5 +++++ 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/completion-5.c create mode 100644 gcc/testsuite/gcc.target/i386/spellcheck-options-5.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5de2dfaac3..5d5f03cfcff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-04-27 Martin Liska + + 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 * config/riscv/riscv-protos.h (riscv_move_integer): Add machine_mode diff --git a/gcc/opt-suggestions.c b/gcc/opt-suggestions.c index 415dcc9fc45..a820c78ff56 100644 --- a/gcc/opt-suggestions.c +++ b/gcc/opt-suggestions.c @@ -141,12 +141,14 @@ option_proposer::build_option_suggestions (const char *prefix) } else { + bool option_added = false; if (option->flags & CL_TARGET) { vec 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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4c68148e67b..6a52a9b1102 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-04-27 Martin Liska + + 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 * 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 index 00000000000..6719cfb6717 --- /dev/null +++ b/gcc/testsuite/gcc.dg/completion-5.c @@ -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 index 00000000000..4a878ba2da0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/spellcheck-options-5.c @@ -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 } */ -- 2.30.2