From 49435a09da75feeded1e7287833f9fbdf34f1d33 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 7 Aug 2017 01:00:36 +0200 Subject: [PATCH] Fixed warings generated using -Weverything --- CMakeLists.txt | 3 ++- glm/gtc/random.inl | 9 +++++---- glm/gtx/integer.inl | 2 +- glm/gtx/string_cast.inl | 30 +++++++++++++++--------------- test/gtc/gtc_type_precision.cpp | 2 +- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 466a6c6b..f385a13b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/glm/gtc/random.inl b/glm/gtc/random.inl index 103f9fc1..3a16eb39 100644 --- a/glm/gtc/random.inl +++ b/glm/gtc/random.inl @@ -6,6 +6,7 @@ #include #include #include +#include namespace glm{ namespace detail @@ -311,7 +312,7 @@ namespace detail template 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 @@ -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; } diff --git a/glm/gtx/integer.inl b/glm/gtx/integer.inl index 186072f6..ce386f8b 100644 --- a/glm/gtx/integer.inl +++ b/glm/gtx/integer.inl @@ -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; } diff --git a/glm/gtx/string_cast.inl b/glm/gtx/string_cast.inl index 0bf73a54..f8265775 100644 --- a/glm/gtx/string_cast.inl +++ b/glm/gtx/string_cast.inl @@ -33,26 +33,26 @@ namespace detail template struct literal { - GLM_FUNC_QUALIFIER static char const * value() {return "%d";}; + GLM_FUNC_QUALIFIER static char const * value() {return "%d";} }; template struct literal { - 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 { - GLM_FUNC_QUALIFIER static char const * value() {return "%lld";}; + GLM_FUNC_QUALIFIER static char const * value() {return "%lld";} }; template<> struct literal { - 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 { - GLM_FUNC_QUALIFIER static char const * value() {return "";}; + GLM_FUNC_QUALIFIER static char const * value() {return "";} }; template<> struct prefix { - GLM_FUNC_QUALIFIER static char const * value() {return "d";}; + GLM_FUNC_QUALIFIER static char const * value() {return "d";} }; template<> struct prefix { - GLM_FUNC_QUALIFIER static char const * value() {return "b";}; + GLM_FUNC_QUALIFIER static char const * value() {return "b";} }; template<> struct prefix { - GLM_FUNC_QUALIFIER static char const * value() {return "u8";}; + GLM_FUNC_QUALIFIER static char const * value() {return "u8";} }; template<> struct prefix { - GLM_FUNC_QUALIFIER static char const * value() {return "i8";}; + GLM_FUNC_QUALIFIER static char const * value() {return "i8";} }; template<> struct prefix { - GLM_FUNC_QUALIFIER static char const * value() {return "u16";}; + GLM_FUNC_QUALIFIER static char const * value() {return "u16";} }; template<> struct prefix { - GLM_FUNC_QUALIFIER static char const * value() {return "i16";}; + GLM_FUNC_QUALIFIER static char const * value() {return "i16";} }; template<> struct prefix { - GLM_FUNC_QUALIFIER static char const * value() {return "u";}; + GLM_FUNC_QUALIFIER static char const * value() {return "u";} }; template<> struct prefix { - GLM_FUNC_QUALIFIER static char const * value() {return "i";}; + GLM_FUNC_QUALIFIER static char const * value() {return "i";} }; template<> struct prefix { - GLM_FUNC_QUALIFIER static char const * value() {return "u64";}; + GLM_FUNC_QUALIFIER static char const * value() {return "u64";} }; template<> struct prefix { - GLM_FUNC_QUALIFIER static char const * value() {return "i64";}; + GLM_FUNC_QUALIFIER static char const * value() {return "i64";} }; template diff --git a/test/gtc/gtc_type_precision.cpp b/test/gtc/gtc_type_precision.cpp index 8ae43005..05a2dc85 100644 --- a/test/gtc/gtc_type_precision.cpp +++ b/test/gtc/gtc_type_precision.cpp @@ -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(VectorC.size()); ++i) { VectorC[i] = VectorA[i] + VectorB[i]; }