gcc/libcpp
Nathan Sidwell 13f93cf533 preprocessor: Add deferred macros
Deferred macros are needed for C++ modules.  Header units may export
macro definitions and undefinitions.  These are resolved lazily at the
point of (potential) use.  (The language specifies that, it's not just
a useful optimization.)  Thus, identifier nodes grow a 'deferred'
field, which fortunately doesn't expand the structure on 64-bit
systems as there was padding there.  This is non-zero on NT_MACRO
nodes, if the macro is deferred.  When such an identifier is lexed, it
is resolved via a callback that I added recently.  That will either
provide the macro definition, or discover it there was an overriding
undef.  Either way the identifier is no longer a deferred macro.
Notice it is now possible for NT_MACRO nodes to have a NULL macro
expansion.

	libcpp/
	* include/cpplib.h (struct cpp_hashnode): Add deferred field.
	(cpp_set_deferred_macro): Define.
	(cpp_get_deferred_macro): Declare.
	(cpp_macro_definition): Reformat, add overload.
	(cpp_macro_definition_location): Deal with deferred macro.
	(cpp_alloc_token_string, cpp_compare_macro): Declare.
	* internal.h (_cpp_notify_macro_use): Return bool
	(_cpp_maybe_notify_macro_use): Likewise.
	* directives.c (do_undef): Check macro is not undef before
	warning.
	(do_ifdef, do_ifndef): Deal with deferred macro.
	* expr.c (parse_defined): Likewise.
	* lex.c (cpp_allocate_token_string): Break out of ...
	(create_literal): ... here.  Call it.
	(cpp_maybe_module_directive): Deal with deferred macro.
	* macro.c (cpp_get_token_1): Deal with deferred macro.
	(warn_of_redefinition): Deal with deferred macro.
	(compare_macros): Rename to ...
	(cpp_compare_macro): ... here.  Make extern.
	(cpp_get_deferred_macro): New.
	(_cpp_notify_macro_use): Deal with deferred macro, return bool
	indicating definedness.
	(cpp_macro_definition): Deal with deferred macro.
2020-11-24 08:31:03 -08:00
..
include preprocessor: Add deferred macros 2020-11-24 08:31:03 -08:00
po Daily bump. 2020-07-21 00:16:28 +00:00
ChangeLog Daily bump. 2020-11-20 00:16:40 +00:00
ChangeLog.jit
Makefile.in libcpp, libdecnumber: configure and substitute AR 2020-05-23 21:59:02 +00:00
aclocal.m4 libcpp: Enable Intel CET on Intel CET enabled host for jit 2020-05-12 09:17:45 -07:00
charset.c diagnostics: Support conversion of tabs to spaces [PR49973] [PR86904] 2020-07-14 12:05:56 -04:00
config.in
configure Require CET support only for the final GCC build 2020-07-30 05:36:24 -07:00
configure.ac libcpp, libdecnumber: configure and substitute AR 2020-05-23 21:59:02 +00:00
directives.c preprocessor: Add deferred macros 2020-11-24 08:31:03 -08:00
errors.c
expr.c preprocessor: Add deferred macros 2020-11-24 08:31:03 -08:00
files.c preprocessor: main file searching 2020-11-19 07:05:08 -08:00
generated_cpp_wcwidth.h libcpp: Update cpp_wcwidth() to Unicode 13.0.0 2020-11-07 09:36:43 -05:00
identifiers.c
init.c preprocessor: main file searching 2020-11-19 07:05:08 -08:00
internal.h preprocessor: Add deferred macros 2020-11-24 08:31:03 -08:00
lex.c preprocessor: Add deferred macros 2020-11-24 08:31:03 -08:00
line-map.c preprocessor: module line maps 2020-11-17 08:10:56 -08:00
location-example.txt
macro.c preprocessor: Add deferred macros 2020-11-24 08:31:03 -08:00
makeucnid.c
mkdeps.c preprocessor: Update mkdeps for modules 2020-11-18 08:44:49 -08:00
pch.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
symtab.c
system.h preprocessor: Random cleanups 2020-05-19 13:23:47 -07:00
traditional.c c: C2x __has_c_attribute 2020-11-12 21:13:51 +00:00
ucnid.h
ucnid.tab