Skip to content

Commit 706d472

Browse files
committed
Use the new MSVC preprocessor
1 parent 9c65488 commit 706d472

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

Release/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
192192
if (NOT (MSVC_VERSION LESS 1920))
193193
add_compile_options(/permissive-)
194194
endif()
195+
196+
if (NOT (MSVC_VERSION LESS 1926))
197+
add_compile_options(/Zc:preprocessor)
198+
endif()
195199
endif()
196200
else()
197201
message("-- Unknown compiler, success is doubtful.")

Release/tests/common/UnitTestpp/src/CheckMacros.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
#error UnitTest++ redefines VERIFY_IS_NULL
9595
#endif
9696

97-
#ifdef WIN32
97+
#if defined(WIN32) && defined(_MSC_VER) && (_MSC_VER < 1926)
9898
#define VERIFY_IS_TRUE(expression, ...) CHECK_EQUAL(true, expression, __VA_ARGS__)
9999
#define VERIFY_IS_FALSE(expression, ...) CHECK_EQUAL(false, expression, __VA_ARGS__)
100100
#define VERIFY_ARE_NOT_EQUAL(expected, actual, ...) CHECK_NOT_EQUAL(expected, actual, __VA_ARGS__)
@@ -118,7 +118,7 @@
118118
UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \
119119
UNITTEST_MULTILINE_MACRO_END
120120

121-
#ifdef WIN32
121+
#if defined(WIN32) && defined(_MSC_VER) && (_MSC_VER < 1926)
122122

123123
#define CHECK_EQUAL(expected, actual, ...) \
124124
do \

Release/tests/common/UnitTestpp/src/TestMacros.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ extern "C" _DLL_EXPORT TestList& __cdecl GetTestList();
9393
} \
9494
namespace Suite##Name
9595

96-
#ifdef _WIN32
96+
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1926)
9797
#define TEST_EX(Name, List, ...) \
9898
class Test##Name : public UnitTest::Test \
9999
{ \
@@ -124,13 +124,13 @@ extern "C" _DLL_EXPORT TestList& __cdecl GetTestList();
124124
void Test##Name::RunImpl() const
125125
#endif
126126

127-
#ifdef _WIN32
127+
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1926)
128128
#define TEST(Name, ...) TEST_EX(Name, UnitTest::GetTestList(), __VA_ARGS__)
129129
#else
130130
#define TEST(Name, ...) TEST_EX(Name, UnitTest::GetTestList(), ##__VA_ARGS__)
131131
#endif
132132

133-
#ifdef _WIN32
133+
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1926)
134134
#define TEST_FIXTURE_EX(Fixture, Name, List, ...) \
135135
class Fixture##Name##Helper : public Fixture \
136136
{ \
@@ -242,7 +242,7 @@ extern "C" _DLL_EXPORT TestList& __cdecl GetTestList();
242242
void Fixture##Name##Helper::RunImpl()
243243
#endif
244244

245-
#ifdef _WIN32
245+
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1926)
246246
#define TEST_FIXTURE(Fixture, Name, ...) TEST_FIXTURE_EX(Fixture, Name, UnitTest::GetTestList(), __VA_ARGS__)
247247
#else
248248
#define TEST_FIXTURE(Fixture, Name, ...) TEST_FIXTURE_EX(Fixture, Name, UnitTest::GetTestList(), ##__VA_ARGS__)

0 commit comments

Comments
 (0)