-
- Downloads
Spelling suggestions for misspelled preprocessor directives
This patch allows the preprocessor to offer suggestions for misspelled directives, taking us from e.g.: test.c:5:2: error: invalid preprocessing directive #endfi #endfi ^~~~~ to: test.c:5:2: error: invalid preprocessing directive #endfi; did you mean #endif? #endfi ^~~~~ endif gcc/c-family/ChangeLog: * c-common.c: Include "spellcheck.h". (cb_get_suggestion): New function. * c-common.h (cb_get_suggestion): New decl. * c-lex.c (init_c_lex): Initialize cb->get_suggestion to cb_get_suggestion. gcc/testsuite/ChangeLog: * gcc.dg/cpp/misspelled-directive-1.c: New testcase. * gcc.dg/cpp/misspelled-directive-2.c: New testcase. libcpp/ChangeLog: * directives.c (directive_names): New array. (_cpp_handle_directive): Offer spelling suggestions for misspelled directives. * errors.c (cpp_diagnostic_at_richloc): New function. (cpp_error_at_richloc): New function. * include/cpplib.h (struct cpp_callbacks): Add field "get_suggestion". (cpp_error_at_richloc): New decl. From-SVN: r239585
Showing
- gcc/c-family/ChangeLog 8 additions, 0 deletionsgcc/c-family/ChangeLog
- gcc/c-family/c-common.c 17 additions, 0 deletionsgcc/c-family/c-common.c
- gcc/c-family/c-common.h 5 additions, 0 deletionsgcc/c-family/c-common.h
- gcc/c-family/c-lex.c 1 addition, 0 deletionsgcc/c-family/c-lex.c
- gcc/testsuite/ChangeLog 5 additions, 0 deletionsgcc/testsuite/ChangeLog
- gcc/testsuite/gcc.dg/cpp/misspelled-directive-1.c 12 additions, 0 deletionsgcc/testsuite/gcc.dg/cpp/misspelled-directive-1.c
- gcc/testsuite/gcc.dg/cpp/misspelled-directive-2.c 21 additions, 0 deletionsgcc/testsuite/gcc.dg/cpp/misspelled-directive-2.c
- libcpp/ChangeLog 11 additions, 0 deletionslibcpp/ChangeLog
- libcpp/directives.c 39 additions, 2 deletionslibcpp/directives.c
- libcpp/errors.c 36 additions, 0 deletionslibcpp/errors.c
- libcpp/include/cpplib.h 8 additions, 0 deletionslibcpp/include/cpplib.h
Loading
Please register or sign in to comment