diff --git a/library/PolyVoxCore/CMakeLists.txt b/library/PolyVoxCore/CMakeLists.txt index 65492a6f..145484dd 100644 --- a/library/PolyVoxCore/CMakeLists.txt +++ b/library/PolyVoxCore/CMakeLists.txt @@ -153,7 +153,7 @@ SET_PROPERTY(TARGET PolyVoxCore PROPERTY FOLDER "Library") SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES VERSION ${POLYVOX_VERSION} SOVERSION ${POLYVOX_VERSION_MAJOR}) IF(MSVC) - SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS "/W4 /wd4251 /wd4127") #Disable warning on STL exports + SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS "/W4 /wd4251") #Disable warning on STL exports ENDIF(MSVC) #Install diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/ErrorHandling.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/ErrorHandling.h index 8d434c9a..3e5d9057 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/ErrorHandling.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Impl/ErrorHandling.h @@ -36,6 +36,14 @@ freely, subject to the following restrictions: #define POLYVOX_HALT() std::exit(EXIT_FAILURE) #endif +// We use the do...while(0) construct in our macros (for reasons see here: http://stackoverflow.com/a/154138) +// but Visual Studio gives unhelpful 'conditional expression is constant' warnings. The recommended solution +// (http://stackoverflow.com/a/1946485) is to disable these warnings. +#if defined(_MSC_VER) + __pragma(warning(push)) + __pragma(warning(disable:4127)) +#endif + #define POLYVOX_UNUSED(x) do { (void)sizeof(x); } while(0) /* @@ -120,4 +128,9 @@ freely, subject to the following restrictions: getThrowHandler()((except), __FILE__, __LINE__) #endif +// See the corresponding 'push' above. +#if defined(_MSC_VER) + __pragma(warning(pop)) +#endif + #endif //__PolyVox_ErrorHandling_H__