Skip to content
Permalink
Browse files

Use _WIN32 macro for detecting MSVC Windows

Previously we used `WIN32`, which sometimes does exist, but according to
https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019
`_WIN32` is the one that is actually provided by the compiler.

Closes #1676.
  • Loading branch information...
horenmar committed Jul 6, 2019
1 parent 820271b commit 11488e63b694176951e991ad87c9ef7c76db50c9
Showing with 2 additions and 2 deletions.
  1. +1 −1 include/internal/catch_session.cpp
  2. +1 −1 include/internal/catch_session.h
@@ -197,7 +197,7 @@ namespace Catch {
return 0;
}

#if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE)
#if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE)
int Session::applyCommandLine( int argc, wchar_t const * const * argv ) {

char **utf8Argv = new char *[ argc ];
@@ -26,7 +26,7 @@ namespace Catch {
void libIdentify();

int applyCommandLine( int argc, char const * const * argv );
#if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE)
#if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE)
int applyCommandLine( int argc, wchar_t const * const * argv );
#endif

1 comment on commit 11488e6

@Quincunx271

This comment has been minimized.

Copy link
Contributor

commented on 11488e6 Jul 8, 2019

If you really only want to handle MSVC, _MSC_VER might be a better choice. _WIN32 may be set by other compilers targeting windows ( osmcode/libosmium#224 and https://blog.kowalczyk.info/article/j/guide-to-predefined-macros-in-c-compilers-gcc-clang-msvc-etc..html ).

In other words, _WIN32 checks that OS is Windows, _MSC_VER checks that the compiler is MSVC.

Please sign in to comment.
You can’t perform that action at this time.