Add support for GNU's named variadics for macros.#218
Add support for GNU's named variadics for macros.#218jwnhy wants to merge 15 commits intoboostorg:developfrom
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...) xis 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_PLACEMARKERSandsupport_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_dto compress all these node into one, andaccess_node_dto 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.cppthat was introduced in Add support for modular build structure. #214, which I guess it's my locallibcissue.Let me know if there is any issue.