gcc/libcpp/include
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
..
cpp-id-data.h Update copyright years. 2016-01-04 15:30:50 +01:00
cpplib.h Spelling suggestions for misspelled preprocessor directives 2016-08-18 18:52:43 +00:00
line-map.h Move make_location from tree.h/c to input.h/c 2016-07-27 17:21:20 +00:00
mkdeps.h Update copyright years. 2016-01-04 15:30:50 +01:00
symtab.h Update copyright years. 2016-01-04 15:30:50 +01:00