Go to file
David Malcolm 1a4f11c88a C FE: suggest corrections for misspelled identifiers and type names
gcc/c-family/ChangeLog:
	PR c/70339
	* c-common.h (enum lookup_name_fuzzy_kind): New enum.
	(lookup_name_fuzzy): New prototype.

gcc/c/ChangeLog:
	PR c/70339
	* c-decl.c: Include spellcheck-tree.h and gcc-rich-location.h.
	(implicit_decl_warning): When issuing warnings for implicit
	declarations, attempt to provide a suggestion via
	lookup_name_fuzzy.
	(undeclared_variable): Likewise when issuing errors.
	(lookup_name_in_scope): Likewise.
	(struct edit_distance_traits<cpp_hashnode *>): New struct.
	(best_macro_match): New typedef.
	(find_closest_macro_cpp_cb): New function.
	(lookup_name_fuzzy): New function.
	* c-parser.c: Include gcc-rich-location.h.
	(c_token_starts_typename): Split out case CPP_KEYWORD into...
	(c_keyword_starts_typename): ...this new function.
	(c_parser_declaration_or_fndef): When issuing errors about
	missing "struct" etc, add a fixit.  For other kinds of errors,
	attempt to provide a suggestion via lookup_name_fuzzy.
	(c_parser_parms_declarator): When looking ahead to detect typos in
	type names, also reject CPP_KEYWORD.
	(c_parser_parameter_declaration): When issuing errors about
	unknown type names, attempt to provide a suggestion via
	lookup_name_fuzzy.
	* c-tree.h (c_keyword_starts_typename): New prototype.

gcc/ChangeLog:
	PR c/70339
	* diagnostic-core.h (pedwarn_at_rich_loc): New prototype.
	* diagnostic.c (pedwarn_at_rich_loc): New function.
	* spellcheck.h (best_match::best_match): Add a
	"best_distance_so_far" optional parameter.
	(best_match::set_best_so_far): New method.
	(best_match::get_best_distance): New accessor.
	(best_match::get_best_candidate_length): New accessor.

gcc/testsuite/ChangeLog:
	PR c/70339
	* c-c++-common/attributes-1.c: Update dg-prune-output to include
	hint.
	* gcc.dg/diagnostic-token-ranges.c (undeclared_identifier): Update
	expected results due to builtin "nanl" now being suggested for
	"name".
	* gcc.dg/pr67580.c: Update expected messages.
	* gcc.dg/spellcheck-identifiers.c: New testcase.
	* gcc.dg/spellcheck-typenames.c: New testcase.

From-SVN: r237714
2016-06-22 15:20:41 +00:00
boehm-gc
config remove support for the interix target 2016-06-21 21:57:20 +00:00
contrib remove mep-* support 2016-06-21 21:57:49 +00:00
fixincludes remove support for the interix target 2016-06-21 21:57:20 +00:00
gcc C FE: suggest corrections for misspelled identifiers and type names 2016-06-22 15:20:41 +00:00
gnattools
gotools Update copyright dates 2016-06-07 08:54:22 +00:00
include
INSTALL
intl
libada
libatomic
libbacktrace
libcc1 Update copyright dates 2016-06-07 08:54:22 +00:00
libcilkrts
libcpp Implement -fdiagnostics-parseable-fixits 2016-06-22 14:42:30 +00:00
libdecnumber
libffi
libgcc remove mep-* support 2016-06-21 21:57:49 +00:00
libgfortran
libgo
libgomp semantics.c (handle_omp_array_sections_1): Don't ICE when processing_template_decl when checking for bitfields and unions. 2016-06-17 15:35:42 +02:00
libiberty Don't needlessly clear xmemdup allocated memory. 2016-05-31 20:38:54 +09:30
libitm
libjava libtool-version: Bump soversion. 2016-06-01 20:10:48 +00:00
libmpx mpx_wrappers.c (move_bounds): Fix overflow bug. 2016-06-10 09:23:53 +00:00
libobjc
liboffloadmic target.c (gomp_device_copy): New function. 2016-05-26 09:58:56 +00:00
libquadmath
libsanitizer
libssp
libstdc++-v3 remove mep-* support 2016-06-21 21:57:49 +00:00
libvtv
lto-plugin
maintainer-scripts generate_libstdcxx_web_docs: Use realpath to get absolute path. 2016-06-13 08:47:13 +01:00
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ChangeLog remove avr-rtems support 2016-06-21 21:57:44 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure remove avr-rtems support 2016-06-21 21:57:44 +00:00
configure.ac remove avr-rtems support 2016-06-21 21:57:44 +00:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS (Write After Approval): Add myself. 2016-06-18 13:26:36 +00:00
Makefile.def
Makefile.in Add dependencies to configure rule 2016-05-28 22:38:47 +09:30
Makefile.tpl Add dependencies to configure rule 2016-05-28 22:38:47 +09:30
missing
mkdep
mkinstalldirs
move-if-change
README
symlink-tree
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.