Fixed warnings

master
Christophe Riccio ago%!(EXTRA string=8 years)
parent 32054a8fdf
commit 5a747d2ae5
  1. 2
      CMakeLists.txt
  2. 44
      test/core/core_func_common.cpp
  3. 2
      test/core/core_func_geometric.cpp
  4. 4
      test/core/core_func_integer_bit_count.cpp
  5. 4
      test/gtc/gtc_integer.cpp
  6. 2
      test/gtc/gtc_quaternion.cpp
  7. 4
      test/gtc/gtc_ulp.cpp

@ -84,7 +84,7 @@ endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 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(-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 -Wno-double-promotion) add_definitions(-Wno-sign-conversion -Wno-unused-variable -Wno-missing-prototypes -Wno-unreachable-code -Wno-missing-variable-declarations -Wno-sign-compare)
endif() endif()
option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF) option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF)

@ -191,28 +191,28 @@ namespace floatBitsToInt
float A = 1.0f; float A = 1.0f;
int B = glm::floatBitsToInt(A); int B = glm::floatBitsToInt(A);
float C = glm::intBitsToFloat(B); float C = glm::intBitsToFloat(B);
Error += A == C ? 0 : 1; Error += glm::epsilonEqual(A, C, 0.0001f) ? 0 : 1;
} }
{ {
glm::vec2 A(1.0f, 2.0f); glm::vec2 A(1.0f, 2.0f);
glm::ivec2 B = glm::floatBitsToInt(A); glm::ivec2 B = glm::floatBitsToInt(A);
glm::vec2 C = glm::intBitsToFloat(B); glm::vec2 C = glm::intBitsToFloat(B);
Error += A == C? 0 : 1; Error += glm::epsilonEqual(A, C, 0.0001f) ? 0 : 1;
} }
{ {
glm::vec3 A(1.0f, 2.0f, 3.0f); glm::vec3 A(1.0f, 2.0f, 3.0f);
glm::ivec3 B = glm::floatBitsToInt(A); glm::ivec3 B = glm::floatBitsToInt(A);
glm::vec3 C = glm::intBitsToFloat(B); glm::vec3 C = glm::intBitsToFloat(B);
Error += A == C? 0 : 1; Error += glm::epsilonEqual(A, C, 0.0001f) ? 0 : 1;
} }
{ {
glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f); glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f);
glm::ivec4 B = glm::floatBitsToInt(A); glm::ivec4 B = glm::floatBitsToInt(A);
glm::vec4 C = glm::intBitsToFloat(B); glm::vec4 C = glm::intBitsToFloat(B);
Error += A == C? 0 : 1; Error += glm::epsilonEqual(A, C, 0.0001f) ? 0 : 1;
} }
return Error; return Error;
@ -229,28 +229,28 @@ namespace floatBitsToUint
float A = 1.0f; float A = 1.0f;
glm::uint B = glm::floatBitsToUint(A); glm::uint B = glm::floatBitsToUint(A);
float C = glm::intBitsToFloat(B); float C = glm::intBitsToFloat(B);
Error += A == C? 0 : 1; Error += glm::epsilonEqual(A, C, 0.0001f) ? 0 : 1;
} }
{ {
glm::vec2 A(1.0f, 2.0f); glm::vec2 A(1.0f, 2.0f);
glm::uvec2 B = glm::floatBitsToUint(A); glm::uvec2 B = glm::floatBitsToUint(A);
glm::vec2 C = glm::uintBitsToFloat(B); glm::vec2 C = glm::uintBitsToFloat(B);
Error += A == C ? 0 : 1; Error += glm::epsilonEqual(A, C, 0.0001f) ? 0 : 1;
} }
{ {
glm::vec3 A(1.0f, 2.0f, 3.0f); glm::vec3 A(1.0f, 2.0f, 3.0f);
glm::uvec3 B = glm::floatBitsToUint(A); glm::uvec3 B = glm::floatBitsToUint(A);
glm::vec3 C = glm::uintBitsToFloat(B); glm::vec3 C = glm::uintBitsToFloat(B);
Error += A == C? 0 : 1; Error += glm::epsilonEqual(A, C, 0.0001f) ? 0 : 1;
} }
{ {
glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f); glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f);
glm::uvec4 B = glm::floatBitsToUint(A); glm::uvec4 B = glm::floatBitsToUint(A);
glm::vec4 C = glm::uintBitsToFloat(B); glm::vec4 C = glm::uintBitsToFloat(B);
Error += A == C? 0 : 1; Error += glm::epsilonEqual(A, C, 0.0001f) ? 0 : 1;
} }
return Error; return Error;
@ -550,36 +550,36 @@ namespace round_
{ {
float A = glm::round(0.0f); float A = glm::round(0.0f);
Error += A == 0.0f ? 0 : 1; Error += glm::epsilonEqual(A, 0.0f, glm::epsilon<float>() ? 0 : 1;
float B = glm::round(0.5f); float B = glm::round(0.5f);
Error += B == 1.0f ? 0 : 1; Error += glm::epsilonEqual(B, 1.0f, glm::epsilon<float>() ? 0 : 1;
float C = glm::round(1.0f); float C = glm::round(1.0f);
Error += C == 1.0f ? 0 : 1; Error += glm::epsilonEqual(C, 1.0f, glm::epsilon<float>() ? 0 : 1;
float D = glm::round(0.1f); float D = glm::round(0.1f);
Error += D == 0.0f ? 0 : 1; Error += glm::epsilonEqual(D, 0.0f, glm::epsilon<float>() ? 0 : 1;
float E = glm::round(0.9f); float E = glm::round(0.9f);
Error += E == 1.0f ? 0 : 1; Error += glm::epsilonEqual(E, 1.0f, glm::epsilon<float>() ? 0 : 1;
float F = glm::round(1.5f); float F = glm::round(1.5f);
Error += F == 2.0f ? 0 : 1; Error += glm::epsilonEqual(F, 2.0f, glm::epsilon<float>() ? 0 : 1;
float G = glm::round(1.9f); float G = glm::round(1.9f);
Error += G == 2.0f ? 0 : 1; Error += glm::epsilonEqual(G, 2.0f, glm::epsilon<float>() ? 0 : 1;
} }
{ {
float A = glm::round(-0.0f); float A = glm::round(-0.0f);
Error += A == 0.0f ? 0 : 1; Error += glm::epsilonEqual(A, 0.0f, glm::epsilon<float>() ? 0 : 1;
float B = glm::round(-0.5f); float B = glm::round(-0.5f);
Error += B == -1.0f ? 0 : 1; Error += glm::epsilonEqual(B, -1.0f, glm::epsilon<float>() ? 0 : 1;
float C = glm::round(-1.0f); float C = glm::round(-1.0f);
Error += C == -1.0f ? 0 : 1; Error += glm::epsilonEqual(C, -1.0f, glm::epsilon<float>() ? 0 : 1;
float D = glm::round(-0.1f); float D = glm::round(-0.1f);
Error += D == 0.0f ? 0 : 1; Error += glm::epsilonEqual(D, 0.0f, glm::epsilon<float>() ? 0 : 1;
float E = glm::round(-0.9f); float E = glm::round(-0.9f);
Error += E == -1.0f ? 0 : 1; Error += glm::epsilonEqual(E, -1.0f, glm::epsilon<float>() ? 0 : 1;
float F = glm::round(-1.5f); float F = glm::round(-1.5f);
Error += F == -2.0f ? 0 : 1; Error += glm::epsilonEqual(F, -2.0f, glm::epsilon<float>() ? 0 : 1;
float G = glm::round(-1.9f); float G = glm::round(-1.9f);
Error += G == -2.0f ? 0 : 1; Error += glm::epsilonEqual(G, -2.0f, glm::epsilon<float>() ? 0 : 1;
} }
return Error; return Error;

@ -154,7 +154,7 @@ namespace refract
float A(-1.0f); float A(-1.0f);
float B(1.0f); float B(1.0f);
float C = glm::refract(A, B, 0.5f); float C = glm::refract(A, B, 0.5f);
Error += C == -1.0f ? 0 : 1; Error += glm::epsilonEqual(C, -1.0f, 0.0001f) ? 0 : 1;
} }
{ {

@ -7,7 +7,7 @@
unsigned rotatel(unsigned x, int n) unsigned rotatel(unsigned x, int n)
{ {
if ((unsigned)n > 63) {printf("rotatel, n out of range.\n"); exit(1);} if (static_cast<unsigned>(n) > 63) {printf("rotatel, n out of range.\n"); exit(1);}
return (x << n) | (x >> (32 - n)); return (x << n) | (x >> (32 - n));
} }
@ -164,7 +164,7 @@ int pop9(unsigned x)
y = y & 0x1111111111111111ULL; y = y & 0x1111111111111111ULL;
y = y * 0x1111111111111111ULL; y = y * 0x1111111111111111ULL;
y = y >> 60; y = y >> 60;
return y; return static_cast<int>(y);
} }
int errors; int errors;

@ -206,8 +206,8 @@ namespace uround
for(float f = 0.0f; f < 3.1f; f += 0.05f) for(float f = 0.0f; f < 3.1f; f += 0.05f)
{ {
int RoundFast = glm::uround(f); int RoundFast = static_cast<int>(glm::uround(f));
int RoundSTD = glm::round(f); int RoundSTD = static_cast<int>(glm::round(f));
Error += RoundFast == RoundSTD ? 0 : 1; Error += RoundFast == RoundSTD ? 0 : 1;
assert(!Error); assert(!Error);
} }

@ -134,7 +134,7 @@ int test_quat_slerp()
float const Epsilon = 0.0001f;//glm::epsilon<float>(); float const Epsilon = 0.0001f;//glm::epsilon<float>();
float sqrt2 = sqrt(2.0f)/2.0f; float sqrt2 = std::sqrt(2.0f)/2.0f;
glm::quat id(static_cast<float>(1), static_cast<float>(0), static_cast<float>(0), static_cast<float>(0)); glm::quat id(static_cast<float>(1), static_cast<float>(0), static_cast<float>(0), static_cast<float>(0));
glm::quat Y90rot(sqrt2, 0.0f, sqrt2, 0.0f); glm::quat Y90rot(sqrt2, 0.0f, sqrt2, 0.0f);
glm::quat Y180rot(0.0f, 0.0f, 1.0f, 0.0f); glm::quat Y180rot(0.0f, 0.0f, 1.0f, 0.0f);

@ -8,9 +8,9 @@ int test_ulp_float_dist()
float A = 1.0f; float A = 1.0f;
float B = glm::next_float(A); float B = glm::next_float(A);
Error += A != B ? 0 : 1; Error += glm::epsilonNotEqual(A, B, glm::epsilon<float>()) ? 0 : 1;
float C = glm::prev_float(B); float C = glm::prev_float(B);
Error += A == C ? 0 : 1; Error += glm::epsilonEqual(A, C, glm::epsilon<float>()) ? 0 : 1;
int D = glm::float_distance(A, B); int D = glm::float_distance(A, B);
Error += D == 1 ? 0 : 1; Error += D == 1 ? 0 : 1;

Loading…
Cancel
Save