diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index b640791..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 @@ -45,8 +44,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 +60,9 @@ 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}; + +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 @@ -74,6 +75,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 +239,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 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(); }