Fixed warings generated using -Weverything

This commit is contained in:
Christophe Riccio 2017-08-07 01:00:36 +02:00
parent d63aa4ea85
commit 49435a09da
5 changed files with 24 additions and 22 deletions

View File

@ -83,7 +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 -Wno-sign-conversion -Wno-unused-variable -Wno-missing-prototypes)
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)
endif()
option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF)

View File

@ -6,6 +6,7 @@
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <cmath>
namespace glm{
namespace detail
@ -311,7 +312,7 @@ namespace detail
template<typename T>
GLM_FUNC_QUALIFIER vec<3, T, defaultp> ballRand(T Radius)
{
{
vec<3, T, defaultp> Result(T(0));
T LenRadius(T(0));
@ -331,7 +332,7 @@ namespace detail
GLM_FUNC_QUALIFIER vec<2, T, defaultp> circularRand(T Radius)
{
T a = linearRand(T(0), T(6.283185307179586476925286766559f));
return vec<2, T, defaultp>(cos(a), sin(a)) * Radius;
return vec<2, T, defaultp>(cos(a), sin(a)) * Radius;
}
template<typename T>
@ -342,8 +343,8 @@ namespace detail
T r = sqrt(T(1) - z * z);
T x = r * cos(a);
T y = r * sin(a);
T x = r * std::cos(a);
T y = r * std::sin(a);
return vec<3, T, defaultp>(x, y, z) * Radius;
}

View File

@ -10,7 +10,7 @@ namespace glm
return x >= 0 ? 1 : -1;
int result = x;
for(int i = 1; i < y; ++i)
for(uint i = 1; i < y; ++i)
result *= x;
return result;
}

View File

@ -33,26 +33,26 @@ namespace detail
template<typename T, bool isFloat = false>
struct literal
{
GLM_FUNC_QUALIFIER static char const * value() {return "%d";};
GLM_FUNC_QUALIFIER static char const * value() {return "%d";}
};
template<typename T>
struct literal<T, true>
{
GLM_FUNC_QUALIFIER static char const * value() {return "%f";};
GLM_FUNC_QUALIFIER static char const * value() {return "%f";}
};
# if GLM_MODEL == GLM_MODEL_32 && GLM_COMPILER && GLM_COMPILER_VC
template<>
struct literal<uint64_t, false>
{
GLM_FUNC_QUALIFIER static char const * value() {return "%lld";};
GLM_FUNC_QUALIFIER static char const * value() {return "%lld";}
};
template<>
struct literal<int64_t, false>
{
GLM_FUNC_QUALIFIER static char const * value() {return "%lld";};
GLM_FUNC_QUALIFIER static char const * value() {return "%lld";}
};
# endif//GLM_MODEL == GLM_MODEL_32 && GLM_COMPILER && GLM_COMPILER_VC
@ -62,67 +62,67 @@ namespace detail
template<>
struct prefix<float>
{
GLM_FUNC_QUALIFIER static char const * value() {return "";};
GLM_FUNC_QUALIFIER static char const * value() {return "";}
};
template<>
struct prefix<double>
{
GLM_FUNC_QUALIFIER static char const * value() {return "d";};
GLM_FUNC_QUALIFIER static char const * value() {return "d";}
};
template<>
struct prefix<bool>
{
GLM_FUNC_QUALIFIER static char const * value() {return "b";};
GLM_FUNC_QUALIFIER static char const * value() {return "b";}
};
template<>
struct prefix<uint8_t>
{
GLM_FUNC_QUALIFIER static char const * value() {return "u8";};
GLM_FUNC_QUALIFIER static char const * value() {return "u8";}
};
template<>
struct prefix<int8_t>
{
GLM_FUNC_QUALIFIER static char const * value() {return "i8";};
GLM_FUNC_QUALIFIER static char const * value() {return "i8";}
};
template<>
struct prefix<uint16_t>
{
GLM_FUNC_QUALIFIER static char const * value() {return "u16";};
GLM_FUNC_QUALIFIER static char const * value() {return "u16";}
};
template<>
struct prefix<int16_t>
{
GLM_FUNC_QUALIFIER static char const * value() {return "i16";};
GLM_FUNC_QUALIFIER static char const * value() {return "i16";}
};
template<>
struct prefix<uint32_t>
{
GLM_FUNC_QUALIFIER static char const * value() {return "u";};
GLM_FUNC_QUALIFIER static char const * value() {return "u";}
};
template<>
struct prefix<int32_t>
{
GLM_FUNC_QUALIFIER static char const * value() {return "i";};
GLM_FUNC_QUALIFIER static char const * value() {return "i";}
};
template<>
struct prefix<uint64_t>
{
GLM_FUNC_QUALIFIER static char const * value() {return "u64";};
GLM_FUNC_QUALIFIER static char const * value() {return "u64";}
};
template<>
struct prefix<int64_t>
{
GLM_FUNC_QUALIFIER static char const * value() {return "i64";};
GLM_FUNC_QUALIFIER static char const * value() {return "i64";}
};
template<typename matType>

View File

@ -861,7 +861,7 @@ static int test_openmp()
}
#pragma omp parallel for default(none) shared(VectorA, VectorB, VectorC)
for (int i = 0; i < VectorC.size(); ++i)
for (int i = 0; i < static_cast<int>(VectorC.size()); ++i)
{
VectorC[i] = VectorA[i] + VectorB[i];
}