aboutsummaryrefslogtreecommitdiff
path: root/libcpp/include
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-12-14 07:21:49 -0800
committerNathan Sidwell <nathan@acm.org>2020-12-14 07:23:59 -0800
commit62c5ea5228857a910b38df91c2b0fe28f4d1ddc8 (patch)
tree617d39cb5f141236757bee418fbbeab8ea407084 /libcpp/include
parent159b0bd9ce263dfb791eff5133b0ca0207201c84 (diff)
downloadgcc-62c5ea5228857a910b38df91c2b0fe28f4d1ddc8.zip
gcc-62c5ea5228857a910b38df91c2b0fe28f4d1ddc8.tar.gz
gcc-62c5ea5228857a910b38df91c2b0fe28f4d1ddc8.tar.bz2
preprocessor: Deferred macro support
For deferred macros we also need a new field on the macro itself, so that the module machinery can determine the macro was imported. Also the documentation for the hashnode's deferred field was incomplete. libcpp/ * include/cpplib.h (struct cpp_macro): Add imported_p field. (struct cpp_hashnode): Tweak deferred field documentation. * macro.c (_cpp_new_macro): Clear new field. (cpp_get_deferred_macro, get_deferred_or_lazy_macro): Assert more.
Diffstat (limited to 'libcpp/include')
-rw-r--r--libcpp/include/cpplib.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 692aee5..50d28dc 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -826,7 +826,10 @@ struct GTY(()) cpp_macro {
tokens. */
unsigned int extra_tokens : 1;
- /* 1 bits spare (32-bit). 33 on 64-bit target. */
+ /* Imported C++20 macro (from a header unit). */
+ unsigned int imported_p : 1;
+
+ /* 0 bits spare (32-bit). 32 on 64-bit target. */
union cpp_exp_u
{
@@ -921,9 +924,11 @@ struct GTY(()) cpp_hashnode {
/* 5 bits spare. */
- /* On a 64-bit system there would be 32-bits of padding to the value
+ /* The deferred cookie is applicable to NT_USER_MACRO or NT_VOID.
+ The latter for when a macro had a prevailing undef.
+ On a 64-bit system there would be 32-bits of padding to the value
field. So placing the deferred index here is not costly. */
- unsigned deferred; /* Deferred index, (unless zero). */
+ unsigned deferred; /* Deferred cookie */
union _cpp_hashnode_value GTY ((desc ("%1.type"))) value;
};