re PR preprocessor/92296 (internal compiler error: Segmentation fault #pragma push_macro("__LINE__"))

PR preprocessor/92296
	* internal.h (struct def_pragma_macro): Add is_builtin bitfield.
	(_cpp_restore_special_builtin): Declare.
	* init.c (_cpp_restore_special_builtin): New function.
	* directives.c (do_pragma_push_macro): For NT_BUILTIN_MACRO
	set is_builtin and don't try to grab definition.
	(cpp_pop_definition): Use _cpp_restore_special_builtin to restore
	builtin macros.

	* c-c++-common/cpp/pr92296-1.c: New test.
	* c-c++-common/cpp/pr92296-2.c: New test.

From-SVN: r277685
This commit is contained in:
Jakub Jelinek
2019-10-31 18:38:44 +01:00
committed by Jakub Jelinek
parent 0092b21f24
commit aa23e73b1a
7 changed files with 162 additions and 0 deletions

View File

@@ -391,6 +391,8 @@ struct def_pragma_macro {
/* Mark if we save an undefined macro. */
unsigned int is_undef : 1;
/* Nonzero if it was a builtin macro. */
unsigned int is_builtin : 1;
};
/* A cpp_reader encapsulates the "state" of a pre-processor run.
@@ -722,6 +724,8 @@ extern void *_cpp_commit_buff (cpp_reader *pfile, size_t size);
/* In init.c. */
extern void _cpp_maybe_push_include_file (cpp_reader *);
extern const char *cpp_named_operator2name (enum cpp_ttype type);
extern void _cpp_restore_special_builtin (cpp_reader *pfile,
struct def_pragma_macro *);
/* In directives.c */
extern int _cpp_test_assertion (cpp_reader *, unsigned int *);