C/C++: don't suggest implementation names as spelling fixes (PR c/83236)
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 6 Dec 2017 20:02:55 +0000 (20:02 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Wed, 6 Dec 2017 20:02:55 +0000 (20:02 +0000)
commitc79144f8353af3292903c9c8e508f1de986eb6b0
tree7cd052f971408e0cf364391b328c2c1c9d64b38d
parent613bc14fcd3f6b58289aca9a2980cacfc2e75299
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.

From-SVN: r255453
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c-family/c-common.h
gcc/c-family/c-spellcheck.cc
gcc/c-family/c-spellcheck.h
gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/spellcheck-reserved.c [new file with mode: 0644]