gcc/libcpp
David Malcolm cb18fd07f2 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
2016-08-18 18:52:43 +00:00
..
include Spelling suggestions for misspelled preprocessor directives 2016-08-18 18:52:43 +00:00
po * sr.po: Update. 2016-06-03 22:07:36 +01:00
ChangeLog Spelling suggestions for misspelled preprocessor directives 2016-08-18 18:52:43 +00:00
ChangeLog.jit Merger of dmalcolm/jit branch from git 2014-11-11 21:55:52 +00:00
Makefile.in Update copyright years. 2016-01-04 15:30:50 +01:00
aclocal.m4 libcpp: Bump to automake 1.11.6 2015-05-13 11:02:17 +00:00
charset.c Fix crash in selftest::test_lexer_string_locations_ucn4 (PR bootstrap/72823) 2016-08-06 18:06:30 +00:00
config.in Change ENABLE_VALGRIND_CHECKING to 2016-05-20 08:03:25 +00:00
configure Change ENABLE_VALGRIND_CHECKING to 2016-05-20 08:03:25 +00:00
configure.ac Change ENABLE_VALGRIND_CHECKING to 2016-05-20 08:03:25 +00:00
directives-only.c Update copyright years. 2016-01-04 15:30:50 +01:00
directives.c Spelling suggestions for misspelled preprocessor directives 2016-08-18 18:52:43 +00:00
errors.c Spelling suggestions for misspelled preprocessor directives 2016-08-18 18:52:43 +00:00
expr.c expr.c (cpp_classify_number): Hex floats are new in C++1z. 2016-03-15 08:08:31 -04:00
files.c libcpp: Tweak to missing #include source location 2016-06-22 15:29:21 +00:00
identifiers.c Update copyright years. 2016-01-04 15:30:50 +01:00
init.c libcpp: Tweak to missing #include source location 2016-06-22 15:29:21 +00:00
internal.h On-demand locations within string-literals 2016-08-05 18:08:33 +00:00
lex.c re PR c/7652 (-Wswitch-break : Warn if a switch case falls through) 2016-08-12 10:30:47 +00:00
line-map.c input.c: add lexing selftests and a test matrix for line_table states 2016-07-11 16:02:20 +00:00
location-example.txt Source range tracking in libcpp and C FE, with bit-packing optimization 2015-11-13 16:29:59 +00:00
macro.c re PR c/7652 (-Wswitch-break : Warn if a switch case falls through) 2016-08-12 10:30:47 +00:00
makeucnid.c Update copyright years. 2016-01-04 15:30:50 +01:00
mkdeps.c Update copyright years. 2016-01-04 15:30:50 +01:00
pch.c re PR c/7652 (-Wswitch-break : Warn if a switch case falls through) 2016-08-18 10:28:03 +00:00
symtab.c Update copyright years. 2016-01-04 15:30:50 +01:00
system.h Update copyright years. 2016-01-04 15:30:50 +01:00
traditional.c Update copyright years. 2016-01-04 15:30:50 +01:00
ucnid.h Update copyright years. 2016-01-04 15:30:50 +01:00
ucnid.tab Update copyright years. 2016-01-04 15:30:50 +01:00