From 8755be56d69f3f9452dcc9a43e8203803c1bcbac Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 12:15:15 -0700 Subject: [PATCH 01/14] Update matrix_transform.inl --- glm/ext/matrix_transform.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/ext/matrix_transform.inl b/glm/ext/matrix_transform.inl index 5037ec1b2..e5f0abe01 100644 --- a/glm/ext/matrix_transform.inl +++ b/glm/ext/matrix_transform.inl @@ -144,7 +144,7 @@ namespace glm template GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAt(vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up) { - if(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) + if GLM_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) return lookAtLH(eye, center, up); else return lookAtRH(eye, center, up); From 503a22960a31c18e750bbfd169978d616b0dd4d7 Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 12:21:20 -0700 Subject: [PATCH 02/14] constexpr warning Removes warning: conditional expression is constant, consider using 'if constexpr' statement instead --- glm/ext/matrix_clip_space.inl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/ext/matrix_clip_space.inl b/glm/ext/matrix_clip_space.inl index 9b870dc71..702d7b00b 100644 --- a/glm/ext/matrix_clip_space.inl +++ b/glm/ext/matrix_clip_space.inl @@ -323,13 +323,13 @@ namespace glm template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspective(T fovy, T aspect, T zNear, T zFar) { - if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO) + if GLM_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO) return perspectiveLH_ZO(fovy, aspect, zNear, zFar); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO) + else if GLM_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO) return perspectiveLH_NO(fovy, aspect, zNear, zFar); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO) + else if GLM_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO) return perspectiveRH_ZO(fovy, aspect, zNear, zFar); - else if(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO) + else if GLM_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO) return perspectiveRH_NO(fovy, aspect, zNear, zFar); } From 658bbdb5255f36528445c3492657098c594d13f7 Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 13:08:57 -0700 Subject: [PATCH 03/14] Update setup.hpp Enable 'if constexpr' when c++17 --- glm/detail/setup.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 5200fa2ba..737fc035f 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -289,6 +289,11 @@ #if GLM_HAS_CONSTEXPR # define GLM_CONSTEXPR constexpr +#if GLM_LANG_CXX17_FLAG +# define GLM_IF_CONSTEXPR constexpr +#else +# define GLM_IF_CONSTEXPR +#endif #else # define GLM_CONSTEXPR #endif From 59f2c2d50e69e1207351ccabed5a96a3a2c9a827 Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 13:11:08 -0700 Subject: [PATCH 04/14] Update matrix_transform.inl --- glm/ext/matrix_transform.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/ext/matrix_transform.inl b/glm/ext/matrix_transform.inl index e5f0abe01..5ac737131 100644 --- a/glm/ext/matrix_transform.inl +++ b/glm/ext/matrix_transform.inl @@ -144,7 +144,7 @@ namespace glm template GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAt(vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up) { - if GLM_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) + if GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) return lookAtLH(eye, center, up); else return lookAtRH(eye, center, up); From e4ab1096ceb48eef5695a562507ce4ce5d2802aa Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 13:11:56 -0700 Subject: [PATCH 05/14] Update matrix_clip_space.inl --- glm/ext/matrix_clip_space.inl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/ext/matrix_clip_space.inl b/glm/ext/matrix_clip_space.inl index 702d7b00b..e5876f615 100644 --- a/glm/ext/matrix_clip_space.inl +++ b/glm/ext/matrix_clip_space.inl @@ -323,13 +323,13 @@ namespace glm template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspective(T fovy, T aspect, T zNear, T zFar) { - if GLM_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO) + if GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO) return perspectiveLH_ZO(fovy, aspect, zNear, zFar); - else if GLM_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO) + else if GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO) return perspectiveLH_NO(fovy, aspect, zNear, zFar); - else if GLM_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO) + else if GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO) return perspectiveRH_ZO(fovy, aspect, zNear, zFar); - else if GLM_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO) + else if GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO) return perspectiveRH_NO(fovy, aspect, zNear, zFar); } From b0f6910f0c932b64572869f38e2e04ccbf617f3d Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 14:14:10 -0700 Subject: [PATCH 06/14] Update setup.hpp --- glm/detail/setup.hpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 737fc035f..3295d6ece 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -289,15 +289,24 @@ #if GLM_HAS_CONSTEXPR # define GLM_CONSTEXPR constexpr -#if GLM_LANG_CXX17_FLAG -# define GLM_IF_CONSTEXPR constexpr -#else -# define GLM_IF_CONSTEXPR -#endif #else # define GLM_CONSTEXPR #endif +// +#if GLM_HAS_CONSTEXPR +# if (GLM_COMPILER & GLM_COMPILER_CLANG ) +# if __has_feature(cxx_if_constexpr) +# define GLM_IF_CONSTEXPR constexpr +# else +# define GLM_IF_CONSTEXPR +# endif +# elif GLM_LANG_CXX17_FLAG +# define GLM_IF_CONSTEXPR constexpr +# else +# define GLM_IF_CONSTEXPR +#endif + // #if GLM_LANG & GLM_LANG_CXX11_FLAG # define GLM_HAS_ASSIGNABLE 1 From 94f685c1117eb8a63139da0427a3824560625240 Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 15:00:24 -0700 Subject: [PATCH 07/14] Update setup.hpp --- glm/detail/setup.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 3295d6ece..e2c4c4e13 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -297,14 +297,14 @@ #if GLM_HAS_CONSTEXPR # if (GLM_COMPILER & GLM_COMPILER_CLANG ) # if __has_feature(cxx_if_constexpr) -# define GLM_IF_CONSTEXPR constexpr +# define GLM_IF_CONSTEXPR if constexpr # else -# define GLM_IF_CONSTEXPR +# define GLM_IF_CONSTEXPR if # endif # elif GLM_LANG_CXX17_FLAG -# define GLM_IF_CONSTEXPR constexpr +# define GLM_IF_CONSTEXPR if constexpr # else -# define GLM_IF_CONSTEXPR +# define GLM_IF_CONSTEXPR if #endif // From 0bb41224f364276263d1016ef4524051cca4cb8f Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 15:01:13 -0700 Subject: [PATCH 08/14] Update matrix_transform.inl --- glm/ext/matrix_transform.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/ext/matrix_transform.inl b/glm/ext/matrix_transform.inl index 5ac737131..a415157e0 100644 --- a/glm/ext/matrix_transform.inl +++ b/glm/ext/matrix_transform.inl @@ -144,7 +144,7 @@ namespace glm template GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAt(vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up) { - if GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) + GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT) return lookAtLH(eye, center, up); else return lookAtRH(eye, center, up); From 80679fd523053b4b910ca3726dc279f2d2cc2601 Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 15:02:54 -0700 Subject: [PATCH 09/14] Update matrix_clip_space.inl --- glm/ext/matrix_clip_space.inl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/ext/matrix_clip_space.inl b/glm/ext/matrix_clip_space.inl index e5876f615..baf68ccab 100644 --- a/glm/ext/matrix_clip_space.inl +++ b/glm/ext/matrix_clip_space.inl @@ -323,13 +323,13 @@ namespace glm template GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspective(T fovy, T aspect, T zNear, T zFar) { - if GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO) + GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO) return perspectiveLH_ZO(fovy, aspect, zNear, zFar); - else if GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO) + else GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO) return perspectiveLH_NO(fovy, aspect, zNear, zFar); - else if GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO) + else GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO) return perspectiveRH_ZO(fovy, aspect, zNear, zFar); - else if GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO) + else GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO) return perspectiveRH_NO(fovy, aspect, zNear, zFar); } From cf74190dfd7c6325208e3b0ff5bdcab4c828e185 Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 15:06:44 -0700 Subject: [PATCH 10/14] Update setup.hpp --- glm/detail/setup.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index e2c4c4e13..1e4520efb 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -305,6 +305,7 @@ # define GLM_IF_CONSTEXPR if constexpr # else # define GLM_IF_CONSTEXPR if +# endif #endif // From a03e1fc8f4178997d1d3c4266a76a8bf17b3adf8 Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 16:53:40 -0700 Subject: [PATCH 11/14] Update setup.hpp --- glm/detail/setup.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 1e4520efb..555c401a6 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -306,6 +306,8 @@ # else # define GLM_IF_CONSTEXPR if # endif +#else +# define GLM_IF_CONSTEXPR if #endif // From fe6c08ea10a5b233f6dc6e4157c455f1aff75c91 Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 17:47:11 -0700 Subject: [PATCH 12/14] Update setup.hpp --- glm/detail/setup.hpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 555c401a6..5f2e71851 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -296,17 +296,19 @@ // #if GLM_HAS_CONSTEXPR # if (GLM_COMPILER & GLM_COMPILER_CLANG ) -# if __has_feature(cxx_if_constexpr) -# define GLM_IF_CONSTEXPR if constexpr -# else -# define GLM_IF_CONSTEXPR if -# endif +# define GLM_HAS_IF_CONSTEXPR __has_feature(cxx_if_constexpr) # elif GLM_LANG_CXX17_FLAG -# define GLM_IF_CONSTEXPR if constexpr +# define GLM_HAS_IF_CONSTEXPR 1 # else -# define GLM_IF_CONSTEXPR if +# define GLM_HAS_IF_CONSTEXPR 0 # endif #else +# define GLM_HAS_IF_CONSTEXPR 0 +#endif + +#if GLM_HAS_IF_CONSTEXPR +# define GLM_IF_CONSTEXPR if constexpr +#else # define GLM_IF_CONSTEXPR if #endif From 2877c42a369cf4f30c0057bff394b6f801b7e288 Mon Sep 17 00:00:00 2001 From: Tim R Date: Sun, 31 Mar 2019 18:00:30 -0700 Subject: [PATCH 13/14] Update setup.hpp --- glm/detail/setup.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 5f2e71851..bde13ba0d 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -295,8 +295,10 @@ // #if GLM_HAS_CONSTEXPR -# if (GLM_COMPILER & GLM_COMPILER_CLANG ) +# if (GLM_COMPILER & GLM_COMPILER_CLANG) # define GLM_HAS_IF_CONSTEXPR __has_feature(cxx_if_constexpr) +# elif (GLM_COMPILER & GLM_COMPILER_GCC) +# define GLM_HAS_IF_CONSTEXPR GLM_COMPILER >= GLM_COMPILER_GCC7 # elif GLM_LANG_CXX17_FLAG # define GLM_HAS_IF_CONSTEXPR 1 # else From f0685972f155df900d81ed759b87c10fb9762a48 Mon Sep 17 00:00:00 2001 From: Tim R Date: Mon, 1 Apr 2019 00:26:04 -0700 Subject: [PATCH 14/14] Update setup.hpp --- glm/detail/setup.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index bde13ba0d..56e6591a6 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -299,7 +299,7 @@ # define GLM_HAS_IF_CONSTEXPR __has_feature(cxx_if_constexpr) # elif (GLM_COMPILER & GLM_COMPILER_GCC) # define GLM_HAS_IF_CONSTEXPR GLM_COMPILER >= GLM_COMPILER_GCC7 -# elif GLM_LANG_CXX17_FLAG +# elif (GLM_LANG & GLM_LANG_CXX17_FLAG) # define GLM_HAS_IF_CONSTEXPR 1 # else # define GLM_HAS_IF_CONSTEXPR 0