Commit 18f5df94 by Jakub Jelinek Committed by Jakub Jelinek

re PR preprocessor/88974 (ICE: Segmentation fault (in linemap_resolve_location))

	PR preprocessor/88974
	* directives.c (SEEN_EOL): Move macro to ...
	* internal.h (SEEN_EOL): ... here.
	* expr.c (parse_has_include): Don't cpp_get_token if SEEN_EOL ().

	* c-c++-common/cpp/pr88974.c: New test.

From-SVN: r268285
parent 2f6a6b28
2019-01-26 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/88974
* c-c++-common/cpp/pr88974.c: New test.
2019-01-25 Paolo Carlini <paolo.carlini@oracle.com> 2019-01-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/88969 PR c++/88969
......
/* PR preprocessor/88974 */
/* { dg-do preprocess } */
#if __has_include (<pr88974.h)
/* { dg-error "missing terminating > character" "" { target *-*-* } .-1 } */
#endif
2019-01-26 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/88974
* directives.c (SEEN_EOL): Move macro to ...
* internal.h (SEEN_EOL): ... here.
* expr.c (parse_has_include): Don't cpp_get_token if SEEN_EOL ().
2019-01-01 Jakub Jelinek <jakub@redhat.com> 2019-01-01 Jakub Jelinek <jakub@redhat.com>
Update copyright years. Update copyright years.
......
...@@ -204,8 +204,6 @@ static const directive linemarker_dir = ...@@ -204,8 +204,6 @@ static const directive linemarker_dir =
do_linemarker, UC"#", 1, KANDR, IN_I do_linemarker, UC"#", 1, KANDR, IN_I
}; };
#define SEEN_EOL() (pfile->cur_token[-1].type == CPP_EOF)
/* Skip any remaining tokens in a directive. */ /* Skip any remaining tokens in a directive. */
static void static void
skip_rest_of_line (cpp_reader *pfile) skip_rest_of_line (cpp_reader *pfile)
......
...@@ -2238,7 +2238,7 @@ parse_has_include (cpp_reader *pfile, enum include_type type) ...@@ -2238,7 +2238,7 @@ parse_has_include (cpp_reader *pfile, enum include_type type)
XDELETEVEC (fname); XDELETEVEC (fname);
} }
if (paren && cpp_get_token (pfile)->type != CPP_CLOSE_PAREN) if (paren && !SEEN_EOL () && cpp_get_token (pfile)->type != CPP_CLOSE_PAREN)
cpp_error (pfile, CPP_DL_ERROR, cpp_error (pfile, CPP_DL_ERROR,
"missing ')' after \"__has_include__\""); "missing ')' after \"__has_include__\"");
......
...@@ -593,6 +593,8 @@ struct cpp_reader ...@@ -593,6 +593,8 @@ struct cpp_reader
#define is_nvspace(x) IS_NVSPACE(x) #define is_nvspace(x) IS_NVSPACE(x)
#define is_space(x) IS_SPACE_OR_NUL(x) #define is_space(x) IS_SPACE_OR_NUL(x)
#define SEEN_EOL() (pfile->cur_token[-1].type == CPP_EOF)
/* This table is constant if it can be initialized at compile time, /* This table is constant if it can be initialized at compile time,
which is the case if cpp was compiled with GCC >=2.7, or another which is the case if cpp was compiled with GCC >=2.7, or another
compiler that supports C99. */ compiler that supports C99. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment