[libc++] Make variables in templates inline (#115785)

The variables are all `constexpr`, which implies `inline`. Since they
aren't `constexpr` in C++03 they're also not `inline` there. Because of
that we define them out-of-line currently. Instead we can use the C++17
extension of `inline` variables, which results in the same weak
definitions of the variables but without having all the boilerplate.
This commit is contained in:
Nikolas Klauser 2024-11-13 11:57:16 +01:00 committed by GitHub
parent 889b3c9487
commit b69ddbc628
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 64 additions and 474 deletions

View File

@ -43,8 +43,8 @@ public:
typedef typename _Engine::result_type result_type; typedef typename _Engine::result_type result_type;
// engine characteristics // engine characteristics
static _LIBCPP_CONSTEXPR const size_t block_size = __p; static inline _LIBCPP_CONSTEXPR const size_t block_size = __p;
static _LIBCPP_CONSTEXPR const size_t used_block = __r; static inline _LIBCPP_CONSTEXPR const size_t used_block = __r;
#ifdef _LIBCPP_CXX03_LANG #ifdef _LIBCPP_CXX03_LANG
static const result_type _Min = _Engine::_Min; static const result_type _Min = _Engine::_Min;
@ -110,12 +110,6 @@ public:
operator>>(basic_istream<_CharT, _Traits>& __is, discard_block_engine<_Eng, _Pp, _Rp>& __x); operator>>(basic_istream<_CharT, _Traits>& __is, discard_block_engine<_Eng, _Pp, _Rp>& __x);
}; };
template <class _Engine, size_t __p, size_t __r>
_LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::block_size;
template <class _Engine, size_t __p, size_t __r>
_LIBCPP_CONSTEXPR const size_t discard_block_engine<_Engine, __p, __r>::used_block;
template <class _Engine, size_t __p, size_t __r> template <class _Engine, size_t __p, size_t __r>
typename discard_block_engine<_Engine, __p, __r>::result_type discard_block_engine<_Engine, __p, __r>::operator()() { typename discard_block_engine<_Engine, __p, __r>::result_type discard_block_engine<_Engine, __p, __r>::operator()() {
if (__n_ >= static_cast<int>(__r)) { if (__n_ >= static_cast<int>(__r)) {

View File

@ -251,12 +251,12 @@ public:
static_assert(_Min < _Max, "linear_congruential_engine invalid parameters"); static_assert(_Min < _Max, "linear_congruential_engine invalid parameters");
// engine characteristics // engine characteristics
static _LIBCPP_CONSTEXPR const result_type multiplier = __a; static inline _LIBCPP_CONSTEXPR const result_type multiplier = __a;
static _LIBCPP_CONSTEXPR const result_type increment = __c; static inline _LIBCPP_CONSTEXPR const result_type increment = __c;
static _LIBCPP_CONSTEXPR const result_type modulus = __m; static inline _LIBCPP_CONSTEXPR const result_type modulus = __m;
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
static _LIBCPP_CONSTEXPR const result_type default_seed = 1u; static inline _LIBCPP_CONSTEXPR const result_type default_seed = 1u;
// constructors and seeding functions // constructors and seeding functions
#ifndef _LIBCPP_CXX03_LANG #ifndef _LIBCPP_CXX03_LANG
@ -318,22 +318,6 @@ private:
operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x); operator>>(basic_istream<_CharT, _Traits>& __is, linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
}; };
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::increment;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::modulus;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
_LIBCPP_CONSTEXPR const typename linear_congruential_engine<_UIntType, __a, __c, __m>::result_type
linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed;
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m> template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
template <class _Sseq> template <class _Sseq>
void linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q, integral_constant<unsigned, 1>) { void linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q, integral_constant<unsigned, 1>) {

View File

@ -166,22 +166,22 @@ public:
static_assert(__f <= _Max, "mersenne_twister_engine invalid parameters"); static_assert(__f <= _Max, "mersenne_twister_engine invalid parameters");
// engine characteristics // engine characteristics
static _LIBCPP_CONSTEXPR const size_t word_size = __w; static inline _LIBCPP_CONSTEXPR const size_t word_size = __w;
static _LIBCPP_CONSTEXPR const size_t state_size = __n; static inline _LIBCPP_CONSTEXPR const size_t state_size = __n;
static _LIBCPP_CONSTEXPR const size_t shift_size = __m; static inline _LIBCPP_CONSTEXPR const size_t shift_size = __m;
static _LIBCPP_CONSTEXPR const size_t mask_bits = __r; static inline _LIBCPP_CONSTEXPR const size_t mask_bits = __r;
static _LIBCPP_CONSTEXPR const result_type xor_mask = __a; static inline _LIBCPP_CONSTEXPR const result_type xor_mask = __a;
static _LIBCPP_CONSTEXPR const size_t tempering_u = __u; static inline _LIBCPP_CONSTEXPR const size_t tempering_u = __u;
static _LIBCPP_CONSTEXPR const result_type tempering_d = __d; static inline _LIBCPP_CONSTEXPR const result_type tempering_d = __d;
static _LIBCPP_CONSTEXPR const size_t tempering_s = __s; static inline _LIBCPP_CONSTEXPR const size_t tempering_s = __s;
static _LIBCPP_CONSTEXPR const result_type tempering_b = __b; static inline _LIBCPP_CONSTEXPR const result_type tempering_b = __b;
static _LIBCPP_CONSTEXPR const size_t tempering_t = __t; static inline _LIBCPP_CONSTEXPR const size_t tempering_t = __t;
static _LIBCPP_CONSTEXPR const result_type tempering_c = __c; static inline _LIBCPP_CONSTEXPR const result_type tempering_c = __c;
static _LIBCPP_CONSTEXPR const size_t tempering_l = __l; static inline _LIBCPP_CONSTEXPR const size_t tempering_l = __l;
static _LIBCPP_CONSTEXPR const result_type initialization_multiplier = __f; static inline _LIBCPP_CONSTEXPR const result_type initialization_multiplier = __f;
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
static _LIBCPP_CONSTEXPR const result_type default_seed = 5489u; static inline _LIBCPP_CONSTEXPR const result_type default_seed = 5489u;
// constructors and seeding functions // constructors and seeding functions
#ifndef _LIBCPP_CXX03_LANG #ifndef _LIBCPP_CXX03_LANG
@ -310,329 +310,6 @@ private:
} }
}; };
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::word_size;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::state_size;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::shift_size;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mask_bits;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
_UIntType,
__w,
__n,
__m,
__r,
__a,
__u,
__d,
__s,
__b,
__t,
__c,
__l,
__f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::xor_mask;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_u;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
_UIntType,
__w,
__n,
__m,
__r,
__a,
__u,
__d,
__s,
__b,
__t,
__c,
__l,
__f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_d;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_s;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
_UIntType,
__w,
__n,
__m,
__r,
__a,
__u,
__d,
__s,
__b,
__t,
__c,
__l,
__f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_b;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_t;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
_UIntType,
__w,
__n,
__m,
__r,
__a,
__u,
__d,
__s,
__b,
__t,
__c,
__l,
__f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_c;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const size_t
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::tempering_l;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
_UIntType,
__w,
__n,
__m,
__r,
__a,
__u,
__d,
__s,
__b,
__t,
__c,
__l,
__f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::
initialization_multiplier;
template <class _UIntType,
size_t __w,
size_t __n,
size_t __m,
size_t __r,
_UIntType __a,
size_t __u,
_UIntType __d,
size_t __s,
_UIntType __b,
size_t __t,
_UIntType __c,
size_t __l,
_UIntType __f>
_LIBCPP_CONSTEXPR const typename mersenne_twister_engine<
_UIntType,
__w,
__n,
__m,
__r,
__a,
__u,
__d,
__s,
__b,
__t,
__c,
__l,
__f>::result_type
mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::default_seed;
template <class _UIntType, template <class _UIntType,
size_t __w, size_t __w,
size_t __n, size_t __n,

View File

@ -66,7 +66,7 @@ private:
public: public:
// engine characteristics // engine characteristics
static _LIBCPP_CONSTEXPR const size_t table_size = __k; static inline _LIBCPP_CONSTEXPR const size_t table_size = __k;
#ifdef _LIBCPP_CXX03_LANG #ifdef _LIBCPP_CXX03_LANG
static const result_type _Min = _Engine::_Min; static const result_type _Min = _Engine::_Min;
@ -173,9 +173,6 @@ private:
} }
}; };
template <class _Engine, size_t __k>
_LIBCPP_CONSTEXPR const size_t shuffle_order_engine<_Engine, __k>::table_size;
template <class _Eng, size_t _Kp> template <class _Eng, size_t _Kp>
_LIBCPP_HIDE_FROM_ABI bool _LIBCPP_HIDE_FROM_ABI bool
operator==(const shuffle_order_engine<_Eng, _Kp>& __x, const shuffle_order_engine<_Eng, _Kp>& __y) { operator==(const shuffle_order_engine<_Eng, _Kp>& __x, const shuffle_order_engine<_Eng, _Kp>& __y) {

View File

@ -72,12 +72,12 @@ public:
static_assert(_Min < _Max, "subtract_with_carry_engine invalid parameters"); static_assert(_Min < _Max, "subtract_with_carry_engine invalid parameters");
// engine characteristics // engine characteristics
static _LIBCPP_CONSTEXPR const size_t word_size = __w; static inline _LIBCPP_CONSTEXPR const size_t word_size = __w;
static _LIBCPP_CONSTEXPR const size_t short_lag = __s; static inline _LIBCPP_CONSTEXPR const size_t short_lag = __s;
static _LIBCPP_CONSTEXPR const size_t long_lag = __r; static inline _LIBCPP_CONSTEXPR const size_t long_lag = __r;
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; } _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type min() { return _Min; }
_LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; } _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR result_type max() { return _Max; }
static _LIBCPP_CONSTEXPR const result_type default_seed = 19780503u; static inline _LIBCPP_CONSTEXPR const result_type default_seed = 19780503u;
// constructors and seeding functions // constructors and seeding functions
#ifndef _LIBCPP_CXX03_LANG #ifndef _LIBCPP_CXX03_LANG
@ -130,19 +130,6 @@ private:
_LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>); _LIBCPP_HIDE_FROM_ABI void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
}; };
template <class _UIntType, size_t __w, size_t __s, size_t __r>
_LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
template <class _UIntType, size_t __w, size_t __s, size_t __r>
_LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
template <class _UIntType, size_t __w, size_t __s, size_t __r>
_LIBCPP_CONSTEXPR const size_t subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
template <class _UIntType, size_t __w, size_t __s, size_t __r>
_LIBCPP_CONSTEXPR const typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::result_type
subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed;
template <class _UIntType, size_t __w, size_t __s, size_t __r> template <class _UIntType, size_t __w, size_t __s, size_t __r>
void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, integral_constant<unsigned, 1>) { void subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd, integral_constant<unsigned, 1>) {
linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd); linear_congruential_engine<result_type, 40014u, 0u, 2147483563u> __e(__sd == 0u ? default_seed : __sd);

View File

@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, _Tp __v> template <class _Tp, _Tp __v>
struct _LIBCPP_TEMPLATE_VIS integral_constant { struct _LIBCPP_TEMPLATE_VIS integral_constant {
static _LIBCPP_CONSTEXPR const _Tp value = __v; static inline _LIBCPP_CONSTEXPR const _Tp value = __v;
typedef _Tp value_type; typedef _Tp value_type;
typedef integral_constant type; typedef integral_constant type;
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT { return value; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT { return value; }
@ -28,9 +28,6 @@ struct _LIBCPP_TEMPLATE_VIS integral_constant {
#endif #endif
}; };
template <class _Tp, _Tp __v>
_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
typedef integral_constant<bool, true> true_type; typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type; typedef integral_constant<bool, false> false_type;

View File

@ -166,8 +166,6 @@ template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS __unique_typeinfo { struct _LIBCPP_TEMPLATE_VIS __unique_typeinfo {
static constexpr int __id = 0; static constexpr int __id = 0;
}; };
template <class _Tp>
constexpr int __unique_typeinfo<_Tp>::__id;
template <class _Tp> template <class _Tp>
inline _LIBCPP_HIDE_FROM_ABI constexpr const void* __get_fallback_typeid() { inline _LIBCPP_HIDE_FROM_ABI constexpr const void* __get_fallback_typeid() {

View File

@ -464,18 +464,18 @@ class _LIBCPP_TEMPLATE_VIS numeric_limits : private __libcpp_numeric_limits<_Tp>
typedef typename __base::type type; typedef typename __base::type type;
public: public:
static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized; static inline _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); } [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return __base::min(); }
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); } [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return __base::max(); }
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); } [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return __base::lowest(); }
static _LIBCPP_CONSTEXPR const int digits = __base::digits; static inline _LIBCPP_CONSTEXPR const int digits = __base::digits;
static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10; static inline _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10; static inline _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed; static inline _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer; static inline _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact; static inline _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
static _LIBCPP_CONSTEXPR const int radix = __base::radix; static inline _LIBCPP_CONSTEXPR const int radix = __base::radix;
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT { [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {
return __base::epsilon(); return __base::epsilon();
} }
@ -483,17 +483,17 @@ public:
return __base::round_error(); return __base::round_error();
} }
static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent; static inline _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10; static inline _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent; static inline _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10; static inline _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity; static inline _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN; static inline _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN; static inline _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
_LIBCPP_SUPPRESS_DEPRECATED_PUSH _LIBCPP_SUPPRESS_DEPRECATED_PUSH
static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm; static inline _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
static _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss; static inline _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
_LIBCPP_SUPPRESS_DEPRECATED_POP _LIBCPP_SUPPRESS_DEPRECATED_POP
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT { [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {
return __base::infinity(); return __base::infinity();
@ -508,62 +508,15 @@ public:
return __base::denorm_min(); return __base::denorm_min();
} }
static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559; static inline _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded; static inline _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo; static inline _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
static _LIBCPP_CONSTEXPR const bool traps = __base::traps; static inline _LIBCPP_CONSTEXPR const bool traps = __base::traps;
static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before; static inline _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style; static inline _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
}; };
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_specialized;
template <class _Tp>
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits;
template <class _Tp>
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits10;
template <class _Tp>
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_digits10;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_signed;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_integer;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_exact;
template <class _Tp>
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::radix;
template <class _Tp>
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent;
template <class _Tp>
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent10;
template <class _Tp>
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent;
template <class _Tp>
_LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent10;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_infinity;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_quiet_NaN;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_signaling_NaN;
template <class _Tp>
_LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<_Tp>::has_denorm;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_denorm_loss;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_iec559;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_bounded;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_modulo;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::traps;
template <class _Tp>
_LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::tinyness_before;
template <class _Tp>
_LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style;
template <class _Tp> template <class _Tp>
class _LIBCPP_TEMPLATE_VIS numeric_limits<const _Tp> : public numeric_limits<_Tp> {}; class _LIBCPP_TEMPLATE_VIS numeric_limits<const _Tp> : public numeric_limits<_Tp> {};

View File

@ -236,18 +236,12 @@ class _LIBCPP_TEMPLATE_VIS ratio {
static _LIBCPP_CONSTEXPR const intmax_t __gcd = __static_gcd<__na, __da>; static _LIBCPP_CONSTEXPR const intmax_t __gcd = __static_gcd<__na, __da>;
public: public:
static _LIBCPP_CONSTEXPR const intmax_t num = __s * __na / __gcd; static inline _LIBCPP_CONSTEXPR const intmax_t num = __s * __na / __gcd;
static _LIBCPP_CONSTEXPR const intmax_t den = __da / __gcd; static inline _LIBCPP_CONSTEXPR const intmax_t den = __da / __gcd;
typedef ratio<num, den> type; typedef ratio<num, den> type;
}; };
template <intmax_t _Num, intmax_t _Den>
_LIBCPP_CONSTEXPR const intmax_t ratio<_Num, _Den>::num;
template <intmax_t _Num, intmax_t _Den>
_LIBCPP_CONSTEXPR const intmax_t ratio<_Num, _Den>::den;
template <class _Tp> template <class _Tp>
inline const bool __is_ratio_v = false; inline const bool __is_ratio_v = false;

View File

@ -134,7 +134,10 @@ static system_clock::time_point __libcpp_system_clock_now() {
#endif #endif
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated")
const bool system_clock::is_steady; const bool system_clock::is_steady;
_LIBCPP_DIAGNOSTIC_POP
system_clock::time_point system_clock::now() noexcept { return __libcpp_system_clock_now(); } system_clock::time_point system_clock::now() noexcept { return __libcpp_system_clock_now(); }
@ -226,7 +229,10 @@ static steady_clock::time_point __libcpp_steady_clock_now() {
# error "Monotonic clock not implemented on this platform" # error "Monotonic clock not implemented on this platform"
# endif # endif
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated")
const bool steady_clock::is_steady; const bool steady_clock::is_steady;
_LIBCPP_DIAGNOSTIC_POP
steady_clock::time_point steady_clock::now() noexcept { return __libcpp_steady_clock_now(); } steady_clock::time_point steady_clock::now() noexcept { return __libcpp_steady_clock_now(); }

View File

@ -36,7 +36,10 @@
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated")
const bool _FilesystemClock::is_steady; const bool _FilesystemClock::is_steady;
_LIBCPP_DIAGNOSTIC_POP
_FilesystemClock::time_point _FilesystemClock::now() noexcept { _FilesystemClock::time_point _FilesystemClock::now() noexcept {
typedef chrono::duration<rep> __secs; typedef chrono::duration<rep> __secs;

View File

@ -24,7 +24,10 @@ using parser::string_view_t;
// path definitions // path definitions
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated")
constexpr path::value_type path::preferred_separator; constexpr path::value_type path::preferred_separator;
_LIBCPP_DIAGNOSTIC_POP
path& path::replace_extension(path const& replacement) { path& path::replace_extension(path const& replacement) {
path p = extension(); path p = extension();

View File

@ -28,10 +28,6 @@
using namespace itanium_demangle; using namespace itanium_demangle;
constexpr const char *itanium_demangle::FloatData<float>::spec;
constexpr const char *itanium_demangle::FloatData<double>::spec;
constexpr const char *itanium_demangle::FloatData<long double>::spec;
// <discriminator> := _ <non-negative number> # when number < 10 // <discriminator> := _ <non-negative number> # when number < 10
// := __ <non-negative number> _ # when number >= 10 // := __ <non-negative number> _ # when number >= 10
// extension := decimal-digit+ # at the end of string // extension := decimal-digit+ # at the end of string

View File

@ -24,6 +24,7 @@ function(cxx_add_warning_flags target enable_werror enable_pedantic)
-Wunused-template -Wunused-template
-Wformat-nonliteral -Wformat-nonliteral
-Wzero-length-array -Wzero-length-array
-Wdeprecated-redundant-constexpr-static-def
) )
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")