From 370ac6ec9fa2d2e98f355431dc53476370fac35c Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 21 Feb 2023 09:10:39 -0800 Subject: [PATCH 1/4] Suppress Wconstant-conversion warning on Apple Clang --- include/boost/charconv/from_chars.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index b640791..a742847 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -74,6 +74,10 @@ constexpr unsigned char digit_from_char(char val) noexcept # pragma warning(disable: 4146) // unary minus operator applied to unsigned type, result still unsigned # pragma warning(disable: 4189) // 'is_negative': local variable is initialized but not referenced +#elif defined(__clang__) && defined(__APPLE__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wconstant-conversion" + #elif defined(__GNUC__) && (__GNUC__ < 7) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Woverflow" @@ -234,6 +238,8 @@ BOOST_CXX14_CONSTEXPR from_chars_result from_chars_integer_impl(const char* firs #ifdef BOOST_MSVC # pragma warning(pop) +#elif defined(__clang__) && defined(__APPLE__) +# pragma clang diagnostic pop #elif defined(__GNUC__) && (__GNUC__ < 7) # pragma GCC diagnostic pop #endif From cf3ef482b197338d6c561ffc83167e3d6c4229fc Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 21 Feb 2023 09:12:05 -0800 Subject: [PATCH 2/4] Replace std::array with c-style array --- include/boost/charconv/from_chars.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index a742847..4fe1f93 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -45,8 +45,8 @@ struct from_chars_result namespace detail { -static constexpr std::array uchar_values = - {{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, +static constexpr unsigned char uchar_values[] = + {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, @@ -61,7 +61,7 @@ static constexpr std::array uchar_values = 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}}; + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; // Convert characters for 0-9, A-Z, a-z to 0-35. Anything else is 255 constexpr unsigned char digit_from_char(char val) noexcept From 2e60941a2ef74df349699d98cd6ea842f2f3cad0 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 21 Feb 2023 09:49:32 -0800 Subject: [PATCH 3/4] Add static_assert for sizeof uchar_values array --- include/boost/charconv/from_chars.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index 4fe1f93..ae1d6cb 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -63,6 +62,8 @@ static constexpr unsigned char uchar_values[] = 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; +static_assert(sizeof(uchar_values) == 256, "uchar_values should represent all 256 values of unsigned char"); + // Convert characters for 0-9, A-Z, a-z to 0-35. Anything else is 255 constexpr unsigned char digit_from_char(char val) noexcept { From fe6a62ffedc3d4e4b4c97d09c7bab3856550a0ff Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 21 Feb 2023 10:28:40 -0800 Subject: [PATCH 4/4] Disable floating point tests on platforms with known failures --- test/limits.cpp | 6 +++--- test/roundtrip.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/limits.cpp b/test/limits.cpp index 52f3ce5..0b1a76b 100644 --- a/test/limits.cpp +++ b/test/limits.cpp @@ -172,16 +172,16 @@ int main() test_integral(); test_integral(); -#if !defined(__CYGWIN__) +#if !defined(__CYGWIN__) && !defined(__s390x__) && !((defined(__arm__) || defined(__aarch64__)) && !defined(__APPLE__)) && !(defined(__APPLE__) && (__clang_major__ == 12)) - // the stub implementations fail under Cygwin; + // the stub implementations fail under Cygwin, s390x, linux ARM, and Apple Clang w/Xcode 12.2; // re-enable these when we have real ones test_floating_point(); test_floating_point(); test_floating_point(); -#endif // !defined(__CYGWIN__) +#endif // Broken Platforms #ifdef BOOST_CHARCONV_HAS_INT128 diff --git a/test/roundtrip.cpp b/test/roundtrip.cpp index 5a48d4d..0f7523e 100644 --- a/test/roundtrip.cpp +++ b/test/roundtrip.cpp @@ -296,9 +296,9 @@ int main() #endif } -#if !defined(__CYGWIN__) +#if !defined(__CYGWIN__) && !defined(__s390x__) && !((defined(__arm__) || defined(__aarch64__)) && !defined(__APPLE__)) && !(defined(__APPLE__) && (__clang_major__ == 12)) - // the stub implementations fail under Cygwin; + // the stub implementations fail under Cygwin, s390x, linux ARM, and Apple Clang w/Xcode 12.2; // re-enable these when we have real ones // float @@ -368,7 +368,7 @@ int main() test_roundtrip_bv(); } -#endif // !defined(__CYGWIN__) +#endif // Broken platforms return boost::report_errors(); }