Use different qualifiers for default function and constructor

So it is more robust against user configuration to force constructor initialisation
This commit is contained in:
Stephen Xu 2023-03-21 19:06:17 +00:00
parent 140e7cf1b2
commit 91c9409959
No known key found for this signature in database
GPG Key ID: F7A92E1474FAB7BF
29 changed files with 39 additions and 31 deletions

View File

@ -479,13 +479,21 @@
#define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL
#define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE
#if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
// Do not use CUDA function qualifiers on CUDA compiler when functions are made default
#if GLM_HAS_DEFAULTED_FUNCTIONS
# define GLM_DEFAULTED_FUNC_DECL
# define GLM_DEFAULTED_FUNC_QUALIFIER
# define GLM_DEFAULTED_FUNC_QUALIFIER GLM_INLINE
#else
# define GLM_DEFAULTED_FUNC_DECL GLM_FUNC_DECL
# define GLM_DEFAULTED_FUNC_QUALIFIER GLM_FUNC_QUALIFIER
#endif//GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
#endif//GLM_HAS_DEFAULTED_FUNCTIONS
#if !defined(GLM_FORCE_CTOR_INIT)
# define GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_DEFAULTED_FUNC_DECL
# define GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_DEFAULTED_FUNC_QUALIFIER
#else
# define GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_FUNC_DECL
# define GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_FUNC_QUALIFIER
#endif//GLM_FORCE_CTOR_INIT
///////////////////////////////////////////////////////////////////////////////////
// Swizzle operators

View File

@ -32,7 +32,7 @@ namespace glm
// -- Constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<2, 2, T, P> const& m);

View File

@ -6,7 +6,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>::mat()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR mat<2, 2, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST
: value{col_type(1, 0), col_type(0, 1)}
# endif

View File

@ -33,7 +33,7 @@ namespace glm
// -- Constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<2, 3, T, P> const& m);

View File

@ -4,7 +4,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q>::mat()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR mat<2, 3, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST
: value{col_type(1, 0, 0), col_type(0, 1, 0)}
# endif

View File

@ -33,7 +33,7 @@ namespace glm
// -- Constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<2, 4, T, P> const& m);

View File

@ -4,7 +4,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q>::mat()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR mat<2, 4, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST
: value{col_type(1, 0, 0, 0), col_type(0, 1, 0, 0)}
# endif

View File

@ -33,7 +33,7 @@ namespace glm
// -- Constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<3, 2, T, P> const& m);

View File

@ -4,7 +4,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR mat<3, 2, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST
: value{col_type(1, 0), col_type(0, 1), col_type(0, 0)}
# endif

View File

@ -32,7 +32,7 @@ namespace glm
// -- Constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<3, 3, T, P> const& m);

View File

@ -6,7 +6,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q>::mat()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR mat<3, 3, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST
: value{col_type(1, 0, 0), col_type(0, 1, 0), col_type(0, 0, 1)}
# endif

View File

@ -33,7 +33,7 @@ namespace glm
// -- Constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<3, 4, T, P> const& m);

View File

@ -4,7 +4,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q>::mat()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR mat<3, 4, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST
: value{col_type(1, 0, 0, 0), col_type(0, 1, 0, 0), col_type(0, 0, 1, 0)}
# endif

View File

@ -33,7 +33,7 @@ namespace glm
// -- Constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 2, T, P> const& m);

View File

@ -4,7 +4,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q>::mat()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR mat<4, 2, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST
: value{col_type(1, 0), col_type(0, 1), col_type(0, 0), col_type(0, 0)}
# endif

View File

@ -33,7 +33,7 @@ namespace glm
// -- Constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 3, T, P> const& m);

View File

@ -4,7 +4,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q>::mat()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR mat<4, 3, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST
: value{col_type(1, 0, 0), col_type(0, 1, 0), col_type(0, 0, 1), col_type(0, 0, 0)}
# endif

View File

@ -32,7 +32,7 @@ namespace glm
// -- Constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 4, T, P> const& m);

View File

@ -6,7 +6,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q>::mat()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR mat<4, 4, T, Q>::mat()
# if GLM_CONFIG_CTOR_INIT == GLM_CTOR_INITIALIZER_LIST
: value{col_type(1, 0, 0, 0), col_type(0, 1, 0, 0), col_type(0, 0, 1, 0), col_type(0, 0, 0, 1)}
# endif

View File

@ -80,7 +80,7 @@ namespace glm
// -- Implicit basic constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR qua() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR qua() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR qua(qua<T, Q> const& q) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR qua(qua<T, P> const& q);

View File

@ -97,7 +97,7 @@ namespace detail
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR qua<T, Q>::qua()
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
# ifdef GLM_FORCE_QUAT_DATA_XYZW
: x(0), y(0), z(0), w(1)

View File

@ -92,7 +92,7 @@ namespace glm
// -- Implicit basic constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR vec() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, T, P> const& v);

View File

@ -8,7 +8,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR vec<1, T, Q>::vec()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR vec<1, T, Q>::vec()
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0)
# endif

View File

@ -94,7 +94,7 @@ namespace glm
// -- Implicit basic constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR vec() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, T, P> const& v);

View File

@ -8,7 +8,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q>::vec()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR vec<2, T, Q>::vec()
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0), y(0)
# endif

View File

@ -98,7 +98,7 @@ namespace glm
// -- Implicit basic constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR vec() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<3, T, P> const& v);

View File

@ -8,7 +8,7 @@ namespace glm
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, T, Q>::vec()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR vec<3, T, Q>::vec()
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0), y(0), z(0)
# endif

View File

@ -97,7 +97,7 @@ namespace glm
// -- Implicit basic constructors --
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR vec() GLM_DEFAULT_CTOR;
GLM_DEFAULTED_FUNC_DECL GLM_CONSTEXPR vec(vec<4, T, Q> const& v) GLM_DEFAULT;
template<qualifier P>
GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<4, T, P> const& v);

View File

@ -131,7 +131,7 @@ namespace detail
# if GLM_CONFIG_DEFAULTED_DEFAULT_CTOR == GLM_DISABLE
template<typename T, qualifier Q>
GLM_DEFAULTED_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, T, Q>::vec()
GLM_DEFAULTED_DEFAULT_CTOR_QUALIFIER GLM_CONSTEXPR vec<4, T, Q>::vec()
# if GLM_CONFIG_CTOR_INIT != GLM_CTOR_INIT_DISABLE
: x(0), y(0), z(0), w(0)
# endif