From 447d22103a051715d4dccfdec6f1f329ce31197d Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Tue, 3 Sep 2024 17:21:04 -0700 Subject: [PATCH 1/5] try to silence warnings from apple-clang --- include/meta/meta.hpp | 4 ---- include/range/v3/iterator/diffmax_t.hpp | 27 ----------------------- include/range/v3/utility/static_const.hpp | 5 ----- 3 files changed, 36 deletions(-) diff --git a/include/meta/meta.hpp b/include/meta/meta.hpp index 6b13d9f512..9de86d6043 100644 --- a/include/meta/meta.hpp +++ b/include/meta/meta.hpp @@ -2837,10 +2837,6 @@ namespace meta { static constexpr T value{}; }; - - // Avoid potential ODR violations with global objects: - template - constexpr T static_const::value; } // namespace detail ///\endcond diff --git a/include/range/v3/iterator/diffmax_t.hpp b/include/range/v3/iterator/diffmax_t.hpp index a08ef3f72a..2578374fcb 100644 --- a/include/range/v3/iterator/diffmax_t.hpp +++ b/include/range/v3/iterator/diffmax_t.hpp @@ -433,33 +433,6 @@ namespace std struct numeric_limits<::ranges::detail::diffmax_t const volatile> : numeric_limits<::ranges::detail::diffmax_t> {}; - -#if RANGES_CXX_INLINE_VARIABLES >= RANGES_CXX_INLINE_VARIABLES_17 - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_specialized; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_signed; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_integer; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_exact; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_infinity; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_quiet_NaN; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_signaling_NaN; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_denorm; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_denorm_loss; - inline constexpr std::float_round_style - numeric_limits<::ranges::detail::diffmax_t>::round_style; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_iec559; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_bounded; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_modulo; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::digits; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::digits10; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::max_digits10; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::radix; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::min_exponent; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::min_exponent10; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::max_exponent; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::max_exponent10; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::traps; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::tinyness_before; -#endif } // namespace std /// \endcond diff --git a/include/range/v3/utility/static_const.hpp b/include/range/v3/utility/static_const.hpp index 690a142851..e96a573355 100644 --- a/include/range/v3/utility/static_const.hpp +++ b/include/range/v3/utility/static_const.hpp @@ -22,11 +22,6 @@ namespace ranges { static constexpr T value{}; }; - - /// \ingroup group-utility - /// \sa `static_const` - template - constexpr T static_const::value; } // namespace ranges #endif From fcab61623909408dea8cd1f7260af8c9823ae4f3 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Tue, 3 Sep 2024 17:25:16 -0700 Subject: [PATCH 2/5] Revert "try to silence warnings from apple-clang" This reverts commit 447d22103a051715d4dccfdec6f1f329ce31197d. --- include/meta/meta.hpp | 4 ++++ include/range/v3/iterator/diffmax_t.hpp | 27 +++++++++++++++++++++++ include/range/v3/utility/static_const.hpp | 5 +++++ 3 files changed, 36 insertions(+) diff --git a/include/meta/meta.hpp b/include/meta/meta.hpp index 9de86d6043..6b13d9f512 100644 --- a/include/meta/meta.hpp +++ b/include/meta/meta.hpp @@ -2837,6 +2837,10 @@ namespace meta { static constexpr T value{}; }; + + // Avoid potential ODR violations with global objects: + template + constexpr T static_const::value; } // namespace detail ///\endcond diff --git a/include/range/v3/iterator/diffmax_t.hpp b/include/range/v3/iterator/diffmax_t.hpp index 2578374fcb..a08ef3f72a 100644 --- a/include/range/v3/iterator/diffmax_t.hpp +++ b/include/range/v3/iterator/diffmax_t.hpp @@ -433,6 +433,33 @@ namespace std struct numeric_limits<::ranges::detail::diffmax_t const volatile> : numeric_limits<::ranges::detail::diffmax_t> {}; + +#if RANGES_CXX_INLINE_VARIABLES >= RANGES_CXX_INLINE_VARIABLES_17 + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_specialized; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_signed; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_integer; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_exact; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_infinity; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_quiet_NaN; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_signaling_NaN; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_denorm; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_denorm_loss; + inline constexpr std::float_round_style + numeric_limits<::ranges::detail::diffmax_t>::round_style; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_iec559; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_bounded; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_modulo; + inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::digits; + inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::digits10; + inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::max_digits10; + inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::radix; + inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::min_exponent; + inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::min_exponent10; + inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::max_exponent; + inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::max_exponent10; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::traps; + inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::tinyness_before; +#endif } // namespace std /// \endcond diff --git a/include/range/v3/utility/static_const.hpp b/include/range/v3/utility/static_const.hpp index e96a573355..690a142851 100644 --- a/include/range/v3/utility/static_const.hpp +++ b/include/range/v3/utility/static_const.hpp @@ -22,6 +22,11 @@ namespace ranges { static constexpr T value{}; }; + + /// \ingroup group-utility + /// \sa `static_const` + template + constexpr T static_const::value; } // namespace ranges #endif From bbfec6b31f6a0e9193f10285cbc3a79596e1b1a8 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Tue, 3 Sep 2024 17:32:37 -0700 Subject: [PATCH 3/5] suppress annoying apple-clang warning --- include/range/v3/detail/prologue.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/range/v3/detail/prologue.hpp b/include/range/v3/detail/prologue.hpp index 53d23130c3..8f35787941 100644 --- a/include/range/v3/detail/prologue.hpp +++ b/include/range/v3/detail/prologue.hpp @@ -48,3 +48,7 @@ RANGES_DIAGNOSTIC_KEYWORD_MACRO #pragma push_macro("I") #undef I + +#if defined(__apple_build_version__) +RANGES_DIAGNOSTIC_IGNORE("-Wdeprecated") +#endif From 2dc749914087746a60d2a929c93c35b9813a0358 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Wed, 4 Sep 2024 08:37:54 -0700 Subject: [PATCH 4/5] try once again to silence apple-clang warning --- include/concepts/swap.hpp | 5 +- include/meta/meta.hpp | 12 +- include/range/v3/detail/prologue.hpp | 4 - include/range/v3/iterator/diffmax_t.hpp | 135 +++++++++++++--------- include/range/v3/utility/static_const.hpp | 9 +- 5 files changed, 100 insertions(+), 65 deletions(-) diff --git a/include/concepts/swap.hpp b/include/concepts/swap.hpp index dd7086411d..700cbe4c50 100644 --- a/include/concepts/swap.hpp +++ b/include/concepts/swap.hpp @@ -28,7 +28,7 @@ #endif #ifndef CPP_CXX_INLINE_VARIABLES -#ifdef __cpp_inline_variables // TODO: fix this if SD-6 picks another name +#ifdef __cpp_inline_variables #define CPP_CXX_INLINE_VARIABLES __cpp_inline_variables // TODO: remove once clang defines __cpp_inline_variables (or equivalent) #elif defined(__clang__) && \ @@ -124,8 +124,11 @@ namespace concepts { static constexpr T const value {}; }; + +#if CPP_CXX_INLINE_VARIABLES < 201606L template constexpr T const static_const::value; +#endif } /// \endcond diff --git a/include/meta/meta.hpp b/include/meta/meta.hpp index 6b13d9f512..dc06cd1101 100644 --- a/include/meta/meta.hpp +++ b/include/meta/meta.hpp @@ -2835,12 +2835,14 @@ namespace meta template struct static_const { - static constexpr T value{}; + static constexpr T const value{}; }; +#if !META_CXX_INLINE_VARIABLES // Avoid potential ODR violations with global objects: - template - constexpr T static_const::value; + template + constexpr T const static_const::value; +#endif } // namespace detail ///\endcond @@ -3776,9 +3778,9 @@ namespace meta { /// A user-defined literal that generates objects of type \c meta::size_t. /// \ingroup integral - template + template constexpr fold...>, meta::size_t<0>, quote> - operator"" _z() + operator""_z() { return {}; } diff --git a/include/range/v3/detail/prologue.hpp b/include/range/v3/detail/prologue.hpp index 8f35787941..53d23130c3 100644 --- a/include/range/v3/detail/prologue.hpp +++ b/include/range/v3/detail/prologue.hpp @@ -48,7 +48,3 @@ RANGES_DIAGNOSTIC_KEYWORD_MACRO #pragma push_macro("I") #undef I - -#if defined(__apple_build_version__) -RANGES_DIAGNOSTIC_IGNORE("-Wdeprecated") -#endif diff --git a/include/range/v3/iterator/diffmax_t.hpp b/include/range/v3/iterator/diffmax_t.hpp index a08ef3f72a..0c6d117a29 100644 --- a/include/range/v3/iterator/diffmax_t.hpp +++ b/include/range/v3/iterator/diffmax_t.hpp @@ -347,6 +347,85 @@ namespace ranges template constexpr bool _is_integer_like_ = true; #endif + + template + struct diffmax_numeric_limits + { + static constexpr bool const is_specialized = true; + static constexpr bool const is_signed = true; + static constexpr bool const is_integer = true; + static constexpr bool const is_exact = true; + static constexpr bool const has_infinity = false; + static constexpr bool const has_quiet_NaN = false; + static constexpr bool const has_signaling_NaN = false; + static constexpr bool const has_denorm = false; + static constexpr bool const has_denorm_loss = false; + static constexpr std::float_round_style const round_style = + std::round_toward_zero; + static constexpr bool const is_iec559 = false; + static constexpr bool const is_bounded = true; + static constexpr bool const is_modulo = false; + static constexpr int const digits = CHAR_BIT * sizeof(std::uintmax_t) + 1; + static constexpr int const digits10 = + static_cast(digits * 0.301029996); // digits * std::log10(2) + static constexpr int const max_digits10 = 0; + static constexpr int const radix = 2; + static constexpr int const min_exponent = 0; + static constexpr int const min_exponent10 = 0; + static constexpr int const max_exponent = 0; + static constexpr int const max_exponent10 = 0; + static constexpr bool const traps = true; + static constexpr bool const tinyness_before = false; + }; + +#if RANGES_CXX_INLINE_VARIABLES < RANGES_CXX_INLINE_VARIABLES_17 + template + constexpr bool const diffmax_numeric_limits::is_specialized; + template + constexpr bool const diffmax_numeric_limits::is_signed; + template + constexpr bool const diffmax_numeric_limits::is_integer; + template + constexpr bool const diffmax_numeric_limits::is_exact; + template + constexpr bool const diffmax_numeric_limits::has_infinity; + template + constexpr bool const diffmax_numeric_limits::has_quiet_NaN; + template + constexpr bool const diffmax_numeric_limits::has_signaling_NaN; + template + constexpr bool const diffmax_numeric_limits::has_denorm; + template + constexpr bool const diffmax_numeric_limits::has_denorm_loss; + template + constexpr std::float_round_style const diffmax_numeric_limits::round_style; + template + constexpr bool const diffmax_numeric_limits::is_iec559; + template + constexpr bool const diffmax_numeric_limits::is_bounded; + template + constexpr bool const diffmax_numeric_limits::is_modulo; + template + constexpr int const diffmax_numeric_limits::digits; + template + constexpr int const diffmax_numeric_limits::digits10; + template + constexpr int const diffmax_numeric_limits::max_digits10; + template + constexpr int const diffmax_numeric_limits::radix; + template + constexpr int const diffmax_numeric_limits::min_exponent; + template + constexpr int const diffmax_numeric_limits::min_exponent10; + template + constexpr int const diffmax_numeric_limits::max_exponent; + template + constexpr int const diffmax_numeric_limits::max_exponent10; + template + constexpr bool const diffmax_numeric_limits::traps; + template + constexpr bool const diffmax_numeric_limits::tinyness_before; +#endif } // namespace detail /// \endcond } // namespace ranges @@ -358,32 +437,8 @@ namespace std { template<> struct numeric_limits<::ranges::detail::diffmax_t> + : ::ranges::detail::diffmax_numeric_limits<> { - static constexpr bool is_specialized = true; - static constexpr bool is_signed = true; - static constexpr bool is_integer = true; - static constexpr bool is_exact = true; - static constexpr bool has_infinity = false; - static constexpr bool has_quiet_NaN = false; - static constexpr bool has_signaling_NaN = false; - static constexpr bool has_denorm = false; - static constexpr bool has_denorm_loss = false; - static constexpr std::float_round_style round_style = std::round_toward_zero; - static constexpr bool is_iec559 = false; - static constexpr bool is_bounded = true; - static constexpr bool is_modulo = false; - static constexpr int digits = CHAR_BIT * sizeof(std::uintmax_t) + 1; - static constexpr int digits10 = - static_cast(digits * 0.301029996); // digits * std::log10(2) - static constexpr int max_digits10 = 0; - static constexpr int radix = 2; - static constexpr int min_exponent = 0; - static constexpr int min_exponent10 = 0; - static constexpr int max_exponent = 0; - static constexpr int max_exponent10 = 0; - static constexpr bool traps = true; - static constexpr bool tinyness_before = false; - static constexpr ::ranges::detail::diffmax_t max() noexcept { return std::uintmax_t(-1); @@ -421,45 +476,21 @@ namespace std return 0; } }; + template<> struct numeric_limits<::ranges::detail::diffmax_t const> : numeric_limits<::ranges::detail::diffmax_t> {}; + template<> struct numeric_limits<::ranges::detail::diffmax_t volatile> : numeric_limits<::ranges::detail::diffmax_t> {}; + template<> struct numeric_limits<::ranges::detail::diffmax_t const volatile> : numeric_limits<::ranges::detail::diffmax_t> {}; - -#if RANGES_CXX_INLINE_VARIABLES >= RANGES_CXX_INLINE_VARIABLES_17 - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_specialized; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_signed; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_integer; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_exact; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_infinity; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_quiet_NaN; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_signaling_NaN; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_denorm; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::has_denorm_loss; - inline constexpr std::float_round_style - numeric_limits<::ranges::detail::diffmax_t>::round_style; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_iec559; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_bounded; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::is_modulo; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::digits; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::digits10; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::max_digits10; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::radix; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::min_exponent; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::min_exponent10; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::max_exponent; - inline constexpr int numeric_limits<::ranges::detail::diffmax_t>::max_exponent10; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::traps; - inline constexpr bool numeric_limits<::ranges::detail::diffmax_t>::tinyness_before; -#endif } // namespace std /// \endcond diff --git a/include/range/v3/utility/static_const.hpp b/include/range/v3/utility/static_const.hpp index 690a142851..2a400c0acd 100644 --- a/include/range/v3/utility/static_const.hpp +++ b/include/range/v3/utility/static_const.hpp @@ -13,20 +13,23 @@ #ifndef RANGES_V3_UTILITY_STATIC_CONST_HPP #define RANGES_V3_UTILITY_STATIC_CONST_HPP +#include + namespace ranges { /// \ingroup group-utility - template struct static_const { - static constexpr T value{}; + static constexpr T const value{}; }; +#if RANGES_CXX_INLINE_VARIABLES < RANGES_CXX_INLINE_VARIABLES_17 /// \ingroup group-utility /// \sa `static_const` template - constexpr T static_const::value; + constexpr T const static_const::value; +#endif } // namespace ranges #endif From d32017a07cf468f38b1a258dc2542a3de05ae9d7 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Wed, 4 Sep 2024 08:42:20 -0700 Subject: [PATCH 5/5] closer --- include/range/v3/view/span.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/range/v3/view/span.hpp b/include/range/v3/view/span.hpp index 8ecda46940..0199a59bff 100644 --- a/include/range/v3/view/span.hpp +++ b/include/range/v3/view/span.hpp @@ -361,8 +361,10 @@ namespace ranges template RANGES_INLINE_VAR constexpr bool enable_borrowed_range> = true; +#if RANGES_CXX_INLINE_VARIABLES < RANGES_CXX_INLINE_VARIABLES_17 template constexpr detail::span_index_t span::extent; +#endif #if RANGES_CXX_DEDUCTION_GUIDES >= RANGES_CXX_DEDUCTION_GUIDES_17 template(typename Rng)(