Commits

David Williams committed 23042c3

Moved warning suppression into the relevant file so that it's not global.

Comments (0)

Files changed (2)

library/PolyVoxCore/CMakeLists.txt

 
 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

library/PolyVoxCore/include/PolyVoxCore/Impl/ErrorHandling.h

     #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)
 
 /*
 		getThrowHandler()((except), __FILE__, __LINE__)
 #endif
 
+// See the corresponding 'push' above.
+#if defined(_MSC_VER)
+	__pragma(warning(pop))
+#endif
+
 #endif //__PolyVox_ErrorHandling_H__