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() 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 -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() endif()
option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF) option(GLM_TEST_ENABLE_LANG_EXTENSIONS "Enable language extensions" OFF)

View File

@ -6,6 +6,7 @@
#include <cstdlib> #include <cstdlib>
#include <ctime> #include <ctime>
#include <cassert> #include <cassert>
#include <cmath>
namespace glm{ namespace glm{
namespace detail namespace detail
@ -342,8 +343,8 @@ namespace detail
T r = sqrt(T(1) - z * z); T r = sqrt(T(1) - z * z);
T x = r * cos(a); T x = r * std::cos(a);
T y = r * sin(a); T y = r * std::sin(a);
return vec<3, T, defaultp>(x, y, z) * Radius; return vec<3, T, defaultp>(x, y, z) * Radius;
} }

View File

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

View File

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

View File

@ -861,7 +861,7 @@ static int test_openmp()
} }
#pragma omp parallel for default(none) shared(VectorA, VectorB, VectorC) #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]; VectorC[i] = VectorA[i] + VectorB[i];
} }