-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for GNU's named variadics for macros. #218
base: develop
Are you sure you want to change the base?
Conversation
…ng for named variadics without variadics
I haven't had an opportunity to review the code yet (currently traveling) but this will definitely need tests. You can either add to one of the existing variadic macro tests, or create a new one (particularly if different command line options are required, e.g. whatever activates the gcc extensions mode). AFAIK the best documentation on the various test features are found in the test driver code here. I often start by finding a similar test to the one I need to write under |
Sure, thank you for the advice, sorry I am occupied by some other tasks. Will find a time to add some tests. |
As mentioned in #164, named_variadics like
#define(x...) x
is widely used in projects like the Linux kernel.This PR adds support for this feature.
This PR adds a
BOOST_WAVE_SUPPORT_GNU_NAMED_VARIADICS_PLACEMARKERS
andsupport_option_named_variadics = 0x100000
.When the macro is enabled, but the runtime option is not, it throws
bad_define_statement_named_va_args
, to remind the user to enable the option.When the macro is disabled, it just reports
ill_formed.
I modified the lexer so it accept construct like
(ch_p(T_IDENTIFIER) >> *ppsp >> ch_p(T_ELLIPSIS))
, then, I usedtoken_node_d
to compress all these node into one, andaccess_node_d
to modify the node information toT_GNU_NAMED_VARIADIC
.This helps deal with later replacement and expansion.
Expansion part.
I re-use most of the original codes.
Testing
I have run some basic examples to ensure this feature works as expected.
The original test suite also passed, except for the one failure
t_5_007.cpp
that was introduced in Add support for modular build structure. #214, which I guess it's my locallibc
issue.Let me know if there is any issue.