From c33f2fa56ae3a6dbabea04b1ce592bebd63c0823 Mon Sep 17 00:00:00 2001 From: christophe Date: Sun, 19 Oct 2025 16:11:45 +0200 Subject: [PATCH] Remove integer C++11 workaround --- glm/detail/func_integer.inl | 20 ----- glm/detail/setup.hpp | 136 +++++++++++++--------------------- glm/detail/type_quat.hpp | 7 +- glm/detail/type_quat.inl | 2 - glm/ext.hpp | 9 +-- glm/ext/scalar_int_sized.hpp | 32 -------- glm/ext/scalar_uint_sized.hpp | 32 -------- glm/fwd.hpp | 12 --- glm/glm.cppm | 2 - glm/gtc/type_precision.hpp | 31 ++------ test/gtx/gtx_range.cpp | 10 --- 11 files changed, 62 insertions(+), 231 deletions(-) diff --git a/glm/detail/func_integer.inl b/glm/detail/func_integer.inl index 7f6f08dc1..94d01d592 100644 --- a/glm/detail/func_integer.inl +++ b/glm/detail/func_integer.inl @@ -7,17 +7,6 @@ #endif//(GLM_ARCH & GLM_ARCH_X86 && GLM_COMPILER & GLM_COMPILER_VC) #include -#if !GLM_HAS_EXTENDED_INTEGER_TYPE -# if GLM_COMPILER & GLM_COMPILER_GCC -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wlong-long" -# endif -# if (GLM_COMPILER & GLM_COMPILER_CLANG) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wc++11-long-long" -# endif -#endif - namespace glm{ namespace detail { @@ -377,15 +366,6 @@ namespace detail } }//namespace glm -#if !GLM_HAS_EXTENDED_INTEGER_TYPE -# if GLM_COMPILER & GLM_COMPILER_GCC -# pragma GCC diagnostic pop -# endif -# if (GLM_COMPILER & GLM_COMPILER_CLANG) -# pragma clang diagnostic pop -# endif -#endif - #if GLM_CONFIG_SIMD == GLM_ENABLE # include "func_integer_simd.inl" #endif diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 6e309355d..49b519fd3 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -144,17 +144,6 @@ /////////////////////////////////////////////////////////////////////////////////// // Has of C++ features -// N1988 -#if GLM_LANG & GLM_LANG_CXX11_FLAG -# define GLM_HAS_EXTENDED_INTEGER_TYPE 1 -#else -# define GLM_HAS_EXTENDED_INTEGER_TYPE (\ - ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC)) || \ - ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CUDA)) || \ - ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG)) || \ - ((GLM_COMPILER & GLM_COMPILER_HIP))) -#endif - // N2672 Initializer lists http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm #if GLM_COMPILER & GLM_COMPILER_CLANG # define GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers) @@ -205,19 +194,6 @@ ((GLM_COMPILER & GLM_COMPILER_HIP)))) #endif -// N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf -#if GLM_COMPILER & GLM_COMPILER_CLANG -# define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions) -#elif GLM_LANG & GLM_LANG_CXX11_FLAG -# define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1 -#else -# define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ - ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ - ((GLM_COMPILER & GLM_COMPILER_CUDA)) || \ - ((GLM_COMPILER & GLM_COMPILER_HIP)))) -#endif - // N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf #if GLM_COMPILER & GLM_COMPILER_CLANG # define GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates) @@ -231,19 +207,6 @@ ((GLM_COMPILER & GLM_COMPILER_HIP)))) #endif -// N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html -#if GLM_COMPILER & GLM_COMPILER_CLANG -# define GLM_HAS_RANGE_FOR __has_feature(cxx_range_for) -#elif GLM_LANG & GLM_LANG_CXX11_FLAG -# define GLM_HAS_RANGE_FOR 1 -#else -# define GLM_HAS_RANGE_FOR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ - ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \ - ((GLM_COMPILER & GLM_COMPILER_VC)) || \ - ((GLM_COMPILER & GLM_COMPILER_CUDA)) || \ - ((GLM_COMPILER & GLM_COMPILER_HIP)))) -#endif - // N2235 Generalized Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf // N3652 Extended Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) // Compiler SIMD intrinsics don't support constexpr... @@ -264,29 +227,6 @@ # define GLM_CONSTEXPR #endif -// -#if GLM_HAS_CONSTEXPR -# if (GLM_COMPILER & GLM_COMPILER_CLANG) -# if __has_feature(cxx_if_constexpr) -# define GLM_HAS_IF_CONSTEXPR 1 -# else -# define GLM_HAS_IF_CONSTEXPR 0 -# endif -# elif (GLM_LANG & GLM_LANG_CXX17_FLAG) -# define GLM_HAS_IF_CONSTEXPR 1 -# else -# 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 - // [nodiscard] #if GLM_LANG & GLM_LANG_CXX17_FLAG # define GLM_NODISCARD [[nodiscard]] @@ -294,16 +234,6 @@ # define GLM_NODISCARD #endif -// -#if GLM_LANG & GLM_LANG_CXX11_FLAG -# define GLM_HAS_MAKE_SIGNED 1 -#else -# define GLM_HAS_MAKE_SIGNED ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ - ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ - ((GLM_COMPILER & GLM_COMPILER_CUDA)) || \ - ((GLM_COMPILER & GLM_COMPILER_HIP)))) -#endif - // #if defined(GLM_FORCE_INTRINSICS) # define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\ @@ -581,9 +511,22 @@ namespace glm /////////////////////////////////////////////////////////////////////////////////// // uint +#include + + namespace glm{ namespace detail { + typedef std::int8_t int8; + typedef std::int16_t int16; + typedef std::int32_t int32; + typedef std::int64_t int64; + + typedef std::uint8_t uint8; + typedef std::uint16_t uint16; + typedef std::uint32_t uint32; + typedef std::uint64_t uint64; + template struct is_int { @@ -591,13 +534,49 @@ namespace detail }; template<> - struct is_int + struct is_int { enum test {value = ~0}; }; template<> - struct is_int + struct is_int + { + enum test {value = ~0}; + }; + + template<> + struct is_int + { + enum test {value = ~0}; + }; + + template<> + struct is_int + { + enum test {value = ~0}; + }; + + template<> + struct is_int + { + enum test {value = ~0}; + }; + + template<> + struct is_int + { + enum test {value = ~0}; + }; + + template<> + struct is_int + { + enum test {value = ~0}; + }; + + template<> + struct is_int { enum test {value = ~0}; }; @@ -606,19 +585,6 @@ namespace detail typedef unsigned int uint; }//namespace glm -/////////////////////////////////////////////////////////////////////////////////// -// 64-bit int - -#include - -namespace glm{ -namespace detail -{ - typedef std::uint64_t uint64; - typedef std::int64_t int64; -}//namespace detail -}//namespace glm - /////////////////////////////////////////////////////////////////////////////////// // Only use x, y, z, w as vector type components diff --git a/glm/detail/type_quat.hpp b/glm/detail/type_quat.hpp index 1b41e1560..a1ac36ff7 100644 --- a/glm/detail/type_quat.hpp +++ b/glm/detail/type_quat.hpp @@ -92,11 +92,8 @@ namespace glm template GLM_CTOR_DECL GLM_EXPLICIT qua(qua const& q); - /// Explicit conversion operators -# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS - GLM_FUNC_DECL explicit operator mat<3, 3, T, Q>() const; - GLM_FUNC_DECL explicit operator mat<4, 4, T, Q>() const; -# endif + GLM_FUNC_DECL explicit operator mat<3, 3, T, Q>() const; + GLM_FUNC_DECL explicit operator mat<4, 4, T, Q>() const; /// Create a quaternion from two normalized axis /// diff --git a/glm/detail/type_quat.inl b/glm/detail/type_quat.inl index 6a8f9871b..3cc43a6af 100644 --- a/glm/detail/type_quat.inl +++ b/glm/detail/type_quat.inl @@ -240,7 +240,6 @@ namespace detail *this = quat_cast(m); } -# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS template GLM_FUNC_QUALIFIER qua::operator mat<3, 3, T, Q>() const { @@ -252,7 +251,6 @@ namespace detail { return mat4_cast(*this); } -# endif//GLM_HAS_EXPLICIT_CONVERSION_OPERATORS // -- Unary arithmetic operators -- diff --git a/glm/ext.hpp b/glm/ext.hpp index 4356dbacf..5800c0b22 100644 --- a/glm/ext.hpp +++ b/glm/ext.hpp @@ -214,11 +214,7 @@ #include "./gtx/functions.hpp" #include "./gtx/gradient_paint.hpp" #include "./gtx/handed_coordinate_space.hpp" - -#if __cplusplus >= 201103L #include "./gtx/hash.hpp" -#endif - #include "./gtx/integer.hpp" #include "./gtx/intersect.hpp" #include "./gtx/io.hpp" @@ -260,8 +256,5 @@ #if GLM_HAS_TEMPLATE_ALIASES # include "./gtx/scalar_multiplication.hpp" #endif - -#if GLM_HAS_RANGE_FOR -# include "./gtx/range.hpp" -#endif +#include "./gtx/range.hpp" #endif//GLM_ENABLE_EXPERIMENTAL diff --git a/glm/ext/scalar_int_sized.hpp b/glm/ext/scalar_int_sized.hpp index 8e9c511c9..f781bee66 100644 --- a/glm/ext/scalar_int_sized.hpp +++ b/glm/ext/scalar_int_sized.hpp @@ -19,38 +19,6 @@ #endif namespace glm{ -namespace detail -{ -# if GLM_HAS_EXTENDED_INTEGER_TYPE - typedef std::int8_t int8; - typedef std::int16_t int16; - typedef std::int32_t int32; -# else - typedef signed char int8; - typedef signed short int16; - typedef signed int int32; -#endif// - - template<> - struct is_int - { - enum test {value = ~0}; - }; - - template<> - struct is_int - { - enum test {value = ~0}; - }; - - template<> - struct is_int - { - enum test {value = ~0}; - }; -}//namespace detail - - /// @addtogroup ext_scalar_int_sized /// @{ diff --git a/glm/ext/scalar_uint_sized.hpp b/glm/ext/scalar_uint_sized.hpp index fd5267fad..305c9ddaf 100644 --- a/glm/ext/scalar_uint_sized.hpp +++ b/glm/ext/scalar_uint_sized.hpp @@ -19,38 +19,6 @@ #endif namespace glm{ -namespace detail -{ -# if GLM_HAS_EXTENDED_INTEGER_TYPE - typedef std::uint8_t uint8; - typedef std::uint16_t uint16; - typedef std::uint32_t uint32; -# else - typedef unsigned char uint8; - typedef unsigned short uint16; - typedef unsigned int uint32; -#endif - - template<> - struct is_int - { - enum test {value = ~0}; - }; - - template<> - struct is_int - { - enum test {value = ~0}; - }; - - template<> - struct is_int - { - enum test {value = ~0}; - }; -}//namespace detail - - /// @addtogroup ext_scalar_uint_sized /// @{ diff --git a/glm/fwd.hpp b/glm/fwd.hpp index 9c2e5eafa..aac882f22 100644 --- a/glm/fwd.hpp +++ b/glm/fwd.hpp @@ -4,7 +4,6 @@ namespace glm { -#if GLM_HAS_EXTENDED_INTEGER_TYPE typedef std::int8_t int8; typedef std::int16_t int16; typedef std::int32_t int32; @@ -14,17 +13,6 @@ namespace glm typedef std::uint16_t uint16; typedef std::uint32_t uint32; typedef std::uint64_t uint64; -#else - typedef signed char int8; - typedef signed short int16; - typedef signed int int32; - typedef detail::int64 int64; - - typedef unsigned char uint8; - typedef unsigned short uint16; - typedef unsigned int uint32; - typedef detail::uint64 uint64; -#endif // Scalar int diff --git a/glm/glm.cppm b/glm/glm.cppm index e468f410a..94f86f913 100644 --- a/glm/glm.cppm +++ b/glm/glm.cppm @@ -2214,11 +2214,9 @@ export namespace glm { using glm::operator*; using glm::operator/; # endif -# if GLM_HAS_RANGE_FOR using glm::components; using glm::begin; using glm::end; -# endif using glm::abs; using glm::acos; diff --git a/glm/gtc/type_precision.hpp b/glm/gtc/type_precision.hpp index 775e2f484..1f4e21299 100644 --- a/glm/gtc/type_precision.hpp +++ b/glm/gtc/type_precision.hpp @@ -195,29 +195,21 @@ namespace glm /// @see gtc_type_precision typedef detail::int64 highp_i64; - -#if GLM_HAS_EXTENDED_INTEGER_TYPE - using std::int8_t; - using std::int16_t; - using std::int32_t; - using std::int64_t; -#else /// 8 bit signed integer type. /// @see gtc_type_precision - typedef detail::int8 int8_t; + using std::int8_t; /// 16 bit signed integer type. /// @see gtc_type_precision - typedef detail::int16 int16_t; + using std::int16_t; /// 32 bit signed integer type. /// @see gtc_type_precision - typedef detail::int32 int32_t; + using std::int32_t; /// 64 bit signed integer type. /// @see gtc_type_precision - typedef detail::int64 int64_t; -#endif + using std::int64_t; /// 8 bit signed integer type. /// @see gtc_type_precision @@ -382,28 +374,21 @@ namespace glm /// @see gtc_type_precision typedef detail::uint64 highp_u64; -#if GLM_HAS_EXTENDED_INTEGER_TYPE - using std::uint8_t; - using std::uint16_t; - using std::uint32_t; - using std::uint64_t; -#else /// Default qualifier 8 bit unsigned integer type. /// @see gtc_type_precision - typedef detail::uint8 uint8_t; + using std::uint8_t; /// Default qualifier 16 bit unsigned integer type. /// @see gtc_type_precision - typedef detail::uint16 uint16_t; + using std::uint16_t; /// Default qualifier 32 bit unsigned integer type. /// @see gtc_type_precision - typedef detail::uint32 uint32_t; + using std::uint32_t; /// Default qualifier 64 bit unsigned integer type. /// @see gtc_type_precision - typedef detail::uint64 uint64_t; -#endif + using std::uint64_t; /// Default qualifier 8 bit unsigned integer type. /// @see gtc_type_precision diff --git a/test/gtx/gtx_range.cpp b/test/gtx/gtx_range.cpp index 03523e90d..43ccf3f00 100644 --- a/test/gtx/gtx_range.cpp +++ b/test/gtx/gtx_range.cpp @@ -3,8 +3,6 @@ #include #include -#if GLM_HAS_RANGE_FOR - #define GLM_ENABLE_EXPERIMENTAL #include @@ -73,11 +71,3 @@ int main() return Error; } -#else - -int main() -{ - return 0; -} - -#endif//GLM_HAS_RANGE_FOR