diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-11-29 16:25:01 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-11-29 16:25:01 +0000 |
commit | 8bf3cdff10beadb7072b0841be3fc7381d3218bd (patch) | |
tree | 006b95a47c80c65017ae64cf4c8fceb7ae9e9f9f /gcc/spellcheck.c | |
parent | 8684b292035b9463cdd12cc6f0a5114b775cfadb (diff) | |
download | gcc-8bf3cdff10beadb7072b0841be3fc7381d3218bd.zip gcc-8bf3cdff10beadb7072b0841be3fc7381d3218bd.tar.gz gcc-8bf3cdff10beadb7072b0841be3fc7381d3218bd.tar.bz2 |
spellcheck bugfixes: don't offer the goal string as a suggestion
gcc/cp/ChangeLog:
PR c++/77922
* name-lookup.c (lookup_name_fuzzy): Filter out reserved words
that were filtered out by init_reswords.
gcc/ChangeLog:
PR c++/72774
PR c++/72786
PR c++/77922
PR c++/78313
* spellcheck.c (selftest::test_find_closest_string): Verify that
we don't offer the goal string as a suggestion.
* spellcheck.h (best_match::get_best_meaningful_candidate): Don't
offer the goal string as a suggestion.
gcc/testsuite/ChangeLog:
PR c++/72774
PR c++/72786
PR c++/77922
PR c++/78313
* g++.dg/spellcheck-c++-11-keyword.C: New test case.
* g++.dg/spellcheck-macro-ordering.C: New test case.
* g++.dg/spellcheck-pr78313.C: New test case.
From-SVN: r242965
Diffstat (limited to 'gcc/spellcheck.c')
-rw-r--r-- | gcc/spellcheck.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/spellcheck.c b/gcc/spellcheck.c index b37b1e4..86cdee1 100644 --- a/gcc/spellcheck.c +++ b/gcc/spellcheck.c @@ -210,6 +210,11 @@ test_find_closest_string () ASSERT_STREQ ("banana", find_closest_string ("banyan", &candidates)); ASSERT_STREQ ("cherry", find_closest_string ("berry", &candidates)); ASSERT_EQ (NULL, find_closest_string ("not like the others", &candidates)); + + /* If the goal string somehow makes it into the candidate list, offering + it as a suggestion will be nonsensical. Verify that we don't offer such + suggestions. */ + ASSERT_EQ (NULL, find_closest_string ("banana", &candidates)); } /* Test data for test_metric_conditions. */ |