From 61789eedf831541b415691f7376a83fa81e6d73b Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 12 Feb 2016 17:39:27 +0000 Subject: 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 --- gcc/opts.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'gcc/opts.c') diff --git a/gcc/opts.c b/gcc/opts.c index 0a18c26..2f45312 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1434,12 +1434,7 @@ enable_fdo_optimizations (struct gcc_options *opts, } /* -f{,no-}sanitize{,-recover}= suboptions. */ -static const struct sanitizer_opts_s -{ - const char *const name; - unsigned int flag; - size_t len; -} sanitizer_opts[] = +const struct sanitizer_opts_s sanitizer_opts[] = { #define SANITIZER_OPT(name, flags) { #name, flags, sizeof #name - 1 } SANITIZER_OPT (address, SANITIZE_ADDRESS | SANITIZE_USER_ADDRESS), -- cgit v1.1