Fixed Visual C++ /W4 warnings

This commit is contained in:
Christophe Riccio 2017-08-18 12:59:16 +02:00
parent e1dc14ddd4
commit 2c2d3931ee
4 changed files with 49 additions and 40 deletions

View File

@ -116,13 +116,17 @@ int test_bvec4_ctor()
glm::bvec4 const D = A && B;
glm::bvec4 const E = A && C;
glm::bvec4 const F = A || C;
bool const G = A == C;
bool const H = A != C;
Error += D == glm::bvec4(true) ? 0 : 1;
Error += E == glm::bvec4(false) ? 0 : 1;
Error += F == glm::bvec4(true) ? 0 : 1;
bool const G = A == C;
bool const H = A != C;
Error += !G ? 0 : 1;
Error += H ? 0 : 1;
return Error;
}

View File

@ -11,7 +11,7 @@
namespace floor_
{
int test()
static int test()
{
int Error(0);
@ -89,7 +89,7 @@ namespace floor_
namespace modf_
{
int test()
static int test()
{
int Error(0);
@ -135,7 +135,7 @@ namespace modf_
namespace mod_
{
int test()
static int test()
{
int Error(0);
@ -185,7 +185,7 @@ namespace mod_
namespace floatBitsToInt
{
int test()
static int test()
{
int Error = 0;
@ -223,7 +223,7 @@ namespace floatBitsToInt
namespace floatBitsToUint
{
int test()
static int test()
{
int Error = 0;
@ -261,7 +261,7 @@ namespace floatBitsToUint
namespace min_
{
int test()
static int test()
{
int Error = 0;
@ -288,7 +288,7 @@ namespace min_
namespace max_
{
int test()
static int test()
{
int Error = 0;
@ -315,7 +315,7 @@ namespace max_
namespace clamp_
{
int test()
static int test()
{
int Error = 0;
@ -401,7 +401,7 @@ namespace mix_
{glm::vec4(1.0f, 2.0f, 3.0f, 4.0f), glm::vec4(5.0f, 6.0f, 7.0f, 8.0f), glm::bvec4(true, false, true, false), glm::vec4(5.0f, 2.0f, 7.0f, 4.0f)}
};
int test()
static int test()
{
int Error = 0;
@ -518,7 +518,7 @@ namespace step_
{ glm::vec4( 0.0f, 1.0f, 2.0f, 3.0f), glm::vec4(-1.0f,-2.0f,-3.0f,-4.0f), glm::vec4(0.0f) }
};
int test()
static int test()
{
int Error = 0;
@ -546,7 +546,7 @@ namespace step_
namespace round_
{
int test()
static int test()
{
int Error = 0;
@ -590,7 +590,7 @@ namespace round_
namespace roundEven
{
int test()
static int test()
{
int Error = 0;
@ -736,7 +736,7 @@ namespace roundEven
namespace isnan_
{
int test()
static int test()
{
int Error = 0;
@ -763,7 +763,7 @@ namespace isnan_
namespace isinf_
{
int test()
static int test()
{
int Error = 0;
@ -966,7 +966,7 @@ namespace sign
return Error;
}
int test()
static int test()
{
int Error = 0;
@ -1122,7 +1122,7 @@ namespace sign
return Error;
}
int perf(std::size_t Samples)
static int perf(std::size_t Samples)
{
int Error(0);
@ -1136,7 +1136,7 @@ namespace sign
namespace frexp_
{
int test()
static int test()
{
int Error(0);
@ -1178,7 +1178,7 @@ namespace frexp_
namespace ldexp_
{
int test()
static int test()
{
int Error(0);
@ -1218,20 +1218,6 @@ int main()
{
int Error = 0;
glm::ivec4 const a(1);
glm::ivec4 const b = ~a;
glm::int32 const c(1);
glm::int32 const d = ~c;
# if GLM_ARCH & GLM_ARCH_AVX_BIT && GLM_HAS_UNRESTRICTED_UNIONS
glm_vec4 const A = _mm_set_ps(4, 3, 2, 1);
glm_vec4 const B = glm_vec4_swizzle_xyzw(A);
glm_vec4 const C = _mm_permute_ps(A, _MM_SHUFFLE(3, 2, 1, 0));
glm_vec4 const D = _mm_permute_ps(A, _MM_SHUFFLE(0, 1, 2, 3));
glm_vec4 const E = _mm_shuffle_ps(A, A, _MM_SHUFFLE(0, 1, 2, 3));
# endif
Error += sign::test();
Error += floor_::test();
Error += mod_::test();
@ -1242,6 +1228,7 @@ int main()
Error += step_::test();
Error += max_::test();
Error += min_::test();
Error += clamp_::test();
Error += round_::test();
Error += roundEven::test();
Error += isnan_::test();
@ -1251,8 +1238,10 @@ int main()
# ifdef NDEBUG
std::size_t Samples = 1000;
Error += sign::perf(Samples);
# else
std::size_t Samples = 1;
# endif
Error += sign::perf(Samples);
return Error;
}

View File

@ -1,6 +1,6 @@
#include <glm/glm.hpp>
int test_int_size()
static int test_int_size()
{
return
sizeof(glm::int_t) != sizeof(glm::lowp_int) &&
@ -8,7 +8,7 @@ int test_int_size()
sizeof(glm::int_t) != sizeof(glm::highp_int);
}
int test_uint_size()
static int test_uint_size()
{
return
sizeof(glm::uint_t) != sizeof(glm::lowp_uint) &&
@ -16,20 +16,35 @@ int test_uint_size()
sizeof(glm::uint_t) != sizeof(glm::highp_uint);
}
int test_int_precision()
static int test_int_precision()
{
return (
sizeof(glm::lowp_int) <= sizeof(glm::mediump_int) &&
sizeof(glm::mediump_int) <= sizeof(glm::highp_int)) ? 0 : 1;
}
int test_uint_precision()
static int test_uint_precision()
{
return (
sizeof(glm::lowp_uint) <= sizeof(glm::mediump_uint) &&
sizeof(glm::mediump_uint) <= sizeof(glm::highp_uint)) ? 0 : 1;
}
static int test_bit_operator()
{
int Error = 0;
glm::ivec4 const a(1);
glm::ivec4 const b = ~a;
Error += glm::all(glm::equal(b, glm::ivec4(-2))) ? 0 : 1;
glm::int32 const c(1);
glm::int32 const d = ~c;
Error += d == -2 ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -38,6 +53,7 @@ int main()
Error += test_int_precision();
Error += test_uint_size();
Error += test_uint_precision();
Error += test_bit_operator();
return Error;
}

View File

@ -104,7 +104,7 @@ static int test_vec4_ctor()
}
#endif// GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
# if GLM_HAS_CONSTEXPR && GLM_ARCH == GLM_ARCH_PURE
# if GLM_HAS_CONSTEXPR && GLM_ARCH == GLM_ARCH_PURE && !(GLM_COMPILER & GLM_COMPILER_VC) // Visual Studio bug?
{
constexpr glm::ivec4 v(1);