-
Notifications
You must be signed in to change notification settings - Fork 27
Fix expansion of __VA_ARGS__
macro argument in MSVC
#45
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
Conversation
|
@quicknir: I noticed that in the 'dev' branch you are are already looking at reducing the max number of iterations, so I've also done that in this pull request. Of course, feel free to ignore. Although this merge request works find on my simple use scenario using C++17, I see that it's still failing the C++14 appveyor tests. Looks like some further debugging will be required ... . |
@samangh the reduction in iterations is only to support MSVC, so if that is not necessary to support MSVC, it's fine to leave it at 256. This looks quite promising; even if there are still some issues with MSVC, if this doesn't break Linux (which it seems unlikely to do), I can still merge what we have, as it seems a step in the right direction. Out of curiosity, do you know whether it's MSVC or gcc that's compliant in terms of the macro expansion order? IIRC variadic macros were officially standardized in C++11 so there should be some wording on this. |
This is because we are using the 'Visual Studio 2019' image, which only has the 2019 version available.
@quicknir: Yeah, unfortunately the 125 max iterations is a hard compiler limit in MSVC. I'm not sure about which of the two compilers is more compliant. I suspect that the expansion order is not specified clearly in the standard (although I haven't checked), see the replies to this stackoverflow question for instance. |
Looks like I managed to fix all the issues, so this can be merged. I also made |
@quicknir: I was wondering if you've had any chance to look at this? Much appreciated. |
Hey sorry! I lost track of this, glad you pinged me. All looks good, merging. Thanks very much for your help. |
This merge request fixes issues with variadic macro argument expansion in MSVC. The issue is that when passing
__VA_ARGS__
as an argument to another macro, MSVC expands__VA_ARGS__
after passing, whilst gcc expands it before.Issue #31 can be closed.