Browse Source

Fixed warnings

Christophe Riccio 8 years ago
parent
commit
2cc0c53da7

+ 2 - 2
CMakeLists.txt

@@ -83,8 +83,8 @@ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}"
 endif()
 
 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-	add_definitions(-Weverything -Wpedantic -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-documentation -Wno-gnu-anonymous-struct -Wno-nested-anon-types)
-	add_definitions(-Wno-sign-conversion -Wno-unused-variable -Wno-missing-prototypes -Wno-unreachable-code -Wno-missing-variable-declarations -Wno-sign-compare)
+	add_definitions(-Weverything -Wpedantic -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++11-long-long -Wno-padded -Wno-documentation -Wno-gnu-anonymous-struct -Wno-nested-anon-types)
+	add_definitions(-Wno-sign-conversion -Wno-unused-variable -Wno-missing-prototypes -Wno-unreachable-code -Wno-missing-variable-declarations -Wno-sign-compare -Wno-global-constructors)
 endif()
 
 option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF)

+ 3 - 2
glm/gtc/quaternion.inl

@@ -5,6 +5,7 @@
 #include "../geometric.hpp"
 #include "../exponential.hpp"
 #include "../detail/compute_vector_relational.hpp"
+#include "epsilon.hpp"
 #include <limits>
 
 namespace glm{
@@ -352,13 +353,13 @@ namespace detail
 	template<typename T, precision P>
 	GLM_FUNC_QUALIFIER bool operator==(tquat<T, P> const & q1, tquat<T, P> const & q2)
 	{
-		return (q1.x == q2.x) && (q1.y == q2.y) && (q1.z == q2.z) && (q1.w == q2.w);
+		return all(epsilonEqual(q1, q2, epsilon<T>()));
 	}
 
 	template<typename T, precision P>
 	GLM_FUNC_QUALIFIER bool operator!=(tquat<T, P> const & q1, tquat<T, P> const & q2)
 	{
-		return (q1.x != q2.x) || (q1.y != q2.y) || (q1.z != q2.z) || (q1.w != q2.w);
+		return any(epsilonNotEqual(q1, q2, epsilon<T>()));
 	}
 
 	// -- Operations --

+ 3 - 1
glm/gtx/common.inl

@@ -2,6 +2,8 @@
 /// @file glm/gtx/common.inl
 
 #include <cmath>
+#include "../gtc/epsilon.hpp"
+#include "../gtc/constants.hpp"
 
 namespace glm{
 namespace detail
@@ -33,7 +35,7 @@ namespace detail
 #		if GLM_HAS_CXX11_STL
 			return std::fpclassify(x) == FP_SUBNORMAL;
 #		else
-			return x != static_cast<T>(0) && std::fabs(x) < std::numeric_limits<T>::min();
+			return epsilonNotEqual(x, static_cast<T>(0), epsilon<T>()) && std::fabs(x) < std::numeric_limits<T>::min();
 #		endif
 	}
 

+ 1 - 1
glm/gtx/log_base.inl

@@ -6,7 +6,7 @@ namespace glm
 	template<typename genType> 
 	GLM_FUNC_QUALIFIER genType log(genType const & x, genType const & base)
 	{
-		assert(x != genType(0));
+		assert(!detail::compute_equal<genType>::call(x, static_cast<genType>(0)));
 		return glm::log(x) / glm::log(base);
 	}
 

+ 2 - 2
glm/gtx/scalar_relational.inl

@@ -50,7 +50,7 @@ namespace glm
 		T const & y
 	)
 	{
-		return x == y;
+		return detail::compute_equal<T>::call(x, y);
 	}
 
 	template<typename T>
@@ -60,7 +60,7 @@ namespace glm
 		T const & y
 	)
 	{
-		return x != y;
+		return !detail::compute_equal<T>::call(x, y);
 	}
 
 	GLM_FUNC_QUALIFIER bool any

+ 8 - 8
test/core/core_func_common.cpp

@@ -332,7 +332,7 @@ namespace mix_
 		T Result;
 	};
 
-	entry<float, bool> TestBool[] =
+	entry<float, bool> const TestBool[] =
 	{
 		{0.0f, 1.0f, false, 0.0f},
 		{0.0f, 1.0f, true, 1.0f},
@@ -340,7 +340,7 @@ namespace mix_
 		{-1.0f, 1.0f, true, 1.0f}
 	};
 
-	entry<float, float> TestFloat[] =
+	entry<float, float> const TestFloat[] =
 	{
 		{0.0f, 1.0f, 0.0f, 0.0f},
 		{0.0f, 1.0f, 1.0f, 1.0f},
@@ -348,7 +348,7 @@ namespace mix_
 		{-1.0f, 1.0f, 1.0f, 1.0f}
 	};
 
-	entry<glm::vec2, bool> TestVec2Bool[] =
+	entry<glm::vec2, bool> const TestVec2Bool[] =
 	{
 		{glm::vec2(0.0f), glm::vec2(1.0f), false, glm::vec2(0.0f)},
 		{glm::vec2(0.0f), glm::vec2(1.0f), true, glm::vec2(1.0f)},
@@ -356,7 +356,7 @@ namespace mix_
 		{glm::vec2(-1.0f), glm::vec2(1.0f), true, glm::vec2(1.0f)}
 	};
 
-	entry<glm::vec2, glm::bvec2> TestBVec2[] =
+	entry<glm::vec2, glm::bvec2> const TestBVec2[] =
 	{
 		{glm::vec2(0.0f), glm::vec2(1.0f), glm::bvec2(false), glm::vec2(0.0f)},
 		{glm::vec2(0.0f), glm::vec2(1.0f), glm::bvec2(true), glm::vec2(1.0f)},
@@ -365,7 +365,7 @@ namespace mix_
 		{glm::vec2(-1.0f), glm::vec2(1.0f), glm::bvec2(true, false), glm::vec2(1.0f, -1.0f)}
 	};
 
-	entry<glm::vec3, bool> TestVec3Bool[] =
+	entry<glm::vec3, bool> const TestVec3Bool[] =
 	{
 		{glm::vec3(0.0f), glm::vec3(1.0f), false, glm::vec3(0.0f)},
 		{glm::vec3(0.0f), glm::vec3(1.0f), true, glm::vec3(1.0f)},
@@ -373,7 +373,7 @@ namespace mix_
 		{glm::vec3(-1.0f), glm::vec3(1.0f), true, glm::vec3(1.0f)}
 	};
 
-	entry<glm::vec3, glm::bvec3> TestBVec3[] =
+	entry<glm::vec3, glm::bvec3> const TestBVec3[] =
 	{
 		{glm::vec3(0.0f), glm::vec3(1.0f), glm::bvec3(false), glm::vec3(0.0f)},
 		{glm::vec3(0.0f), glm::vec3(1.0f), glm::bvec3(true), glm::vec3(1.0f)},
@@ -382,7 +382,7 @@ namespace mix_
 		{glm::vec3(1.0f, 2.0f, 3.0f), glm::vec3(4.0f, 5.0f, 6.0f), glm::bvec3(true, false, true), glm::vec3(4.0f, 2.0f, 6.0f)}
 	};
 
-	entry<glm::vec4, bool> TestVec4Bool[] = 
+	entry<glm::vec4, bool> const TestVec4Bool[] = 
 	{
 		{glm::vec4(0.0f), glm::vec4(1.0f), false, glm::vec4(0.0f)},
 		{glm::vec4(0.0f), glm::vec4(1.0f), true, glm::vec4(1.0f)},
@@ -390,7 +390,7 @@ namespace mix_
 		{glm::vec4(-1.0f), glm::vec4(1.0f), true, glm::vec4(1.0f)}
 	};
 
-	entry<glm::vec4, glm::bvec4> TestBVec4[] = 
+	entry<glm::vec4, glm::bvec4> const TestBVec4[] = 
 	{
 		{glm::vec4(0.0f, 0.0f, 1.0f, 1.0f), glm::vec4(2.0f, 2.0f, 3.0f, 3.0f), glm::bvec4(false, true, false, true), glm::vec4(0.0f, 2.0f, 1.0f, 3.0f)},
 		{glm::vec4(0.0f), glm::vec4(1.0f), glm::bvec4(true), glm::vec4(1.0f)},

+ 1 - 1
test/gtc/gtc_packing.cpp

@@ -153,7 +153,7 @@ int test_U3x10_1x2()
 	}
 
 	glm::u8vec4 const v0(0xff, 0x77, 0x0, 0x33);
-	glm::uint32 const p0 = *(glm::uint32*)(&v0[0]);
+	glm::uint32 const p0 = *reinterpret_cast<glm::uint32 const*>(&v0[0]);
 	glm::uint32 const r0 = 0x330077ff;
 
 	Error += p0 == r0 ? 0 : 1;