aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-02-12 17:39:27 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-02-12 17:39:27 +0000
commit61789eedf831541b415691f7376a83fa81e6d73b (patch)
tree570dfb8c0732f310844f592f252d735a0da81372 /gcc/gcc.h
parentc3090c1f521bb5fedd5e7f977bce1bf0e1fc0a8e (diff)
downloadgcc-61789eedf831541b415691f7376a83fa81e6d73b.zip
gcc-61789eedf831541b415691f7376a83fa81e6d73b.tar.gz
gcc-61789eedf831541b415691f7376a83fa81e6d73b.tar.bz2
PR driver/69265 and 69453: improved suggestions for various misspelled options
gcc/ChangeLog: PR driver/69265 PR driver/69453 * gcc.c (driver::driver): Initialize m_option_suggestions. (driver::~driver): Clean up m_option_suggestions. (suggest_option): Convert to... (driver::suggest_option): ...this, and split out into driver::build_option_suggestions and find_closest_string. (driver::build_option_suggestions): New function, from first half of suggest_option. Special-case OPT_fsanitize_ and OPT_fsanitize_recover_, making use of the sanitizer_opts array. For options of enum types, add the various enum values to the candidate strings. (driver::handle_unrecognized_options): Remove "const". * gcc.h (driver::handle_unrecognized_options): Likewise. (driver::build_option_suggestions): New decl. (driver::suggest_option): New decl. (driver::m_option_suggestions): New field. * opts-common.c (add_misspelling_candidates): New function. * opts.c (sanitizer_opts): Remove decl of struct sanitizer_opts_s and make non-static. * opts.h (sanitizer_opts): New array decl. (add_misspelling_candidates): New function decl. * spellcheck.c (find_closest_string): New function. * spellcheck.h (find_closest_string): New function decl. gcc/testsuite/ChangeLog: PR driver/69265 PR driver/69453 * gcc.dg/spellcheck-options-3.c: New test case. * gcc.dg/spellcheck-options-4.c: New test case. * gcc.dg/spellcheck-options-5.c: New test case. * gcc.dg/spellcheck-options-6.c: New test case. * gcc.dg/spellcheck-options-7.c: New test case. * gcc.dg/spellcheck-options-8.c: New test case. * gcc.dg/spellcheck-options-9.c: New test case. * gcc.dg/spellcheck-options-10.c: New test case. From-SVN: r233382
Diffstat (limited to 'gcc/gcc.h')
-rw-r--r--gcc/gcc.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/gcc.h b/gcc/gcc.h
index 4fa0f4f..cb7081f 100644
--- a/gcc/gcc.h
+++ b/gcc/gcc.h
@@ -45,7 +45,9 @@ class driver
void putenv_COLLECT_GCC (const char *argv0) const;
void maybe_putenv_COLLECT_LTO_WRAPPER () const;
void maybe_putenv_OFFLOAD_TARGETS () const;
- void handle_unrecognized_options () const;
+ void build_option_suggestions (void);
+ const char *suggest_option (const char *bad_opt);
+ void handle_unrecognized_options ();
int maybe_print_and_exit () const;
bool prepare_infiles ();
void do_spec_on_infiles () const;
@@ -57,6 +59,7 @@ class driver
char *explicit_link_files;
struct cl_decoded_option *decoded_options;
unsigned int decoded_options_count;
+ auto_vec <char *> *m_option_suggestions;
};
/* The mapping of a spec function name to the C function that