8000 Re-duplicate tracelogging macros to make the MSVC preprocessor happy by dunhor · Pull Request #351 · microsoft/wil · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Re-duplicate tracelogging macros to make the MSVC preprocessor happy #351

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

Merged
merged 2 commits into from
Aug 15, 2023

Conversation

dunhor
Copy link
Member
@dunhor dunhor commented Aug 15, 2023

The MSVC preprocessor apparently won't expand macro arguments that contain commas, meaning that the _TLGWRITE_GENERIC_PARTB_FIELDS solution that we have currently causes issues because it combines with the previous argument throughout the entire preprocessor chain. This change re-duplicates the macros that use it to avoid this issue. Note that the same issue likely still exists if _GENERIC_PARTB_FIELDS_ENABLED contains multiple comma-separated values, however this doesn't appear to be an issue in practice, likely because the macros don't care and the argument gets forwarded all the way until it gets read by the lexer, which will treat commas correctly.

@dunhor dunhor requested a review from jonwis August 15, 2023 16:32
@dunhor
Copy link
Member Author
dunhor commented Aug 15, 2023

Oh, also expanded the tests to actually validate that things compile...

Also, /experimental:preprocessor gives the correct MSVC behavior, however we cannot rely on that.

@dunhor
Copy link
Member Author
dunhor commented Aug 15, 2023

For those interested, this illustrates the issue with the MSVC preprocessor: https://godbolt.org/z/js6he3h1Y

@dunhor dunhor merged commit e0dc2f0 into master Aug 15, 2023
@dunhor dunhor deleted the dunhor/traceloggingmacros branch August 15, 2023 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0