Reduced warnings when using very strict compilation flags #646

This commit is contained in:
Christophe Riccio 2017-07-07 11:26:12 +04:30
parent 27f8e5b0a1
commit 1ad55c5016
8 changed files with 61 additions and 28 deletions

View File

@ -14,7 +14,7 @@ include(CMakePackageConfigHelpers)
enable_testing()
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -g -Weverything -Wpedantic -Werror -Wno-padded -Wno-c++98-compat -Wno-documentation -std=c++11)
option(GLM_STATIC_LIBRARY_ENABLE "GLM static library" OFF)
if(GLM_STATIC_LIBRARY_ENABLE)

View File

@ -696,7 +696,15 @@ namespace detail
GLM_FUNC_QUALIFIER int floatBitsToInt(float const & v)
{
return reinterpret_cast<int&>(const_cast<float&>(v));
union
{
float in;
int out;
} u;
u.in = v;
return u.out;
}
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
@ -707,7 +715,15 @@ namespace detail
GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & v)
{
return reinterpret_cast<uint&>(const_cast<float&>(v));
union
{
float in;
uint out;
} u;
u.in = v;
return u.out;
}
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
@ -718,7 +734,15 @@ namespace detail
GLM_FUNC_QUALIFIER float intBitsToFloat(int const & v)
{
return reinterpret_cast<float&>(const_cast<int&>(v));
union
{
int in;
float out;
} u;
u.in = v;
return u.out;
}
template<template<length_t, typename, precision> class vecType, length_t L, precision P>
@ -729,7 +753,15 @@ namespace detail
GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & v)
{
return reinterpret_cast<float&>(const_cast<uint&>(v));
union
{
uint in;
float out;
} u;
u.in = v;
return u.out;
}
template<template<length_t, typename, precision> class vecType, length_t L, precision P>

View File

@ -191,7 +191,7 @@ namespace detail
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, P> const & x, vec<4, float, P> const & y, vec<4, bool, P> const & a)
{
__m128i const Load = _mm_set_epi32(-(int)a.w, -(int)a.z, -(int)a.y, -(int)a.x);
__m128i const Load = _mm_set_epi32(-static_cast<int>(a.w), -static_cast<int>(a.z), -static_cast<int>(a.y), -static_cast<int>(a.x));
__m128 const Mask = _mm_castsi128_ps(Load);
vec<4, float, P> Result(uninitialize);

View File

@ -298,12 +298,12 @@ namespace detail
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldReverse(vecType<L, T, P> const& v)
{
vecType<L, T, P> x(v);
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32));
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, static_cast<T>(0x5555555555555555ull), static_cast<T>( 1));
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, static_cast<T>(0x3333333333333333ull), static_cast<T>( 2));
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, static_cast<T>(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, static_cast<T>(0x00FF00FF00FF00FFull), static_cast<T>( 8));
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, static_cast<T>(0x0000FFFF0000FFFFull), static_cast<T>(16));
x = detail::compute_bitfieldReverseStep<L, T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, static_cast<T>(0x00000000FFFFFFFFull), static_cast<T>(32));
return x;
}

View File

@ -15,7 +15,7 @@ namespace detail
{
__m128i const set0 = v.data;
__m128i const set1 = _mm_set1_epi32(Mask);
__m128i const set1 = _mm_set1_epi32(static_cast<int>(Mask));
__m128i const and1 = _mm_and_si128(set0, set1);
__m128i const sft1 = _mm_slli_epi32(and1, Shift);
@ -36,7 +36,7 @@ namespace detail
{
__m128i const set0 = v.data;
__m128i const set1 = _mm_set1_epi32(Mask);
__m128i const set1 = _mm_set1_epi32(static_cast<int>(Mask));
__m128i const and0 = _mm_and_si128(set0, set1);
__m128i const sft0 = _mm_slli_epi32(set0, Shift);
__m128i const and1 = _mm_and_si128(sft0, set1);

View File

@ -19,9 +19,9 @@ namespace detail
{
mat<4, 4, float, P> result(uninitialize);
glm_mat4_matrixCompMult(
*(glm_vec4 const (*)[4])&x[0].data,
*(glm_vec4 const (*)[4])&y[0].data,
*(glm_vec4(*)[4])&result[0].data);
*static_cast<glm_vec4 const (*)[4]>(&x[0].data),
*static_cast<glm_vec4 const (*)[4]>(&y[0].data),
*static_cast<glm_vec4(*)[4]>(&result[0].data));
return result;
}
};
@ -33,8 +33,8 @@ namespace detail
{
mat<4, 4, float, P> result(uninitialize);
glm_mat4_transpose(
*(glm_vec4 const (*)[4])&m[0].data,
*(glm_vec4(*)[4])&result[0].data);
*static_cast<glm_vec4 const (*)[4]>(&m[0].data),
*static_cast<glm_vec4(*)[4]>(&result[0].data));
return result;
}
};

View File

@ -46,7 +46,7 @@ namespace detail
//
detail::uif32 result;
result.i = (unsigned int)(s << 31);
result.i = static_cast<unsigned int>(s << 31);
return result.f;
}
else
@ -74,7 +74,7 @@ namespace detail
//
uif32 result;
result.i = (unsigned int)((s << 31) | 0x7f800000);
result.i = static_cast<unsigned int>((s << 31) | 0x7f800000);
return result.f;
}
else
@ -84,7 +84,7 @@ namespace detail
//
uif32 result;
result.i = (unsigned int)((s << 31) | 0x7f800000 | (m << 13));
result.i = static_cast<unsigned int>((s << 31) | 0x7f800000 | (m << 13));
return result.f;
}
}
@ -101,7 +101,7 @@ namespace detail
//
uif32 Result;
Result.i = (unsigned int)((s << 31) | (e << 23) | m);
Result.i = static_cast<unsigned int>((s << 31) | (e << 23) | m);
return Result.f;
}
@ -109,7 +109,7 @@ namespace detail
{
uif32 Entry;
Entry.f = f;
int i = (int)Entry.i;
int i = static_cast<int>(Entry.i);
//
// Our floating point number, f, is represented by the bit

View File

@ -74,6 +74,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Removed GCC shadow warnings #595
- Added error for including of different versions of GLM #619
- Added GLM_FORCE_IGNORE_VERSION to ignore error caused by including different version of GLM #619
- Reduced warnings when using very strict compilation flags #646
#### Fixes:
- Removed doxygen references to GTC_half_float which was removed in 0.9.4