Skip to content
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

[msvc] Fix using the SDK with compliant mode enabled #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions c74support/max-includes/ext_preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@

// C74_PASS_ARGS passes __VA_ARGS__ as multiple parameters to another macro, working around the following bug:
// https://connect.microsoft.com/VisualStudio/feedback/details/521844/variadic-macro-treating-va-args-as-a-single-parameter-for-other-macros#details
#if _MSC_VER >= 1400
#if _MSC_VER >= 1400 && _MSC_VER < 1937 && __cplusplus < 202003L
#define C74_MSVC_VAARGS_WORKAROUND 1
#else
#define C74_MSVC_VAARGS_WORKAROUND 0
#endif

#if C74_MSVC_VAARGS_WORKAROUND
# define C74_PASS_ARGS_LEFT (
# define C74_PASS_ARGS_RIGHT )
# define C74_PASS_ARGS(...) C74_PASS_ARGS_LEFT __VA_ARGS__ C74_PASS_ARGS_RIGHT
Expand Down Expand Up @@ -179,7 +185,7 @@
// this is done to sign-extend and promote shorter integer types
// - see object_method for an example

#if _MSC_VER >= 1400
#if C74_MSVC_VAARGS_WORKAROUND
#define C74_VARFUN(VARFUN_IMPL, ...) C74_JOIN_2(C74_VARFUN_, C74_NUM_ARGS(__VA_ARGS__)) C74_PASS_ARGS(VARFUN_IMPL, __VA_ARGS__)
#else
#define C74_VARFUN(VARFUN_IMPL, ...) C74_JOIN_2(C74_VARFUN_, C74_NUM_ARGS(__VA_ARGS__))( VARFUN_IMPL, __VA_ARGS__ )
Expand Down