gcc/libcpp
Jakub Jelinek c04babd9df libcpp: Fix ICEs on __has_include syntax errors [PR93545]
Some of the following testcases ICE, because one of the cpp_get_token
calls in builtin_has_include reads the CPP_EOF token but the caller isn't
aware that CPP_EOF has been reached and will do another cpp_get_token.
get_token_no_padding is something that is use by the
has_attribute/has_builtin callbacks, which will first peek and will not
consume CPP_EOF (but will consume other tokens).  The !SEEN_EOL ()
check on the other side doesn't work anymore and isn't really needed,
as we don't consume the EOF.  The change adds one further error to the
pr88974.c testcase, if we wanted just one error per __has_include,
we could add some boolean whether we've emitted errors already and
only emit the first one we encounter (not implemented).

2020-02-04  Jakub Jelinek  <jakub@redhat.com>

	PR preprocessor/93545
	* macro.c (cpp_get_token_no_padding): New function.
	(builtin_has_include): Use it instead of cpp_get_token.  Don't check
	SEEN_EOL.

	* c-c++-common/cpp/pr88974.c: Expect another diagnostics during error
	recovery.
	* c-c++-common/cpp/pr93545-1.c: New test.
	* c-c++-common/cpp/pr93545-2.c: New test.
	* c-c++-common/cpp/pr93545-3.c: New test.
	* c-c++-common/cpp/pr93545-4.c: New test.
2020-02-04 13:38:16 +01:00
..
include preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
po
ChangeLog libcpp: Fix ICEs on __has_include syntax errors [PR93545] 2020-02-04 13:38:16 +01:00
ChangeLog.jit
Makefile.in Update copyright years. 2020-01-01 12:51:42 +01:00
aclocal.m4
charset.c Update copyright years. 2020-01-01 12:51:42 +01:00
config.in
configure Fixes after recent configure changes relating to static libraries 2020-02-01 00:34:28 +00:00
configure.ac
directives-only.c Update copyright years. 2020-01-01 12:51:42 +01:00
directives.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
errors.c Update copyright years. 2020-01-01 12:51:42 +01:00
expr.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
files.c [PR 80005] Fix __has_include 2020-01-20 05:39:59 -08:00
generated_cpp_wcwidth.h Byte vs column awareness for diagnostic-show-locus.c (PR 49973) 2019-12-09 20:03:47 +00:00
identifiers.c [PR 80005] Fix __has_include 2020-01-20 05:39:59 -08:00
init.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
internal.h preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
lex.c Update copyright years. 2020-01-01 12:51:42 +01:00
line-map.c Add diagnostic paths 2020-01-10 21:22:12 +00:00
location-example.txt
macro.c libcpp: Fix ICEs on __has_include syntax errors [PR93545] 2020-02-04 13:38:16 +01:00
makeucnid.c Update copyright years. 2020-01-01 12:51:42 +01:00
mkdeps.c Work around array out of bounds warning in mkdeps 2020-01-16 11:09:24 +01:00
pch.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
symtab.c Update copyright years. 2020-01-01 12:51:42 +01:00
system.h Update copyright years. 2020-01-01 12:51:42 +01:00
traditional.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
ucnid.h Update copyright years. 2020-01-01 12:51:42 +01:00
ucnid.tab Update copyright years. 2020-01-01 12:51:42 +01:00