[Bug c/83236] "Did you mean" suggestions maybe shouldn't offer implementation-private names

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 6 20:03:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83236

--- Comment #7 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Wed Dec  6 20:02:55 2017
New Revision: 255453

URL: https://gcc.gnu.org/viewcvs?rev=255453&root=gcc&view=rev
Log:
C/C++: don't suggest implementation names as spelling fixes (PR c/83236)

gcc/c-family/ChangeLog:
        PR c/83236
        * c-common.c (selftest::c_family_tests): Call
        selftest::c_spellcheck_cc_tests.
        * c-common.h (selftest::c_spellcheck_cc_tests): New decl.
        * c-spellcheck.cc: Include "selftest.h".
        (name_reserved_for_implementation_p): New function.
        (should_suggest_as_macro_p): New function.
        (find_closest_macro_cpp_cb): Move the check for NT_MACRO to
        should_suggest_as_macro_p and call it.
        (selftest::test_name_reserved_for_implementation_p): New function.
        (selftest::c_spellcheck_cc_tests): New function.
        * c-spellcheck.h (name_reserved_for_implementation_p): New decl.

gcc/c/ChangeLog:
        PR c/83236
        * c-decl.c (lookup_name_fuzzy): Don't suggest names that are
        reserved for use by the implementation.

gcc/cp/ChangeLog:
        PR c/83236
        * name-lookup.c (consider_binding_level): Don't suggest names that
        are reserved for use by the implementation.

gcc/testsuite/ChangeLog:
        PR c/83236
        * c-c++-common/spellcheck-reserved.c: New test case.


Added:
    trunk/gcc/testsuite/c-c++-common/spellcheck-reserved.c
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/c-family/c-common.h
    trunk/gcc/c-family/c-spellcheck.cc
    trunk/gcc/c-family/c-spellcheck.h
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-decl.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/testsuite/ChangeLog


More information about the Gcc-bugs mailing list