Browse Source

Visual C++: Enables /Wall

Christophe 1 year ago
parent
commit
88a6ed6ee1

+ 1 - 0
glm/ext/scalar_ulp.inl

@@ -13,6 +13,7 @@
 #if GLM_COMPILER & GLM_COMPILER_VC
 #if GLM_COMPILER & GLM_COMPILER_VC
 #	pragma warning(push)
 #	pragma warning(push)
 #	pragma warning(disable : 4127)
 #	pragma warning(disable : 4127)
+#	pragma warning(disable : 4365) // '=': signed/unsigned mismatch
 #elif GLM_COMPILER & GLM_COMPILER_CLANG
 #elif GLM_COMPILER & GLM_COMPILER_CLANG
 #	pragma clang diagnostic push
 #	pragma clang diagnostic push
 #	pragma clang diagnostic ignored "-Wsign-conversion"
 #	pragma clang diagnostic ignored "-Wsign-conversion"

+ 1 - 1
glm/gtc/packing.inl

@@ -650,7 +650,7 @@ namespace detail
 		detail::u9u9u9e5 Unpack;
 		detail::u9u9u9e5 Unpack;
 		Unpack.pack = v;
 		Unpack.pack = v;
 
 
-		return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * pow(2.0f, Unpack.data.w - 15.f - 9.f);
+		return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * pow(2.0f, static_cast<float>(Unpack.data.w) - 15.f - 9.f);
 	}
 	}
 
 
 	// Based on Brian Karis http://graphicrants.blogspot.fr/2009/04/rgbm-color-encoding.html
 	// Based on Brian Karis http://graphicrants.blogspot.fr/2009/04/rgbm-color-encoding.html

+ 15 - 1
test/CMakeLists.txt

@@ -38,7 +38,21 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
 	endif()
 	endif()
 
 
 	if(NOT GLM_DISABLE_AUTO_DETECTION)
 	if(NOT GLM_DISABLE_AUTO_DETECTION)
-		add_compile_options(/W4 /WX)
+		add_compile_options(/Wall /WX)
+		add_compile_options(/wd4464) # warning C4464: relative include path contains '..'
+		add_compile_options(/wd4514) # warning C4514: unreferenced inline function has been removed 
+		add_compile_options(/wd4365) # warning C4365: signed/unsigned mismatch 
+		add_compile_options(/wd5045) # warning C5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
+		add_compile_options(/wd5029) # warning C5029: nonstandard extension used: alignment attributes in C++ apply to variables, data members and tag types only
+		add_compile_options(/wd4820) # warning C4820: 'test_decl::S1': '3' bytes padding added after data member 'test_decl::S1::A' 
+		add_compile_options(/wd4710) # warning C4710: 'std::string glm::detail::format(const char *,...)': function not inlined
+		add_compile_options(/wd4626) # warning C4626: 'glm::io::format_punct<CTy>': assignment operator was implicitly defined as deleted
+		add_compile_options(/wd4711) # warning C4711: function 'int __cdecl test_vec1(void)' selected for automatic inline expansion 
+		add_compile_options(/wd4571) # warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught
+		add_compile_options(/wd4625) # warning C4625: 'std::codecvt_base': copy constructor was implicitly defined as deleted
+		add_compile_options(/wd5026) # warning C5026: 'std::_Generic_error_category': move constructor was implicitly defined as deleted
+		add_compile_options(/wd5027) # warning C5027: 'std::_Generic_error_category': move assignment operator was implicitly defined as deleted
+		add_compile_options(/wd4774) # warning C4774: 'sprintf_s' : format string expected in argument 3 is not a string literal
 	endif()
 	endif()
 #	add_compile_options(/wd4309 /wd4324 /wd4389 /wd4127 /wd4267 /wd4146 /wd4201 /wd4464 /wd4514 /wd4701 /wd4820 /wd4365)
 #	add_compile_options(/wd4309 /wd4324 /wd4389 /wd4127 /wd4267 /wd4146 /wd4201 /wd4464 /wd4514 /wd4701 /wd4820 /wd4365)
 	add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 	add_definitions(-D_CRT_SECURE_NO_WARNINGS)

+ 2 - 0
test/core/core_func_integer_bit_count.cpp

@@ -5,6 +5,8 @@
 #include <cstdlib>     //To define "exit", req'd by XLC.
 #include <cstdlib>     //To define "exit", req'd by XLC.
 #include <ctime>
 #include <ctime>
 
 
+#include <glm/glm.hpp>
+
 #ifdef NDEBUG
 #ifdef NDEBUG
 
 
 #if GLM_COMPILER & GLM_COMPILER_CLANG
 #if GLM_COMPILER & GLM_COMPILER_CLANG

+ 10 - 10
test/core/core_func_integer_find_lsb.cpp

@@ -164,23 +164,23 @@ static int ntz7(unsigned x)
 // This file has divisions by zero to test isnan
 // This file has divisions by zero to test isnan
 #if GLM_COMPILER & GLM_COMPILER_VC
 #if GLM_COMPILER & GLM_COMPILER_VC
 #	pragma warning(push)
 #	pragma warning(push)
-#	pragma warning(disable : 4800)
 #	pragma warning(disable : 4146)
 #	pragma warning(disable : 4146)
 #endif
 #endif
-
+/*
 static int ntz7_christophe(unsigned x)
 static int ntz7_christophe(unsigned x)
 {
 {
 	unsigned y, bz, b4, b3, b2, b1, b0;
 	unsigned y, bz, b4, b3, b2, b1, b0;
 
 
 	y = x & -x;               // Isolate rightmost 1-bit.
 	y = x & -x;               // Isolate rightmost 1-bit.
-	bz = unsigned(!bool(y));           // 1 if y = 0.
-	b4 = unsigned(!bool(y & 0x0000FFFF)) * 16;
-	b3 = unsigned(!bool(y & 0x00FF00FF)) * 8;
-	b2 = unsigned(!bool(y & 0x0F0F0F0F)) * 4;
-	b1 = unsigned(!bool(y & 0x33333333)) * 2;
-	b0 = unsigned(!bool(y & 0x55555555)) * 1;
+	bz = static_cast<unsigned>(!static_cast<bool>(y));           // 1 if y = 0.
+	b4 = static_cast<unsigned>(!static_cast<bool>(y & 0x0000FFFF)) * 16;
+	b3 = static_cast<unsigned>(!static_cast<bool>(y & 0x00FF00FF)) * 8;
+	b2 = static_cast<unsigned>(!static_cast<bool>(y & 0x0F0F0F0F)) * 4;
+	b1 = static_cast<unsigned>(!static_cast<bool>(y & 0x33333333)) * 2;
+	b0 = static_cast<unsigned>(!static_cast<bool>(y & 0x55555555)) * 1;
 	return bz + b4 + b3 + b2 + b1 + b0;
 	return bz + b4 + b3 + b2 + b1 + b0;
 }
 }
+*/
 
 
 /* Below is David Seal's algorithm, found at
 /* Below is David Seal's algorithm, found at
 http://www.ciphersbyritter.com/NEWS4/BITCT.HTM Table
 http://www.ciphersbyritter.com/NEWS4/BITCT.HTM Table
@@ -386,7 +386,7 @@ int main()
 	TimestampEnd = std::clock();
 	TimestampEnd = std::clock();
 
 
 	std::printf("ntz7: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
 	std::printf("ntz7: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
-
+/*
 	TimestampBeg = std::clock();
 	TimestampBeg = std::clock();
 	for (std::size_t k = 0; k < Count; ++k)
 	for (std::size_t k = 0; k < Count; ++k)
 	for (i = 0; i < n; i += 2) {
 	for (i = 0; i < n; i += 2) {
@@ -394,7 +394,7 @@ int main()
 	TimestampEnd = std::clock();
 	TimestampEnd = std::clock();
 
 
 	std::printf("ntz7_christophe: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
 	std::printf("ntz7_christophe: %d clocks\n", static_cast<int>(TimestampEnd - TimestampBeg));
-
+*/
 	TimestampBeg = std::clock();
 	TimestampBeg = std::clock();
 	for (std::size_t k = 0; k < Count; ++k)
 	for (std::size_t k = 0; k < Count; ++k)
 	for (i = 0; i < n; i += 2) {
 	for (i = 0; i < n; i += 2) {