[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 Xi Ruoyao changed: What|Removed |Added Resolution|--- |FIXED Target Milestone|--- |9.0 Status|ASSIGNED|RESOLVED CC||xry111 at gcc dot gnu.org --- Comment #15 from Xi Ruoyao --- Closing as gcc-8 branch is closed for years.
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 Jakub Jelinek changed: What|Removed |Added Target Milestone|8.5 |---
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 Eric Gallager changed: What|Removed |Added Target Milestone|9.2 |8.5 --- Comment #14 from Eric Gallager --- (In reply to David Malcolm from comment #11) > Fixed on trunk; keeping open until I backport it to gcc-8-branch. adjusting target milestone then
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 Jakub Jelinek changed: What|Removed |Added Target Milestone|9.0 |9.2 --- Comment #13 from Jakub Jelinek --- GCC 9.1 has been released.
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 --- Comment #12 from David Malcolm --- Author: dmalcolm Date: Tue Dec 4 21:33:08 2018 New Revision: 266798 URL: https://gcc.gnu.org/viewcvs?rev=266798=gcc=rev Log: spellcheck.c: add another selftest for PR c/82967 This adds another testcase for overzealous spellchecker suggestions, reported on IRC. gcc/ChangeLog: PR c/82967 * spellcheck.c (selftest::test_suggestions): Add another assertion. Modified: trunk/gcc/ChangeLog trunk/gcc/spellcheck.c
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 --- Comment #11 from David Malcolm --- Fixed on trunk; keeping open until I backport it to gcc-8-branch.
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 --- Comment #10 from David Malcolm --- Author: dmalcolm Date: Fri Sep 14 22:02:58 2018 New Revision: 264335 URL: https://gcc.gnu.org/viewcvs?rev=264335=gcc=rev Log: Fix overeager spelling corrections (PR c/82967) This patch tunes class best_match's cutoff for rejecting meaningless spelling suggestions. Previously, we allowed an edit distance of up to half of the length of the longer of the goal string and closest candidate strings, rounded down. With this patch, we now allow only up to a third - with some tuning of rounding (and for very short strings), to ensure that: (a) everything that worked before still works (with the removal of a couple of cases that shouldn't), and that (b) the new threshold is always at least as conservative as the old threshold and thus shouldn't offer new nonsensical suggestions (with the possible exception of cases where transposition has helped; see r261521 aka Damerau-Levenshtein; PR other/69968). In particular, all of the bogus suggestions from PR c/82967 are now no longer offered. gcc/ChangeLog: PR c/82967 * spellcheck.c (get_edit_distance_cutoff): New function. (selftest::test_edit_distance_unit_test_oneway): Rename to... (selftest::test_get_edit_distance_one_way): ...this. (selftest::test_get_edit_distance_unit): Rename to... (selftest::test_get_edit_distance_both_ways): ...this. (selftest::test_edit_distances): Move tests to this new function, and test some more pairs of strings. Update for above renaming. (selftest::get_old_cutoff): New function. (selftest::test_get_edit_distance_cutoff): New function. (selftest::assert_suggested_for): New function. (ASSERT_SUGGESTED_FOR): New macro. (selftest::assert_not_suggested_for): New function. (ASSERT_NOT_SUGGESTED_FOR): New macro. (selftest::test_suggestions): New function. (selftest::spellcheck_c_tests): Move test_get_edit_distance_unit tests to selftest::test_edit_distances and call it. Add calls to selftest::test_get_edit_distance_cutoff and selftest::test_suggestions. * spellcheck.h (get_edit_distance_cutoff): New function declaration. (best_match::consider): Replace hard-coded cutoff calculation with a call to... (best_match::get_cutoff): New declaration. (best_match::get_best_meaningful_candidate): Likewise. gcc/testsuite/ChangeLog: PR c/82967 * c-c++-common/attributes-1.c: Remove bogus suggestion from dg-prune-output. * gcc.dg/diagnostic-token-ranges.c (undeclared_identifier): Remove bogus suggestion. * gcc.dg/spellcheck-identifiers-4.c: New test. Added: trunk/gcc/testsuite/gcc.dg/spellcheck-identifiers-4.c Modified: trunk/gcc/ChangeLog trunk/gcc/spellcheck.c trunk/gcc/spellcheck.h trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/c-c++-common/attributes-1.c trunk/gcc/testsuite/gcc.dg/diagnostic-token-ranges.c
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 --- Comment #9 from David Malcolm --- (In reply to David Malcolm from comment #8) > *** Bug 78068 has been marked as a duplicate of this bug. *** This one had "time" vs "nice", which the patch has test coverage for, via: + ASSERT_NOT_SUGGESTED_FOR ("nice", "time");
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 David Malcolm changed: What|Removed |Added CC||trippels at gcc dot gnu.org --- Comment #8 from David Malcolm --- *** Bug 78068 has been marked as a duplicate of this bug. ***
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 Eric Gallager changed: What|Removed |Added Keywords||patch URL||https://gcc.gnu.org/ml/gcc- ||patches/2018-08/msg01542.ht ||ml --- Comment #7 from Eric Gallager --- (In reply to David Malcolm from comment #6) > Candidate patch: https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01542.html adding "patch" keyword
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 --- Comment #6 from David Malcolm --- Candidate patch: https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01542.html
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 Eric Gallager changed: What|Removed |Added Status|NEW |ASSIGNED See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=81419 --- Comment #5 from Eric Gallager --- ASSIGNED since there's an assignee. Also possibly related to bug 81419
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 David Malcolm changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=69968 --- Comment #4 from David Malcolm --- Note that this could well interact with PR 69968 (use of Damerau-Levenshtein, rather than Levenshtein for edit distance): allowing transpositions will make some distances shorter. For the __i386__ vs __DATE__ case, maybe we should detect leading/trailing underscores and ignore them when computing if the edit distance is reasonable. It's an edit distance of 4 (4 substitutions) on a length of 8, but perhaps the effective length should be 4 (ignoring the underscores)?
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 --- Comment #3 from David Malcolm --- Another example: ia3230612.c:4:41: error: '__i386__' undeclared here (not in a function); did you mean '__DATE__'? && sizeof (long) == 4 ? 1 : -1] = { __i386__ }; ^~~~ __DATE__
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 Eric Gallager changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2018-03-22 CC||egallager at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from Eric Gallager --- Confirmed.
[Bug c/82967] "did you mean" suggestions are way too suggestive
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82967 David Malcolm changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |dmalcolm at gcc dot gnu.org Target Milestone|--- |9.0 --- Comment #1 from David Malcolm --- Another example: #include void test (float pf, float inff) { assert (pf == inff); } : In function 'test': :5:3: warning: implicit declaration of function 'assert'; did you mean 'sqrt'? [-Wimplicit-function-declaration] assert (pf == inff); ^~ sqrt (ideally we ought to suggest including for this one, but even so, the suggestion is unreasonable)