From 87ecf4a233e132f3bca8b5c4736c3cb3ae60b20c Mon Sep 17 00:00:00 2001 From: Groove Date: Tue, 24 Jul 2018 21:04:48 +0200 Subject: [PATCH] Fixed Visual C++ 2013 warnings in vector relational code #782 --- glm/detail/func_vector_relational.inl | 19 +++++++++++++------ readme.md | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/glm/detail/func_vector_relational.inl b/glm/detail/func_vector_relational.inl index 7c66125a..1b256eda 100644 --- a/glm/detail/func_vector_relational.inl +++ b/glm/detail/func_vector_relational.inl @@ -3,6 +3,13 @@ #include "compute_vector_relational.hpp" +// Bug #782: Warning C4701: potentially uninitialized local variable 'Result' used +#if ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) +# define GLM_BUG_VC_INIT (false) +#else +# define GLM_BUG_VC_INIT +#endif + namespace glm { template @@ -10,7 +17,7 @@ namespace glm { assert(x.length() == y.length()); - vec Result; + vec Result GLM_BUG_VC_INIT; for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] < y[i]; @@ -22,7 +29,7 @@ namespace glm { assert(x.length() == y.length()); - vec Result; + vec Result GLM_BUG_VC_INIT; for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] <= y[i]; return Result; @@ -33,7 +40,7 @@ namespace glm { assert(x.length() == y.length()); - vec Result; + vec Result GLM_BUG_VC_INIT; for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] > y[i]; return Result; @@ -44,7 +51,7 @@ namespace glm { assert(x.length() == y.length()); - vec Result; + vec Result GLM_BUG_VC_INIT; for(length_t i = 0; i < x.length(); ++i) Result[i] = x[i] >= y[i]; return Result; @@ -55,7 +62,7 @@ namespace glm { assert(x.length() == y.length()); - vec Result; + vec Result GLM_BUG_VC_INIT; for(length_t i = 0; i < x.length(); ++i) Result[i] = detail::compute_equal::is_iec559>::call(x[i], y[i]); return Result; @@ -66,7 +73,7 @@ namespace glm { assert(x.length() == y.length()); - vec Result; + vec Result GLM_BUG_VC_INIT; for(length_t i = 0; i < x.length(); ++i) Result[i] = !detail::compute_equal::is_iec559>::call(x[i], y[i]); return Result; diff --git a/readme.md b/readme.md index e38f2a9f..54d8305f 100644 --- a/readme.md +++ b/readme.md @@ -67,6 +67,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate) - Fixed int mod - Anonymous unions require C++ language extensions - Fixed ortho #790 +- Fixed Visual C++ 2013 warnings in vector relational code #782 ### [GLM 0.9.9.0](https://github.com/g-truc/glm/releases/tag/0.9.9.0) - 2018-05-22 #### Features: