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

Use the new MSVC preprocessor #1734

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
Use the new MSVC preprocessor
  • Loading branch information
abrauninger committed Nov 30, 2022
commit 706d4726c6977aff4c953ba372786686d73a3b89
4 changes: 4 additions & 0 deletions Release/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -192,6 +192,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if (NOT (MSVC_VERSION LESS 1920))
add_compile_options(/permissive-)
endif()

if (NOT (MSVC_VERSION LESS 1926))
add_compile_options(/Zc:preprocessor)
endif()
endif()
else()
message("-- Unknown compiler, success is doubtful.")
4 changes: 2 additions & 2 deletions Release/tests/common/UnitTestpp/src/CheckMacros.h
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@
#error UnitTest++ redefines VERIFY_IS_NULL
#endif

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

#ifdef WIN32
#if defined(WIN32) && defined(_MSC_VER) && (_MSC_VER < 1926)

#define CHECK_EQUAL(expected, actual, ...) \
do \
8 changes: 4 additions & 4 deletions Release/tests/common/UnitTestpp/src/TestMacros.h
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ extern "C" _DLL_EXPORT TestList& __cdecl GetTestList();
} \
namespace Suite##Name

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

#ifdef _WIN32
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1926)
#define TEST(Name, ...) TEST_EX(Name, UnitTest::GetTestList(), __VA_ARGS__)
#else
#define TEST(Name, ...) TEST_EX(Name, UnitTest::GetTestList(), ##__VA_ARGS__)
#endif

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

#ifdef _WIN32
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1926)
#define TEST_FIXTURE(Fixture, Name, ...) TEST_FIXTURE_EX(Fixture, Name, UnitTest::GetTestList(), __VA_ARGS__)
#else
#define TEST_FIXTURE(Fixture, Name, ...) TEST_FIXTURE_EX(Fixture, Name, UnitTest::GetTestList(), ##__VA_ARGS__)