Skip to content

Use the new MSVC preprocessor #1734

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

abrauninger
Copy link

MSVC has a new preprocessor (https://devblogs.microsoft.com/cppblog/announcing-full-support-for-a-c-c-conformant-preprocessor-in-msvc/). To compile code with MSVC and C++20 we need to use the new preprocessor (/Zc:preprocessor).

This change updates cpprestsdk to use /Zc:preprocessor on versions of MSVC that support it (>= 16.6, which is _MSC_VER 1926).

Without code changes, /Zc:preprocessor causes build breaks due to empty __VA_ARGS__ in the macros defined in CheckMacros.h and TestMacros.h. Those headers already have versions of the macros that use the conformant ##__VA_ARGS__ syntax for non-MSVC compilers, so this change uses those existing macros for MSVC as well, on versions of MSVC that support /Zc:preprocessor.

@tiagomacarios
Copy link
Member

tiagomacarios commented Nov 30, 2022

Perhaps the we should enabling the new code based on _MSVC_TRADITIONAL?

@barcharcraz
Copy link
Member

Is this really necessary? this appears to only effect internal test headers, not public API headers, So I don't think this should fix any bugs related to using cpprest and the new preprocessor at the same time.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants