Open jefftrull opened 2 years ago
Isn't this dangerous/ambiguous? Wasn't the comma right before the ...
optional? I don't remember the details...
It seems unambiguous to me. If there is some identifier token prior to the ...
we use that instead of __VA_ARGS__
.
Can you give an example?
It seems unambiguous to me. If there is some identifier token prior to the
...
we use that instead of__VA_ARGS__
.Can you give an example?
Most likely I'm misremembering things. Please feel free to implement this gcc extension if you feel it is valuable. However, as wave was always meant to be strictly conforming, I'd suggest enabling this feature only based on an explicit option the user has to provide. Wave could even mention this new option in the error message if it discovers the construct, but the option was not enabled.
Is this still ongoing?
I need this feature to compile kernel code and I'd like to help. But I am quite new to Wave too... Could anyone provide rough guidance about which file I should learn and modify to add this feature?
Like many open source libraries, Wave progresses at a rate determined by the energy level and availability of its maintainers :) I think your contribution would be very welcome, particularly given the use of this syntax in the Linux kernel (a popular target of analysis)! I'd be happy to help you get involved.
Given that this is a non-standard extension we would need to create a feature flag for it. We support certain MSVC extensions with a macro flag BOOST_WAVE_SUPPORT_MS_EXTENSIONS
at compile time; another model would be to connect into the language support feature flags available at runtime in this file. The latter might be more appropriate given that the lexer itself (probably) does not need to be modified.
The actual code implementing variadic macros definition starts about here while the expansion is handled here. You are looking for a way to conditionally use a different token (probably an identifier) with a specific name instead of __VA_ARGS__
. And some minimal unit tests would be required.
@jefftrull Hi, thank you for the suggestion.
I just opened up a PR to support this feature.
Please let me know if anything is missing or wrong.
This piece of code appears in recent Ubuntu distributions, in
/usr/include/linux/stddef.h
:The gcc manual notes that names other than
__VA_ARGS__
- in this case,MEMBERS
- may be used to refer to the variadic arguments "as an extension". Given the ubiquity of this header it may be useful to add support for this extension.