From 6d3144002c28ad7aa37254774fb07517e4267455 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Mon, 30 Dec 2024 19:35:59 +0100 Subject: [PATCH 01/84] Initial impl --- CMakeLists.txt | 7 +++- include/boost/charconv/chars_format.hpp | 3 ++ include/boost/charconv/config.hpp | 7 ++++ include/boost/charconv/detail/apply_sign.hpp | 5 ++- include/boost/charconv/detail/config.hpp | 21 +++++++++- .../charconv/detail/dragonbox/dragonbox.hpp | 8 ++-- .../detail/dragonbox/dragonbox_common.hpp | 4 +- .../boost/charconv/detail/dragonbox/floff.hpp | 6 ++- include/boost/charconv/detail/emulated128.hpp | 7 +++- .../detail/fast_float/ascii_number.hpp | 6 ++- .../charconv/detail/fast_float/bigint.hpp | 2 + .../detail/fast_float/decimal_to_binary.hpp | 2 + .../detail/fast_float/digit_comparison.hpp | 6 ++- .../charconv/detail/fast_float/fast_table.hpp | 4 ++ .../detail/fast_float/float_common.hpp | 38 ++++++++++--------- .../detail/fast_float/parse_number.hpp | 3 +- .../detail/from_chars_integer_impl.hpp | 5 ++- .../charconv/detail/from_chars_result.hpp | 3 ++ .../charconv/detail/integer_search_trees.hpp | 2 + include/boost/charconv/detail/memcpy.hpp | 2 + .../detail/{ => private}/bit_layouts.hpp | 18 +++------ .../detail/{ => private}/buffer_sizing.hpp | 3 ++ .../detail/{ => private}/compute_float32.hpp | 4 +- .../detail/{ => private}/compute_float64.hpp | 7 +++- .../detail/{ => private}/compute_float80.hpp | 14 ++++--- .../{ => private}/fallback_routines.hpp | 6 ++- .../detail/{ => private}/issignaling.hpp | 7 +++- .../charconv/detail/{ => private}/parser.hpp | 4 ++ .../{ => private}/significand_tables.hpp | 3 ++ .../boost/charconv/detail/ryu/generic_128.hpp | 2 + .../charconv/detail/ryu/ryu_generic_128.hpp | 20 +++++----- .../charconv/detail/to_chars_integer_impl.hpp | 5 ++- .../boost/charconv/detail/to_chars_result.hpp | 5 +++ include/boost/charconv/detail/type_traits.hpp | 2 + include/boost/charconv/from_chars.hpp | 9 +++-- include/boost/charconv/limits.hpp | 5 +++ include/boost/charconv/to_chars.hpp | 2 + modules/boost_charconv.cppm | 17 +++++++++ src/float128_impl.hpp | 15 ++++---- src/from_chars.cpp | 36 ++++++++++++++++-- src/from_chars_float_impl.hpp | 12 +++--- src/quadmath_header.hpp | 14 +++++++ src/to_chars.cpp | 26 +++++++++++++ src/to_chars_float_impl.hpp | 16 ++++---- 44 files changed, 296 insertions(+), 97 deletions(-) rename include/boost/charconv/detail/{ => private}/bit_layouts.hpp (90%) rename include/boost/charconv/detail/{ => private}/buffer_sizing.hpp (98%) rename include/boost/charconv/detail/{ => private}/compute_float32.hpp (94%) rename include/boost/charconv/detail/{ => private}/compute_float64.hpp (98%) rename include/boost/charconv/detail/{ => private}/compute_float80.hpp (94%) rename include/boost/charconv/detail/{ => private}/fallback_routines.hpp (99%) rename include/boost/charconv/detail/{ => private}/issignaling.hpp (92%) rename include/boost/charconv/detail/{ => private}/parser.hpp (99%) rename include/boost/charconv/detail/{ => private}/significand_tables.hpp (99%) create mode 100644 modules/boost_charconv.cppm create mode 100644 src/quadmath_header.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index b495b8ac6..162ea9298 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ # Distributed under the Boost Software License, Version 1.0. # https://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required(VERSION 3.8...3.20) +cmake_minimum_required(VERSION 3.8...3.31) project(boost_charconv VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) @@ -14,6 +14,11 @@ add_library(boost_charconv add_library(Boost::charconv ALIAS boost_charconv) +if (BOOST_USE_MODULES) + boost_set_cxx20_module_settings(boost_charconv) + target_sources(boost_charconv PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES modules/boost_charconv.cppm) +endif() + target_include_directories(boost_charconv PUBLIC include) diff --git a/include/boost/charconv/chars_format.hpp b/include/boost/charconv/chars_format.hpp index 0542372bf..21972b182 100644 --- a/include/boost/charconv/chars_format.hpp +++ b/include/boost/charconv/chars_format.hpp @@ -5,10 +5,13 @@ #ifndef BOOST_CHARCONV_CHARS_FORMAT_HPP #define BOOST_CHARCONV_CHARS_FORMAT_HPP +#include + namespace boost { namespace charconv { // Floating-point format for primitive numerical conversion // chars_format is a bitmask type (16.3.3.3.3) +BOOST_MODULE_EXPORT enum class chars_format : unsigned { scientific = 1 << 0, diff --git a/include/boost/charconv/config.hpp b/include/boost/charconv/config.hpp index 0d94ccd4a..e23151523 100644 --- a/include/boost/charconv/config.hpp +++ b/include/boost/charconv/config.hpp @@ -6,12 +6,17 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include +#ifndef BOOST_USE_MODULES #include #include +#endif + // This header implements separate compilation features as described in // http://www.boost.org/more/separate_compilation.html +// TODO: handle this correctly! #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHARCONV_DYN_LINK) # if defined(BOOST_CHARCONV_SOURCE) # define BOOST_CHARCONV_DECL BOOST_SYMBOL_EXPORT @@ -32,7 +37,9 @@ # define BOOST_DYN_LINK #endif +#ifndef BOOST_USE_MODULES #include +#endif #endif diff --git a/include/boost/charconv/detail/apply_sign.hpp b/include/boost/charconv/detail/apply_sign.hpp index ef6db7143..d20ec2192 100644 --- a/include/boost/charconv/detail/apply_sign.hpp +++ b/include/boost/charconv/detail/apply_sign.hpp @@ -5,10 +5,13 @@ #ifndef BOOST_CHARCONV_DETAIL_APPLY_SIGN_HPP #define BOOST_CHARCONV_DETAIL_APPLY_SIGN_HPP -#include #include #include +#ifndef BOOST_USE_MODULES +#include #include +#endif + // We are purposefully converting values here #ifdef BOOST_MSVC diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index 9ccfb0d68..08c6d3f28 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -5,9 +5,14 @@ #ifndef BOOST_CHARCONV_DETAIL_CONFIG_HPP #define BOOST_CHARCONV_DETAIL_CONFIG_HPP +// In modular builds, this header should only +// be included from the global module fragment #include -#include #include +#include +#ifndef BOOST_USE_MODULES +#include +#endif #include #define BOOST_CHARCONV_ASSERT(expr) BOOST_ASSERT(expr) @@ -167,7 +172,7 @@ static_assert((BOOST_CHARCONV_ENDIAN_BIG_BYTE || BOOST_CHARCONV_ENDIAN_LITTLE_BY // Detection for C++23 fixed width floating point types // All of these types are optional so check for each of them individually -#if (defined(_MSVC_LANG) && _MSVC_LANG > 202002L) || __cplusplus > 202002L +#if !defined(BOOST_USE_MODULES) && ((defined(_MSVC_LANG) && _MSVC_LANG > 202002L) || __cplusplus > 202002L) # if __has_include() # include # endif @@ -188,4 +193,16 @@ static_assert((BOOST_CHARCONV_ENDIAN_BIG_BYTE || BOOST_CHARCONV_ENDIAN_LITTLE_BY # define BOOST_CHARCONV_HAS_BRAINFLOAT16 #endif +// Detect long double and its number of bits +#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 +# define BOOST_CHARCONV_LDBL_BITS 80 // 80 bit long double (e.g. x86-64) +#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 +# define BOOST_CHARCONV_LDBL_BITS 128 // 128 bit long double (e.g. s390x, ppcle64) +#elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +#define BOOST_CHARCONV_LDBL_BITS 64 // 64 bit long double (double == long double on ARM) +#else // Unsupported long double representation +# define BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE +# define BOOST_CHARCONV_LDBL_BITS -1 +#endif + #endif // BOOST_CHARCONV_DETAIL_CONFIG_HPP diff --git a/include/boost/charconv/detail/dragonbox/dragonbox.hpp b/include/boost/charconv/detail/dragonbox/dragonbox.hpp index f2d3449ac..a90433aa1 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox.hpp @@ -22,11 +22,12 @@ #ifndef BOOST_CHARCONV_DETAIL_DRAGONBOX_HPP #define BOOST_CHARCONV_DETAIL_DRAGONBOX_HPP -#include #include -#include +#include +#include +#ifndef BOOST_USE_MODULES +#include #include -#include #include #include #include @@ -34,6 +35,7 @@ #include #include #include +#endif #ifdef BOOST_MSVC # pragma warning(push) diff --git a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp index 0bee7d091..261a97171 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp @@ -24,8 +24,9 @@ #ifndef BOOST_CHARCONV_DETAIL_DRAGONBOX_COMMON_HPP #define BOOST_CHARCONV_DETAIL_DRAGONBOX_COMMON_HPP +#include +#ifndef BOOST_USE_MODULES #include -#include #include #include #include @@ -35,6 +36,7 @@ #include #include #include +#endif namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/dragonbox/floff.hpp b/include/boost/charconv/detail/dragonbox/floff.hpp index 32d138b37..dad05fd17 100644 --- a/include/boost/charconv/detail/dragonbox/floff.hpp +++ b/include/boost/charconv/detail/dragonbox/floff.hpp @@ -24,10 +24,11 @@ #ifndef BOOST_CHARCONV_DETAIL_FLOFF #define BOOST_CHARCONV_DETAIL_FLOFF +#include +#include +#ifndef BOOST_USE_MODULES #include -#include #include -#include #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#endif #ifdef BOOST_MSVC # pragma warning(push) diff --git a/include/boost/charconv/detail/emulated128.hpp b/include/boost/charconv/detail/emulated128.hpp index e77133d04..93a6ab5d3 100644 --- a/include/boost/charconv/detail/emulated128.hpp +++ b/include/boost/charconv/detail/emulated128.hpp @@ -8,14 +8,17 @@ #ifndef BOOST_CHARCONV_DETAIL_EMULATED128_HPP #define BOOST_CHARCONV_DETAIL_EMULATED128_HPP -#include #include +#ifndef BOOST_USE_MODULES +#include #include #include #include #include #include #include +#endif + namespace boost { namespace charconv { namespace detail { @@ -825,7 +828,7 @@ BOOST_CHARCONV_CXX14_CONSTEXPR uint128 &uint128::operator%=(uint128 v) noexcept return *this; } -static inline std::uint64_t umul64(std::uint32_t x, std::uint32_t y) noexcept +inline std::uint64_t umul64(std::uint32_t x, std::uint32_t y) noexcept { // __emulu is not available on ARM https://learn.microsoft.com/en-us/cpp/intrinsics/emul-emulu?view=msvc-170 #if defined(BOOST_CHARCONV_HAS_MSVC_32BIT_INTRINSICS) && !defined(_M_ARM) diff --git a/include/boost/charconv/detail/fast_float/ascii_number.hpp b/include/boost/charconv/detail/fast_float/ascii_number.hpp index 159a7661d..00c3639fd 100644 --- a/include/boost/charconv/detail/fast_float/ascii_number.hpp +++ b/include/boost/charconv/detail/fast_float/ascii_number.hpp @@ -9,10 +9,12 @@ #define BOOST_CHARCONV_DETAIL_FASTFLOAT_ASCII_NUMBER_HPP #include +#ifndef BOOST_USE_MODULES #include #include #include #include +#endif namespace boost { namespace charconv { namespace detail { namespace fast_float { @@ -45,7 +47,7 @@ uint64_t read_u64(const char *chars) { return val; } uint64_t val; - ::memcpy(&val, chars, sizeof(uint64_t)); + std::memcpy(&val, chars, sizeof(uint64_t)); #if BOOST_CHARCONV_FASTFLOAT_IS_BIG_ENDIAN == 1 // Need to read as-if the number was in little-endian order. val = byteswap(val); @@ -67,7 +69,7 @@ void write_u64(uint8_t *chars, uint64_t val) { // Need to read as-if the number was in little-endian order. val = byteswap(val); #endif - ::memcpy(chars, &val, sizeof(uint64_t)); + std::memcpy(chars, &val, sizeof(uint64_t)); } // credit @aqrit diff --git a/include/boost/charconv/detail/fast_float/bigint.hpp b/include/boost/charconv/detail/fast_float/bigint.hpp index fd98590cd..11499da76 100644 --- a/include/boost/charconv/detail/fast_float/bigint.hpp +++ b/include/boost/charconv/detail/fast_float/bigint.hpp @@ -9,10 +9,12 @@ #define BOOST_CHARCONV_DETAIL_FASTFLOAT_BIGINT_HPP #include +#ifndef BOOST_USE_MODULES #include #include #include #include +#endif namespace boost { namespace charconv { namespace detail { namespace fast_float { diff --git a/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp b/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp index 4a76a6eeb..03b02f682 100644 --- a/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp +++ b/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp @@ -10,12 +10,14 @@ #include #include +#ifndef BOOST_USE_MODULES #include #include #include #include #include #include +#endif namespace boost { namespace charconv { namespace detail { namespace fast_float { diff --git a/include/boost/charconv/detail/fast_float/digit_comparison.hpp b/include/boost/charconv/detail/fast_float/digit_comparison.hpp index 231279410..b33aebc53 100644 --- a/include/boost/charconv/detail/fast_float/digit_comparison.hpp +++ b/include/boost/charconv/detail/fast_float/digit_comparison.hpp @@ -11,10 +11,12 @@ #include #include #include +#ifndef BOOST_USE_MODULES #include #include #include #include +#endif namespace boost { namespace charconv { namespace detail { namespace fast_float { @@ -165,7 +167,7 @@ BOOST_FORCEINLINE BOOST_CHARCONV_FASTFLOAT_CONSTEXPR20 void skip_zeros(UC const * & first, UC const * last) noexcept { uint64_t val; while (!cpp20_and_in_constexpr() && std::distance(first, last) >= int_cmp_len()) { - ::memcpy(&val, first, sizeof(uint64_t)); + std::memcpy(&val, first, sizeof(uint64_t)); if (val != int_cmp_zeros()) { break; } @@ -187,7 +189,7 @@ bool is_truncated(UC const * first, UC const * last) noexcept { // do 8-bit optimizations, can just compare to 8 literal 0s. uint64_t val; while (!cpp20_and_in_constexpr() && std::distance(first, last) >= int_cmp_len()) { - ::memcpy(&val, first, sizeof(uint64_t)); + std::memcpy(&val, first, sizeof(uint64_t)); if (val != int_cmp_zeros()) { return true; } diff --git a/include/boost/charconv/detail/fast_float/fast_table.hpp b/include/boost/charconv/detail/fast_float/fast_table.hpp index e08eb3145..6650bc6c7 100644 --- a/include/boost/charconv/detail/fast_float/fast_table.hpp +++ b/include/boost/charconv/detail/fast_float/fast_table.hpp @@ -8,8 +8,12 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_TABLE_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_TABLE_HPP +// TODO: this should be in src/ #include +#ifndef BOOST_USE_MODULES #include +#endif + namespace boost { namespace charconv { namespace detail { namespace fast_float { diff --git a/include/boost/charconv/detail/fast_float/float_common.hpp b/include/boost/charconv/detail/fast_float/float_common.hpp index 0b9d3aee5..11fca785f 100644 --- a/include/boost/charconv/detail/fast_float/float_common.hpp +++ b/include/boost/charconv/detail/fast_float/float_common.hpp @@ -9,6 +9,7 @@ #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FLOAT_COMMON_HPP #include +#ifndef BOOST_USE_MODULES #include #include #include @@ -18,6 +19,7 @@ #include #include #include +#endif namespace boost { namespace charconv { namespace detail { namespace fast_float { @@ -37,7 +39,7 @@ using parse_options = parse_options_t; }}}} -#if BOOST_CHARCONV_FASTFLOAT_HAS_BIT_CAST +#if BOOST_CHARCONV_FASTFLOAT_HAS_BIT_CAST && !defined(BOOST_USE_MODULES) #include #endif @@ -288,23 +290,23 @@ struct binary_format_lookup_tables; template struct binary_format : binary_format_lookup_tables { using equiv_uint = typename std::conditional::type; - static inline constexpr int mantissa_explicit_bits(); - static inline constexpr int minimum_exponent(); - static inline constexpr int infinite_power(); - static inline constexpr int sign_index(); - static inline constexpr int min_exponent_fast_path(); // used when fegetround() == FE_TONEAREST - static inline constexpr int max_exponent_fast_path(); - static inline constexpr int max_exponent_round_to_even(); - static inline constexpr int min_exponent_round_to_even(); - static inline constexpr uint64_t max_mantissa_fast_path(int64_t power); - static inline constexpr uint64_t max_mantissa_fast_path(); // used when fegetround() == FE_TONEAREST - static inline constexpr int largest_power_of_ten(); - static inline constexpr int smallest_power_of_ten(); - static inline constexpr T exact_power_of_ten(int64_t power); - static inline constexpr size_t max_digits(); - static inline constexpr equiv_uint exponent_mask(); - static inline constexpr equiv_uint mantissa_mask(); - static inline constexpr equiv_uint hidden_bit_mask(); + static constexpr int mantissa_explicit_bits(); + static constexpr int minimum_exponent(); + static constexpr int infinite_power(); + static constexpr int sign_index(); + static constexpr int min_exponent_fast_path(); // used when fegetround() == FE_TONEAREST + static constexpr int max_exponent_fast_path(); + static constexpr int max_exponent_round_to_even(); + static constexpr int min_exponent_round_to_even(); + static constexpr uint64_t max_mantissa_fast_path(int64_t power); + static constexpr uint64_t max_mantissa_fast_path(); // used when fegetround() == FE_TONEAREST + static constexpr int largest_power_of_ten(); + static constexpr int smallest_power_of_ten(); + static constexpr T exact_power_of_ten(int64_t power); + static constexpr size_t max_digits(); + static constexpr equiv_uint exponent_mask(); + static constexpr equiv_uint mantissa_mask(); + static constexpr equiv_uint hidden_bit_mask(); }; template diff --git a/include/boost/charconv/detail/fast_float/parse_number.hpp b/include/boost/charconv/detail/fast_float/parse_number.hpp index 8205bf7ca..c1f29b027 100644 --- a/include/boost/charconv/detail/fast_float/parse_number.hpp +++ b/include/boost/charconv/detail/fast_float/parse_number.hpp @@ -12,11 +12,12 @@ #include #include #include - +#ifndef BOOST_USE_MODULES #include #include #include #include +#endif namespace boost { namespace charconv { namespace detail { namespace fast_float { diff --git a/include/boost/charconv/detail/from_chars_integer_impl.hpp b/include/boost/charconv/detail/from_chars_integer_impl.hpp index a069fd968..7135b5984 100644 --- a/include/boost/charconv/detail/from_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/from_chars_integer_impl.hpp @@ -6,11 +6,12 @@ #define BOOST_CHARCONV_DETAIL_FROM_CHARS_INTEGER_IMPL_HPP #include -#include #include #include #include #include +#ifndef BOOST_USE_MODULES +#include #include #include #include @@ -19,6 +20,8 @@ #include #include #include +#endif + namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/from_chars_result.hpp b/include/boost/charconv/detail/from_chars_result.hpp index e4302cfab..dd914faa1 100644 --- a/include/boost/charconv/detail/from_chars_result.hpp +++ b/include/boost/charconv/detail/from_chars_result.hpp @@ -5,7 +5,10 @@ #ifndef BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP #define BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP +#ifndef BOOST_USE_MODULES #include +#endif + namespace boost { namespace charconv { diff --git a/include/boost/charconv/detail/integer_search_trees.hpp b/include/boost/charconv/detail/integer_search_trees.hpp index 9b4de0913..a3e49704d 100644 --- a/include/boost/charconv/detail/integer_search_trees.hpp +++ b/include/boost/charconv/detail/integer_search_trees.hpp @@ -8,11 +8,13 @@ // https://stackoverflow.com/questions/1489830/efficient-way-to-determine-number-of-digits-in-an-integer?page=1&tab=scoredesc#tab-top // https://graphics.stanford.edu/~seander/bithacks.html +#ifndef BOOST_USE_MODULES #include #include #include #include #include +#endif namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/memcpy.hpp b/include/boost/charconv/detail/memcpy.hpp index 1e68315f4..369a40b43 100644 --- a/include/boost/charconv/detail/memcpy.hpp +++ b/include/boost/charconv/detail/memcpy.hpp @@ -5,9 +5,11 @@ #ifndef BOOST_CHARCONV_DETAIL_MEMCPY_HPP #define BOOST_CHARCONV_DETAIL_MEMCPY_HPP +#ifndef BOOST_USE_MODULES #include #include #include +#endif // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89689 // GCC 10 added checks for length of memcpy which yields the following warning (converted to error with -Werror) diff --git a/include/boost/charconv/detail/bit_layouts.hpp b/include/boost/charconv/detail/private/bit_layouts.hpp similarity index 90% rename from include/boost/charconv/detail/bit_layouts.hpp rename to include/boost/charconv/detail/private/bit_layouts.hpp index c163ce06a..9d3cdc186 100644 --- a/include/boost/charconv/detail/bit_layouts.hpp +++ b/include/boost/charconv/detail/private/bit_layouts.hpp @@ -5,10 +5,13 @@ #ifndef BOOST_CHARCONV_DETAIL_BIT_LAYOUTS_HPP #define BOOST_CHARCONV_DETAIL_BIT_LAYOUTS_HPP +#ifndef BOOST_USE_MODULES #include #include #include #include +#endif + // Layouts of floating point types as specified by IEEE 754 // See page 23 of IEEE 754-2008 @@ -56,7 +59,7 @@ struct ieee754_binary64 }; // 80 bit long double (e.g. x86-64) -#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 +#if BOOST_CHARCONV_LDBL_BITS == 80 struct IEEEl2bits { @@ -83,10 +86,8 @@ struct ieee754_binary80 static constexpr int decimal_digits = 18; }; -#define BOOST_CHARCONV_LDBL_BITS 80 - // 128 bit long double (e.g. s390x, ppcle64) -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 +#elif BOOST_CHARCONV_LDBL_BITS == 128 struct IEEEl2bits { @@ -103,10 +104,8 @@ struct IEEEl2bits #endif }; -#define BOOST_CHARCONV_LDBL_BITS 128 - // 64 bit long double (double == long double on ARM) -#elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +#elif BOOST_CHARCONV_LDBL_BITS == 64 struct IEEEl2bits { @@ -123,11 +122,6 @@ struct IEEEl2bits #endif }; -#define BOOST_CHARCONV_LDBL_BITS 64 - -#else // Unsupported long double representation -# define BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE -# define BOOST_CHARCONV_LDBL_BITS -1 #endif struct IEEEbinary128 diff --git a/include/boost/charconv/detail/buffer_sizing.hpp b/include/boost/charconv/detail/private/buffer_sizing.hpp similarity index 98% rename from include/boost/charconv/detail/buffer_sizing.hpp rename to include/boost/charconv/detail/private/buffer_sizing.hpp index bc598c935..a462678f5 100644 --- a/include/boost/charconv/detail/buffer_sizing.hpp +++ b/include/boost/charconv/detail/private/buffer_sizing.hpp @@ -5,9 +5,12 @@ #ifndef BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP #define BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP +#ifndef BOOST_USE_MODULES #include #include #include +#endif + namespace boost { namespace charconv { diff --git a/include/boost/charconv/detail/compute_float32.hpp b/include/boost/charconv/detail/private/compute_float32.hpp similarity index 94% rename from include/boost/charconv/detail/compute_float32.hpp rename to include/boost/charconv/detail/private/compute_float32.hpp index 85ece7f8c..68a91e29b 100644 --- a/include/boost/charconv/detail/compute_float32.hpp +++ b/include/boost/charconv/detail/private/compute_float32.hpp @@ -5,10 +5,12 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT32_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT32_HPP -#include +#include +#ifndef BOOST_USE_MODULES #include #include #include +#endif namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/compute_float64.hpp b/include/boost/charconv/detail/private/compute_float64.hpp similarity index 98% rename from include/boost/charconv/detail/compute_float64.hpp rename to include/boost/charconv/detail/private/compute_float64.hpp index 3cb83537f..0ee26b1ec 100644 --- a/include/boost/charconv/detail/compute_float64.hpp +++ b/include/boost/charconv/detail/private/compute_float64.hpp @@ -6,14 +6,17 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT64_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT64_HPP -#include -#include +#include +#ifndef BOOST_USE_MODULES #include +#include #include #include #include #include #include +#endif + namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/compute_float80.hpp b/include/boost/charconv/detail/private/compute_float80.hpp similarity index 94% rename from include/boost/charconv/detail/compute_float80.hpp rename to include/boost/charconv/detail/private/compute_float80.hpp index ad1e51486..358c9f215 100644 --- a/include/boost/charconv/detail/compute_float80.hpp +++ b/include/boost/charconv/detail/private/compute_float80.hpp @@ -5,9 +5,10 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP -#include +#include +#ifndef BOOST_USE_MODULES #include -#include +#include #include #include #include @@ -15,12 +16,13 @@ #include #include #include - #ifdef BOOST_CHARCONV_DEBUG_FLOAT128 -#include -#include -#include +# include +# include +# include #endif +#endif + namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/fallback_routines.hpp b/include/boost/charconv/detail/private/fallback_routines.hpp similarity index 99% rename from include/boost/charconv/detail/fallback_routines.hpp rename to include/boost/charconv/detail/private/fallback_routines.hpp index 681aef5a9..5a66b5571 100644 --- a/include/boost/charconv/detail/fallback_routines.hpp +++ b/include/boost/charconv/detail/private/fallback_routines.hpp @@ -5,10 +5,11 @@ #ifndef BOOST_FALLBACK_ROUTINES_HPP #define BOOST_FALLBACK_ROUTINES_HPP -#include #include -#include +#ifndef BOOST_USE_MODULES #include +#include +#include #include #include #include @@ -16,6 +17,7 @@ #include #include #include +#endif namespace boost { namespace charconv { diff --git a/include/boost/charconv/detail/issignaling.hpp b/include/boost/charconv/detail/private/issignaling.hpp similarity index 92% rename from include/boost/charconv/detail/issignaling.hpp rename to include/boost/charconv/detail/private/issignaling.hpp index 596ce007d..5f6fdab8b 100644 --- a/include/boost/charconv/detail/issignaling.hpp +++ b/include/boost/charconv/detail/private/issignaling.hpp @@ -5,15 +5,18 @@ #ifndef BOOST_CHARCONV_DETAIL_ISSIGNALING_HPP #define BOOST_CHARCONV_DETAIL_ISSIGNALING_HPP +#include +#ifndef BOOST_USE_MODULES #include -#include #include #include +#endif + namespace boost { namespace charconv { namespace detail { template -inline bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (T x) noexcept; +bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (T x) noexcept; #if BOOST_CHARCONV_LDBL_BITS == 128 diff --git a/include/boost/charconv/detail/parser.hpp b/include/boost/charconv/detail/private/parser.hpp similarity index 99% rename from include/boost/charconv/detail/parser.hpp rename to include/boost/charconv/detail/private/parser.hpp index 3e1a16ce8..d57731823 100644 --- a/include/boost/charconv/detail/parser.hpp +++ b/include/boost/charconv/detail/private/parser.hpp @@ -5,18 +5,22 @@ #ifndef BOOST_CHARCONV_DETAIL_PARSER_HPP #define BOOST_CHARCONV_DETAIL_PARSER_HPP +#ifndef BOOST_USE_MODULES #include #include #include #include #include #include +#include #include #include #include #include #include #include +#endif + #if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__) # pragma GCC diagnostic push diff --git a/include/boost/charconv/detail/significand_tables.hpp b/include/boost/charconv/detail/private/significand_tables.hpp similarity index 99% rename from include/boost/charconv/detail/significand_tables.hpp rename to include/boost/charconv/detail/private/significand_tables.hpp index 51dd71f45..b939f5863 100644 --- a/include/boost/charconv/detail/significand_tables.hpp +++ b/include/boost/charconv/detail/private/significand_tables.hpp @@ -6,8 +6,11 @@ #ifndef BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP #define BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP +#ifndef BOOST_USE_MODULES #include #include +#endif + // The significand of a floating point number is often referred to as the mantissa. // Using the term mantissa is discouraged by IEEE 1516 diff --git a/include/boost/charconv/detail/ryu/generic_128.hpp b/include/boost/charconv/detail/ryu/generic_128.hpp index 23c5234dd..e6c6f1c78 100644 --- a/include/boost/charconv/detail/ryu/generic_128.hpp +++ b/include/boost/charconv/detail/ryu/generic_128.hpp @@ -6,10 +6,12 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP +#ifndef BOOST_USE_MODULES #include #include #include #include +#endif #define BOOST_CHARCONV_POW5_TABLE_SIZE 56 #define BOOST_CHARCONV_POW5_BITCOUNT 249 diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index 65074fc96..ee1a7c098 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -7,9 +7,10 @@ #define BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP #include +#include +#ifndef BOOST_USE_MODULES #include #include -#include #include #include #include @@ -18,6 +19,7 @@ #ifdef BOOST_CHARCONV_DEBUG # include #endif +#endif namespace boost { namespace charconv { namespace detail { namespace ryu { @@ -361,7 +363,7 @@ static inline int copy_special_str(char* result, const std::ptrdiff_t result_siz return -1; } -static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, char* result, const ptrdiff_t result_size, int precision) noexcept +static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, char* result, const std::ptrdiff_t result_size, int precision) noexcept { if (v.exponent == fd128_exceptional_exponent) { @@ -397,7 +399,7 @@ static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, ch if (precision > 0) { result[current_len++] = '.'; - memset(result+current_len, '0', precision); + std::memset(result+current_len, '0', precision); current_len += precision; precision = 0; } @@ -412,7 +414,7 @@ static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, ch } result = r.ptr; - memset(result, '0', static_cast(v.exponent)); + std::memset(result, '0', static_cast(v.exponent)); result += static_cast(v.exponent); *result++ = '.'; current_len += v.exponent + 1; @@ -425,7 +427,7 @@ static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, ch return -static_cast(std::errc::result_out_of_range); } - memmove(result + current_len + v.exponent + 1, result + current_len + v.exponent, static_cast(-v.exponent)); + std::memmove(result + current_len + v.exponent + 1, result + current_len + v.exponent, static_cast(-v.exponent)); const auto shift = result + current_len + v.exponent; const auto shift_width = (shift - result) + 1; memcpy(shift, ".", 1U); @@ -480,9 +482,9 @@ static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, ch return -static_cast(std::errc::value_too_large); } - memmove(result - v.exponent - current_len + 2, result, static_cast(current_len)); + std::memmove(result - v.exponent - current_len + 2, result, static_cast(current_len)); memcpy(result, "0.", 2U); - memset(result + 2, '0', static_cast(0 - v.exponent - current_len)); + std::memset(result + 2, '0', static_cast(0 - v.exponent - current_len)); current_len = -v.exponent + 2; precision -= current_len - 2; result += current_len; @@ -495,7 +497,7 @@ static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, ch return -static_cast(std::errc::result_out_of_range); } - memset(result, '0', static_cast(precision)); + std::memset(result, '0', static_cast(precision)); current_len += precision; } @@ -509,7 +511,7 @@ static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, ch // Maximal char buffer requirement: // sign + mantissa digits + decimal dot + 'E' + exponent sign + exponent digits // = 1 + 39 + 1 + 1 + 1 + 10 = 53 -static inline int generic_to_chars(const struct floating_decimal_128 v, char* result, const ptrdiff_t result_size, +static inline int generic_to_chars(const struct floating_decimal_128 v, char* result, const std::ptrdiff_t result_size, chars_format fmt = chars_format::general, int precision = -1) noexcept { if (v.exponent == fd128_exceptional_exponent) diff --git a/include/boost/charconv/detail/to_chars_integer_impl.hpp b/include/boost/charconv/detail/to_chars_integer_impl.hpp index 1ef54a2f0..5204bb0b4 100644 --- a/include/boost/charconv/detail/to_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/to_chars_integer_impl.hpp @@ -7,12 +7,13 @@ #ifndef BOOST_CHARCONV_DETAIL_TO_CHARS_INTEGER_IMPL_HPP #define BOOST_CHARCONV_DETAIL_TO_CHARS_INTEGER_IMPL_HPP -#include #include #include #include #include #include +#ifndef BOOST_USE_MODULES +#include #include #include #include @@ -25,6 +26,8 @@ #include #include #include +#endif + namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/to_chars_result.hpp b/include/boost/charconv/detail/to_chars_result.hpp index e564fe6cd..7e53f9c95 100644 --- a/include/boost/charconv/detail/to_chars_result.hpp +++ b/include/boost/charconv/detail/to_chars_result.hpp @@ -5,12 +5,17 @@ #ifndef BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP #define BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP +#include +#ifndef BOOST_USE_MODULES #include +#endif + // 22.13.2, Primitive numerical output conversion namespace boost { namespace charconv { +BOOST_MODULE_EXPORT struct to_chars_result { char *ptr; diff --git a/include/boost/charconv/detail/type_traits.hpp b/include/boost/charconv/detail/type_traits.hpp index 416055516..dc488628b 100644 --- a/include/boost/charconv/detail/type_traits.hpp +++ b/include/boost/charconv/detail/type_traits.hpp @@ -5,8 +5,10 @@ #ifndef BOOST_CHARCONV_DETAIL_TYPE_TRAITS_HPP #define BOOST_CHARCONV_DETAIL_TYPE_TRAITS_HPP +#ifndef BOOST_USE_MODULES #include #include +#endif namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index 10e4cb4a6..11f3b55cc 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -6,16 +6,19 @@ #ifndef BOOST_CHARCONV_FROM_CHARS_HPP_INCLUDED #define BOOST_CHARCONV_FROM_CHARS_HPP_INCLUDED -#include #include #include -#include #include #include +#include +#ifndef BOOST_USE_MODULES +#include #include #include +#endif + -namespace boost { namespace charconv { +BOOST_MODULE_EXPORT namespace boost { namespace charconv { // integer overloads diff --git a/include/boost/charconv/limits.hpp b/include/boost/charconv/limits.hpp index f62809f30..2d98fa838 100644 --- a/include/boost/charconv/limits.hpp +++ b/include/boost/charconv/limits.hpp @@ -5,9 +5,13 @@ #ifndef BOOST_CHARCONV_LIMITS_HPP #define BOOST_CHARCONV_LIMITS_HPP +#include +#ifndef BOOST_USE_MODULES #include #include #include +#endif + namespace boost { namespace charconv { @@ -41,6 +45,7 @@ template struct is_uint128: std::false_type {}; } // namespace detail +BOOST_MODULE_EXPORT template struct limits { BOOST_ATTRIBUTE_UNUSED static constexpr int max_chars10 = diff --git a/include/boost/charconv/to_chars.hpp b/include/boost/charconv/to_chars.hpp index 7192fda57..7020aac1c 100644 --- a/include/boost/charconv/to_chars.hpp +++ b/include/boost/charconv/to_chars.hpp @@ -11,7 +11,9 @@ #include #include #include +#include +BOOST_MODULE_EXPORT namespace boost { namespace charconv { diff --git a/modules/boost_charconv.cppm b/modules/boost_charconv.cppm new file mode 100644 index 000000000..94683d487 --- /dev/null +++ b/modules/boost_charconv.cppm @@ -0,0 +1,17 @@ +module; + +#include // for UINT64_C +#include // for CHAR_BIT +#include +#include +#include +#include + +export module boost.charconv; + +import std; +import boost.core; + +// Wrapping compiled libraries in "extern C++" breaks +// implementation units: exported declarations are no longer reachable +#include diff --git a/src/float128_impl.hpp b/src/float128_impl.hpp index e6b2261ca..48a25b2dc 100644 --- a/src/float128_impl.hpp +++ b/src/float128_impl.hpp @@ -5,21 +5,22 @@ #ifndef BOOST_CHARCONV_FLOAT128_IMPL_HPP #define BOOST_CHARCONV_FLOAT128_IMPL_HPP -#include #include -#include -#include -#include +#include +#include +#include +#ifndef BOOST_USE_MODULES +#include "quadmath_header.hpp" +#include #include #include #include #include +#endif + // Only add in float128 support if the build system says it can #ifdef BOOST_CHARCONV_HAS_QUADMATH - -#include - #define BOOST_CHARCONV_HAS_FLOAT128 namespace boost { diff --git a/src/from_chars.cpp b/src/from_chars.cpp index 2c01e73cf..619e0f307 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -3,6 +3,28 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +// Global module fragment with all required includes +module; +#include // for UINT64_C +#include // for CHAR_BIT +#include // for HUGE_VAL +#include +#include +#include +#include +#include +#include "quadmath_header.hpp" + +// This is an implementation unit +module boost.charconv; +import std; +import boost.core; + +#endif + + // https://stackoverflow.com/questions/38060411/visual-studio-2015-wont-suppress-error-c4996 #ifndef _SCL_SECURE_NO_WARNINGS # define _SCL_SECURE_NO_WARNINGS @@ -11,9 +33,18 @@ # define NO_WARN_MBCS_MFC_DEPRECATION #endif +// These headers are part of the implementation, and safe to include #include "float128_impl.hpp" #include "from_chars_float_impl.hpp" #include +#if BOOST_CHARCONV_LDBL_BITS > 64 +# include +# ifndef BOOST_USE_MODULES +# include +# endif +#endif + +#ifndef BOOST_USE_MODULES #include #include #include @@ -22,12 +53,9 @@ #include #include #include - -#if BOOST_CHARCONV_LDBL_BITS > 64 -# include -# include #endif + #if defined(__GNUC__) && __GNUC__ < 5 # pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif diff --git a/src/from_chars_float_impl.hpp b/src/from_chars_float_impl.hpp index 0571ab961..b77446b39 100644 --- a/src/from_chars_float_impl.hpp +++ b/src/from_chars_float_impl.hpp @@ -6,17 +6,19 @@ #ifndef BOOST_CHARCONV_DETAIL_FROM_CHARS_FLOAT_IMPL_HPP #define BOOST_CHARCONV_DETAIL_FROM_CHARS_FLOAT_IMPL_HPP +#include +#include +#include +#include +#include +#ifndef BOOST_USE_MODULES #include #include -#include -#include -#include -#include -#include #include #include #include #include +#endif namespace boost { namespace charconv { namespace detail { diff --git a/src/quadmath_header.hpp b/src/quadmath_header.hpp new file mode 100644 index 000000000..0d0fbab92 --- /dev/null +++ b/src/quadmath_header.hpp @@ -0,0 +1,14 @@ +// Copyright 2024 Matt Borland +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_CHARCONV_QUADMATH_HPP +#define BOOST_CHARCONV_QUADMATH_HPP + +// Conditionally includes quadmath headers. +// Reduces duplication in modular builds +#ifdef BOOST_CHARCONV_HAS_QUADMATH +#include +#endif + +#endif diff --git a/src/to_chars.cpp b/src/to_chars.cpp index ab0c77d72..7ebc1224f 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -4,8 +4,32 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +// Global module fragment with all required includes +module; +#include // for UINT64_C +#include // for CHAR_BIT +#include // for HUGE_VAL +#include +#include +#include +#include +#include +#include "quadmath_header.hpp" + +// This is an implementation unit +module boost.charconv; +import std; +import boost.core; + +#endif + +// These headers are part of the implementation, and safe to include #include "float128_impl.hpp" #include "to_chars_float_impl.hpp" + +#ifndef BOOST_USE_MODULES #include #include #include @@ -13,6 +37,8 @@ #include #include #include +#endif + namespace boost { namespace charconv { namespace detail { namespace to_chars_detail { diff --git a/src/to_chars_float_impl.hpp b/src/to_chars_float_impl.hpp index 24803287d..273b6c8dc 100644 --- a/src/to_chars_float_impl.hpp +++ b/src/to_chars_float_impl.hpp @@ -8,18 +8,19 @@ #define BOOST_CHARCONV_DETAIL_TO_CHARS_FLOAT_IMPL_HPP #include "float128_impl.hpp" +#include +#include +#include +#include +#include +#ifndef BOOST_USE_MODULES #include #include #include #include -#include -#include -#include #include #include #include -#include -#include #include #include #include @@ -38,10 +39,11 @@ #include #include #endif +#endif #if (BOOST_CHARCONV_LDBL_BITS == 80 || BOOST_CHARCONV_LDBL_BITS == 128) # include -# include +# include #endif namespace boost { @@ -49,7 +51,7 @@ namespace charconv { namespace detail { template -inline to_chars_result to_chars_nonfinite(char* first, char* last, Real value, int classification) noexcept; +to_chars_result to_chars_nonfinite(char* first, char* last, Real value, int classification) noexcept; #if BOOST_CHARCONV_LDBL_BITS == 128 || defined(BOOST_CHARCONV_HAS_STDFLOAT128) || defined(BOOST_CHARCONV_HAS_FLOAT16) || defined(BOOST_CHARCONV_HAS_BRAINFLOAT16) From 8b95972afef6727e0ca6b14eb5506e074a091c69 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 13:42:54 +0100 Subject: [PATCH 02/84] Test: quick --- test/quick.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/quick.cpp b/test/quick.cpp index 5d71c37a8..88a2d477e 100644 --- a/test/quick.cpp +++ b/test/quick.cpp @@ -7,7 +7,12 @@ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif +#ifdef BOOST_USE_MODULES +import boost.charconv; +#else #include +#endif + int main() { From a88ac6932f1c5fe1d3464881fbd65fad310b206a Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 13:56:03 +0100 Subject: [PATCH 03/84] Test: from_chars --- include/boost/charconv/detail/from_chars_result.hpp | 3 ++- test/from_chars.cpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/boost/charconv/detail/from_chars_result.hpp b/include/boost/charconv/detail/from_chars_result.hpp index dd914faa1..a91777e49 100644 --- a/include/boost/charconv/detail/from_chars_result.hpp +++ b/include/boost/charconv/detail/from_chars_result.hpp @@ -5,6 +5,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP #define BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP +#include #ifndef BOOST_USE_MODULES #include #endif @@ -37,7 +38,7 @@ struct from_chars_result_t constexpr explicit operator bool() const noexcept { return ec == std::errc{}; } }; -using from_chars_result = from_chars_result_t; +BOOST_MODULE_EXPORT using from_chars_result = from_chars_result_t; }} // Namespaces diff --git a/test/from_chars.cpp b/test/from_chars.cpp index ed7048f10..40769e6ef 100644 --- a/test/from_chars.cpp +++ b/test/from_chars.cpp @@ -3,6 +3,15 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES +#include +#include +#include +#include +import std; +import boost.charconv; +import boost.core; +#else #include #include #include @@ -12,12 +21,13 @@ #include #include #include - #if defined(__has_include) # if __has_include() # include # endif #endif +#endif + #ifdef BOOST_CHARCONV_HAS_INT128 template From 0fca203448a0334306659bd88d608db17db9e7ff Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 13:57:57 +0100 Subject: [PATCH 04/84] Test: to_chars --- test/to_chars.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/to_chars.cpp b/test/to_chars.cpp index 91a605f15..d0cc64e56 100644 --- a/test/to_chars.cpp +++ b/test/to_chars.cpp @@ -3,6 +3,16 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES +#include +#include +#include +#include +#include // for UINT64_C +import std; +import boost.charconv; +import boost.core; +#else #include #include #include @@ -11,6 +21,8 @@ #include #include #include +#endif + #ifdef BOOST_CHARCONV_HAS_INT128 template From d8af7a658560cadc64d825c2501f3ac76a7ae735 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 14:16:49 +0100 Subject: [PATCH 05/84] Fixed include for non-modular build --- src/from_chars.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/from_chars.cpp b/src/from_chars.cpp index 619e0f307..1a0b38822 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -46,7 +46,7 @@ import boost.core; #ifndef BOOST_USE_MODULES #include -#include +#include #include #include #include From 21d38bea5002a53545607def223a9a2b23a8d830 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 14:17:55 +0100 Subject: [PATCH 06/84] Test: roundtrip --- test/roundtrip.cpp | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/test/roundtrip.cpp b/test/roundtrip.cpp index e5835a719..f72627898 100644 --- a/test/roundtrip.cpp +++ b/test/roundtrip.cpp @@ -2,17 +2,34 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES #include +#include +#include +#include // for INT64_C +import std; +import boost.charconv; +import boost.core; +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + #ifdef BOOST_HAS_INT128 -// We need to define these operator<< overloads before -// including boost/core/lightweight_test.hpp, or they -// won't be visible to BOOST_TEST_EQ // LCOV_EXCL_START -#include - static char* mini_to_chars( char (&buffer)[ 64 ], boost::uint128_type v ) { char* p = buffer + 64; @@ -59,18 +76,6 @@ std::ostream& operator<<( std::ostream& os, boost::int128_type v ) #endif // #ifdef BOOST_HAS_INT128 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - int const N = 1024; static boost::detail::splitmix64 rng; @@ -296,7 +301,7 @@ int64_t ToOrdinal(FPType x) // Number of normal representable numbers for each exponent. static const auto - NumbersPerExponent = static_cast(scalbn(Radix-1, SignificandDigits-1)); + NumbersPerExponent = static_cast(std::scalbn(Radix-1, SignificandDigits-1)); if (x == 0) return 0; @@ -319,7 +324,7 @@ int64_t ToOrdinal(FPType x) /* Start with the number of representable numbers in preceding normal exponent ranges. */ - auto count = static_cast(static_cast(exponent - MinimumExponent) * NumbersPerExponent); + auto count = static_cast(static_cast(exponent - MinimumExponent) * NumbersPerExponent); /* For subnormal numbers, fraction * radix ** SignificandDigits is the number of representable numbers from 0 to x. For normal numbers, From cff3f1dbed3ad2dddc71bee309d307dc23e14389 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 14:25:31 +0100 Subject: [PATCH 07/84] Test: from_chars_STL --- test/from_chars_STL_comp.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/from_chars_STL_comp.cpp b/test/from_chars_STL_comp.cpp index 7823a34c0..1a782fe36 100644 --- a/test/from_chars_STL_comp.cpp +++ b/test/from_chars_STL_comp.cpp @@ -6,6 +6,13 @@ #if !defined(BOOST_NO_CXX17_HDR_CHARCONV) && (!defined(__clang_major__) || (defined(__clang_major__) && __clang_major__ > 7)) +#ifdef BOOST_USE_MODULES +#include +#include +import std; +import boost.core; +import boost.charconv; +#else #include #include #include @@ -15,6 +22,8 @@ #include #include #include +#endif + template void test() From 469db1cc2458a4db94941055f494c531009bae46 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 14:26:52 +0100 Subject: [PATCH 08/84] Test: to_chars_STL --- test/to_chars_integer_STL_comp.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/to_chars_integer_STL_comp.cpp b/test/to_chars_integer_STL_comp.cpp index 89cdc1191..dd6fd1bb5 100644 --- a/test/to_chars_integer_STL_comp.cpp +++ b/test/to_chars_integer_STL_comp.cpp @@ -6,6 +6,13 @@ #if !defined(BOOST_NO_CXX17_HDR_CHARCONV) && (!defined(__clang_major__) || (defined(__clang_major__) && __clang_major__ > 7)) +#ifdef BOOST_USE_MODULES +#include +#include +import std; +import boost.charconv; +import boost.core; +#else #include #include #include @@ -19,6 +26,8 @@ #include #include #include +#endif + template void stress_test_worker() From 1b2434832da90dd7120fbb4138c13e00f2ebc80d Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 14:33:26 +0100 Subject: [PATCH 09/84] Ensure roundtrip doesn't use EQ --- test/roundtrip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/roundtrip.cpp b/test/roundtrip.cpp index f72627898..206ebab46 100644 --- a/test/roundtrip.cpp +++ b/test/roundtrip.cpp @@ -255,7 +255,7 @@ template void test_roundtrip( T value, boost::charconv::chars_format fm T v2 = 0; auto r2 = boost::charconv::from_chars( buffer, r.ptr, v2, fmt ); - if( BOOST_TEST( r2.ec == std::errc() ) && BOOST_TEST_EQ( v2, value ) && BOOST_TEST( r2.ptr == r.ptr) ) + if( BOOST_TEST( r2.ec == std::errc() ) && BOOST_TEST( v2 == value ) && BOOST_TEST( r2.ptr == r.ptr) ) { } else From b5fb3860fed3889e3764273c12b963561cb46fb6 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 14:37:00 +0100 Subject: [PATCH 10/84] Test: limits --- test/limits.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/test/limits.cpp b/test/limits.cpp index d38e4a164..66781f58e 100644 --- a/test/limits.cpp +++ b/test/limits.cpp @@ -4,16 +4,27 @@ // https://www.boost.org/LICENSE_1_0.txt #include +#ifdef BOOST_USE_MODULES +#include +#include +import std; +import boost.charconv; +import boost.core; +#else +#include +#include +#include +#include +#include +#include +#include +#include +#endif #ifdef BOOST_HAS_INT128 -// We need to define these operator<< overloads before -// including boost/core/lightweight_test.hpp, or they -// won't be visible to BOOST_TEST_EQ // LCOV_EXCL_START -#include - static char* mini_to_chars( char (&buffer)[ 64 ], boost::uint128_type v ) { char* p = buffer + 64; @@ -60,13 +71,7 @@ std::ostream& operator<<( std::ostream& os, boost::int128_type v ) #endif // #ifdef BOOST_HAS_INT128 -#include -#include -#include -#include -#include -#include -#include + void test_odr_use( int const* ); @@ -158,7 +163,7 @@ template void test_floating_point( T value ) T v2 = 0; auto r2 = boost::charconv::from_chars( buffer, r.ptr, v2 ); - if (!BOOST_TEST(r2.ec == std::errc()) && BOOST_TEST_EQ( v2, value )) + if (!BOOST_TEST(r2.ec == std::errc()) && BOOST_TEST( v2 == value )) { // LCOV_EXCL_START std::cerr << " Value: " << value @@ -185,7 +190,7 @@ template void test_floating_point( T value ) T v2 = 0; auto r2 = boost::charconv::from_chars( buffer, r.ptr, v2 ); - if (!BOOST_TEST(r2.ec == std::errc()) && BOOST_TEST_EQ( v2, value )) + if (!BOOST_TEST(r2.ec == std::errc()) && BOOST_TEST( v2 == value )) { // LCOV_EXCL_START std::cerr << " Value: " << value From 608b335636c066109d14110847f24f44d3fd026b Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 14:39:31 +0100 Subject: [PATCH 11/84] Test: to_chars_snprintf --- test/to_chars_sprintf.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/to_chars_sprintf.cpp b/test/to_chars_sprintf.cpp index 87c08ecc6..6557cc3e0 100644 --- a/test/to_chars_sprintf.cpp +++ b/test/to_chars_sprintf.cpp @@ -3,6 +3,15 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include + +#ifdef BOOST_USE_MODULES +#include +#include +import std; +import boost.core; +import boost.charconv; +#else #include #include #include @@ -15,6 +24,8 @@ #include #include #include +#endif + int const N = 1024; From 14253a0fd183817ace7218820e2bc75fbe4412fb Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 14:48:39 +0100 Subject: [PATCH 12/84] global_module_fragment header --- .../detail/global_module_fragment.hpp | 20 +++++++++++++++++++ modules/boost_charconv.cppm | 7 +------ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 include/boost/charconv/detail/global_module_fragment.hpp diff --git a/include/boost/charconv/detail/global_module_fragment.hpp b/include/boost/charconv/detail/global_module_fragment.hpp new file mode 100644 index 000000000..9d22f2328 --- /dev/null +++ b/include/boost/charconv/detail/global_module_fragment.hpp @@ -0,0 +1,20 @@ +// Copyright 2023 Matt Borland +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_CHARCONV_DETAIL_GLOBAL_MODULE_FRAGMENT_HPP +#define BOOST_CHARCONV_DETAIL_GLOBAL_MODULE_FRAGMENT_HPP + +// Includes to be placed in the global module fragment. +// Reused by tests that include headers with names +// that are not exported from the module. + +#include // for UINT64_C +#include // for CHAR_BIT +#include +#include +#include +#include + + +#endif diff --git a/modules/boost_charconv.cppm b/modules/boost_charconv.cppm index 94683d487..fd149d6b1 100644 --- a/modules/boost_charconv.cppm +++ b/modules/boost_charconv.cppm @@ -1,11 +1,6 @@ module; -#include // for UINT64_C -#include // for CHAR_BIT -#include -#include -#include -#include +#include export module boost.charconv; From fd08bf790c731b5a5ae25915f2bb191ae6ab3cb4 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 14:49:30 +0100 Subject: [PATCH 13/84] Test: num_digits --- .../charconv/detail/integer_search_trees.hpp | 2 +- test/test_num_digits.cpp | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/boost/charconv/detail/integer_search_trees.hpp b/include/boost/charconv/detail/integer_search_trees.hpp index a3e49704d..428d2c5ea 100644 --- a/include/boost/charconv/detail/integer_search_trees.hpp +++ b/include/boost/charconv/detail/integer_search_trees.hpp @@ -8,9 +8,9 @@ // https://stackoverflow.com/questions/1489830/efficient-way-to-determine-number-of-digits-in-an-integer?page=1&tab=scoredesc#tab-top // https://graphics.stanford.edu/~seander/bithacks.html +#include #ifndef BOOST_USE_MODULES #include -#include #include #include #include diff --git a/test/test_num_digits.cpp b/test/test_num_digits.cpp index fde6d28d5..1e133e5e5 100644 --- a/test/test_num_digits.cpp +++ b/test/test_num_digits.cpp @@ -2,12 +2,22 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include -#include + +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +#include +#include +#else #include #include #include +#endif + +#include +#include +#include + #if defined(__GNUC__) && (__GNUC__ < 7) # pragma GCC diagnostic push From 454289130ee857d18020b962c194cd9e794aa64d Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 15:31:18 +0100 Subject: [PATCH 14/84] Test: limits_link_1 --- test/limits_link_1.cpp | 8 +++++++- test/limits_link_2.cpp | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/test/limits_link_1.cpp b/test/limits_link_1.cpp index a7b2eaf9b..83fe87e54 100644 --- a/test/limits_link_1.cpp +++ b/test/limits_link_1.cpp @@ -2,8 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include +#include +#ifdef BOOST_USE_MODULES +import boost.charconv; +#else #include -#include +#endif + void test_odr_use( int const* ); diff --git a/test/limits_link_2.cpp b/test/limits_link_2.cpp index b45c627fd..bd0da30ec 100644 --- a/test/limits_link_2.cpp +++ b/test/limits_link_2.cpp @@ -2,8 +2,13 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include +#include +#ifdef BOOST_USE_MODULES +import boost.charconv; +#else #include -#include +#endif void test_odr_use( int const* ); From 03f19d11653abf91a3a423618f30a6a705f14965 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 15:33:50 +0100 Subject: [PATCH 15/84] Test: 128_native --- test/test_128bit_native.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/test_128bit_native.cpp b/test/test_128bit_native.cpp index 61e1dd64a..ce7f36f19 100644 --- a/test/test_128bit_native.cpp +++ b/test/test_128bit_native.cpp @@ -2,10 +2,19 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include + +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +#include +#include +#else #include #include -#include +#endif + +#include +#include // Required by modular builds for UINT64_C void test128() { From 740e9517d584aed7c268e4f77165ef1f891269d3 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 15:38:09 +0100 Subject: [PATCH 16/84] Test: 128_emulation --- test/test_128bit_emulation.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/test/test_128bit_emulation.cpp b/test/test_128bit_emulation.cpp index 6a17011a1..a92c37f51 100644 --- a/test/test_128bit_emulation.cpp +++ b/test/test_128bit_emulation.cpp @@ -2,17 +2,27 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +#include +#include +#else +#include +#include +#include +#include +#endif + +#include #include +#include + #ifdef BOOST_HAS_INT128 -// We need to define these operator<< overloads before -// including boost/core/lightweight_test.hpp, or they -// won't be visible to BOOST_TEST_EQ // LCOV_EXCL_START -#include - static char* mini_to_chars( char (&buffer)[ 64 ], boost::uint128_type v ) { char* p = buffer + 64; @@ -59,13 +69,6 @@ std::ostream& operator<<( std::ostream& os, boost::int128_type v ) #endif // #ifdef BOOST_HAS_INT128 -#include -#include -#include -#include -#include -#include - using boost::charconv::detail::uint128; using boost::charconv::detail::trivial_uint128; From 08987ccd16949d76af4c34c9215e843995c4a86e Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 17:02:22 +0100 Subject: [PATCH 17/84] Make private headers include-able in tests --- include/boost/charconv/detail/dragonbox/dragonbox.hpp | 4 +++- include/boost/charconv/detail/dragonbox/dragonbox_common.hpp | 4 +++- include/boost/charconv/detail/dragonbox/floff.hpp | 4 +++- include/boost/charconv/detail/fast_float/float_common.hpp | 4 +++- include/boost/charconv/detail/private/bit_layouts.hpp | 4 +++- include/boost/charconv/detail/private/buffer_sizing.hpp | 4 +++- include/boost/charconv/detail/private/compute_float64.hpp | 4 +++- include/boost/charconv/detail/private/compute_float80.hpp | 4 +++- include/boost/charconv/detail/private/fallback_routines.hpp | 4 +++- include/boost/charconv/detail/private/issignaling.hpp | 4 +++- include/boost/charconv/detail/private/parser.hpp | 5 +++-- include/boost/charconv/detail/private/significand_tables.hpp | 4 +++- include/boost/charconv/detail/ryu/generic_128.hpp | 4 +++- include/boost/charconv/detail/ryu/ryu_generic_128.hpp | 4 +++- 14 files changed, 42 insertions(+), 15 deletions(-) diff --git a/include/boost/charconv/detail/dragonbox/dragonbox.hpp b/include/boost/charconv/detail/dragonbox/dragonbox.hpp index a90433aa1..fcf61007c 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox.hpp @@ -25,11 +25,13 @@ #include #include #include -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include #include #include +#endif +#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp index 261a97171..810c43999 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp @@ -25,10 +25,12 @@ #define BOOST_CHARCONV_DETAIL_DRAGONBOX_COMMON_HPP #include -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include #include +#endif +#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/charconv/detail/dragonbox/floff.hpp b/include/boost/charconv/detail/dragonbox/floff.hpp index dad05fd17..508187b37 100644 --- a/include/boost/charconv/detail/dragonbox/floff.hpp +++ b/include/boost/charconv/detail/dragonbox/floff.hpp @@ -26,11 +26,13 @@ #include #include -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include #include #include +#endif +#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/charconv/detail/fast_float/float_common.hpp b/include/boost/charconv/detail/fast_float/float_common.hpp index 11fca785f..b63bb7d38 100644 --- a/include/boost/charconv/detail/fast_float/float_common.hpp +++ b/include/boost/charconv/detail/fast_float/float_common.hpp @@ -9,10 +9,12 @@ #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FLOAT_COMMON_HPP #include -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include #include +#endif +#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/charconv/detail/private/bit_layouts.hpp b/include/boost/charconv/detail/private/bit_layouts.hpp index 9d3cdc186..4dae910db 100644 --- a/include/boost/charconv/detail/private/bit_layouts.hpp +++ b/include/boost/charconv/detail/private/bit_layouts.hpp @@ -5,9 +5,11 @@ #ifndef BOOST_CHARCONV_DETAIL_BIT_LAYOUTS_HPP #define BOOST_CHARCONV_DETAIL_BIT_LAYOUTS_HPP -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include +#endif +#ifndef BOOST_USE_MODULES #include #include #endif diff --git a/include/boost/charconv/detail/private/buffer_sizing.hpp b/include/boost/charconv/detail/private/buffer_sizing.hpp index a462678f5..a7a0a57fc 100644 --- a/include/boost/charconv/detail/private/buffer_sizing.hpp +++ b/include/boost/charconv/detail/private/buffer_sizing.hpp @@ -5,9 +5,11 @@ #ifndef BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP #define BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include +#endif +#ifndef BOOST_USE_MODULES #include #endif diff --git a/include/boost/charconv/detail/private/compute_float64.hpp b/include/boost/charconv/detail/private/compute_float64.hpp index 0ee26b1ec..c544f14d9 100644 --- a/include/boost/charconv/detail/private/compute_float64.hpp +++ b/include/boost/charconv/detail/private/compute_float64.hpp @@ -7,9 +7,11 @@ #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT64_HPP #include -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include +#endif +#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/charconv/detail/private/compute_float80.hpp b/include/boost/charconv/detail/private/compute_float80.hpp index 358c9f215..d7623cdd7 100644 --- a/include/boost/charconv/detail/private/compute_float80.hpp +++ b/include/boost/charconv/detail/private/compute_float80.hpp @@ -6,9 +6,11 @@ #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP #include -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include +#endif +#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/charconv/detail/private/fallback_routines.hpp b/include/boost/charconv/detail/private/fallback_routines.hpp index 5a66b5571..a62b58614 100644 --- a/include/boost/charconv/detail/private/fallback_routines.hpp +++ b/include/boost/charconv/detail/private/fallback_routines.hpp @@ -6,11 +6,13 @@ #define BOOST_FALLBACK_ROUTINES_HPP #include -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include #include #include +#endif +#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/charconv/detail/private/issignaling.hpp b/include/boost/charconv/detail/private/issignaling.hpp index 5f6fdab8b..62064896c 100644 --- a/include/boost/charconv/detail/private/issignaling.hpp +++ b/include/boost/charconv/detail/private/issignaling.hpp @@ -6,8 +6,10 @@ #define BOOST_CHARCONV_DETAIL_ISSIGNALING_HPP #include -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include +#endif +#ifndef BOOST_USE_MODULES #include #include #endif diff --git a/include/boost/charconv/detail/private/parser.hpp b/include/boost/charconv/detail/private/parser.hpp index d57731823..301ab4b1d 100644 --- a/include/boost/charconv/detail/private/parser.hpp +++ b/include/boost/charconv/detail/private/parser.hpp @@ -5,14 +5,15 @@ #ifndef BOOST_CHARCONV_DETAIL_PARSER_HPP #define BOOST_CHARCONV_DETAIL_PARSER_HPP -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include #include #include #include #include -#include +#endif +#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/charconv/detail/private/significand_tables.hpp b/include/boost/charconv/detail/private/significand_tables.hpp index b939f5863..32c54c451 100644 --- a/include/boost/charconv/detail/private/significand_tables.hpp +++ b/include/boost/charconv/detail/private/significand_tables.hpp @@ -6,8 +6,10 @@ #ifndef BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP #define BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include +#endif +#ifndef BOOST_USE_MODULES #include #endif diff --git a/include/boost/charconv/detail/ryu/generic_128.hpp b/include/boost/charconv/detail/ryu/generic_128.hpp index e6c6f1c78..1ed0df2b7 100644 --- a/include/boost/charconv/detail/ryu/generic_128.hpp +++ b/include/boost/charconv/detail/ryu/generic_128.hpp @@ -6,10 +6,12 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include #include +#endif +#ifndef BOOST_USE_MODULES #include #endif diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index ee1a7c098..cd7fc325c 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -8,10 +8,12 @@ #include #include -#ifndef BOOST_USE_MODULES +#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include #include +#endif +#ifndef BOOST_USE_MODULES #include #include #include From 78048a56bbae21196bde50581f04106c44f18507 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 17:03:11 +0100 Subject: [PATCH 18/84] compute_float80 --- test/test_compute_float80.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/test/test_compute_float80.cpp b/test/test_compute_float80.cpp index a800f9572..3e59bfa8a 100644 --- a/test/test_compute_float80.cpp +++ b/test/test_compute_float80.cpp @@ -2,16 +2,25 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include -#include +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +#include +#include +#else #include #include #include #include -#include #include #include +#endif + +#include +#include +#include +#include + // MSVC uses long double = double // Darwin sometimes uses double-double instead of long double From 788cba185c9c0739280df59b6b8085939e902346 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 17:07:16 +0100 Subject: [PATCH 19/84] Test: compute_float64 --- test/test_compute_float64.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/test_compute_float64.cpp b/test/test_compute_float64.cpp index 945276281..039cbeba1 100644 --- a/test/test_compute_float64.cpp +++ b/test/test_compute_float64.cpp @@ -2,12 +2,21 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +#include +#include +#include +#else #include #include #include -#include #include +#endif + +#include +#include using boost::charconv::detail::compute_float64; From 4fd55978ee11c2d2bce1544cca82b9cf8213323c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 18:05:31 +0100 Subject: [PATCH 20/84] Made compute_float64 more self-contained --- include/boost/charconv/detail/private/compute_float64.hpp | 4 ++-- test/test_compute_float64.cpp | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/boost/charconv/detail/private/compute_float64.hpp b/include/boost/charconv/detail/private/compute_float64.hpp index c544f14d9..266c4c497 100644 --- a/include/boost/charconv/detail/private/compute_float64.hpp +++ b/include/boost/charconv/detail/private/compute_float64.hpp @@ -10,13 +10,13 @@ #if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include +#include +#include #endif #ifndef BOOST_USE_MODULES #include -#include #include #include -#include #endif diff --git a/test/test_compute_float64.cpp b/test/test_compute_float64.cpp index 039cbeba1..632334ea7 100644 --- a/test/test_compute_float64.cpp +++ b/test/test_compute_float64.cpp @@ -7,16 +7,15 @@ import std; import boost.core; #include #include -#include #else #include #include #include -#include #endif -#include #include +#include +#include using boost::charconv::detail::compute_float64; From 7520a2857cbbcfd660d1f64ee31de0ac98b82f5d Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 18:29:01 +0100 Subject: [PATCH 21/84] Test: compute_float32 --- test/test_compute_float32.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/test_compute_float32.cpp b/test/test_compute_float32.cpp index d3fa83465..a2dafaa0b 100644 --- a/test/test_compute_float32.cpp +++ b/test/test_compute_float32.cpp @@ -2,11 +2,19 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +#include +#include +#else #include #include -#include #include +#endif + +#include +#include using boost::charconv::detail::compute_float32; From d0d126ef19218b55cb59f8b2fe25140caef6f997 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 18:46:04 +0100 Subject: [PATCH 22/84] Use library-specific export macro --- include/boost/charconv/chars_format.hpp | 6 ++++-- include/boost/charconv/detail/config.hpp | 8 ++++++++ include/boost/charconv/detail/from_chars_result.hpp | 4 ++-- include/boost/charconv/detail/private/compute_float64.hpp | 2 +- include/boost/charconv/detail/private/compute_float80.hpp | 2 +- include/boost/charconv/detail/to_chars_result.hpp | 4 ++-- include/boost/charconv/from_chars.hpp | 2 +- include/boost/charconv/limits.hpp | 3 +-- include/boost/charconv/to_chars.hpp | 7 +++++-- 9 files changed, 25 insertions(+), 13 deletions(-) diff --git a/include/boost/charconv/chars_format.hpp b/include/boost/charconv/chars_format.hpp index 21972b182..9d8a83e9a 100644 --- a/include/boost/charconv/chars_format.hpp +++ b/include/boost/charconv/chars_format.hpp @@ -5,13 +5,15 @@ #ifndef BOOST_CHARCONV_CHARS_FORMAT_HPP #define BOOST_CHARCONV_CHARS_FORMAT_HPP -#include +#ifndef BOOST_USE_MODULES +#include +#endif namespace boost { namespace charconv { // Floating-point format for primitive numerical conversion // chars_format is a bitmask type (16.3.3.3.3) -BOOST_MODULE_EXPORT +BOOST_CHARCONV_MODULE_EXPORT enum class chars_format : unsigned { scientific = 1 << 0, diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index 08c6d3f28..ff97a03a6 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -205,4 +205,12 @@ static_assert((BOOST_CHARCONV_ENDIAN_BIG_BYTE || BOOST_CHARCONV_ENDIAN_LITTLE_BY # define BOOST_CHARCONV_LDBL_BITS -1 #endif +// Modules. Only use export when building the library, +// since the headers might be included by tests even in modular builds. +#if defined(BOOST_USE_MODULES) && defined(BOOST_CHARCONV_SOURCE) +# define BOOST_CHARCONV_MODULE_EXPORT export +#else +# define BOOST_CHARCONV_MODULE_EXPORT +#endif + #endif // BOOST_CHARCONV_DETAIL_CONFIG_HPP diff --git a/include/boost/charconv/detail/from_chars_result.hpp b/include/boost/charconv/detail/from_chars_result.hpp index a91777e49..fcfefeb86 100644 --- a/include/boost/charconv/detail/from_chars_result.hpp +++ b/include/boost/charconv/detail/from_chars_result.hpp @@ -5,8 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP #define BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP -#include #ifndef BOOST_USE_MODULES +#include #include #endif @@ -38,7 +38,7 @@ struct from_chars_result_t constexpr explicit operator bool() const noexcept { return ec == std::errc{}; } }; -BOOST_MODULE_EXPORT using from_chars_result = from_chars_result_t; +BOOST_CHARCONV_MODULE_EXPORT using from_chars_result = from_chars_result_t; }} // Namespaces diff --git a/include/boost/charconv/detail/private/compute_float64.hpp b/include/boost/charconv/detail/private/compute_float64.hpp index 266c4c497..0c2ae4c8a 100644 --- a/include/boost/charconv/detail/private/compute_float64.hpp +++ b/include/boost/charconv/detail/private/compute_float64.hpp @@ -11,12 +11,12 @@ #include #include #include -#include #endif #ifndef BOOST_USE_MODULES #include #include #include +#include #endif diff --git a/include/boost/charconv/detail/private/compute_float80.hpp b/include/boost/charconv/detail/private/compute_float80.hpp index d7623cdd7..ed48922af 100644 --- a/include/boost/charconv/detail/private/compute_float80.hpp +++ b/include/boost/charconv/detail/private/compute_float80.hpp @@ -9,13 +9,13 @@ #if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include #include +#include // HUGE_VAL #endif #ifndef BOOST_USE_MODULES #include #include #include #include -#include #include #include #ifdef BOOST_CHARCONV_DEBUG_FLOAT128 diff --git a/include/boost/charconv/detail/to_chars_result.hpp b/include/boost/charconv/detail/to_chars_result.hpp index 7e53f9c95..4d95e6a05 100644 --- a/include/boost/charconv/detail/to_chars_result.hpp +++ b/include/boost/charconv/detail/to_chars_result.hpp @@ -5,8 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP #define BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP -#include #ifndef BOOST_USE_MODULES +#include #include #endif @@ -15,7 +15,7 @@ namespace boost { namespace charconv { -BOOST_MODULE_EXPORT +BOOST_CHARCONV_MODULE_EXPORT struct to_chars_result { char *ptr; diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index 11f3b55cc..fee408860 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -18,7 +18,7 @@ #endif -BOOST_MODULE_EXPORT namespace boost { namespace charconv { +BOOST_CHARCONV_MODULE_EXPORT namespace boost { namespace charconv { // integer overloads diff --git a/include/boost/charconv/limits.hpp b/include/boost/charconv/limits.hpp index 2d98fa838..34dd2eae1 100644 --- a/include/boost/charconv/limits.hpp +++ b/include/boost/charconv/limits.hpp @@ -5,7 +5,6 @@ #ifndef BOOST_CHARCONV_LIMITS_HPP #define BOOST_CHARCONV_LIMITS_HPP -#include #ifndef BOOST_USE_MODULES #include #include @@ -45,7 +44,7 @@ template struct is_uint128: std::false_type {}; } // namespace detail -BOOST_MODULE_EXPORT +BOOST_CHARCONV_MODULE_EXPORT template struct limits { BOOST_ATTRIBUTE_UNUSED static constexpr int max_chars10 = diff --git a/include/boost/charconv/to_chars.hpp b/include/boost/charconv/to_chars.hpp index 7020aac1c..7bf42c240 100644 --- a/include/boost/charconv/to_chars.hpp +++ b/include/boost/charconv/to_chars.hpp @@ -11,9 +11,12 @@ #include #include #include -#include +#ifndef BOOST_USE_MODULES +#include +#endif + -BOOST_MODULE_EXPORT +BOOST_CHARCONV_MODULE_EXPORT namespace boost { namespace charconv { From 8133fe74395e18e28c9ffc6ccc917dc6b76213bc Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 18:46:27 +0100 Subject: [PATCH 23/84] Test: parser --- test/test_parser.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 1ccdb6488..2afeb8ee1 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -2,14 +2,23 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +#include +#include +#else #include #include #include #include #include #include +#endif + +#include +#include + template void test_integer() From 3d8af3bb8621dece532496e63e88aaf9cadd932f Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 18:49:01 +0100 Subject: [PATCH 24/84] Made fallback_routines.hpp more self-contained --- include/boost/charconv/detail/private/fallback_routines.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/charconv/detail/private/fallback_routines.hpp b/include/boost/charconv/detail/private/fallback_routines.hpp index a62b58614..54752c2d2 100644 --- a/include/boost/charconv/detail/private/fallback_routines.hpp +++ b/include/boost/charconv/detail/private/fallback_routines.hpp @@ -11,6 +11,8 @@ #include #include #include +#include +#include #endif #ifndef BOOST_USE_MODULES #include From 3234d01c55fb1e19aecb498d3ac326903c1b9714 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 18:59:16 +0100 Subject: [PATCH 25/84] Test: from_chars_float --- test/from_chars_float.cpp | 585 +----------------------------------- test/from_chars_strtod.cpp | 600 +++++++++++++++++++++++++++++++++++++ 2 files changed, 610 insertions(+), 575 deletions(-) create mode 100644 test/from_chars_strtod.cpp diff --git a/test/from_chars_float.cpp b/test/from_chars_float.cpp index cf810b559..949fe73fc 100644 --- a/test/from_chars_float.cpp +++ b/test/from_chars_float.cpp @@ -2,7 +2,13 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include "../src/from_chars_float_impl.hpp" +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#include +#else #include #include #include @@ -13,8 +19,11 @@ #include #include #include +#endif + #include + template void spot_value(const std::string& buffer, T expected_value, boost::charconv::chars_format fmt = boost::charconv::chars_format::general) { @@ -471,29 +480,6 @@ void test_issue_45(T v, const std::string& full_buffer, const std::ptrdiff_t ptr } } -template -void test_strtod_routines(T val, const char* str) -{ - T strtod_val = -2; - const auto r = boost::charconv::detail::from_chars_strtod(str, str + std::strlen(str), strtod_val); - if (r.ec == std::errc::not_enough_memory || r.ec == std::errc::result_out_of_range) - { - if (!BOOST_TEST_EQ(strtod_val, T(-2))) - { - std::cerr << "Value was modified from input value, but should not have been"; - } - } - else - { - if (!BOOST_TEST_EQ(strtod_val, val)) - { - std::cerr << std::setprecision(std::numeric_limits::digits10 + 1) - << "Expected: " << val - << "\n Got: " << strtod_val << std::endl; - } - } -} - // Parser ignoring null terminator template void test_issue_48(const T val, const char* str, const std::ptrdiff_t expected_pos, boost::charconv::chars_format fmt = boost::charconv::chars_format::general) @@ -671,557 +657,6 @@ int main() spot_value("0e00000000000", 0e00000000000); spot_value("0e1", 0e1); - // Value in range with 20 million digits. Malloc should max out at 16'711'568 bytes - test_strtod_routines(1.982645139827653964857196, - "1.98264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - ); - - test_strtod_routines(HUGE_VAL, "1e310"); - test_strtod_routines(-HUGE_VALF, "-1e40"); - test_strtod_routines(0.0, "1e-500"); - test_strtod_routines(-0.0F, "-1e-50"); - test_strtod_routines(1.5738291047382910487, "1.5738291047382910487"); - test_strtod_routines(-1.5738291047382910487F, "-1.5738291047382910487"); - // Every power spot_check(1.7e+308, "1.7e+308", boost::charconv::chars_format::scientific); spot_check(1.7e+307, "1.7e+307", boost::charconv::chars_format::scientific); diff --git a/test/from_chars_strtod.cpp b/test/from_chars_strtod.cpp new file mode 100644 index 000000000..51497a5c4 --- /dev/null +++ b/test/from_chars_strtod.cpp @@ -0,0 +1,600 @@ +// Copyright 2023 Matt Borland +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +#include +#include +#else +#include +#include +#include +#include +#include +#endif + +#include +#include "../src/from_chars_float_impl.hpp" + + + +template +void test_strtod_routines(T val, const char* str) +{ + T strtod_val = -2; + const auto r = boost::charconv::detail::from_chars_strtod(str, str + std::strlen(str), strtod_val); + if (r.ec == std::errc::not_enough_memory || r.ec == std::errc::result_out_of_range) + { + if (!BOOST_TEST_EQ(strtod_val, T(-2))) + { + std::cerr << "Value was modified from input value, but should not have been"; + } + } + else + { + if (!BOOST_TEST_EQ(strtod_val, val)) + { + std::cerr << std::setprecision(std::numeric_limits::digits10 + 1) + << "Expected: " << val + << "\n Got: " << strtod_val << std::endl; + } + } +} + +int main() +{ + // Value in range with 20 million digits. Malloc should max out at 16'711'568 bytes + test_strtod_routines(1.982645139827653964857196, + "1.98264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + ); + + test_strtod_routines(HUGE_VAL, "1e310"); + test_strtod_routines(-HUGE_VALF, "-1e40"); + test_strtod_routines(0.0, "1e-500"); + test_strtod_routines(-0.0F, "-1e-50"); + test_strtod_routines(1.5738291047382910487, "1.5738291047382910487"); + test_strtod_routines(-1.5738291047382910487F, "-1.5738291047382910487"); + + return boost::report_errors(); +} From 4b7b8760d0d4fdd87f97f866c0e5e1d4ac2b2b91 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:05:57 +0100 Subject: [PATCH 26/84] Test: to_chars_float --- test/to_chars_float.cpp | 139 ++---------------------- test/to_chars_float_fallback.cpp | 179 +++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+), 129 deletions(-) create mode 100644 test/to_chars_float_fallback.cpp diff --git a/test/to_chars_float.cpp b/test/to_chars_float.cpp index 301c0df7f..9dd0944ed 100644 --- a/test/to_chars_float.cpp +++ b/test/to_chars_float.cpp @@ -3,9 +3,15 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include -#include #include +#include #include #include #include @@ -17,7 +23,8 @@ #include #include #include -#include +#endif + // These numbers diverge from what the formatting is using printf // See: https://godbolt.org/z/zd34KcWMW @@ -52,7 +59,7 @@ void integer_general_format() BOOST_TEST(r1.ec == std::errc()); BOOST_TEST_CSTR_EQ(buffer1, "1217.2772861138403"); T return_v1; - auto r1_return = boost::charconv::from_chars(buffer1, buffer1 + strlen(buffer1), return_v1); + auto r1_return = boost::charconv::from_chars(buffer1, buffer1 + std::strlen(buffer1), return_v1); BOOST_TEST(r1_return.ec == std::errc()); BOOST_TEST_EQ(return_v1, v1); } @@ -171,30 +178,6 @@ constexpr const char* fmt_fixed(long double) return "%.0Lf"; } -template -void test_printf_fallback(T v, const std::string&, boost::charconv::chars_format fmt = boost::charconv::chars_format::general, int precision = -1) -{ - char buffer[256] {}; - const auto r = boost::charconv::detail::to_chars_printf_impl(buffer, buffer + sizeof(buffer), v, fmt, precision); - BOOST_TEST(r.ec == std::errc()); - - char printf_buffer[256] {}; - if (fmt == boost::charconv::chars_format::general) - { - std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_general(v), v); - } - else if (fmt == boost::charconv::chars_format::scientific) - { - std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_sci(v), v); - } - else if (fmt == boost::charconv::chars_format::fixed) - { - std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_fixed(v), v); - } - - BOOST_TEST_CSTR_EQ(buffer, printf_buffer); -} - std::string format(int prec) { std::string format = "%." + std::to_string(prec) + "g"; @@ -300,108 +283,6 @@ int main() spot_check(123456789012345.0, "1.23456789012345e+14", boost::charconv::chars_format::scientific); spot_check(1234567890123456.0, "1.234567890123456e+15", boost::charconv::chars_format::scientific); - test_printf_fallback(1.0, "1"); - test_printf_fallback(1.2, "1.2"); - test_printf_fallback(1.23, "1.23"); - test_printf_fallback(1.234, "1.234"); - test_printf_fallback(1.2345, "1.2345"); - test_printf_fallback(1.23456, "1.23456"); - test_printf_fallback(1.234567, "1.234567"); - test_printf_fallback(1.2345678, "1.2345678"); - test_printf_fallback(1.23456789, "1.23456789"); - test_printf_fallback(1.234567890, "1.23456789"); - test_printf_fallback(1.2345678901, "1.2345678901"); - test_printf_fallback(1.23456789012, "1.23456789012"); - test_printf_fallback(1.234567890123, "1.234567890123"); - test_printf_fallback(1.2345678901234, "1.2345678901234"); - test_printf_fallback(1.23456789012345, "1.23456789012345"); - test_printf_fallback(1.234567890123456, "1.234567890123456"); - - test_printf_fallback(1.0, "1e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2, "1.2e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23, "1.23e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234, "1.234e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345, "1.2345e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456, "1.23456e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567, "1.234567e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678, "1.2345678e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789, "1.23456789e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890, "1.23456789e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678901, "1.2345678901e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789012, "1.23456789012e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890123, "1.234567890123e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678901234, "1.2345678901234e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789012345, "1.23456789012345e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890123456, "1.234567890123456e+00", boost::charconv::chars_format::scientific); - - test_printf_fallback(1.0, "1e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2, "1.2e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23, "1.23e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234, "1.234e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345, "1.2345e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456, "1.23456e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567, "1.234567e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678, "1.2345678e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789, "1.23456789e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890, "1.23456789e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678901, "1.2345678901e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789012, "1.23456789012e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890123, "1.234567890123e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678901234, "1.2345678901234e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789012345, "1.23456789012345e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890123456, "1.234567890123456e+00", boost::charconv::chars_format::fixed); - - test_printf_fallback(1.0L, "1"); - test_printf_fallback(1.2L, "1.2"); - test_printf_fallback(1.23L, "1.23"); - test_printf_fallback(1.234L, "1.234"); - test_printf_fallback(1.2345L, "1.2345"); - test_printf_fallback(1.23456L, "1.23456"); - test_printf_fallback(1.234567L, "1.234567"); - test_printf_fallback(1.2345678L, "1.2345678"); - test_printf_fallback(1.23456789L, "1.23456789"); - test_printf_fallback(1.234567890L, "1.23456789"); - test_printf_fallback(1.2345678901L, "1.2345678901"); - test_printf_fallback(1.23456789012L, "1.23456789012"); - test_printf_fallback(1.234567890123L, "1.234567890123"); - test_printf_fallback(1.2345678901234L, "1.2345678901234"); - test_printf_fallback(1.23456789012345L, "1.23456789012345"); - test_printf_fallback(1.234567890123456L, "1.234567890123456"); - - test_printf_fallback(1.0L, "1e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2L, "1.2e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23L, "1.23e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234L, "1.234e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345L, "1.2345e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456L, "1.23456e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567L, "1.234567e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678L, "1.2345678e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789L, "1.23456789e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890L, "1.23456789e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678901L, "1.2345678901e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789012L, "1.23456789012e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890123L, "1.234567890123e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678901234L, "1.2345678901234e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789012345L, "1.23456789012345e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890123456L, "1.234567890123456e+00", boost::charconv::chars_format::scientific); - - test_printf_fallback(1.0L, "1e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2L, "1.2e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23L, "1.23e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234L, "1.234e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345L, "1.2345e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456L, "1.23456e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567L, "1.234567e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678L, "1.2345678e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789L, "1.23456789e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890L, "1.23456789e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678901L, "1.2345678901e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789012L, "1.23456789012e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890123L, "1.234567890123e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678901234L, "1.2345678901234e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789012345L, "1.23456789012345e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890123456L, "1.234567890123456e+00", boost::charconv::chars_format::fixed); - // Regressions or numbers that take >64 bits to represent correctly spot_check(9007199254740991.0, "9.007199254740991e+15", boost::charconv::chars_format::scientific); spot_check(9007199254740992.0, "9.007199254740992e+15", boost::charconv::chars_format::scientific); diff --git a/test/to_chars_float_fallback.cpp b/test/to_chars_float_fallback.cpp new file mode 100644 index 000000000..12ed6070c --- /dev/null +++ b/test/to_chars_float_fallback.cpp @@ -0,0 +1,179 @@ +// Copyright 2018 Ulf Adams +// Copyright 2023 Matt Borland +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +#include +#include +#else +#include +#include +#include +#endif + +#include + + +constexpr const char* fmt_general(double) +{ + return "%g"; +} + +constexpr const char* fmt_general(long double) +{ + return "%Lg"; +} + +constexpr const char* fmt_sci(double) +{ + return "%e"; +} + +constexpr const char* fmt_sci(long double) +{ + return "%Le"; +} + +constexpr const char* fmt_fixed(double) +{ + return "%.0f"; +} + +constexpr const char* fmt_fixed(long double) +{ + return "%.0Lf"; +} + +template +void test_printf_fallback(T v, const std::string&, boost::charconv::chars_format fmt = boost::charconv::chars_format::general, int precision = -1) +{ + char buffer[256] {}; + const auto r = boost::charconv::detail::to_chars_printf_impl(buffer, buffer + sizeof(buffer), v, fmt, precision); + BOOST_TEST(r.ec == std::errc()); + + char printf_buffer[256] {}; + if (fmt == boost::charconv::chars_format::general) + { + std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_general(v), v); + } + else if (fmt == boost::charconv::chars_format::scientific) + { + std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_sci(v), v); + } + else if (fmt == boost::charconv::chars_format::fixed) + { + std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_fixed(v), v); + } + + BOOST_TEST_CSTR_EQ(buffer, printf_buffer); +} + +int main() +{ + test_printf_fallback(1.0, "1"); + test_printf_fallback(1.2, "1.2"); + test_printf_fallback(1.23, "1.23"); + test_printf_fallback(1.234, "1.234"); + test_printf_fallback(1.2345, "1.2345"); + test_printf_fallback(1.23456, "1.23456"); + test_printf_fallback(1.234567, "1.234567"); + test_printf_fallback(1.2345678, "1.2345678"); + test_printf_fallback(1.23456789, "1.23456789"); + test_printf_fallback(1.234567890, "1.23456789"); + test_printf_fallback(1.2345678901, "1.2345678901"); + test_printf_fallback(1.23456789012, "1.23456789012"); + test_printf_fallback(1.234567890123, "1.234567890123"); + test_printf_fallback(1.2345678901234, "1.2345678901234"); + test_printf_fallback(1.23456789012345, "1.23456789012345"); + test_printf_fallback(1.234567890123456, "1.234567890123456"); + + test_printf_fallback(1.0, "1e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2, "1.2e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23, "1.23e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234, "1.234e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345, "1.2345e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456, "1.23456e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567, "1.234567e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678, "1.2345678e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789, "1.23456789e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890, "1.23456789e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678901, "1.2345678901e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789012, "1.23456789012e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890123, "1.234567890123e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678901234, "1.2345678901234e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789012345, "1.23456789012345e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890123456, "1.234567890123456e+00", boost::charconv::chars_format::scientific); + + test_printf_fallback(1.0, "1e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2, "1.2e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23, "1.23e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234, "1.234e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345, "1.2345e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456, "1.23456e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567, "1.234567e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678, "1.2345678e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789, "1.23456789e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890, "1.23456789e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678901, "1.2345678901e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789012, "1.23456789012e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890123, "1.234567890123e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678901234, "1.2345678901234e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789012345, "1.23456789012345e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890123456, "1.234567890123456e+00", boost::charconv::chars_format::fixed); + + test_printf_fallback(1.0L, "1"); + test_printf_fallback(1.2L, "1.2"); + test_printf_fallback(1.23L, "1.23"); + test_printf_fallback(1.234L, "1.234"); + test_printf_fallback(1.2345L, "1.2345"); + test_printf_fallback(1.23456L, "1.23456"); + test_printf_fallback(1.234567L, "1.234567"); + test_printf_fallback(1.2345678L, "1.2345678"); + test_printf_fallback(1.23456789L, "1.23456789"); + test_printf_fallback(1.234567890L, "1.23456789"); + test_printf_fallback(1.2345678901L, "1.2345678901"); + test_printf_fallback(1.23456789012L, "1.23456789012"); + test_printf_fallback(1.234567890123L, "1.234567890123"); + test_printf_fallback(1.2345678901234L, "1.2345678901234"); + test_printf_fallback(1.23456789012345L, "1.23456789012345"); + test_printf_fallback(1.234567890123456L, "1.234567890123456"); + + test_printf_fallback(1.0L, "1e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2L, "1.2e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23L, "1.23e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234L, "1.234e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345L, "1.2345e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456L, "1.23456e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567L, "1.234567e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678L, "1.2345678e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789L, "1.23456789e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890L, "1.23456789e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678901L, "1.2345678901e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789012L, "1.23456789012e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890123L, "1.234567890123e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678901234L, "1.2345678901234e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789012345L, "1.23456789012345e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890123456L, "1.234567890123456e+00", boost::charconv::chars_format::scientific); + + test_printf_fallback(1.0L, "1e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2L, "1.2e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23L, "1.23e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234L, "1.234e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345L, "1.2345e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456L, "1.23456e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567L, "1.234567e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678L, "1.2345678e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789L, "1.23456789e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890L, "1.23456789e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678901L, "1.2345678901e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789012L, "1.23456789012e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890123L, "1.234567890123e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678901234L, "1.2345678901234e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789012345L, "1.23456789012345e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890123456L, "1.234567890123456e+00", boost::charconv::chars_format::fixed); + + return boost::report_errors(); +} From 267260931abc892b1e650051a20f9bb76d9a29f9 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:07:23 +0100 Subject: [PATCH 27/84] Remove GMF include from from_chars_float --- test/from_chars_float.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/from_chars_float.cpp b/test/from_chars_float.cpp index 949fe73fc..37ae165c0 100644 --- a/test/from_chars_float.cpp +++ b/test/from_chars_float.cpp @@ -7,7 +7,6 @@ import std; import boost.core; import boost.charconv; #include -#include #else #include #include From 81e21fd377e0f1148b07211e45fb5cb31cc83d16 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:11:10 +0100 Subject: [PATCH 28/84] Test: boost_json_values --- test/test_boost_json_values.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/test_boost_json_values.cpp b/test/test_boost_json_values.cpp index fb3e5963c..587860e18 100644 --- a/test/test_boost_json_values.cpp +++ b/test/test_boost_json_values.cpp @@ -7,6 +7,12 @@ // See: https://github.com/boostorg/json/issues/599 // See: https://github.com/boostorg/json/blob/develop/test/double.cpp +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include #include #include @@ -18,7 +24,11 @@ #include #include #include -#include +#endif + +#include // PRId64 +#include // stderr + template void grind(const std::string& str, const T expected_value) From 05b9ea2896203aa325841c0b34e936d912d6f3e4 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:13:16 +0100 Subject: [PATCH 29/84] Test: to_chars_STL --- test/to_chars_float_STL_comp.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/to_chars_float_STL_comp.cpp b/test/to_chars_float_STL_comp.cpp index 848940159..87bd568ba 100644 --- a/test/to_chars_float_STL_comp.cpp +++ b/test/to_chars_float_STL_comp.cpp @@ -7,8 +7,14 @@ // https://en.cppreference.com/w/cpp/compiler_support/17 #if (defined(__GNUC__) && __GNUC__ >= 11) || \ ((defined(__clang__) && __clang_major__ >= 14 && !defined(__APPLE__)) || (defined(__clang__) && defined(__APPLE__) && __clang_major__ >= 16)) || \ - (defined(_MSC_VER) && _MSC_VER >= 1924) + (defined(_MSC_VER) && _MSC_VER >= 1924) && !defined(BOOST_NO_CXX17_HDR_CHARCONV) +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include #include #include @@ -22,6 +28,8 @@ #include #include #include +#endif + template void test_spot(T val, boost::charconv::chars_format fmt = boost::charconv::chars_format::general, int precision = -1) From 4010c959c62de1ec0f085222482cd24f28e5c91b Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:14:20 +0100 Subject: [PATCH 30/84] Test: from_chars_float2 --- test/from_chars_float2.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/from_chars_float2.cpp b/test/from_chars_float2.cpp index 8e0e64260..b9561f17d 100644 --- a/test/from_chars_float2.cpp +++ b/test/from_chars_float2.cpp @@ -2,10 +2,18 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include #include #include -#include +#endif + +#include // stderr static boost::detail::splitmix64 rng; From e9d3a34cbc88066625e877ab9f96266685b2c473 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:16:36 +0100 Subject: [PATCH 31/84] Test: P2497 --- test/P2497.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/P2497.cpp b/test/P2497.cpp index 9359f9c03..71a3111c5 100644 --- a/test/P2497.cpp +++ b/test/P2497.cpp @@ -2,6 +2,12 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include #include #include @@ -11,6 +17,8 @@ #include #include #include +#endif + // No overflows, negative numbers, locales, etc. template From 00cbf9917c14dacb7f9115f437ac17dd4eb65c8c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:17:50 +0100 Subject: [PATCH 32/84] Test: issue 110 --- test/github_issue_110.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/github_issue_110.cpp b/test/github_issue_110.cpp index 0ccf6dec4..f3bdfaa5c 100644 --- a/test/github_issue_110.cpp +++ b/test/github_issue_110.cpp @@ -2,8 +2,17 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#include +#else #include #include +#endif + template void overflow_spot_value(const std::string& buffer, boost::charconv::chars_format fmt = boost::charconv::chars_format::general) From 992ba1b35c11e969a9e01a671135d8a10a1cc963 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:19:11 +0100 Subject: [PATCH 33/84] Test: issue 122 --- test/github_issue_122.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/github_issue_122.cpp b/test/github_issue_122.cpp index c8495b285..cd1394606 100644 --- a/test/github_issue_122.cpp +++ b/test/github_issue_122.cpp @@ -3,11 +3,19 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +#include +#include +#else #include #include -#include -#include #include +#endif + +#include +#include template void test() From efb3bebd02b8ac7d065ad0620e927d1566ba75c0 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:20:18 +0100 Subject: [PATCH 34/84] Test: from_chars_string_view --- test/from_chars_string_view.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/from_chars_string_view.cpp b/test/from_chars_string_view.cpp index 358894281..b0e7ed55e 100644 --- a/test/from_chars_string_view.cpp +++ b/test/from_chars_string_view.cpp @@ -2,18 +2,28 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include + #include +#include + +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else +#include #include #include #include #include #include #include - #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) # include #endif +#endif + static std::mt19937_64 rng(42); constexpr std::size_t N = 1024; From 1ef56a991dc705a3e686dd47fadaa67e3fc8e9ee Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:22:14 +0100 Subject: [PATCH 35/84] Test: issue 152 --- test/github_issue_152.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/github_issue_152.cpp b/test/github_issue_152.cpp index 5409a4767..9c0775aa1 100644 --- a/test/github_issue_152.cpp +++ b/test/github_issue_152.cpp @@ -2,15 +2,25 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include #include -#include #include #include #include #include #include #include +#endif + +#include +#include + constexpr std::size_t N = 1024; static std::mt19937_64 rng(42); From fd5101ba6ab4d823dae8224e34ac3b8f990cbae0 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:23:19 +0100 Subject: [PATCH 36/84] Test: issue 154 --- test/github_issue_154.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/github_issue_154.cpp b/test/github_issue_154.cpp index a7866a0be..b5f393bec 100644 --- a/test/github_issue_154.cpp +++ b/test/github_issue_154.cpp @@ -4,8 +4,17 @@ // // See: https://github.com/boostorg/charconv/issues/154 +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include #include +#endif + +#include int main() { From ec4c0b4f5d9e161a9af86fcbde396c57c1595346 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:24:11 +0100 Subject: [PATCH 37/84] Test: issue 158 --- test/github_issue_158.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/github_issue_158.cpp b/test/github_issue_158.cpp index f1333e037..635a9152a 100644 --- a/test/github_issue_158.cpp +++ b/test/github_issue_158.cpp @@ -5,8 +5,18 @@ // // See: https://github.com/cppalliance/charconv/issues/158 +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include #include +#endif + +#include + void test_values_with_negative_exp() { From cb9c4f6ed6d95ccc2118dff02724ea09685a4bf3 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 19:26:01 +0100 Subject: [PATCH 38/84] Remaining issue tests --- test/github_issue_166.cpp | 9 +++++++++ test/github_issue_166_float128.cpp | 9 +++++++++ test/github_issue_186.cpp | 8 ++++++++ test/github_issue_212.cpp | 11 ++++++++++- 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/test/github_issue_166.cpp b/test/github_issue_166.cpp index bde1b0aea..32e55a5d4 100644 --- a/test/github_issue_166.cpp +++ b/test/github_issue_166.cpp @@ -4,8 +4,17 @@ // // See: https://github.com/cppalliance/charconv/issues/166 +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include #include +#endif + +#include template void simple_test() diff --git a/test/github_issue_166_float128.cpp b/test/github_issue_166_float128.cpp index 9812bdb71..9871e3168 100644 --- a/test/github_issue_166_float128.cpp +++ b/test/github_issue_166_float128.cpp @@ -4,9 +4,18 @@ // // See: https://github.com/boostorg/charconv/issues/166 +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include #include #include +#endif + +#include template void test() diff --git a/test/github_issue_186.cpp b/test/github_issue_186.cpp index 628da1e7f..c41b119b4 100644 --- a/test/github_issue_186.cpp +++ b/test/github_issue_186.cpp @@ -4,10 +4,18 @@ // // See: https://github.com/boostorg/charconv/issues/186 +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include #include #include #include +#endif + template void force_overflow(T value) diff --git a/test/github_issue_212.cpp b/test/github_issue_212.cpp index 110774e2d..f1dba572a 100644 --- a/test/github_issue_212.cpp +++ b/test/github_issue_212.cpp @@ -2,11 +2,20 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES +import std; +import boost.core; +import boost.charconv; +#include +#else #include #include #include -#include #include +#endif + +#include + template void test() From 4771447362d6ea590032d92a26c45dd12877da4e Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 1 Jan 2025 14:21:18 +0100 Subject: [PATCH 39/84] Jamfile --- test/CMakeLists.txt | 2 +- test/Jamfile | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e662b9bb5..7bf0e6e09 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,6 +8,6 @@ if(HAVE_BOOST_TEST) # https://crascit.com/2015/03/28/enabling-cxx11-in-cmake/ set(CMAKE_CXX_EXTENSIONS OFF) -boost_test_jamfile(FILE Jamfile LINK_LIBRARIES Boost::charconv Boost::core Boost::assert Boost::random) +boost_test_jamfile(FILE Jamfile LINK_LIBRARIES Boost::charconv Boost::core Boost::assert) endif() diff --git a/test/Jamfile b/test/Jamfile index a08e8ea18..6e56703a4 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -38,8 +38,8 @@ run quick.cpp ; run from_chars.cpp ; run to_chars.cpp ; run roundtrip.cpp ; -run from_chars_STL_comp.cpp : : : [ requires cxx17_hdr_charconv ] ; -run to_chars_integer_STL_comp.cpp : : : [ requires cxx17_hdr_charconv ] ; +run from_chars_STL_comp.cpp ; +run to_chars_integer_STL_comp.cpp ; run limits.cpp ; run to_chars_sprintf.cpp ; run test_num_digits.cpp ; @@ -51,18 +51,20 @@ run test_compute_float64.cpp ; run test_compute_float32.cpp ; run test_parser.cpp ; run from_chars_float.cpp ; +run from_chars_strtod.cpp ; run to_chars_float.cpp ; +run to_chars_float_fallback.cpp ; run test_boost_json_values.cpp ; -run to_chars_float_STL_comp.cpp : : : [ requires cxx17_hdr_charconv ] ; +run to_chars_float_STL_comp.cpp ; run from_chars_float2.cpp ; run-fail STL_benchmark.cpp : : : [ requires cxx17_hdr_charconv ] [ check-target-builds ../config//has_double_conversion "Google double-coversion support" : "double-conversion" ] ; -run test_float128.cpp : : : [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : "quadmath" ] ; +# run test_float128.cpp : : : [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : "quadmath" ] ; run P2497.cpp ; run github_issue_110.cpp ; run github_issue_122.cpp ; run from_chars_string_view.cpp ; -run github_issue_152.cpp /boost/random//boost_random ; -run github_issue_152_float128.cpp : : : [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : "quadmath" ] ; +run github_issue_152.cpp ; +# run github_issue_152_float128.cpp : : : [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : "quadmath" ] ; run github_issue_154.cpp ; #run github_issue_156.cpp ; run github_issue_158.cpp ; From 849ba2c79ca7f040687343a1f713a664426af934 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 3 Jan 2025 17:37:30 +0100 Subject: [PATCH 40/84] Removed references to boost/config/modules.hpp --- include/boost/charconv/chars_format.hpp | 4 ---- include/boost/charconv/detail/from_chars_result.hpp | 1 - include/boost/charconv/detail/to_chars_result.hpp | 1 - include/boost/charconv/from_chars.hpp | 1 - 4 files changed, 7 deletions(-) diff --git a/include/boost/charconv/chars_format.hpp b/include/boost/charconv/chars_format.hpp index 9d8a83e9a..ea0069c46 100644 --- a/include/boost/charconv/chars_format.hpp +++ b/include/boost/charconv/chars_format.hpp @@ -5,10 +5,6 @@ #ifndef BOOST_CHARCONV_CHARS_FORMAT_HPP #define BOOST_CHARCONV_CHARS_FORMAT_HPP -#ifndef BOOST_USE_MODULES -#include -#endif - namespace boost { namespace charconv { // Floating-point format for primitive numerical conversion diff --git a/include/boost/charconv/detail/from_chars_result.hpp b/include/boost/charconv/detail/from_chars_result.hpp index fcfefeb86..a43b46be7 100644 --- a/include/boost/charconv/detail/from_chars_result.hpp +++ b/include/boost/charconv/detail/from_chars_result.hpp @@ -6,7 +6,6 @@ #define BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP #ifndef BOOST_USE_MODULES -#include #include #endif diff --git a/include/boost/charconv/detail/to_chars_result.hpp b/include/boost/charconv/detail/to_chars_result.hpp index 4d95e6a05..454d5b344 100644 --- a/include/boost/charconv/detail/to_chars_result.hpp +++ b/include/boost/charconv/detail/to_chars_result.hpp @@ -6,7 +6,6 @@ #define BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP #ifndef BOOST_USE_MODULES -#include #include #endif diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index fee408860..041b2483b 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -10,7 +10,6 @@ #include #include #include -#include #ifndef BOOST_USE_MODULES #include #include From ca1b388544bd9b6348b4dcc29cfb132662411154 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 3 Jan 2025 17:37:45 +0100 Subject: [PATCH 41/84] Sanitize charconv/config.hpp --- include/boost/charconv/config.hpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/boost/charconv/config.hpp b/include/boost/charconv/config.hpp index e23151523..3d726a332 100644 --- a/include/boost/charconv/config.hpp +++ b/include/boost/charconv/config.hpp @@ -6,7 +6,6 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include #ifndef BOOST_USE_MODULES #include #include @@ -16,7 +15,6 @@ // This header implements separate compilation features as described in // http://www.boost.org/more/separate_compilation.html -// TODO: handle this correctly! #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHARCONV_DYN_LINK) # if defined(BOOST_CHARCONV_SOURCE) # define BOOST_CHARCONV_DECL BOOST_SYMBOL_EXPORT @@ -37,9 +35,7 @@ # define BOOST_DYN_LINK #endif -#ifndef BOOST_USE_MODULES #include -#endif #endif From b558891fc705cd6c835d86fada73e15a9ced7fe9 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 3 Jan 2025 17:59:27 +0100 Subject: [PATCH 42/84] Restored missing includes --- include/boost/charconv/chars_format.hpp | 4 ++++ include/boost/charconv/detail/from_chars_result.hpp | 1 + include/boost/charconv/detail/to_chars_result.hpp | 1 + 3 files changed, 6 insertions(+) diff --git a/include/boost/charconv/chars_format.hpp b/include/boost/charconv/chars_format.hpp index ea0069c46..ff4a17535 100644 --- a/include/boost/charconv/chars_format.hpp +++ b/include/boost/charconv/chars_format.hpp @@ -5,6 +5,10 @@ #ifndef BOOST_CHARCONV_CHARS_FORMAT_HPP #define BOOST_CHARCONV_CHARS_FORMAT_HPP +#ifndef BOOST_USE_MODULES +#include // BOOST_CHARCONV_MODULE_EXPORT +#endif + namespace boost { namespace charconv { // Floating-point format for primitive numerical conversion diff --git a/include/boost/charconv/detail/from_chars_result.hpp b/include/boost/charconv/detail/from_chars_result.hpp index a43b46be7..6a88e272f 100644 --- a/include/boost/charconv/detail/from_chars_result.hpp +++ b/include/boost/charconv/detail/from_chars_result.hpp @@ -6,6 +6,7 @@ #define BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP #ifndef BOOST_USE_MODULES +#include // for BOOST_CHARCONV_MODULE_EXPORT #include #endif diff --git a/include/boost/charconv/detail/to_chars_result.hpp b/include/boost/charconv/detail/to_chars_result.hpp index 454d5b344..8c60b60a9 100644 --- a/include/boost/charconv/detail/to_chars_result.hpp +++ b/include/boost/charconv/detail/to_chars_result.hpp @@ -6,6 +6,7 @@ #define BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP #ifndef BOOST_USE_MODULES +#include // for BOOST_CHARCONV_MODULE_EXPORT #include #endif From b8f6435c600db04cb770e1c45ed016f743404bd2 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 17:49:07 +0100 Subject: [PATCH 43/84] Migrate to export using --- include/boost/charconv/chars_format.hpp | 5 ----- include/boost/charconv/detail/config.hpp | 8 -------- .../charconv/detail/dragonbox/dragonbox.hpp | 4 +--- .../detail/dragonbox/dragonbox_common.hpp | 4 +--- .../boost/charconv/detail/dragonbox/floff.hpp | 4 +--- .../detail/fast_float/float_common.hpp | 4 +--- .../charconv/detail/from_chars_result.hpp | 3 +-- .../charconv/detail/private/bit_layouts.hpp | 4 +--- .../charconv/detail/private/buffer_sizing.hpp | 4 +--- .../detail/private/compute_float64.hpp | 6 ++---- .../detail/private/compute_float80.hpp | 4 +--- .../detail/private/fallback_routines.hpp | 6 ++---- .../charconv/detail/private/issignaling.hpp | 4 +--- .../boost/charconv/detail/private/parser.hpp | 4 +--- .../detail/private/significand_tables.hpp | 4 +--- .../boost/charconv/detail/ryu/generic_128.hpp | 4 +--- .../charconv/detail/ryu/ryu_generic_128.hpp | 4 +--- .../boost/charconv/detail/to_chars_result.hpp | 2 -- include/boost/charconv/from_chars.hpp | 2 +- include/boost/charconv/limits.hpp | 1 - include/boost/charconv/to_chars.hpp | 1 - modules/boost_charconv.cppm | 16 ++++++++++++++-- src/from_chars.cpp | 18 ++++++++---------- src/to_chars.cpp | 14 +++++++------- test/from_chars_strtod.cpp | 1 + test/github_issue_122.cpp | 2 ++ test/test_compute_float32.cpp | 2 +- test/test_compute_float64.cpp | 2 +- test/to_chars_float_fallback.cpp | 2 ++ 29 files changed, 54 insertions(+), 85 deletions(-) diff --git a/include/boost/charconv/chars_format.hpp b/include/boost/charconv/chars_format.hpp index ff4a17535..0542372bf 100644 --- a/include/boost/charconv/chars_format.hpp +++ b/include/boost/charconv/chars_format.hpp @@ -5,15 +5,10 @@ #ifndef BOOST_CHARCONV_CHARS_FORMAT_HPP #define BOOST_CHARCONV_CHARS_FORMAT_HPP -#ifndef BOOST_USE_MODULES -#include // BOOST_CHARCONV_MODULE_EXPORT -#endif - namespace boost { namespace charconv { // Floating-point format for primitive numerical conversion // chars_format is a bitmask type (16.3.3.3.3) -BOOST_CHARCONV_MODULE_EXPORT enum class chars_format : unsigned { scientific = 1 << 0, diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index ff97a03a6..08c6d3f28 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -205,12 +205,4 @@ static_assert((BOOST_CHARCONV_ENDIAN_BIG_BYTE || BOOST_CHARCONV_ENDIAN_LITTLE_BY # define BOOST_CHARCONV_LDBL_BITS -1 #endif -// Modules. Only use export when building the library, -// since the headers might be included by tests even in modular builds. -#if defined(BOOST_USE_MODULES) && defined(BOOST_CHARCONV_SOURCE) -# define BOOST_CHARCONV_MODULE_EXPORT export -#else -# define BOOST_CHARCONV_MODULE_EXPORT -#endif - #endif // BOOST_CHARCONV_DETAIL_CONFIG_HPP diff --git a/include/boost/charconv/detail/dragonbox/dragonbox.hpp b/include/boost/charconv/detail/dragonbox/dragonbox.hpp index fcf61007c..7d3ffc113 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox.hpp @@ -25,13 +25,11 @@ #include #include #include -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) -#include #include #include #include -#endif #ifndef BOOST_USE_MODULES +#include #include #include #include diff --git a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp index 810c43999..4e4ba97a6 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp @@ -25,12 +25,10 @@ #define BOOST_CHARCONV_DETAIL_DRAGONBOX_COMMON_HPP #include -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) -#include #include #include -#endif #ifndef BOOST_USE_MODULES +#include #include #include #include diff --git a/include/boost/charconv/detail/dragonbox/floff.hpp b/include/boost/charconv/detail/dragonbox/floff.hpp index 508187b37..64c0f53a8 100644 --- a/include/boost/charconv/detail/dragonbox/floff.hpp +++ b/include/boost/charconv/detail/dragonbox/floff.hpp @@ -26,13 +26,11 @@ #include #include -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) -#include #include #include #include -#endif #ifndef BOOST_USE_MODULES +#include #include #include #include diff --git a/include/boost/charconv/detail/fast_float/float_common.hpp b/include/boost/charconv/detail/fast_float/float_common.hpp index b63bb7d38..74f18c04e 100644 --- a/include/boost/charconv/detail/fast_float/float_common.hpp +++ b/include/boost/charconv/detail/fast_float/float_common.hpp @@ -9,12 +9,10 @@ #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FLOAT_COMMON_HPP #include -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include -#include #include -#endif #ifndef BOOST_USE_MODULES +#include #include #include #include diff --git a/include/boost/charconv/detail/from_chars_result.hpp b/include/boost/charconv/detail/from_chars_result.hpp index 6a88e272f..dd914faa1 100644 --- a/include/boost/charconv/detail/from_chars_result.hpp +++ b/include/boost/charconv/detail/from_chars_result.hpp @@ -6,7 +6,6 @@ #define BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP #ifndef BOOST_USE_MODULES -#include // for BOOST_CHARCONV_MODULE_EXPORT #include #endif @@ -38,7 +37,7 @@ struct from_chars_result_t constexpr explicit operator bool() const noexcept { return ec == std::errc{}; } }; -BOOST_CHARCONV_MODULE_EXPORT using from_chars_result = from_chars_result_t; +using from_chars_result = from_chars_result_t; }} // Namespaces diff --git a/include/boost/charconv/detail/private/bit_layouts.hpp b/include/boost/charconv/detail/private/bit_layouts.hpp index 4dae910db..5cddf32a5 100644 --- a/include/boost/charconv/detail/private/bit_layouts.hpp +++ b/include/boost/charconv/detail/private/bit_layouts.hpp @@ -5,11 +5,9 @@ #ifndef BOOST_CHARCONV_DETAIL_BIT_LAYOUTS_HPP #define BOOST_CHARCONV_DETAIL_BIT_LAYOUTS_HPP -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) -#include #include -#endif #ifndef BOOST_USE_MODULES +#include #include #include #endif diff --git a/include/boost/charconv/detail/private/buffer_sizing.hpp b/include/boost/charconv/detail/private/buffer_sizing.hpp index a7a0a57fc..bdf25cb3c 100644 --- a/include/boost/charconv/detail/private/buffer_sizing.hpp +++ b/include/boost/charconv/detail/private/buffer_sizing.hpp @@ -5,11 +5,9 @@ #ifndef BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP #define BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) -#include #include -#endif #ifndef BOOST_USE_MODULES +#include #include #endif diff --git a/include/boost/charconv/detail/private/compute_float64.hpp b/include/boost/charconv/detail/private/compute_float64.hpp index 0c2ae4c8a..7e23833cf 100644 --- a/include/boost/charconv/detail/private/compute_float64.hpp +++ b/include/boost/charconv/detail/private/compute_float64.hpp @@ -7,16 +7,14 @@ #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT64_HPP #include -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include -#include -#include -#endif #ifndef BOOST_USE_MODULES +#include #include #include #include #include +#include #endif diff --git a/include/boost/charconv/detail/private/compute_float80.hpp b/include/boost/charconv/detail/private/compute_float80.hpp index ed48922af..3b28e4e92 100644 --- a/include/boost/charconv/detail/private/compute_float80.hpp +++ b/include/boost/charconv/detail/private/compute_float80.hpp @@ -6,12 +6,10 @@ #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP #include -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include +#ifndef BOOST_USE_MODULES #include #include // HUGE_VAL -#endif -#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/charconv/detail/private/fallback_routines.hpp b/include/boost/charconv/detail/private/fallback_routines.hpp index 54752c2d2..b9c83c775 100644 --- a/include/boost/charconv/detail/private/fallback_routines.hpp +++ b/include/boost/charconv/detail/private/fallback_routines.hpp @@ -6,15 +6,13 @@ #define BOOST_FALLBACK_ROUTINES_HPP #include -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include -#include #include #include +#ifndef BOOST_USE_MODULES +#include #include #include -#endif -#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/charconv/detail/private/issignaling.hpp b/include/boost/charconv/detail/private/issignaling.hpp index 62064896c..5f6fdab8b 100644 --- a/include/boost/charconv/detail/private/issignaling.hpp +++ b/include/boost/charconv/detail/private/issignaling.hpp @@ -6,10 +6,8 @@ #define BOOST_CHARCONV_DETAIL_ISSIGNALING_HPP #include -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) -#include -#endif #ifndef BOOST_USE_MODULES +#include #include #include #endif diff --git a/include/boost/charconv/detail/private/parser.hpp b/include/boost/charconv/detail/private/parser.hpp index 301ab4b1d..65ff21139 100644 --- a/include/boost/charconv/detail/private/parser.hpp +++ b/include/boost/charconv/detail/private/parser.hpp @@ -5,15 +5,13 @@ #ifndef BOOST_CHARCONV_DETAIL_PARSER_HPP #define BOOST_CHARCONV_DETAIL_PARSER_HPP -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) -#include #include #include #include #include #include -#endif #ifndef BOOST_USE_MODULES +#include #include #include #include diff --git a/include/boost/charconv/detail/private/significand_tables.hpp b/include/boost/charconv/detail/private/significand_tables.hpp index 32c54c451..b939f5863 100644 --- a/include/boost/charconv/detail/private/significand_tables.hpp +++ b/include/boost/charconv/detail/private/significand_tables.hpp @@ -6,10 +6,8 @@ #ifndef BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP #define BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) -#include -#endif #ifndef BOOST_USE_MODULES +#include #include #endif diff --git a/include/boost/charconv/detail/ryu/generic_128.hpp b/include/boost/charconv/detail/ryu/generic_128.hpp index 1ed0df2b7..b257ddf16 100644 --- a/include/boost/charconv/detail/ryu/generic_128.hpp +++ b/include/boost/charconv/detail/ryu/generic_128.hpp @@ -6,12 +6,10 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) -#include #include #include -#endif #ifndef BOOST_USE_MODULES +#include #include #endif diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index cd7fc325c..f4e6fb22b 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -8,12 +8,10 @@ #include #include -#if !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_SOURCE) #include -#include #include -#endif #ifndef BOOST_USE_MODULES +#include #include #include #include diff --git a/include/boost/charconv/detail/to_chars_result.hpp b/include/boost/charconv/detail/to_chars_result.hpp index 8c60b60a9..e77e314f0 100644 --- a/include/boost/charconv/detail/to_chars_result.hpp +++ b/include/boost/charconv/detail/to_chars_result.hpp @@ -6,7 +6,6 @@ #define BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP #ifndef BOOST_USE_MODULES -#include // for BOOST_CHARCONV_MODULE_EXPORT #include #endif @@ -15,7 +14,6 @@ namespace boost { namespace charconv { -BOOST_CHARCONV_MODULE_EXPORT struct to_chars_result { char *ptr; diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index 041b2483b..76d2c8c87 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -17,7 +17,7 @@ #endif -BOOST_CHARCONV_MODULE_EXPORT namespace boost { namespace charconv { +namespace boost { namespace charconv { // integer overloads diff --git a/include/boost/charconv/limits.hpp b/include/boost/charconv/limits.hpp index 34dd2eae1..e0feb9c48 100644 --- a/include/boost/charconv/limits.hpp +++ b/include/boost/charconv/limits.hpp @@ -44,7 +44,6 @@ template struct is_uint128: std::false_type {}; } // namespace detail -BOOST_CHARCONV_MODULE_EXPORT template struct limits { BOOST_ATTRIBUTE_UNUSED static constexpr int max_chars10 = diff --git a/include/boost/charconv/to_chars.hpp b/include/boost/charconv/to_chars.hpp index 7bf42c240..2d9b7cbb8 100644 --- a/include/boost/charconv/to_chars.hpp +++ b/include/boost/charconv/to_chars.hpp @@ -16,7 +16,6 @@ #endif -BOOST_CHARCONV_MODULE_EXPORT namespace boost { namespace charconv { diff --git a/modules/boost_charconv.cppm b/modules/boost_charconv.cppm index fd149d6b1..a31ca93f8 100644 --- a/modules/boost_charconv.cppm +++ b/modules/boost_charconv.cppm @@ -7,6 +7,18 @@ export module boost.charconv; import std; import boost.core; -// Wrapping compiled libraries in "extern C++" breaks -// implementation units: exported declarations are no longer reachable +extern "C++" { #include +} + +export namespace boost::charconv { + +using charconv::chars_format; +using charconv::from_chars; +using charconv::from_chars_erange; +using charconv::limits; +using charconv::to_chars; +using charconv::from_chars_result; +using charconv::to_chars_result; + +} diff --git a/src/from_chars.cpp b/src/from_chars.cpp index 1a0b38822..38da1f73f 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -7,14 +7,9 @@ // Global module fragment with all required includes module; -#include // for UINT64_C -#include // for CHAR_BIT +#include #include // for HUGE_VAL #include -#include -#include -#include -#include #include "quadmath_header.hpp" // This is an implementation unit @@ -33,16 +28,15 @@ import boost.core; # define NO_WARN_MBCS_MFC_DEPRECATION #endif -// These headers are part of the implementation, and safe to include +extern "C++" { #include "float128_impl.hpp" #include "from_chars_float_impl.hpp" #include #if BOOST_CHARCONV_LDBL_BITS > 64 # include -# ifndef BOOST_USE_MODULES -# include -# endif +# include #endif +} #ifndef BOOST_USE_MODULES #include @@ -60,6 +54,8 @@ import boost.core; # pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif +extern "C++" { + boost::charconv::from_chars_result boost::charconv::from_chars_erange(const char* first, const char* last, float& value, boost::charconv::chars_format fmt) noexcept { if (fmt != boost::charconv::chars_format::hex) @@ -533,3 +529,5 @@ boost::charconv::from_chars_result boost::charconv::from_chars(boost::core::stri return from_chars_strict_impl(sv.data(), sv.data() + sv.size(), value, fmt); } #endif + +} diff --git a/src/to_chars.cpp b/src/to_chars.cpp index 7ebc1224f..dbac0fe87 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -8,14 +8,9 @@ // Global module fragment with all required includes module; -#include // for UINT64_C -#include // for CHAR_BIT +#include #include // for HUGE_VAL #include -#include -#include -#include -#include #include "quadmath_header.hpp" // This is an implementation unit @@ -25,9 +20,10 @@ import boost.core; #endif -// These headers are part of the implementation, and safe to include +extern "C++" { #include "float128_impl.hpp" #include "to_chars_float_impl.hpp" +} #ifndef BOOST_USE_MODULES #include @@ -575,6 +571,8 @@ namespace boost { namespace charconv { namespace detail { namespace to_chars_det }}}} // Namespaces +extern "C++" { + boost::charconv::to_chars_result boost::charconv::to_chars(char* first, char* last, float value, boost::charconv::chars_format fmt) noexcept { @@ -779,3 +777,5 @@ boost::charconv::to_chars_result boost::charconv::to_chars(char* first, char* la return boost::charconv::detail::to_chars_float_impl(first, last, static_cast(value), fmt, precision); } #endif + +} diff --git a/test/from_chars_strtod.cpp b/test/from_chars_strtod.cpp index 51497a5c4..80ed3b3a2 100644 --- a/test/from_chars_strtod.cpp +++ b/test/from_chars_strtod.cpp @@ -16,6 +16,7 @@ import boost.core; #endif #include +#include #include "../src/from_chars_float_impl.hpp" diff --git a/test/github_issue_122.cpp b/test/github_issue_122.cpp index cd1394606..b56b0e6b4 100644 --- a/test/github_issue_122.cpp +++ b/test/github_issue_122.cpp @@ -14,6 +14,8 @@ import boost.core; #include #endif +#include +#include #include #include diff --git a/test/test_compute_float32.cpp b/test/test_compute_float32.cpp index a2dafaa0b..fea7e6969 100644 --- a/test/test_compute_float32.cpp +++ b/test/test_compute_float32.cpp @@ -10,9 +10,9 @@ import boost.core; #else #include #include -#include #endif +#include #include #include diff --git a/test/test_compute_float64.cpp b/test/test_compute_float64.cpp index 632334ea7..cea341a13 100644 --- a/test/test_compute_float64.cpp +++ b/test/test_compute_float64.cpp @@ -13,9 +13,9 @@ import boost.core; #include #endif +#include #include #include -#include using boost::charconv::detail::compute_float64; diff --git a/test/to_chars_float_fallback.cpp b/test/to_chars_float_fallback.cpp index 12ed6070c..acebf4dea 100644 --- a/test/to_chars_float_fallback.cpp +++ b/test/to_chars_float_fallback.cpp @@ -14,6 +14,8 @@ import boost.core; #include #endif +#include +#include #include From 10987d22ebf659a2d92f9baea2f9e8e8ab5abdc9 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 18:02:43 +0100 Subject: [PATCH 44/84] Undo move headers to private --- .../charconv/detail/{private => }/bit_layouts.hpp | 0 .../charconv/detail/{private => }/buffer_sizing.hpp | 0 .../charconv/detail/{private => }/compute_float32.hpp | 2 +- .../charconv/detail/{private => }/compute_float64.hpp | 2 +- .../charconv/detail/{private => }/compute_float80.hpp | 2 +- include/boost/charconv/detail/dragonbox/dragonbox.hpp | 4 ++-- .../charconv/detail/dragonbox/dragonbox_common.hpp | 2 +- include/boost/charconv/detail/dragonbox/floff.hpp | 2 +- .../detail/{private => }/fallback_routines.hpp | 0 .../charconv/detail/{private => }/issignaling.hpp | 2 +- include/boost/charconv/detail/{private => }/parser.hpp | 0 include/boost/charconv/detail/ryu/ryu_generic_128.hpp | 2 +- .../detail/{private => }/significand_tables.hpp | 0 src/float128_impl.hpp | 6 +++--- src/from_chars.cpp | 4 ++-- src/from_chars_float_impl.hpp | 10 +++++----- src/to_chars_float_impl.hpp | 8 ++++---- test/github_issue_122.cpp | 2 +- test/test_compute_float32.cpp | 2 +- test/test_compute_float64.cpp | 2 +- test/test_compute_float80.cpp | 2 +- test/test_parser.cpp | 2 +- test/to_chars_float_fallback.cpp | 2 +- 23 files changed, 29 insertions(+), 29 deletions(-) rename include/boost/charconv/detail/{private => }/bit_layouts.hpp (100%) rename include/boost/charconv/detail/{private => }/buffer_sizing.hpp (100%) rename include/boost/charconv/detail/{private => }/compute_float32.hpp (96%) rename include/boost/charconv/detail/{private => }/compute_float64.hpp (99%) rename include/boost/charconv/detail/{private => }/compute_float80.hpp (98%) rename include/boost/charconv/detail/{private => }/fallback_routines.hpp (100%) rename include/boost/charconv/detail/{private => }/issignaling.hpp (97%) rename include/boost/charconv/detail/{private => }/parser.hpp (100%) rename include/boost/charconv/detail/{private => }/significand_tables.hpp (100%) diff --git a/include/boost/charconv/detail/private/bit_layouts.hpp b/include/boost/charconv/detail/bit_layouts.hpp similarity index 100% rename from include/boost/charconv/detail/private/bit_layouts.hpp rename to include/boost/charconv/detail/bit_layouts.hpp diff --git a/include/boost/charconv/detail/private/buffer_sizing.hpp b/include/boost/charconv/detail/buffer_sizing.hpp similarity index 100% rename from include/boost/charconv/detail/private/buffer_sizing.hpp rename to include/boost/charconv/detail/buffer_sizing.hpp diff --git a/include/boost/charconv/detail/private/compute_float32.hpp b/include/boost/charconv/detail/compute_float32.hpp similarity index 96% rename from include/boost/charconv/detail/private/compute_float32.hpp rename to include/boost/charconv/detail/compute_float32.hpp index 68a91e29b..18868e297 100644 --- a/include/boost/charconv/detail/private/compute_float32.hpp +++ b/include/boost/charconv/detail/compute_float32.hpp @@ -5,7 +5,7 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT32_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT32_HPP -#include +#include #ifndef BOOST_USE_MODULES #include #include diff --git a/include/boost/charconv/detail/private/compute_float64.hpp b/include/boost/charconv/detail/compute_float64.hpp similarity index 99% rename from include/boost/charconv/detail/private/compute_float64.hpp rename to include/boost/charconv/detail/compute_float64.hpp index 7e23833cf..47008d588 100644 --- a/include/boost/charconv/detail/private/compute_float64.hpp +++ b/include/boost/charconv/detail/compute_float64.hpp @@ -6,7 +6,7 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT64_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT64_HPP -#include +#include #include #ifndef BOOST_USE_MODULES #include diff --git a/include/boost/charconv/detail/private/compute_float80.hpp b/include/boost/charconv/detail/compute_float80.hpp similarity index 98% rename from include/boost/charconv/detail/private/compute_float80.hpp rename to include/boost/charconv/detail/compute_float80.hpp index 3b28e4e92..5463c8d3e 100644 --- a/include/boost/charconv/detail/private/compute_float80.hpp +++ b/include/boost/charconv/detail/compute_float80.hpp @@ -5,7 +5,7 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP -#include +#include #include #ifndef BOOST_USE_MODULES #include diff --git a/include/boost/charconv/detail/dragonbox/dragonbox.hpp b/include/boost/charconv/detail/dragonbox/dragonbox.hpp index 7d3ffc113..238f26790 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox.hpp @@ -23,8 +23,8 @@ #define BOOST_CHARCONV_DETAIL_DRAGONBOX_HPP #include -#include -#include +#include +#include #include #include #include diff --git a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp index 4e4ba97a6..974748874 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp @@ -24,7 +24,7 @@ #ifndef BOOST_CHARCONV_DETAIL_DRAGONBOX_COMMON_HPP #define BOOST_CHARCONV_DETAIL_DRAGONBOX_COMMON_HPP -#include +#include #include #include #ifndef BOOST_USE_MODULES diff --git a/include/boost/charconv/detail/dragonbox/floff.hpp b/include/boost/charconv/detail/dragonbox/floff.hpp index 64c0f53a8..a4bd5a0c5 100644 --- a/include/boost/charconv/detail/dragonbox/floff.hpp +++ b/include/boost/charconv/detail/dragonbox/floff.hpp @@ -25,7 +25,7 @@ #define BOOST_CHARCONV_DETAIL_FLOFF #include -#include +#include #include #include #include diff --git a/include/boost/charconv/detail/private/fallback_routines.hpp b/include/boost/charconv/detail/fallback_routines.hpp similarity index 100% rename from include/boost/charconv/detail/private/fallback_routines.hpp rename to include/boost/charconv/detail/fallback_routines.hpp diff --git a/include/boost/charconv/detail/private/issignaling.hpp b/include/boost/charconv/detail/issignaling.hpp similarity index 97% rename from include/boost/charconv/detail/private/issignaling.hpp rename to include/boost/charconv/detail/issignaling.hpp index 5f6fdab8b..d61499c8f 100644 --- a/include/boost/charconv/detail/private/issignaling.hpp +++ b/include/boost/charconv/detail/issignaling.hpp @@ -5,7 +5,7 @@ #ifndef BOOST_CHARCONV_DETAIL_ISSIGNALING_HPP #define BOOST_CHARCONV_DETAIL_ISSIGNALING_HPP -#include +#include #ifndef BOOST_USE_MODULES #include #include diff --git a/include/boost/charconv/detail/private/parser.hpp b/include/boost/charconv/detail/parser.hpp similarity index 100% rename from include/boost/charconv/detail/private/parser.hpp rename to include/boost/charconv/detail/parser.hpp diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index f4e6fb22b..f4f180ec3 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -7,7 +7,7 @@ #define BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP #include -#include +#include #include #include #ifndef BOOST_USE_MODULES diff --git a/include/boost/charconv/detail/private/significand_tables.hpp b/include/boost/charconv/detail/significand_tables.hpp similarity index 100% rename from include/boost/charconv/detail/private/significand_tables.hpp rename to include/boost/charconv/detail/significand_tables.hpp diff --git a/src/float128_impl.hpp b/src/float128_impl.hpp index 48a25b2dc..a8983d209 100644 --- a/src/float128_impl.hpp +++ b/src/float128_impl.hpp @@ -6,9 +6,9 @@ #define BOOST_CHARCONV_FLOAT128_IMPL_HPP #include -#include -#include -#include +#include +#include +#include #ifndef BOOST_USE_MODULES #include "quadmath_header.hpp" #include diff --git a/src/from_chars.cpp b/src/from_chars.cpp index 38da1f73f..66639f4d1 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -33,14 +33,14 @@ extern "C++" { #include "from_chars_float_impl.hpp" #include #if BOOST_CHARCONV_LDBL_BITS > 64 -# include +# include # include #endif } #ifndef BOOST_USE_MODULES #include -#include +#include #include #include #include diff --git a/src/from_chars_float_impl.hpp b/src/from_chars_float_impl.hpp index b77446b39..33b4d054c 100644 --- a/src/from_chars_float_impl.hpp +++ b/src/from_chars_float_impl.hpp @@ -6,11 +6,11 @@ #ifndef BOOST_CHARCONV_DETAIL_FROM_CHARS_FLOAT_IMPL_HPP #define BOOST_CHARCONV_DETAIL_FROM_CHARS_FLOAT_IMPL_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #ifndef BOOST_USE_MODULES #include #include diff --git a/src/to_chars_float_impl.hpp b/src/to_chars_float_impl.hpp index 273b6c8dc..9b1aa4c62 100644 --- a/src/to_chars_float_impl.hpp +++ b/src/to_chars_float_impl.hpp @@ -10,9 +10,9 @@ #include "float128_impl.hpp" #include #include -#include -#include -#include +#include +#include +#include #ifndef BOOST_USE_MODULES #include #include @@ -43,7 +43,7 @@ #if (BOOST_CHARCONV_LDBL_BITS == 80 || BOOST_CHARCONV_LDBL_BITS == 128) # include -# include +# include #endif namespace boost { diff --git a/test/github_issue_122.cpp b/test/github_issue_122.cpp index b56b0e6b4..66f58bedb 100644 --- a/test/github_issue_122.cpp +++ b/test/github_issue_122.cpp @@ -17,7 +17,7 @@ import boost.core; #include #include #include -#include +#include template void test() diff --git a/test/test_compute_float32.cpp b/test/test_compute_float32.cpp index fea7e6969..00f00264e 100644 --- a/test/test_compute_float32.cpp +++ b/test/test_compute_float32.cpp @@ -13,7 +13,7 @@ import boost.core; #endif #include -#include +#include #include using boost::charconv::detail::compute_float32; diff --git a/test/test_compute_float64.cpp b/test/test_compute_float64.cpp index cea341a13..ba7538e2c 100644 --- a/test/test_compute_float64.cpp +++ b/test/test_compute_float64.cpp @@ -14,7 +14,7 @@ import boost.core; #endif #include -#include +#include #include using boost::charconv::detail::compute_float64; diff --git a/test/test_compute_float80.cpp b/test/test_compute_float80.cpp index 3e59bfa8a..42f0e463b 100644 --- a/test/test_compute_float80.cpp +++ b/test/test_compute_float80.cpp @@ -18,7 +18,7 @@ import boost.core; #include #include -#include +#include #include diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 2afeb8ee1..39aafccf8 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -16,7 +16,7 @@ import boost.core; #include #endif -#include +#include #include diff --git a/test/to_chars_float_fallback.cpp b/test/to_chars_float_fallback.cpp index acebf4dea..3168a5671 100644 --- a/test/to_chars_float_fallback.cpp +++ b/test/to_chars_float_fallback.cpp @@ -16,7 +16,7 @@ import boost.core; #include #include -#include +#include constexpr const char* fmt_general(double) From 1fc1e43f0b5e92262ba37f3566d5bac812a76471 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 18:12:49 +0100 Subject: [PATCH 45/84] Header cleanup --- include/boost/charconv/detail/compute_float64.hpp | 2 +- include/boost/charconv/detail/compute_float80.hpp | 11 +++++------ .../boost/charconv/detail/dragonbox/dragonbox.hpp | 2 +- include/boost/charconv/detail/dragonbox/floff.hpp | 2 +- .../boost/charconv/detail/fallback_routines.hpp | 2 +- .../charconv/detail/fast_float/fast_table.hpp | 2 -- .../boost/charconv/detail/ryu/ryu_generic_128.hpp | 2 +- src/from_chars.cpp | 2 +- src/from_chars_float_impl.hpp | 6 +++--- src/to_chars.cpp | 2 +- src/to_chars_float_impl.hpp | 14 +++++++------- 11 files changed, 22 insertions(+), 25 deletions(-) diff --git a/include/boost/charconv/detail/compute_float64.hpp b/include/boost/charconv/detail/compute_float64.hpp index 47008d588..e75e3653c 100644 --- a/include/boost/charconv/detail/compute_float64.hpp +++ b/include/boost/charconv/detail/compute_float64.hpp @@ -11,9 +11,9 @@ #ifndef BOOST_USE_MODULES #include #include +#include #include #include -#include #include #endif diff --git a/include/boost/charconv/detail/compute_float80.hpp b/include/boost/charconv/detail/compute_float80.hpp index 5463c8d3e..d5b6da198 100644 --- a/include/boost/charconv/detail/compute_float80.hpp +++ b/include/boost/charconv/detail/compute_float80.hpp @@ -5,25 +5,24 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP -#include #include +#include #ifndef BOOST_USE_MODULES #include -#include // HUGE_VAL #include #include #include #include +#include #include #include #ifdef BOOST_CHARCONV_DEBUG_FLOAT128 -# include -# include -# include +#include +#include +#include #endif #endif - namespace boost { namespace charconv { namespace detail { #if BOOST_CHARCONV_LDBL_BITS > 64 diff --git a/include/boost/charconv/detail/dragonbox/dragonbox.hpp b/include/boost/charconv/detail/dragonbox/dragonbox.hpp index 238f26790..cfc9a70ea 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox.hpp @@ -24,8 +24,8 @@ #include #include -#include #include +#include #include #include #ifndef BOOST_USE_MODULES diff --git a/include/boost/charconv/detail/dragonbox/floff.hpp b/include/boost/charconv/detail/dragonbox/floff.hpp index a4bd5a0c5..ebb514170 100644 --- a/include/boost/charconv/detail/dragonbox/floff.hpp +++ b/include/boost/charconv/detail/dragonbox/floff.hpp @@ -24,9 +24,9 @@ #ifndef BOOST_CHARCONV_DETAIL_FLOFF #define BOOST_CHARCONV_DETAIL_FLOFF -#include #include #include +#include #include #include #ifndef BOOST_USE_MODULES diff --git a/include/boost/charconv/detail/fallback_routines.hpp b/include/boost/charconv/detail/fallback_routines.hpp index b9c83c775..06fc99683 100644 --- a/include/boost/charconv/detail/fallback_routines.hpp +++ b/include/boost/charconv/detail/fallback_routines.hpp @@ -5,9 +5,9 @@ #ifndef BOOST_FALLBACK_ROUTINES_HPP #define BOOST_FALLBACK_ROUTINES_HPP +#include #include #include -#include #include #ifndef BOOST_USE_MODULES #include diff --git a/include/boost/charconv/detail/fast_float/fast_table.hpp b/include/boost/charconv/detail/fast_float/fast_table.hpp index 6650bc6c7..d39847b4e 100644 --- a/include/boost/charconv/detail/fast_float/fast_table.hpp +++ b/include/boost/charconv/detail/fast_float/fast_table.hpp @@ -8,13 +8,11 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_TABLE_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_TABLE_HPP -// TODO: this should be in src/ #include #ifndef BOOST_USE_MODULES #include #endif - namespace boost { namespace charconv { namespace detail { namespace fast_float { /** diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index f4f180ec3..f8ce79885 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -7,8 +7,8 @@ #define BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP #include -#include #include +#include #include #ifndef BOOST_USE_MODULES #include diff --git a/src/from_chars.cpp b/src/from_chars.cpp index 66639f4d1..66ab4c994 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -530,4 +530,4 @@ boost::charconv::from_chars_result boost::charconv::from_chars(boost::core::stri } #endif -} +} // extern "C++" diff --git a/src/from_chars_float_impl.hpp b/src/from_chars_float_impl.hpp index 33b4d054c..f4109a7c8 100644 --- a/src/from_chars_float_impl.hpp +++ b/src/from_chars_float_impl.hpp @@ -6,14 +6,14 @@ #ifndef BOOST_CHARCONV_DETAIL_FROM_CHARS_FLOAT_IMPL_HPP #define BOOST_CHARCONV_DETAIL_FROM_CHARS_FLOAT_IMPL_HPP +#include +#include #include #include -#include -#include #include +#include #ifndef BOOST_USE_MODULES #include -#include #include #include #include diff --git a/src/to_chars.cpp b/src/to_chars.cpp index dbac0fe87..3fd118238 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -778,4 +778,4 @@ boost::charconv::to_chars_result boost::charconv::to_chars(char* first, char* la } #endif -} +} // extern "C++" diff --git a/src/to_chars_float_impl.hpp b/src/to_chars_float_impl.hpp index 9b1aa4c62..0745230aa 100644 --- a/src/to_chars_float_impl.hpp +++ b/src/to_chars_float_impl.hpp @@ -13,16 +13,21 @@ #include #include #include -#ifndef BOOST_USE_MODULES #include #include #include -#include #include #include #include #include #include +#if (BOOST_CHARCONV_LDBL_BITS == 80 || BOOST_CHARCONV_LDBL_BITS == 128) +# include +# include +#endif + +#ifndef BOOST_USE_MODULES +#include #include #include #include @@ -34,17 +39,12 @@ #include #include #include - #ifdef BOOST_CHARCONV_DEBUG_FIXED #include #include #endif #endif -#if (BOOST_CHARCONV_LDBL_BITS == 80 || BOOST_CHARCONV_LDBL_BITS == 128) -# include -# include -#endif namespace boost { namespace charconv { From 00633f163306f8f02d111c261083ca0dd4b6a5c3 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 18:14:25 +0100 Subject: [PATCH 46/84] Restore Jamfile --- test/Jamfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/Jamfile b/test/Jamfile index 6e56703a4..a9bf18e3b 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -38,8 +38,8 @@ run quick.cpp ; run from_chars.cpp ; run to_chars.cpp ; run roundtrip.cpp ; -run from_chars_STL_comp.cpp ; -run to_chars_integer_STL_comp.cpp ; +run from_chars_STL_comp.cpp : : : [ requires cxx17_hdr_charconv ] ; +run to_chars_integer_STL_comp.cpp : : : [ requires cxx17_hdr_charconv ] ; run limits.cpp ; run to_chars_sprintf.cpp ; run test_num_digits.cpp ; @@ -55,16 +55,16 @@ run from_chars_strtod.cpp ; run to_chars_float.cpp ; run to_chars_float_fallback.cpp ; run test_boost_json_values.cpp ; -run to_chars_float_STL_comp.cpp ; +run to_chars_float_STL_comp.cpp : : : [ requires cxx17_hdr_charconv ] ; run from_chars_float2.cpp ; run-fail STL_benchmark.cpp : : : [ requires cxx17_hdr_charconv ] [ check-target-builds ../config//has_double_conversion "Google double-coversion support" : "double-conversion" ] ; -# run test_float128.cpp : : : [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : "quadmath" ] ; +run test_float128.cpp : : : [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : "quadmath" ] ; run P2497.cpp ; run github_issue_110.cpp ; run github_issue_122.cpp ; run from_chars_string_view.cpp ; -run github_issue_152.cpp ; -# run github_issue_152_float128.cpp : : : [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : "quadmath" ] ; +run github_issue_152.cpp /boost/random//boost_random ; +run github_issue_152_float128.cpp : : : [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : "quadmath" ] ; run github_issue_154.cpp ; #run github_issue_156.cpp ; run github_issue_158.cpp ; From 45fdf62b0b104a21c470e8e96f6f2c343032b3dd Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 18:34:45 +0100 Subject: [PATCH 47/84] detail/config is now a regular header --- include/boost/charconv/detail/bit_layouts.hpp | 2 +- include/boost/charconv/detail/buffer_sizing.hpp | 2 +- include/boost/charconv/detail/compute_float64.hpp | 2 +- include/boost/charconv/detail/compute_float80.hpp | 2 +- include/boost/charconv/detail/config.hpp | 8 +++----- include/boost/charconv/detail/dragonbox/dragonbox.hpp | 2 +- .../boost/charconv/detail/dragonbox/dragonbox_common.hpp | 2 +- include/boost/charconv/detail/dragonbox/floff.hpp | 2 +- include/boost/charconv/detail/emulated128.hpp | 2 +- include/boost/charconv/detail/fallback_routines.hpp | 2 +- include/boost/charconv/detail/fast_float/float_common.hpp | 2 +- include/boost/charconv/detail/from_chars_integer_impl.hpp | 2 +- include/boost/charconv/detail/global_module_fragment.hpp | 1 - include/boost/charconv/detail/integer_search_trees.hpp | 2 +- include/boost/charconv/detail/issignaling.hpp | 2 +- include/boost/charconv/detail/parser.hpp | 2 +- include/boost/charconv/detail/ryu/generic_128.hpp | 2 +- include/boost/charconv/detail/ryu/ryu_generic_128.hpp | 2 +- include/boost/charconv/detail/to_chars_integer_impl.hpp | 2 +- include/boost/charconv/from_chars.hpp | 2 +- include/boost/charconv/to_chars.hpp | 4 ---- test/roundtrip.cpp | 3 ++- test/to_chars.cpp | 1 + test/to_chars_sprintf.cpp | 2 ++ 24 files changed, 26 insertions(+), 29 deletions(-) diff --git a/include/boost/charconv/detail/bit_layouts.hpp b/include/boost/charconv/detail/bit_layouts.hpp index 5cddf32a5..4b0db5c78 100644 --- a/include/boost/charconv/detail/bit_layouts.hpp +++ b/include/boost/charconv/detail/bit_layouts.hpp @@ -5,9 +5,9 @@ #ifndef BOOST_CHARCONV_DETAIL_BIT_LAYOUTS_HPP #define BOOST_CHARCONV_DETAIL_BIT_LAYOUTS_HPP +#include #include #ifndef BOOST_USE_MODULES -#include #include #include #endif diff --git a/include/boost/charconv/detail/buffer_sizing.hpp b/include/boost/charconv/detail/buffer_sizing.hpp index a98702cf2..629b7fa93 100644 --- a/include/boost/charconv/detail/buffer_sizing.hpp +++ b/include/boost/charconv/detail/buffer_sizing.hpp @@ -5,9 +5,9 @@ #ifndef BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP #define BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP +#include #include #ifndef BOOST_USE_MODULES -#include #include #endif diff --git a/include/boost/charconv/detail/compute_float64.hpp b/include/boost/charconv/detail/compute_float64.hpp index e75e3653c..4b806a3d2 100644 --- a/include/boost/charconv/detail/compute_float64.hpp +++ b/include/boost/charconv/detail/compute_float64.hpp @@ -6,10 +6,10 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT64_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT64_HPP +#include #include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/compute_float80.hpp b/include/boost/charconv/detail/compute_float80.hpp index d5b6da198..4a7e0c1f0 100644 --- a/include/boost/charconv/detail/compute_float80.hpp +++ b/include/boost/charconv/detail/compute_float80.hpp @@ -5,10 +5,10 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP +#include #include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index 08c6d3f28..7d95390fa 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -5,16 +5,14 @@ #ifndef BOOST_CHARCONV_DETAIL_CONFIG_HPP #define BOOST_CHARCONV_DETAIL_CONFIG_HPP -// In modular builds, this header should only -// be included from the global module fragment +#ifndef BOOST_USE_MODULES #include +#include #include #include -#ifndef BOOST_USE_MODULES -#include +#include #endif -#include #define BOOST_CHARCONV_ASSERT(expr) BOOST_ASSERT(expr) #define BOOST_CHARCONV_ASSERT_MSG(expr, msg) BOOST_ASSERT_MSG(expr, msg) diff --git a/include/boost/charconv/detail/dragonbox/dragonbox.hpp b/include/boost/charconv/detail/dragonbox/dragonbox.hpp index cfc9a70ea..02ab8e1f1 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox.hpp @@ -22,6 +22,7 @@ #ifndef BOOST_CHARCONV_DETAIL_DRAGONBOX_HPP #define BOOST_CHARCONV_DETAIL_DRAGONBOX_HPP +#include #include #include #include @@ -29,7 +30,6 @@ #include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp index 974748874..077f92e44 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp @@ -24,11 +24,11 @@ #ifndef BOOST_CHARCONV_DETAIL_DRAGONBOX_COMMON_HPP #define BOOST_CHARCONV_DETAIL_DRAGONBOX_COMMON_HPP +#include #include #include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/dragonbox/floff.hpp b/include/boost/charconv/detail/dragonbox/floff.hpp index ebb514170..b85153f21 100644 --- a/include/boost/charconv/detail/dragonbox/floff.hpp +++ b/include/boost/charconv/detail/dragonbox/floff.hpp @@ -24,13 +24,13 @@ #ifndef BOOST_CHARCONV_DETAIL_FLOFF #define BOOST_CHARCONV_DETAIL_FLOFF +#include #include #include #include #include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/emulated128.hpp b/include/boost/charconv/detail/emulated128.hpp index 0f47f654e..dce867958 100644 --- a/include/boost/charconv/detail/emulated128.hpp +++ b/include/boost/charconv/detail/emulated128.hpp @@ -8,9 +8,9 @@ #ifndef BOOST_CHARCONV_DETAIL_EMULATED128_HPP #define BOOST_CHARCONV_DETAIL_EMULATED128_HPP +#include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/fallback_routines.hpp b/include/boost/charconv/detail/fallback_routines.hpp index 4238e698d..202c02ab0 100644 --- a/include/boost/charconv/detail/fallback_routines.hpp +++ b/include/boost/charconv/detail/fallback_routines.hpp @@ -7,10 +7,10 @@ #include #include +#include #include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/fast_float/float_common.hpp b/include/boost/charconv/detail/fast_float/float_common.hpp index 74f18c04e..9044b6b6e 100644 --- a/include/boost/charconv/detail/fast_float/float_common.hpp +++ b/include/boost/charconv/detail/fast_float/float_common.hpp @@ -10,9 +10,9 @@ #include #include +#include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/from_chars_integer_impl.hpp b/include/boost/charconv/detail/from_chars_integer_impl.hpp index 7135b5984..6490b4ffc 100644 --- a/include/boost/charconv/detail/from_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/from_chars_integer_impl.hpp @@ -6,12 +6,12 @@ #define BOOST_CHARCONV_DETAIL_FROM_CHARS_INTEGER_IMPL_HPP #include +#include #include #include #include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/global_module_fragment.hpp b/include/boost/charconv/detail/global_module_fragment.hpp index 9d22f2328..850948fba 100644 --- a/include/boost/charconv/detail/global_module_fragment.hpp +++ b/include/boost/charconv/detail/global_module_fragment.hpp @@ -16,5 +16,4 @@ #include #include - #endif diff --git a/include/boost/charconv/detail/integer_search_trees.hpp b/include/boost/charconv/detail/integer_search_trees.hpp index 428d2c5ea..432db3da0 100644 --- a/include/boost/charconv/detail/integer_search_trees.hpp +++ b/include/boost/charconv/detail/integer_search_trees.hpp @@ -8,9 +8,9 @@ // https://stackoverflow.com/questions/1489830/efficient-way-to-determine-number-of-digits-in-an-integer?page=1&tab=scoredesc#tab-top // https://graphics.stanford.edu/~seander/bithacks.html +#include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/issignaling.hpp b/include/boost/charconv/detail/issignaling.hpp index 936d6fe84..686ea8386 100644 --- a/include/boost/charconv/detail/issignaling.hpp +++ b/include/boost/charconv/detail/issignaling.hpp @@ -5,9 +5,9 @@ #ifndef BOOST_CHARCONV_DETAIL_ISSIGNALING_HPP #define BOOST_CHARCONV_DETAIL_ISSIGNALING_HPP +#include #include #ifndef BOOST_USE_MODULES -#include #include #include #endif diff --git a/include/boost/charconv/detail/parser.hpp b/include/boost/charconv/detail/parser.hpp index dc3f3877c..77833b431 100644 --- a/include/boost/charconv/detail/parser.hpp +++ b/include/boost/charconv/detail/parser.hpp @@ -5,13 +5,13 @@ #ifndef BOOST_CHARCONV_DETAIL_PARSER_HPP #define BOOST_CHARCONV_DETAIL_PARSER_HPP +#include #include #include #include #include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/ryu/generic_128.hpp b/include/boost/charconv/detail/ryu/generic_128.hpp index b257ddf16..5f5c8c3d7 100644 --- a/include/boost/charconv/detail/ryu/generic_128.hpp +++ b/include/boost/charconv/detail/ryu/generic_128.hpp @@ -6,10 +6,10 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP +#include #include #include #ifndef BOOST_USE_MODULES -#include #include #endif diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index 94acd6a81..172181f81 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -8,10 +8,10 @@ #include #include +#include #include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/detail/to_chars_integer_impl.hpp b/include/boost/charconv/detail/to_chars_integer_impl.hpp index 5204bb0b4..52dce5f87 100644 --- a/include/boost/charconv/detail/to_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/to_chars_integer_impl.hpp @@ -7,13 +7,13 @@ #ifndef BOOST_CHARCONV_DETAIL_TO_CHARS_INTEGER_IMPL_HPP #define BOOST_CHARCONV_DETAIL_TO_CHARS_INTEGER_IMPL_HPP +#include #include #include #include #include #include #ifndef BOOST_USE_MODULES -#include #include #include #include diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index 14c48d210..58512ce65 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -6,12 +6,12 @@ #ifndef BOOST_CHARCONV_FROM_CHARS_HPP_INCLUDED #define BOOST_CHARCONV_FROM_CHARS_HPP_INCLUDED +#include #include #include #include #include #ifndef BOOST_USE_MODULES -#include #include #include #endif diff --git a/include/boost/charconv/to_chars.hpp b/include/boost/charconv/to_chars.hpp index 2d9b7cbb8..7192fda57 100644 --- a/include/boost/charconv/to_chars.hpp +++ b/include/boost/charconv/to_chars.hpp @@ -11,10 +11,6 @@ #include #include #include -#ifndef BOOST_USE_MODULES -#include -#endif - namespace boost { namespace charconv { diff --git a/test/roundtrip.cpp b/test/roundtrip.cpp index 526111dd6..dcd89fbf2 100644 --- a/test/roundtrip.cpp +++ b/test/roundtrip.cpp @@ -21,10 +21,11 @@ import boost.core; #include #include #include -#include #include #endif +#include + #ifdef BOOST_HAS_INT128 diff --git a/test/to_chars.cpp b/test/to_chars.cpp index d0cc64e56..8ffe6d1f8 100644 --- a/test/to_chars.cpp +++ b/test/to_chars.cpp @@ -23,6 +23,7 @@ import boost.core; #include #endif +#include #ifdef BOOST_CHARCONV_HAS_INT128 template diff --git a/test/to_chars_sprintf.cpp b/test/to_chars_sprintf.cpp index a07c89e3a..bc3c33909 100644 --- a/test/to_chars_sprintf.cpp +++ b/test/to_chars_sprintf.cpp @@ -4,6 +4,7 @@ // https://www.boost.org/LICENSE_1_0.txt #include +#include #ifdef BOOST_USE_MODULES #include @@ -27,6 +28,7 @@ import boost.charconv; #endif + int const N = 1024; static boost::detail::splitmix64 rng; From aaba7a053818baf0e666442302c4c1df99838e9f Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 18:42:47 +0100 Subject: [PATCH 48/84] Move away from Boost.CMake function --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e673317a4..339286a0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,8 +15,19 @@ add_library(boost_charconv add_library(Boost::charconv ALIAS boost_charconv) if (BOOST_USE_MODULES) - boost_set_cxx20_module_settings(boost_charconv) target_sources(boost_charconv PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES modules/boost_charconv.cppm) + + # Enable and propagate C++23, import std, and the modules macro + target_compile_features(boost_charconv PUBLIC cxx_std_23) + set_target_properties(boost_charconv PROPERTIES CXX_MODULE_STD 1) + target_compile_definitions(boost_charconv PUBLIC BOOST_USE_MODULES) + + # Silence warnings about includes in the purview + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_compile_options(boost_charconv PRIVATE -Wno-include-angled-in-module-purview) + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + target_compile_options(boost_charconv PRIVATE /wd5244) + endif() endif() target_include_directories(boost_charconv PUBLIC include) From afe4f4b9831dfa92be0a5d688dfa6602aa88e529 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 18:44:01 +0100 Subject: [PATCH 49/84] Missing include in non-modular build --- test/from_chars_strtod.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/from_chars_strtod.cpp b/test/from_chars_strtod.cpp index 80ed3b3a2..ea8014808 100644 --- a/test/from_chars_strtod.cpp +++ b/test/from_chars_strtod.cpp @@ -12,6 +12,7 @@ import boost.core; #include #include #include +#include #include #endif From e33012b9e565b3a6a229d060f7f238426acf15e6 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 18:47:28 +0100 Subject: [PATCH 50/84] Guard include in constexpr_feature_detect --- .../charconv/detail/fast_float/constexpr_feature_detect.hpp | 2 ++ include/boost/charconv/detail/global_module_fragment.hpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp b/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp index 1ac1e4aab..76ff92e4b 100644 --- a/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp +++ b/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp @@ -8,11 +8,13 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_CONSTEXPR_FEATURE_DETECT_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_CONSTEXPR_FEATURE_DETECT_HPP +#ifndef BOOST_USE_MODULES #ifdef __has_include #if __has_include() #include #endif #endif +#endif // Testing for https://wg21.link/N3652, adopted in C++14 #if __cpp_constexpr >= 201304 diff --git a/include/boost/charconv/detail/global_module_fragment.hpp b/include/boost/charconv/detail/global_module_fragment.hpp index 850948fba..36b585a90 100644 --- a/include/boost/charconv/detail/global_module_fragment.hpp +++ b/include/boost/charconv/detail/global_module_fragment.hpp @@ -14,6 +14,11 @@ #include #include #include +#ifdef __has_include +#if __has_include() +#include +#endif +#endif #include #endif From bb01accd147ea0d945cccc11d5e7a96d26e757cf Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 18:57:08 +0100 Subject: [PATCH 51/84] Finalized making detail/config a regular header --- include/boost/charconv/detail/config.hpp | 4 +++- include/boost/charconv/detail/global_module_fragment.hpp | 6 +++++- include/boost/charconv/detail/memcpy.hpp | 2 +- include/boost/charconv/detail/significand_tables.hpp | 2 +- include/boost/charconv/detail/type_traits.hpp | 2 +- include/boost/charconv/limits.hpp | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index 7d95390fa..5926b3af2 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -70,7 +70,9 @@ // Inclue intrinsics if available #if defined(BOOST_MSVC) -# include +# ifndef BOOST_USE_MODULES +# include +# endif # if defined(_WIN64) # define BOOST_CHARCONV_HAS_MSVC_64BIT_INTRINSICS # else diff --git a/include/boost/charconv/detail/global_module_fragment.hpp b/include/boost/charconv/detail/global_module_fragment.hpp index 36b585a90..55a821e42 100644 --- a/include/boost/charconv/detail/global_module_fragment.hpp +++ b/include/boost/charconv/detail/global_module_fragment.hpp @@ -14,11 +14,15 @@ #include #include #include + #ifdef __has_include #if __has_include() #include #endif #endif -#include + +#if defined(BOOST_MSVC) +#include +#endif #endif diff --git a/include/boost/charconv/detail/memcpy.hpp b/include/boost/charconv/detail/memcpy.hpp index 369a40b43..99153829a 100644 --- a/include/boost/charconv/detail/memcpy.hpp +++ b/include/boost/charconv/detail/memcpy.hpp @@ -5,8 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_MEMCPY_HPP #define BOOST_CHARCONV_DETAIL_MEMCPY_HPP -#ifndef BOOST_USE_MODULES #include +#ifndef BOOST_USE_MODULES #include #include #endif diff --git a/include/boost/charconv/detail/significand_tables.hpp b/include/boost/charconv/detail/significand_tables.hpp index b939f5863..736cb9824 100644 --- a/include/boost/charconv/detail/significand_tables.hpp +++ b/include/boost/charconv/detail/significand_tables.hpp @@ -6,8 +6,8 @@ #ifndef BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP #define BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP -#ifndef BOOST_USE_MODULES #include +#ifndef BOOST_USE_MODULES #include #endif diff --git a/include/boost/charconv/detail/type_traits.hpp b/include/boost/charconv/detail/type_traits.hpp index dc488628b..7d405c997 100644 --- a/include/boost/charconv/detail/type_traits.hpp +++ b/include/boost/charconv/detail/type_traits.hpp @@ -5,8 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_TYPE_TRAITS_HPP #define BOOST_CHARCONV_DETAIL_TYPE_TRAITS_HPP -#ifndef BOOST_USE_MODULES #include +#ifndef BOOST_USE_MODULES #include #endif diff --git a/include/boost/charconv/limits.hpp b/include/boost/charconv/limits.hpp index e0feb9c48..9fe93eee4 100644 --- a/include/boost/charconv/limits.hpp +++ b/include/boost/charconv/limits.hpp @@ -5,8 +5,8 @@ #ifndef BOOST_CHARCONV_LIMITS_HPP #define BOOST_CHARCONV_LIMITS_HPP -#ifndef BOOST_USE_MODULES #include +#ifndef BOOST_USE_MODULES #include #include #endif From 272e77dba3cf667d99d3927670278b469b0fa5df Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 19:01:41 +0100 Subject: [PATCH 52/84] Correct include in compute_float80 --- include/boost/charconv/detail/compute_float80.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/charconv/detail/compute_float80.hpp b/include/boost/charconv/detail/compute_float80.hpp index 4a7e0c1f0..b82fd98e5 100644 --- a/include/boost/charconv/detail/compute_float80.hpp +++ b/include/boost/charconv/detail/compute_float80.hpp @@ -8,6 +8,9 @@ #include #include #include +#ifdef BOOST_CHARCONV_DEBUG_FLOAT128 +#include +#endif #ifndef BOOST_USE_MODULES #include #include @@ -19,7 +22,6 @@ #ifdef BOOST_CHARCONV_DEBUG_FLOAT128 #include #include -#include #endif #endif From 4526a5d9671dd972d5258e66deb6e64c1df14115 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 19:09:35 +0100 Subject: [PATCH 53/84] impl_macros.hpp --- src/float128_impl.hpp | 2 +- src/from_chars.cpp | 5 +---- src/impl_macros.hpp | 15 +++++++++++++++ src/to_chars.cpp | 6 ++---- src/to_chars_float_impl.hpp | 14 +++++++------- 5 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 src/impl_macros.hpp diff --git a/src/float128_impl.hpp b/src/float128_impl.hpp index 806a7b634..a85f72282 100644 --- a/src/float128_impl.hpp +++ b/src/float128_impl.hpp @@ -5,13 +5,13 @@ #ifndef BOOST_CHARCONV_FLOAT128_IMPL_HPP #define BOOST_CHARCONV_FLOAT128_IMPL_HPP +#include #include #include #include #include #ifndef BOOST_USE_MODULES #include "quadmath_header.hpp" -#include #include #include #include diff --git a/src/from_chars.cpp b/src/from_chars.cpp index 66ab4c994..b815b74c8 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -7,10 +7,7 @@ // Global module fragment with all required includes module; -#include -#include // for HUGE_VAL -#include -#include "quadmath_header.hpp" +#include "impl_macros.hpp" // This is an implementation unit module boost.charconv; diff --git a/src/impl_macros.hpp b/src/impl_macros.hpp new file mode 100644 index 000000000..d2e21415e --- /dev/null +++ b/src/impl_macros.hpp @@ -0,0 +1,15 @@ +// Copyright 2024 Matt Borland +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_CHARCONV_SRC_IMPL_MACROS_HPP +#define BOOST_CHARCONV_SRC_IMPL_MACROS_HPP + +// Brings all macros required by both public and implementation headers. +// Suitable for cpp files in src/ and test/ when using C++20 modules +#include +#include // for HUGE_VAL +#include +#include "quadmath_header.hpp" + +#endif diff --git a/src/to_chars.cpp b/src/to_chars.cpp index 3fd118238..32318ca10 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -8,10 +8,7 @@ // Global module fragment with all required includes module; -#include -#include // for HUGE_VAL -#include -#include "quadmath_header.hpp" +#include "impl_macros.hpp" // This is an implementation unit module boost.charconv; @@ -26,6 +23,7 @@ extern "C++" { } #ifndef BOOST_USE_MODULES +// Public declarations already visible in modules #include #include #include diff --git a/src/to_chars_float_impl.hpp b/src/to_chars_float_impl.hpp index b3569a13d..66e52675c 100644 --- a/src/to_chars_float_impl.hpp +++ b/src/to_chars_float_impl.hpp @@ -8,26 +8,27 @@ #define BOOST_CHARCONV_DETAIL_TO_CHARS_FLOAT_IMPL_HPP #include "float128_impl.hpp" -#include -#include -#include -#include -#include #include #include #include +#include +#include +#include +#include #include #include #include +#include +#include #include #include + #if (BOOST_CHARCONV_LDBL_BITS == 80 || BOOST_CHARCONV_LDBL_BITS == 128) # include # include #endif #ifndef BOOST_USE_MODULES -#include #include #include #include @@ -45,7 +46,6 @@ #endif #endif - namespace boost { namespace charconv { namespace detail { From 6c93b72e52751a58dbd194e7f8cbabba767c833d Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 19:11:37 +0100 Subject: [PATCH 54/84] restore tests that are not run with modules --- test/from_chars_STL_comp.cpp | 9 --------- test/to_chars_float_STL_comp.cpp | 10 +--------- test/to_chars_integer_STL_comp.cpp | 9 --------- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/test/from_chars_STL_comp.cpp b/test/from_chars_STL_comp.cpp index 1a782fe36..7823a34c0 100644 --- a/test/from_chars_STL_comp.cpp +++ b/test/from_chars_STL_comp.cpp @@ -6,13 +6,6 @@ #if !defined(BOOST_NO_CXX17_HDR_CHARCONV) && (!defined(__clang_major__) || (defined(__clang_major__) && __clang_major__ > 7)) -#ifdef BOOST_USE_MODULES -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include #include @@ -22,8 +15,6 @@ import boost.charconv; #include #include #include -#endif - template void test() diff --git a/test/to_chars_float_STL_comp.cpp b/test/to_chars_float_STL_comp.cpp index d0f429cb2..dec006b75 100644 --- a/test/to_chars_float_STL_comp.cpp +++ b/test/to_chars_float_STL_comp.cpp @@ -7,14 +7,8 @@ // https://en.cppreference.com/w/cpp/compiler_support/17 #if (defined(__GNUC__) && __GNUC__ >= 11) || \ ((defined(__clang__) && __clang_major__ >= 14 && !defined(__APPLE__)) || (defined(__clang__) && defined(__APPLE__) && __clang_major__ >= 16)) || \ - (defined(_MSC_VER) && _MSC_VER >= 1924) && !defined(BOOST_NO_CXX17_HDR_CHARCONV) + (defined(_MSC_VER) && _MSC_VER >= 1924) -#ifdef BOOST_USE_MODULES -import std; -import boost.core; -import boost.charconv; -#include -#else #include #include #include @@ -28,8 +22,6 @@ import boost.charconv; #include #include #include -#endif - template void test_spot(T val, boost::charconv::chars_format fmt = boost::charconv::chars_format::general, int precision = -1) diff --git a/test/to_chars_integer_STL_comp.cpp b/test/to_chars_integer_STL_comp.cpp index dd6fd1bb5..89cdc1191 100644 --- a/test/to_chars_integer_STL_comp.cpp +++ b/test/to_chars_integer_STL_comp.cpp @@ -6,13 +6,6 @@ #if !defined(BOOST_NO_CXX17_HDR_CHARCONV) && (!defined(__clang_major__) || (defined(__clang_major__) && __clang_major__ > 7)) -#ifdef BOOST_USE_MODULES -#include -#include -import std; -import boost.charconv; -import boost.core; -#else #include #include #include @@ -26,8 +19,6 @@ import boost.core; #include #include #include -#endif - template void stress_test_worker() From 28ab577dbcbeacceb3d430be7c71d71179614fdf Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 19:14:16 +0100 Subject: [PATCH 55/84] Remove back from_chars_strtod --- test/Jamfile | 1 - test/from_chars_float.cpp | 578 ++++++++++++++++++++++++++++++++++- test/from_chars_strtod.cpp | 602 ------------------------------------- 3 files changed, 577 insertions(+), 604 deletions(-) delete mode 100644 test/from_chars_strtod.cpp diff --git a/test/Jamfile b/test/Jamfile index a95756e9f..bc60e7050 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -51,7 +51,6 @@ run test_compute_float64.cpp ; run test_compute_float32.cpp ; run test_parser.cpp ; run from_chars_float.cpp ; -run from_chars_strtod.cpp ; run to_chars_float.cpp ; run to_chars_float_fallback.cpp ; run test_boost_json_values.cpp ; diff --git a/test/from_chars_float.cpp b/test/from_chars_float.cpp index 37ae165c0..4455e7e13 100644 --- a/test/from_chars_float.cpp +++ b/test/from_chars_float.cpp @@ -7,6 +7,7 @@ import std; import boost.core; import boost.charconv; #include +#include "../src/impl_macros.hpp" #else #include #include @@ -18,9 +19,10 @@ import boost.charconv; #include #include #include +#include #endif -#include +#include "../src/from_chars_float_impl.hpp" template @@ -479,6 +481,29 @@ void test_issue_45(T v, const std::string& full_buffer, const std::ptrdiff_t ptr } } +template +void test_strtod_routines(T val, const char* str) +{ + T strtod_val = -2; + const auto r = boost::charconv::detail::from_chars_strtod(str, str + std::strlen(str), strtod_val); + if (r.ec == std::errc::not_enough_memory || r.ec == std::errc::result_out_of_range) + { + if (!BOOST_TEST_EQ(strtod_val, T(-2))) + { + std::cerr << "Value was modified from input value, but should not have been"; + } + } + else + { + if (!BOOST_TEST_EQ(strtod_val, val)) + { + std::cerr << std::setprecision(std::numeric_limits::digits10 + 1) + << "Expected: " << val + << "\n Got: " << strtod_val << std::endl; + } + } +} + // Parser ignoring null terminator template void test_issue_48(const T val, const char* str, const std::ptrdiff_t expected_pos, boost::charconv::chars_format fmt = boost::charconv::chars_format::general) @@ -656,6 +681,557 @@ int main() spot_value("0e00000000000", 0e00000000000); spot_value("0e1", 0e1); + // Value in range with 20 million digits. Malloc should max out at 16'711'568 bytes + test_strtod_routines(1.982645139827653964857196, + "1.98264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" + "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" + "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" + "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" + "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" + "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" + "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" + "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" + "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" + "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" + "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" + "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" + "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" + "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" + "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" + "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" + "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" + "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" + "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" + "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" + "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" + "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" + "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" + "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" + "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" + "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" + "536098271563098271536098271536098271536" + ); + + test_strtod_routines(HUGE_VAL, "1e310"); + test_strtod_routines(-HUGE_VALF, "-1e40"); + test_strtod_routines(0.0, "1e-500"); + test_strtod_routines(-0.0F, "-1e-50"); + test_strtod_routines(1.5738291047382910487, "1.5738291047382910487"); + test_strtod_routines(-1.5738291047382910487F, "-1.5738291047382910487"); + // Every power spot_check(1.7e+308, "1.7e+308", boost::charconv::chars_format::scientific); spot_check(1.7e+307, "1.7e+307", boost::charconv::chars_format::scientific); diff --git a/test/from_chars_strtod.cpp b/test/from_chars_strtod.cpp deleted file mode 100644 index ea8014808..000000000 --- a/test/from_chars_strtod.cpp +++ /dev/null @@ -1,602 +0,0 @@ -// Copyright 2023 Matt Borland -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -#ifdef BOOST_USE_MODULES -import std; -import boost.core; -#include -#include -#else -#include -#include -#include -#include -#include -#include -#endif - -#include -#include -#include "../src/from_chars_float_impl.hpp" - - - -template -void test_strtod_routines(T val, const char* str) -{ - T strtod_val = -2; - const auto r = boost::charconv::detail::from_chars_strtod(str, str + std::strlen(str), strtod_val); - if (r.ec == std::errc::not_enough_memory || r.ec == std::errc::result_out_of_range) - { - if (!BOOST_TEST_EQ(strtod_val, T(-2))) - { - std::cerr << "Value was modified from input value, but should not have been"; - } - } - else - { - if (!BOOST_TEST_EQ(strtod_val, val)) - { - std::cerr << std::setprecision(std::numeric_limits::digits10 + 1) - << "Expected: " << val - << "\n Got: " << strtod_val << std::endl; - } - } -} - -int main() -{ - // Value in range with 20 million digits. Malloc should max out at 16'711'568 bytes - test_strtod_routines(1.982645139827653964857196, - "1.98264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - "198264513982765396485719650498261498564729856318926451982754398672495874691824659645" - "1092348576918246513984659103485721634589126458619584619051982671298642158641958264819" - "0519826492851648192519856419258612541685159172360917510925761093561879512865908275198" - "2651982563012895610769517352609182751093560198257610928576510481965234109182954019825" - "7610935761093571092387540619275610395718290513769285109237856091827569104857109358109" - "3857910671958109375610935865109834571986201958109246581398246396857109651089639186275" - "1238961023875609182763509182703618927450916837259013650296857109258607129845760918576" - "5109384659103865791083659127490287596102935761092375819627109382651098346598163450983" - "5109384750198273561907351098627531098465109384750983610984675109384750984610987456109" - "3847561098475260193847609187326501982735601985761904782659013487569102738957109184756" - "9018743691872634509287561098274510938746509827536019827536091827650918327650918265091" - "8237560918275961083726510983726510982650198275609182375609187236510982356109827509862" - "3140985671294567190264790263190756290824609182356907123056918276091837561097812365908" - "1726509817365109823561097235690719823560987126509812376598712635098712365098475610982" - "3756098135760981273965019827609182375609182756098123765098123765081273650982173650982" - "1735091823756109821736509182763905109286510982653109826501982653109835601928375609182" - "5673098217536098217560918273560982165309821753609817365098271365098217365091827651098" - "2735610982735610982735610982713509182756310982715630982735610982175631098275610982735" - "6091827561098273650981253609821753609821765310982756309821763509182756309821756309182" - "7563098217563109827653091827563098217653091827650918273560982716350918273561098217536" - "0918276350918276530982176531098275609182756309827156310982735609182753609827153609182" - "7563098271563908127563091827563109827156309827153609827365109827153098271536098271536" - "0918275631098271536098271560918275630982716530918275630982715360918275360982715360918" - "2753609827153609182756309827156309182756310982715630982715360982715360982715360982715" - "3609827153609827156309827153609821765309182756091827356098271653091827356098271563091" - "8275630982716350918273561098271536098271536098271536098271563098271536098271536098271" - "536098271563098271536098271536098271536" - ); - - test_strtod_routines(HUGE_VAL, "1e310"); - test_strtod_routines(-HUGE_VALF, "-1e40"); - test_strtod_routines(0.0, "1e-500"); - test_strtod_routines(-0.0F, "-1e-50"); - test_strtod_routines(1.5738291047382910487, "1.5738291047382910487"); - test_strtod_routines(-1.5738291047382910487F, "-1.5738291047382910487"); - - return boost::report_errors(); -} From 0d7e4455d2522f9faa769189043e802b9610ea11 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 19:26:35 +0100 Subject: [PATCH 56/84] Test cleanup 1 --- test/github_issue_122.cpp | 6 ++---- test/github_issue_152.cpp | 6 ++---- test/github_issue_154.cpp | 3 +-- test/github_issue_158.cpp | 4 +--- test/github_issue_166.cpp | 3 +-- test/github_issue_166_float128.cpp | 3 +-- test/github_issue_186.cpp | 1 - test/test_compute_float32.cpp | 4 ++-- test/test_compute_float64.cpp | 4 ++-- test/test_compute_float80.cpp | 4 ++-- test/test_num_digits.cpp | 2 +- test/test_parser.cpp | 7 ++++--- test/to_chars.cpp | 5 ++--- 13 files changed, 21 insertions(+), 31 deletions(-) diff --git a/test/github_issue_122.cpp b/test/github_issue_122.cpp index 66f58bedb..01cb01148 100644 --- a/test/github_issue_122.cpp +++ b/test/github_issue_122.cpp @@ -7,16 +7,14 @@ import std; import boost.core; #include -#include +#include "../src/impl_macros.hpp" #else #include #include +#include #include #endif -#include -#include -#include #include template diff --git a/test/github_issue_152.cpp b/test/github_issue_152.cpp index 9c0775aa1..978e21a6c 100644 --- a/test/github_issue_152.cpp +++ b/test/github_issue_152.cpp @@ -7,6 +7,8 @@ import std; import boost.core; import boost.charconv; #include +#include +#include #else #include #include @@ -18,10 +20,6 @@ import boost.charconv; #include #endif -#include -#include - - constexpr std::size_t N = 1024; static std::mt19937_64 rng(42); diff --git a/test/github_issue_154.cpp b/test/github_issue_154.cpp index b5f393bec..bf5315331 100644 --- a/test/github_issue_154.cpp +++ b/test/github_issue_154.cpp @@ -9,13 +9,12 @@ import std; import boost.core; import boost.charconv; #include +#include #else #include #include #endif -#include - int main() { #if BOOST_CHARCONV_LDBL_BITS == 80 diff --git a/test/github_issue_158.cpp b/test/github_issue_158.cpp index 635a9152a..373721738 100644 --- a/test/github_issue_158.cpp +++ b/test/github_issue_158.cpp @@ -10,14 +10,12 @@ import std; import boost.core; import boost.charconv; #include +#include #else #include #include #endif -#include - - void test_values_with_negative_exp() { char buffer[256]; diff --git a/test/github_issue_166.cpp b/test/github_issue_166.cpp index 32e55a5d4..2bb1ba29a 100644 --- a/test/github_issue_166.cpp +++ b/test/github_issue_166.cpp @@ -9,13 +9,12 @@ import std; import boost.core; import boost.charconv; #include +#include #else #include #include #endif -#include - template void simple_test() { diff --git a/test/github_issue_166_float128.cpp b/test/github_issue_166_float128.cpp index 9871e3168..ee7196747 100644 --- a/test/github_issue_166_float128.cpp +++ b/test/github_issue_166_float128.cpp @@ -9,14 +9,13 @@ import std; import boost.core; import boost.charconv; #include +#include #else #include #include #include #endif -#include - template void test() { diff --git a/test/github_issue_186.cpp b/test/github_issue_186.cpp index c41b119b4..f8f7ed8a2 100644 --- a/test/github_issue_186.cpp +++ b/test/github_issue_186.cpp @@ -16,7 +16,6 @@ import boost.charconv; #include #endif - template void force_overflow(T value) { diff --git a/test/test_compute_float32.cpp b/test/test_compute_float32.cpp index 00f00264e..195f951e5 100644 --- a/test/test_compute_float32.cpp +++ b/test/test_compute_float32.cpp @@ -6,14 +6,14 @@ import std; import boost.core; #include -#include +#include "../src/impl_macros.hpp" #else #include #include #endif -#include #include +#include #include using boost::charconv::detail::compute_float32; diff --git a/test/test_compute_float64.cpp b/test/test_compute_float64.cpp index ba7538e2c..80474dfcd 100644 --- a/test/test_compute_float64.cpp +++ b/test/test_compute_float64.cpp @@ -6,16 +6,16 @@ import std; import boost.core; #include -#include +#include "../src/impl_macros.hpp" #else #include #include #include #endif -#include #include #include +#include using boost::charconv::detail::compute_float64; diff --git a/test/test_compute_float80.cpp b/test/test_compute_float80.cpp index 42f0e463b..ca2a3f7cd 100644 --- a/test/test_compute_float80.cpp +++ b/test/test_compute_float80.cpp @@ -6,17 +6,17 @@ import std; import boost.core; #include -#include +#include "../src/impl_macros.hpp" #else #include #include #include #include +#include #include #include #endif -#include #include #include #include diff --git a/test/test_num_digits.cpp b/test/test_num_digits.cpp index 1e133e5e5..d02223185 100644 --- a/test/test_num_digits.cpp +++ b/test/test_num_digits.cpp @@ -7,7 +7,7 @@ import std; import boost.core; #include -#include +#include "../src/impl_macros.hpp" #else #include #include diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 0f25b36c7..50ec2252f 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -5,9 +5,12 @@ #ifdef BOOST_USE_MODULES import std; import boost.core; +import boost.charconv; #include -#include +#include "../src/impl_macros.hpp" #else +#include +#include #include #include #include @@ -17,8 +20,6 @@ import boost.core; #endif #include -#include -#include void test_integer() diff --git a/test/to_chars.cpp b/test/to_chars.cpp index 8ffe6d1f8..0a1709a46 100644 --- a/test/to_chars.cpp +++ b/test/to_chars.cpp @@ -7,8 +7,6 @@ #include #include #include -#include -#include // for UINT64_C import std; import boost.charconv; import boost.core; @@ -23,7 +21,8 @@ import boost.core; #include #endif -#include +#include // for INT_MIN +#include // for UINT64_C #ifdef BOOST_CHARCONV_HAS_INT128 template From 25a494bf87d7a16535016247d7208b134f74bea9 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 19:28:16 +0100 Subject: [PATCH 57/84] Remove to_chars_float_fallback --- test/Jamfile | 1 - test/to_chars_float.cpp | 128 ++++++++++++++++++++++ test/to_chars_float_fallback.cpp | 181 ------------------------------- 3 files changed, 128 insertions(+), 182 deletions(-) delete mode 100644 test/to_chars_float_fallback.cpp diff --git a/test/Jamfile b/test/Jamfile index bc60e7050..e17fb07b2 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -52,7 +52,6 @@ run test_compute_float32.cpp ; run test_parser.cpp ; run from_chars_float.cpp ; run to_chars_float.cpp ; -run to_chars_float_fallback.cpp ; run test_boost_json_values.cpp ; run to_chars_float_STL_comp.cpp : : : [ requires cxx17_hdr_charconv ] ; run from_chars_float2.cpp ; diff --git a/test/to_chars_float.cpp b/test/to_chars_float.cpp index 9dd0944ed..7a0a11b5c 100644 --- a/test/to_chars_float.cpp +++ b/test/to_chars_float.cpp @@ -8,6 +8,7 @@ import std; import boost.core; import boost.charconv; #include +#include "../src/impl_macros.hpp" #else #include #include @@ -25,6 +26,7 @@ import boost.charconv; #include #endif +#include // These numbers diverge from what the formatting is using printf // See: https://godbolt.org/z/zd34KcWMW @@ -178,6 +180,30 @@ constexpr const char* fmt_fixed(long double) return "%.0Lf"; } +template +void test_printf_fallback(T v, const std::string&, boost::charconv::chars_format fmt = boost::charconv::chars_format::general, int precision = -1) +{ + char buffer[256] {}; + const auto r = boost::charconv::detail::to_chars_printf_impl(buffer, buffer + sizeof(buffer), v, fmt, precision); + BOOST_TEST(r.ec == std::errc()); + + char printf_buffer[256] {}; + if (fmt == boost::charconv::chars_format::general) + { + std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_general(v), v); + } + else if (fmt == boost::charconv::chars_format::scientific) + { + std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_sci(v), v); + } + else if (fmt == boost::charconv::chars_format::fixed) + { + std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_fixed(v), v); + } + + BOOST_TEST_CSTR_EQ(buffer, printf_buffer); +} + std::string format(int prec) { std::string format = "%." + std::to_string(prec) + "g"; @@ -283,6 +309,108 @@ int main() spot_check(123456789012345.0, "1.23456789012345e+14", boost::charconv::chars_format::scientific); spot_check(1234567890123456.0, "1.234567890123456e+15", boost::charconv::chars_format::scientific); + test_printf_fallback(1.0, "1"); + test_printf_fallback(1.2, "1.2"); + test_printf_fallback(1.23, "1.23"); + test_printf_fallback(1.234, "1.234"); + test_printf_fallback(1.2345, "1.2345"); + test_printf_fallback(1.23456, "1.23456"); + test_printf_fallback(1.234567, "1.234567"); + test_printf_fallback(1.2345678, "1.2345678"); + test_printf_fallback(1.23456789, "1.23456789"); + test_printf_fallback(1.234567890, "1.23456789"); + test_printf_fallback(1.2345678901, "1.2345678901"); + test_printf_fallback(1.23456789012, "1.23456789012"); + test_printf_fallback(1.234567890123, "1.234567890123"); + test_printf_fallback(1.2345678901234, "1.2345678901234"); + test_printf_fallback(1.23456789012345, "1.23456789012345"); + test_printf_fallback(1.234567890123456, "1.234567890123456"); + + test_printf_fallback(1.0, "1e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2, "1.2e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23, "1.23e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234, "1.234e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345, "1.2345e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456, "1.23456e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567, "1.234567e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678, "1.2345678e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789, "1.23456789e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890, "1.23456789e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678901, "1.2345678901e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789012, "1.23456789012e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890123, "1.234567890123e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678901234, "1.2345678901234e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789012345, "1.23456789012345e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890123456, "1.234567890123456e+00", boost::charconv::chars_format::scientific); + + test_printf_fallback(1.0, "1e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2, "1.2e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23, "1.23e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234, "1.234e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345, "1.2345e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456, "1.23456e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567, "1.234567e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678, "1.2345678e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789, "1.23456789e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890, "1.23456789e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678901, "1.2345678901e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789012, "1.23456789012e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890123, "1.234567890123e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678901234, "1.2345678901234e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789012345, "1.23456789012345e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890123456, "1.234567890123456e+00", boost::charconv::chars_format::fixed); + + test_printf_fallback(1.0L, "1"); + test_printf_fallback(1.2L, "1.2"); + test_printf_fallback(1.23L, "1.23"); + test_printf_fallback(1.234L, "1.234"); + test_printf_fallback(1.2345L, "1.2345"); + test_printf_fallback(1.23456L, "1.23456"); + test_printf_fallback(1.234567L, "1.234567"); + test_printf_fallback(1.2345678L, "1.2345678"); + test_printf_fallback(1.23456789L, "1.23456789"); + test_printf_fallback(1.234567890L, "1.23456789"); + test_printf_fallback(1.2345678901L, "1.2345678901"); + test_printf_fallback(1.23456789012L, "1.23456789012"); + test_printf_fallback(1.234567890123L, "1.234567890123"); + test_printf_fallback(1.2345678901234L, "1.2345678901234"); + test_printf_fallback(1.23456789012345L, "1.23456789012345"); + test_printf_fallback(1.234567890123456L, "1.234567890123456"); + + test_printf_fallback(1.0L, "1e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2L, "1.2e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23L, "1.23e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234L, "1.234e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345L, "1.2345e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456L, "1.23456e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567L, "1.234567e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678L, "1.2345678e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789L, "1.23456789e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890L, "1.23456789e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678901L, "1.2345678901e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789012L, "1.23456789012e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890123L, "1.234567890123e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.2345678901234L, "1.2345678901234e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.23456789012345L, "1.23456789012345e+00", boost::charconv::chars_format::scientific); + test_printf_fallback(1.234567890123456L, "1.234567890123456e+00", boost::charconv::chars_format::scientific); + + test_printf_fallback(1.0L, "1e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2L, "1.2e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23L, "1.23e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234L, "1.234e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345L, "1.2345e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456L, "1.23456e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567L, "1.234567e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678L, "1.2345678e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789L, "1.23456789e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890L, "1.23456789e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678901L, "1.2345678901e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789012L, "1.23456789012e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890123L, "1.234567890123e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.2345678901234L, "1.2345678901234e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.23456789012345L, "1.23456789012345e+00", boost::charconv::chars_format::fixed); + test_printf_fallback(1.234567890123456L, "1.234567890123456e+00", boost::charconv::chars_format::fixed); + // Regressions or numbers that take >64 bits to represent correctly spot_check(9007199254740991.0, "9.007199254740991e+15", boost::charconv::chars_format::scientific); spot_check(9007199254740992.0, "9.007199254740992e+15", boost::charconv::chars_format::scientific); diff --git a/test/to_chars_float_fallback.cpp b/test/to_chars_float_fallback.cpp deleted file mode 100644 index 3168a5671..000000000 --- a/test/to_chars_float_fallback.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright 2018 Ulf Adams -// Copyright 2023 Matt Borland -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -#ifdef BOOST_USE_MODULES -import std; -import boost.core; -#include -#include -#else -#include -#include -#include -#endif - -#include -#include -#include - - -constexpr const char* fmt_general(double) -{ - return "%g"; -} - -constexpr const char* fmt_general(long double) -{ - return "%Lg"; -} - -constexpr const char* fmt_sci(double) -{ - return "%e"; -} - -constexpr const char* fmt_sci(long double) -{ - return "%Le"; -} - -constexpr const char* fmt_fixed(double) -{ - return "%.0f"; -} - -constexpr const char* fmt_fixed(long double) -{ - return "%.0Lf"; -} - -template -void test_printf_fallback(T v, const std::string&, boost::charconv::chars_format fmt = boost::charconv::chars_format::general, int precision = -1) -{ - char buffer[256] {}; - const auto r = boost::charconv::detail::to_chars_printf_impl(buffer, buffer + sizeof(buffer), v, fmt, precision); - BOOST_TEST(r.ec == std::errc()); - - char printf_buffer[256] {}; - if (fmt == boost::charconv::chars_format::general) - { - std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_general(v), v); - } - else if (fmt == boost::charconv::chars_format::scientific) - { - std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_sci(v), v); - } - else if (fmt == boost::charconv::chars_format::fixed) - { - std::snprintf(printf_buffer, sizeof(printf_buffer), fmt_fixed(v), v); - } - - BOOST_TEST_CSTR_EQ(buffer, printf_buffer); -} - -int main() -{ - test_printf_fallback(1.0, "1"); - test_printf_fallback(1.2, "1.2"); - test_printf_fallback(1.23, "1.23"); - test_printf_fallback(1.234, "1.234"); - test_printf_fallback(1.2345, "1.2345"); - test_printf_fallback(1.23456, "1.23456"); - test_printf_fallback(1.234567, "1.234567"); - test_printf_fallback(1.2345678, "1.2345678"); - test_printf_fallback(1.23456789, "1.23456789"); - test_printf_fallback(1.234567890, "1.23456789"); - test_printf_fallback(1.2345678901, "1.2345678901"); - test_printf_fallback(1.23456789012, "1.23456789012"); - test_printf_fallback(1.234567890123, "1.234567890123"); - test_printf_fallback(1.2345678901234, "1.2345678901234"); - test_printf_fallback(1.23456789012345, "1.23456789012345"); - test_printf_fallback(1.234567890123456, "1.234567890123456"); - - test_printf_fallback(1.0, "1e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2, "1.2e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23, "1.23e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234, "1.234e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345, "1.2345e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456, "1.23456e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567, "1.234567e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678, "1.2345678e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789, "1.23456789e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890, "1.23456789e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678901, "1.2345678901e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789012, "1.23456789012e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890123, "1.234567890123e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678901234, "1.2345678901234e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789012345, "1.23456789012345e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890123456, "1.234567890123456e+00", boost::charconv::chars_format::scientific); - - test_printf_fallback(1.0, "1e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2, "1.2e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23, "1.23e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234, "1.234e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345, "1.2345e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456, "1.23456e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567, "1.234567e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678, "1.2345678e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789, "1.23456789e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890, "1.23456789e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678901, "1.2345678901e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789012, "1.23456789012e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890123, "1.234567890123e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678901234, "1.2345678901234e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789012345, "1.23456789012345e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890123456, "1.234567890123456e+00", boost::charconv::chars_format::fixed); - - test_printf_fallback(1.0L, "1"); - test_printf_fallback(1.2L, "1.2"); - test_printf_fallback(1.23L, "1.23"); - test_printf_fallback(1.234L, "1.234"); - test_printf_fallback(1.2345L, "1.2345"); - test_printf_fallback(1.23456L, "1.23456"); - test_printf_fallback(1.234567L, "1.234567"); - test_printf_fallback(1.2345678L, "1.2345678"); - test_printf_fallback(1.23456789L, "1.23456789"); - test_printf_fallback(1.234567890L, "1.23456789"); - test_printf_fallback(1.2345678901L, "1.2345678901"); - test_printf_fallback(1.23456789012L, "1.23456789012"); - test_printf_fallback(1.234567890123L, "1.234567890123"); - test_printf_fallback(1.2345678901234L, "1.2345678901234"); - test_printf_fallback(1.23456789012345L, "1.23456789012345"); - test_printf_fallback(1.234567890123456L, "1.234567890123456"); - - test_printf_fallback(1.0L, "1e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2L, "1.2e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23L, "1.23e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234L, "1.234e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345L, "1.2345e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456L, "1.23456e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567L, "1.234567e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678L, "1.2345678e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789L, "1.23456789e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890L, "1.23456789e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678901L, "1.2345678901e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789012L, "1.23456789012e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890123L, "1.234567890123e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.2345678901234L, "1.2345678901234e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.23456789012345L, "1.23456789012345e+00", boost::charconv::chars_format::scientific); - test_printf_fallback(1.234567890123456L, "1.234567890123456e+00", boost::charconv::chars_format::scientific); - - test_printf_fallback(1.0L, "1e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2L, "1.2e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23L, "1.23e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234L, "1.234e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345L, "1.2345e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456L, "1.23456e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567L, "1.234567e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678L, "1.2345678e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789L, "1.23456789e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890L, "1.23456789e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678901L, "1.2345678901e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789012L, "1.23456789012e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890123L, "1.234567890123e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.2345678901234L, "1.2345678901234e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.23456789012345L, "1.23456789012345e+00", boost::charconv::chars_format::fixed); - test_printf_fallback(1.234567890123456L, "1.234567890123456e+00", boost::charconv::chars_format::fixed); - - return boost::report_errors(); -} From 4bbe46a7f89910c99409c63fe2494e81d0b7aec1 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 19:29:59 +0100 Subject: [PATCH 58/84] Last test cleanup --- test/to_chars_sprintf.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/to_chars_sprintf.cpp b/test/to_chars_sprintf.cpp index bc3c33909..8d3a122ce 100644 --- a/test/to_chars_sprintf.cpp +++ b/test/to_chars_sprintf.cpp @@ -3,9 +3,6 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include - #ifdef BOOST_USE_MODULES #include #include @@ -23,11 +20,11 @@ import boost.charconv; #include #include #include -#include #include #endif - +#include +#include int const N = 1024; From 8f0d876cb72d9aa5ce9c892124599292c7e0bf90 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 19:34:05 +0100 Subject: [PATCH 59/84] Modules cis (1) --- .github/workflows/ci.yml | 1519 +++++++++++++++++------------ .github/workflows/codecov.yml | 202 ---- .github/workflows/fuzz.yml | 289 ------ .github/workflows/qemu.yml | 204 ---- tools/setup_boost_with_modules.py | 28 + 5 files changed, 943 insertions(+), 1299 deletions(-) delete mode 100644 .github/workflows/codecov.yml delete mode 100644 .github/workflows/fuzz.yml delete mode 100644 .github/workflows/qemu.yml create mode 100644 tools/setup_boost_with_modules.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb61471bb..5204c1e45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,552 +24,760 @@ env: B2_CI_VERSION: 1 jobs: - posix: - defaults: - run: - shell: bash + # posix: + # defaults: + # run: + # shell: bash - strategy: - fail-fast: false - matrix: - include: - - toolset: gcc-5 - cxxstd: "03,11,14,1z" - address_model: 32,64 - os: ubuntu-latest - container: ubuntu:16.04 - install: - - g++-5-multilib - - toolset: gcc-5 - cxxstd: "03-gnu,11-gnu,14-gnu,1z-gnu" - address_model: 32,64 - os: ubuntu-latest - container: ubuntu:16.04 - install: - - g++-5-multilib - - toolset: gcc-6 - cxxstd: "03,11,14,1z" - address_model: 32,64 - os: ubuntu-latest - container: ubuntu:18.04 - install: - - g++-6-multilib - - toolset: gcc-7 - cxxstd: "03,11,14,17" - address_model: 32,64 - os: ubuntu-latest - container: ubuntu:18.04 - install: - - g++-7-multilib - - toolset: gcc-8 - cxxstd: "03,11,14,17,2a" - address_model: 32,64 - os: ubuntu-latest - container: ubuntu:18.04 - install: - - g++-8-multilib - - toolset: gcc-9 - cxxstd: "03,11,14,17,2a" - address_model: 32,64 - os: ubuntu-20.04 - install: - - g++-9-multilib - - toolset: gcc-9 - cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,2a-gnu" - address_model: 32,64 - os: ubuntu-20.04 - install: - - g++-9-multilib - - toolset: gcc-10 - cxxstd: "03,11,14,17,20" - address_model: 32,64 - os: ubuntu-20.04 - install: - - g++-10-multilib - - toolset: gcc-11 - cxxstd: "03,11,14,17,20,23" - address_model: 32,64 - os: ubuntu-22.04 - install: - - g++-11-multilib - - toolset: gcc-12 - cxxstd: "03,11,14,17,20,23" - address_model: 32,64 - os: ubuntu-22.04 - install: - - g++-12-multilib - - toolset: gcc-12 - cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu" - address_model: 32,64 - os: ubuntu-22.04 - install: - - g++-12-multilib - - name: UBSAN - toolset: gcc-12 - cxxstd: "03,11,14,17,20,23" - address_model: 32,64 - ubsan: 1 - os: ubuntu-22.04 - install: - - g++-12-multilib - - toolset: gcc-13 - cxxstd: "03,11,14,17,20,23" - address_model: 32,64 - os: ubuntu-24.04 - install: - - g++-13-multilib - cxxflags: -fexcess-precision=fast - - # Linux, clang - - toolset: clang - compiler: clang++-3.8 - cxxstd: "03,11,14" - os: ubuntu-latest - container: ubuntu:16.04 - install: - - clang-3.8 - - toolset: clang - compiler: clang++-3.9 - cxxstd: "03,11,14" - os: ubuntu-latest - container: ubuntu:18.04 - install: - - clang-3.9 - - toolset: clang - compiler: clang++-4.0 - cxxstd: "03,11,14" - os: ubuntu-latest - container: ubuntu:18.04 - install: - - clang-4.0 - - toolset: clang - compiler: clang++-5.0 - cxxstd: "03,11,14,1z" - os: ubuntu-latest - container: ubuntu:18.04 - install: - - clang-5.0 - - toolset: clang - compiler: clang++-6.0 - cxxstd: "03,11,14,17" - os: ubuntu-latest - container: ubuntu:18.04 - install: - - clang-6.0 - - toolset: clang - compiler: clang++-7 - cxxstd: "03,11,14,17" - os: ubuntu-latest - container: ubuntu:18.04 - install: - - clang-7 - # Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode - - toolset: clang - compiler: clang++-8 - cxxstd: "03,11,14,17,2a" - os: ubuntu-latest - container: ubuntu:18.04 - install: - - clang-8 - - g++-7 - gcc_toolchain: 7 - - toolset: clang - compiler: clang++-9 - cxxstd: "03,11,14,17,2a" - os: ubuntu-20.04 - install: - - clang-9 - - toolset: clang - compiler: clang++-10 - cxxstd: "03,11,14,17,20" - os: ubuntu-20.04 - install: - - clang-10 - - toolset: clang - compiler: clang++-11 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - install: - - clang-11 - - toolset: clang - compiler: clang++-12 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - install: - - clang-12 - - toolset: clang - compiler: clang++-13 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - install: - - clang-13 - - toolset: clang - compiler: clang++-14 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - install: - - clang-14 - - toolset: clang - compiler: clang++-14 - cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu" - os: ubuntu-22.04 - install: - - clang-14 - - toolset: clang - compiler: clang++-15 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - install: - - clang-15 - sources: - - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" - source_keys: - - "https://apt.llvm.org/llvm-snapshot.gpg.key" - - toolset: clang - compiler: clang++-15 - cxxstd: "03,11,14,17,20,2b" - os: ubuntu-22.04 - install: - - clang-15 - - libc++-15-dev - - libc++abi-15-dev - sources: - - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" - source_keys: - - "https://apt.llvm.org/llvm-snapshot.gpg.key" - cxxflags: -stdlib=libc++ - linkflags: -stdlib=libc++ - - toolset: clang - compiler: clang++-16 - cxxstd: "03,11,14,17,20,2b" - os: ubuntu-22.04 - install: - - clang-16 - sources: - - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" - source_keys: - - "https://apt.llvm.org/llvm-snapshot.gpg.key" - - toolset: clang - compiler: clang++-17 - cxxstd: "03,11,14,17,20,2b" - os: ubuntu-22.04 - install: - - clang-17 - sources: - - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" - source_keys: - - "https://apt.llvm.org/llvm-snapshot.gpg.key" - - name: UBSAN - toolset: clang - compiler: clang++-14 - cxxstd: "03,11,14,17,20,2b" - cxxflags: -stdlib=libc++ - linkflags: -stdlib=libc++ - ubsan: 1 - os: ubuntu-22.04 - install: - - clang-14 - - libc++-14-dev - - libc++abi-14-dev - - - toolset: clang - cxxstd: "03,11,14,17,20,2b" - os: macos-13 - - toolset: clang - cxxstd: "03,11,14,17,20,2b" - os: macos-14 - - toolset: clang - cxxstd: "03,11,14,17,20,2b" - os: macos-15 - - timeout-minutes: 60 - runs-on: ${{matrix.os}} - container: - image: ${{matrix.container}} - volumes: - - /node20217:/node20217:rw,rshared - - ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }} + # strategy: + # fail-fast: false + # matrix: + # include: + # - toolset: gcc-5 + # cxxstd: "03,11,14,1z" + # address_model: 32,64 + # os: ubuntu-latest + # container: ubuntu:16.04 + # install: + # - g++-5-multilib + # - toolset: gcc-5 + # cxxstd: "03-gnu,11-gnu,14-gnu,1z-gnu" + # address_model: 32,64 + # os: ubuntu-latest + # container: ubuntu:16.04 + # install: + # - g++-5-multilib + # - toolset: gcc-6 + # cxxstd: "03,11,14,1z" + # address_model: 32,64 + # os: ubuntu-latest + # container: ubuntu:18.04 + # install: + # - g++-6-multilib + # - toolset: gcc-7 + # cxxstd: "03,11,14,17" + # address_model: 32,64 + # os: ubuntu-latest + # container: ubuntu:18.04 + # install: + # - g++-7-multilib + # - toolset: gcc-8 + # cxxstd: "03,11,14,17,2a" + # address_model: 32,64 + # os: ubuntu-latest + # container: ubuntu:18.04 + # install: + # - g++-8-multilib + # - toolset: gcc-9 + # cxxstd: "03,11,14,17,2a" + # address_model: 32,64 + # os: ubuntu-20.04 + # install: + # - g++-9-multilib + # - toolset: gcc-9 + # cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,2a-gnu" + # address_model: 32,64 + # os: ubuntu-20.04 + # install: + # - g++-9-multilib + # - toolset: gcc-10 + # cxxstd: "03,11,14,17,20" + # address_model: 32,64 + # os: ubuntu-20.04 + # install: + # - g++-10-multilib + # - toolset: gcc-11 + # cxxstd: "03,11,14,17,20,23" + # address_model: 32,64 + # os: ubuntu-22.04 + # install: + # - g++-11-multilib + # - toolset: gcc-12 + # cxxstd: "03,11,14,17,20,23" + # address_model: 32,64 + # os: ubuntu-22.04 + # install: + # - g++-12-multilib + # - toolset: gcc-12 + # cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu" + # address_model: 32,64 + # os: ubuntu-22.04 + # install: + # - g++-12-multilib + # - name: UBSAN + # toolset: gcc-12 + # cxxstd: "03,11,14,17,20,23" + # address_model: 32,64 + # ubsan: 1 + # os: ubuntu-22.04 + # install: + # - g++-12-multilib + # - toolset: gcc-13 + # cxxstd: "03,11,14,17,20,23" + # address_model: 32,64 + # os: ubuntu-24.04 + # install: + # - g++-13-multilib + # cxxflags: -fexcess-precision=fast - steps: - - name: Setup environment - run: | - if [ -f "/etc/debian_version" ] - then - echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV - export DEBIAN_FRONTEND=noninteractive - fi - if [ -n "${{matrix.container}}" ] - then - echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV - if [ -f "/etc/debian_version" ] - then - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ] - then - PYTHON_PACKAGE="python-is-python3" - else - PYTHON_PACKAGE="python" - fi - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake - fi - if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then - # Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590 - curl -sL https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217 - fi - fi - git config --global pack.threads 0 - - uses: actions/checkout@v4 + # # Linux, clang + # - toolset: clang + # compiler: clang++-3.8 + # cxxstd: "03,11,14" + # os: ubuntu-latest + # container: ubuntu:16.04 + # install: + # - clang-3.8 + # - toolset: clang + # compiler: clang++-3.9 + # cxxstd: "03,11,14" + # os: ubuntu-latest + # container: ubuntu:18.04 + # install: + # - clang-3.9 + # - toolset: clang + # compiler: clang++-4.0 + # cxxstd: "03,11,14" + # os: ubuntu-latest + # container: ubuntu:18.04 + # install: + # - clang-4.0 + # - toolset: clang + # compiler: clang++-5.0 + # cxxstd: "03,11,14,1z" + # os: ubuntu-latest + # container: ubuntu:18.04 + # install: + # - clang-5.0 + # - toolset: clang + # compiler: clang++-6.0 + # cxxstd: "03,11,14,17" + # os: ubuntu-latest + # container: ubuntu:18.04 + # install: + # - clang-6.0 + # - toolset: clang + # compiler: clang++-7 + # cxxstd: "03,11,14,17" + # os: ubuntu-latest + # container: ubuntu:18.04 + # install: + # - clang-7 + # # Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode + # - toolset: clang + # compiler: clang++-8 + # cxxstd: "03,11,14,17,2a" + # os: ubuntu-latest + # container: ubuntu:18.04 + # install: + # - clang-8 + # - g++-7 + # gcc_toolchain: 7 + # - toolset: clang + # compiler: clang++-9 + # cxxstd: "03,11,14,17,2a" + # os: ubuntu-20.04 + # install: + # - clang-9 + # - toolset: clang + # compiler: clang++-10 + # cxxstd: "03,11,14,17,20" + # os: ubuntu-20.04 + # install: + # - clang-10 + # - toolset: clang + # compiler: clang++-11 + # cxxstd: "03,11,14,17,20" + # os: ubuntu-22.04 + # install: + # - clang-11 + # - toolset: clang + # compiler: clang++-12 + # cxxstd: "03,11,14,17,20" + # os: ubuntu-22.04 + # install: + # - clang-12 + # - toolset: clang + # compiler: clang++-13 + # cxxstd: "03,11,14,17,20" + # os: ubuntu-22.04 + # install: + # - clang-13 + # - toolset: clang + # compiler: clang++-14 + # cxxstd: "03,11,14,17,20" + # os: ubuntu-22.04 + # install: + # - clang-14 + # - toolset: clang + # compiler: clang++-14 + # cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu" + # os: ubuntu-22.04 + # install: + # - clang-14 + # - toolset: clang + # compiler: clang++-15 + # cxxstd: "03,11,14,17,20" + # os: ubuntu-22.04 + # install: + # - clang-15 + # sources: + # - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" + # source_keys: + # - "https://apt.llvm.org/llvm-snapshot.gpg.key" + # - toolset: clang + # compiler: clang++-15 + # cxxstd: "03,11,14,17,20,2b" + # os: ubuntu-22.04 + # install: + # - clang-15 + # - libc++-15-dev + # - libc++abi-15-dev + # sources: + # - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" + # source_keys: + # - "https://apt.llvm.org/llvm-snapshot.gpg.key" + # cxxflags: -stdlib=libc++ + # linkflags: -stdlib=libc++ + # - toolset: clang + # compiler: clang++-16 + # cxxstd: "03,11,14,17,20,2b" + # os: ubuntu-22.04 + # install: + # - clang-16 + # sources: + # - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" + # source_keys: + # - "https://apt.llvm.org/llvm-snapshot.gpg.key" + # - toolset: clang + # compiler: clang++-17 + # cxxstd: "03,11,14,17,20,2b" + # os: ubuntu-22.04 + # install: + # - clang-17 + # sources: + # - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" + # source_keys: + # - "https://apt.llvm.org/llvm-snapshot.gpg.key" + # - name: UBSAN + # toolset: clang + # compiler: clang++-14 + # cxxstd: "03,11,14,17,20,2b" + # cxxflags: -stdlib=libc++ + # linkflags: -stdlib=libc++ + # ubsan: 1 + # os: ubuntu-22.04 + # install: + # - clang-14 + # - libc++-14-dev + # - libc++abi-14-dev - - name: Install packages - if: matrix.install - run: | - declare -a SOURCE_KEYS SOURCES - if [ -n "${{join(matrix.source_keys, ' ')}}" ] - then - SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}") - fi - if [ -n "${{join(matrix.sources, ' ')}}" ] - then - SOURCES=("${{join(matrix.sources, '" "')}}") - fi - for key in "${SOURCE_KEYS[@]}" - do - for i in {1..$NET_RETRY_COUNT} - do - echo "Adding key: $key" - wget -O - "$key" | sudo apt-key add - && break || sleep 2 - done - done - if [ ${#SOURCES[@]} -gt 0 ] - then - APT_ADD_REPO_COMMON_ARGS=("-y") - APT_ADD_REPO_SUPPORTED_ARGS="$(apt-add-repository --help | perl -ne 'if (/^\s*-n/) { print "n"; } elsif (/^\s*-P/) { print "P"; } elsif (/^\s*-S/) { print "S"; } elsif (/^\s*-U/) { print "U"; }')" - if [ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*n*}" ] - then - APT_ADD_REPO_COMMON_ARGS+=("-n") - fi - APT_ADD_REPO_HAS_SOURCE_ARGS="$([ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*P*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*S*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*U*}" ] && echo 1 || echo 0)" - for source in "${SOURCES[@]}" - do - for i in {1..$NET_RETRY_COUNT} - do - APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}") - if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ] - then - case "$source" in - "ppa:"*) - APT_ADD_REPO_ARGS+=("-P") - ;; - "deb "*) - APT_ADD_REPO_ARGS+=("-S") - ;; - *) - APT_ADD_REPO_ARGS+=("-U") - ;; - esac - fi - APT_ADD_REPO_ARGS+=("$source") - echo "apt-add-repository ${APT_ADD_REPO_ARGS[@]}" - sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2 - done - done - fi - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} locales - sudo locale-gen de_DE.UTF-8 - sudo update-locale - - name: Setup GCC Toolchain - if: matrix.gcc_toolchain - run: | - GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" - echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV - MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" - mkdir -p "$GCC_TOOLCHAIN_ROOT" - ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" - ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" - mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" - ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" - - name: Setup Boost - run: | - echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY - LIBRARY=${GITHUB_REPOSITORY#*/} - echo LIBRARY: $LIBRARY - echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV - echo GITHUB_BASE_REF: $GITHUB_BASE_REF - echo GITHUB_REF: $GITHUB_REF - REF=${GITHUB_BASE_REF:-$GITHUB_REF} - REF=${REF#refs/heads/} - echo REF: $REF - BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true - echo BOOST_BRANCH: $BOOST_BRANCH - BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) - echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV - echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV - DEPINST_ARGS=() - GIT_VERSION="$(git --version | sed -e 's/git version //')" - GIT_HAS_JOBS=1 - if [ -f "/etc/debian_version" ] - then - if $(dpkg --compare-versions "$GIT_VERSION" lt 2.8.0) - then - GIT_HAS_JOBS=0 - fi - else - declare -a GIT_VER=(${GIT_VERSION//./ }) - declare -a GIT_MIN_VER=(2 8 0) - for ((i=0; i<${#GIT_VER[@]}; i++)) - do - if [ -z "${GIT_MIN_VER[i]}" ] - then - GIT_MIN_VER[i]=0 - fi - if [ "${GIT_VER[i]}" -lt "${GIT_MIN_VER[i]}" ] - then - GIT_HAS_JOBS=0 - break - fi - done - fi - if [ "$GIT_HAS_JOBS" -ne 0 ] - then - DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") - fi - cd .. - git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" - cd boost-root - mkdir -p libs/$LIBRARY - cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY - git submodule update --init tools/boostdep - DEPINST_ARGS+=("$LIBRARY") - python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" - if [ -z "${{matrix.cmake_tests}}" ] - then - ./bootstrap.sh - ./b2 headers - if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] - then - echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam - if [ -n "$GCC_TOOLCHAIN_ROOT" ] - then - echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam - fi - echo " ;" >> ~/user-config.jam - fi - fi - - name: Run tests - if: matrix.cmake_tests == '' - run: | - cd ../boost-root - B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}" "link=static,shared") - if [ -n "${{matrix.build_variant}}" ] - then - B2_ARGS+=("variant=${{matrix.build_variant}}") - else - B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") - fi - if [ -n "${{matrix.threading}}" ] - then - B2_ARGS+=("threading=${{matrix.threading}}") - fi - if [ -n "${{matrix.ubsan}}" ] - then - export UBSAN_OPTIONS="print_stacktrace=1" - B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global") - fi - if [ -n "${{matrix.cxxflags}}" ] - then - B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") - fi - if [ -n "${{matrix.linkflags}}" ] - then - B2_ARGS+=("linkflags=${{matrix.linkflags}}") - fi - if [ -n "${{matrix.address_model}}" ] - then - B2_ARGS+=("address-model=${{matrix.address_model}}") - fi - B2_ARGS+=("libs/$LIBRARY/test") - set -x - ./b2 "${B2_ARGS[@]}" - - windows: - strategy: - fail-fast: false - matrix: - include: - - toolset: msvc-14.0 - cxxstd: "14,latest" - addrmd: 32,64 - os: windows-2019 - - toolset: msvc-14.2 - cxxstd: "14,17,20,latest" - addrmd: 32,64 - os: windows-2019 - - toolset: msvc-14.3 - cxxstd: "14,17,20,latest" - addrmd: 32,64 - os: windows-2022 - - toolset: clang-win - cxxstd: "14,17,latest" - addrmd: 32,64 - os: windows-2022 - - toolset: gcc - cxxstd: "03,11,14,17,2a" - addrmd: 64 - os: windows-2019 - - runs-on: ${{matrix.os}} + # - toolset: clang + # cxxstd: "03,11,14,17,20,2b" + # os: macos-13 + # - toolset: clang + # cxxstd: "03,11,14,17,20,2b" + # os: macos-14 + # - toolset: clang + # cxxstd: "03,11,14,17,20,2b" + # os: macos-15 - steps: - - uses: actions/checkout@v3 + # timeout-minutes: 60 + # runs-on: ${{matrix.os}} + # container: + # image: ${{matrix.container}} + # volumes: + # - /node20217:/node20217:rw,rshared + # - ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }} - - name: Setup Boost - shell: cmd - run: | - echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% - for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi - echo LIBRARY: %LIBRARY% - echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% - echo GITHUB_BASE_REF: %GITHUB_BASE_REF% - echo GITHUB_REF: %GITHUB_REF% - if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% - set BOOST_BRANCH=develop - for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master - echo BOOST_BRANCH: %BOOST_BRANCH% - cd .. - git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root - cd boost-root - xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ - git submodule update --init tools/boostdep - python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% - cmd /c bootstrap - b2 -d0 headers + # steps: + # - name: Setup environment + # run: | + # if [ -f "/etc/debian_version" ] + # then + # echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV + # export DEBIAN_FRONTEND=noninteractive + # fi + # if [ -n "${{matrix.container}}" ] + # then + # echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV + # if [ -f "/etc/debian_version" ] + # then + # apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + # if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ] + # then + # PYTHON_PACKAGE="python-is-python3" + # else + # PYTHON_PACKAGE="python" + # fi + # apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake + # fi + # if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then + # # Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590 + # curl -sL https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217 + # fi + # fi + # git config --global pack.threads 0 + # - uses: actions/checkout@v4 - - name: Run tests - shell: cmd - run: | - cd ../boost-root - b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release link=static,shared embed-manifest-via=linker + # - name: Install packages + # if: matrix.install + # run: | + # declare -a SOURCE_KEYS SOURCES + # if [ -n "${{join(matrix.source_keys, ' ')}}" ] + # then + # SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}") + # fi + # if [ -n "${{join(matrix.sources, ' ')}}" ] + # then + # SOURCES=("${{join(matrix.sources, '" "')}}") + # fi + # for key in "${SOURCE_KEYS[@]}" + # do + # for i in {1..$NET_RETRY_COUNT} + # do + # echo "Adding key: $key" + # wget -O - "$key" | sudo apt-key add - && break || sleep 2 + # done + # done + # if [ ${#SOURCES[@]} -gt 0 ] + # then + # APT_ADD_REPO_COMMON_ARGS=("-y") + # APT_ADD_REPO_SUPPORTED_ARGS="$(apt-add-repository --help | perl -ne 'if (/^\s*-n/) { print "n"; } elsif (/^\s*-P/) { print "P"; } elsif (/^\s*-S/) { print "S"; } elsif (/^\s*-U/) { print "U"; }')" + # if [ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*n*}" ] + # then + # APT_ADD_REPO_COMMON_ARGS+=("-n") + # fi + # APT_ADD_REPO_HAS_SOURCE_ARGS="$([ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*P*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*S*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*U*}" ] && echo 1 || echo 0)" + # for source in "${SOURCES[@]}" + # do + # for i in {1..$NET_RETRY_COUNT} + # do + # APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}") + # if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ] + # then + # case "$source" in + # "ppa:"*) + # APT_ADD_REPO_ARGS+=("-P") + # ;; + # "deb "*) + # APT_ADD_REPO_ARGS+=("-S") + # ;; + # *) + # APT_ADD_REPO_ARGS+=("-U") + # ;; + # esac + # fi + # APT_ADD_REPO_ARGS+=("$source") + # echo "apt-add-repository ${APT_ADD_REPO_ARGS[@]}" + # sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2 + # done + # done + # fi + # sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + # sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} locales + # sudo locale-gen de_DE.UTF-8 + # sudo update-locale + # - name: Setup GCC Toolchain + # if: matrix.gcc_toolchain + # run: | + # GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" + # echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV + # MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" + # mkdir -p "$GCC_TOOLCHAIN_ROOT" + # ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" + # ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" + # mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" + # ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" + # - name: Setup Boost + # run: | + # echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + # LIBRARY=${GITHUB_REPOSITORY#*/} + # echo LIBRARY: $LIBRARY + # echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + # echo GITHUB_BASE_REF: $GITHUB_BASE_REF + # echo GITHUB_REF: $GITHUB_REF + # REF=${GITHUB_BASE_REF:-$GITHUB_REF} + # REF=${REF#refs/heads/} + # echo REF: $REF + # BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true + # echo BOOST_BRANCH: $BOOST_BRANCH + # BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) + # echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV + # echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV + # DEPINST_ARGS=() + # GIT_VERSION="$(git --version | sed -e 's/git version //')" + # GIT_HAS_JOBS=1 + # if [ -f "/etc/debian_version" ] + # then + # if $(dpkg --compare-versions "$GIT_VERSION" lt 2.8.0) + # then + # GIT_HAS_JOBS=0 + # fi + # else + # declare -a GIT_VER=(${GIT_VERSION//./ }) + # declare -a GIT_MIN_VER=(2 8 0) + # for ((i=0; i<${#GIT_VER[@]}; i++)) + # do + # if [ -z "${GIT_MIN_VER[i]}" ] + # then + # GIT_MIN_VER[i]=0 + # fi + # if [ "${GIT_VER[i]}" -lt "${GIT_MIN_VER[i]}" ] + # then + # GIT_HAS_JOBS=0 + # break + # fi + # done + # fi + # if [ "$GIT_HAS_JOBS" -ne 0 ] + # then + # DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") + # fi + # cd .. + # git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" + # cd boost-root + # mkdir -p libs/$LIBRARY + # cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + # git submodule update --init tools/boostdep + # DEPINST_ARGS+=("$LIBRARY") + # python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" + # if [ -z "${{matrix.cmake_tests}}" ] + # then + # ./bootstrap.sh + # ./b2 headers + # if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] + # then + # echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam + # if [ -n "$GCC_TOOLCHAIN_ROOT" ] + # then + # echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam + # fi + # echo " ;" >> ~/user-config.jam + # fi + # fi + # - name: Run tests + # if: matrix.cmake_tests == '' + # run: | + # cd ../boost-root + # B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}" "link=static,shared") + # if [ -n "${{matrix.build_variant}}" ] + # then + # B2_ARGS+=("variant=${{matrix.build_variant}}") + # else + # B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") + # fi + # if [ -n "${{matrix.threading}}" ] + # then + # B2_ARGS+=("threading=${{matrix.threading}}") + # fi + # if [ -n "${{matrix.ubsan}}" ] + # then + # export UBSAN_OPTIONS="print_stacktrace=1" + # B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global") + # fi + # if [ -n "${{matrix.cxxflags}}" ] + # then + # B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") + # fi + # if [ -n "${{matrix.linkflags}}" ] + # then + # B2_ARGS+=("linkflags=${{matrix.linkflags}}") + # fi + # if [ -n "${{matrix.address_model}}" ] + # then + # B2_ARGS+=("address-model=${{matrix.address_model}}") + # fi + # B2_ARGS+=("libs/$LIBRARY/test") + # set -x + # ./b2 "${B2_ARGS[@]}" - posix-cmake-subdir: - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-20.04 - - os: ubuntu-22.04 - - os: macos-13 - - os: macos-14 - - os: macos-15 + # windows: + # strategy: + # fail-fast: false + # matrix: + # include: + # - toolset: msvc-14.0 + # cxxstd: "14,latest" + # addrmd: 32,64 + # os: windows-2019 + # - toolset: msvc-14.2 + # cxxstd: "14,17,20,latest" + # addrmd: 32,64 + # os: windows-2019 + # - toolset: msvc-14.3 + # cxxstd: "14,17,20,latest" + # addrmd: 32,64 + # os: windows-2022 + # - toolset: clang-win + # cxxstd: "14,17,latest" + # addrmd: 32,64 + # os: windows-2022 + # - toolset: gcc + # cxxstd: "03,11,14,17,2a" + # addrmd: 64 + # os: windows-2019 + + # runs-on: ${{matrix.os}} + + # steps: + # - uses: actions/checkout@v3 + + # - name: Setup Boost + # shell: cmd + # run: | + # echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% + # for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi + # echo LIBRARY: %LIBRARY% + # echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% + # echo GITHUB_BASE_REF: %GITHUB_BASE_REF% + # echo GITHUB_REF: %GITHUB_REF% + # if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% + # set BOOST_BRANCH=develop + # for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master + # echo BOOST_BRANCH: %BOOST_BRANCH% + # cd .. + # git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root + # cd boost-root + # xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ + # git submodule update --init tools/boostdep + # python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + # cmd /c bootstrap + # b2 -d0 headers + + # - name: Run tests + # shell: cmd + # run: | + # cd ../boost-root + # b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release link=static,shared embed-manifest-via=linker + + # posix-cmake-subdir: + # strategy: + # fail-fast: false + # matrix: + # include: + # - os: ubuntu-20.04 + # - os: ubuntu-22.04 + # - os: macos-13 + # - os: macos-14 + # - os: macos-15 + + # runs-on: ${{matrix.os}} - runs-on: ${{matrix.os}} + # steps: + # - uses: actions/checkout@v3 + + # - name: Install packages + # if: matrix.install + # run: sudo apt-get -y install ${{matrix.install}} + + # - name: Setup Boost + # run: | + # echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + # LIBRARY=${GITHUB_REPOSITORY#*/} + # echo LIBRARY: $LIBRARY + # echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + # echo GITHUB_BASE_REF: $GITHUB_BASE_REF + # echo GITHUB_REF: $GITHUB_REF + # REF=${GITHUB_BASE_REF:-$GITHUB_REF} + # REF=${REF#refs/heads/} + # echo REF: $REF + # BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + # echo BOOST_BRANCH: $BOOST_BRANCH + # cd .. + # git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + # cd boost-root + # mkdir -p libs/$LIBRARY + # cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + # git submodule update --init tools/boostdep + # python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + + # - name: Use library with add_subdirectory + # run: | + # cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test + # mkdir __build__ && cd __build__ + # cmake .. + # cmake --build . + # ctest --output-on-failure --no-tests=error + + # posix-cmake-install: + # strategy: + # fail-fast: false + # matrix: + # include: + # - os: ubuntu-20.04 + # - os: ubuntu-22.04 + # - os: macos-13 + # - os: macos-14 + # - os: macos-15 + + # runs-on: ${{matrix.os}} + + # steps: + # - uses: actions/checkout@v3 + + # - name: Install packages + # if: matrix.install + # run: sudo apt-get -y install ${{matrix.install}} + + # - name: Setup Boost + # run: | + # echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + # LIBRARY=${GITHUB_REPOSITORY#*/} + # echo LIBRARY: $LIBRARY + # echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + # echo GITHUB_BASE_REF: $GITHUB_BASE_REF + # echo GITHUB_REF: $GITHUB_REF + # REF=${GITHUB_BASE_REF:-$GITHUB_REF} + # REF=${REF#refs/heads/} + # echo REF: $REF + # BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + # echo BOOST_BRANCH: $BOOST_BRANCH + # cd .. + # git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + # cd boost-root + # mkdir -p libs/$LIBRARY + # cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + # git submodule update --init tools/boostdep + # python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + + # - name: Configure + # run: | + # cd ../boost-root + # mkdir __build__ && cd __build__ + # cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=ON .. + + # - name: Install + # run: | + # cd ../boost-root/__build__ + # cmake --build . --target install + + # - name: Use the installed library + # run: | + # cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__ + # cmake -DCMAKE_PREFIX_PATH=~/.local .. + # cmake --build . + # ctest --output-on-failure --no-tests=error + + # posix-cmake-test: + # strategy: + # fail-fast: false + # matrix: + # include: + # - os: ubuntu-20.04 + # - os: ubuntu-22.04 + # - os: macos-13 + # - os: macos-14 + # - os: macos-15 + + # runs-on: ${{matrix.os}} + + # steps: + # - uses: actions/checkout@v3 + + # - name: Install packages + # if: matrix.install + # run: sudo apt-get -y install ${{matrix.install}} + + # - name: Setup Boost + # run: | + # echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + # LIBRARY=${GITHUB_REPOSITORY#*/} + # echo LIBRARY: $LIBRARY + # echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + # echo GITHUB_BASE_REF: $GITHUB_BASE_REF + # echo GITHUB_REF: $GITHUB_REF + # REF=${GITHUB_BASE_REF:-$GITHUB_REF} + # REF=${REF#refs/heads/} + # echo REF: $REF + # BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + # echo BOOST_BRANCH: $BOOST_BRANCH + # cd .. + # git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + # cd boost-root + # mkdir -p libs/$LIBRARY + # cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + # git submodule update --init tools/boostdep + # python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + + # - name: Configure + # run: | + # cd ../boost-root + # mkdir __build__ && cd __build__ + # cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON .. + + # - name: Build tests + # run: | + # cd ../boost-root/__build__ + # cmake --build . --target tests + + # - name: Run tests + # run: | + # cd ../boost-root/__build__ + # ctest --output-on-failure --no-tests=error + + # MSYS2: + # defaults: + # run: + # shell: msys2 {0} + # strategy: + # fail-fast: false + # matrix: + # include: + # - { sys: MINGW32, compiler: gcc, cxxstd: '03,11,17,20', cxxflags: "-fexcess-precision=fast" } + # - { sys: MINGW64, compiler: gcc, cxxstd: '03,11,17,20', cxxflags: "-fexcess-precision=fast" } + + # runs-on: windows-latest + + # steps: + # - uses: actions/checkout@v3 + + # - name: Setup MSYS2 environment + # uses: msys2/setup-msys2@v2 + # with: + # msystem: ${{matrix.sys}} + # update: true + # install: git python + # pacboy: gcc:p cmake:p ninja:p + + # - name: Fetch Boost.CI + # uses: actions/checkout@v3 + # with: + # repository: boostorg/boost-ci + # ref: master + # path: boost-ci-cloned + # - name: Get CI scripts folder + # run: | + # # Copy ci folder if not testing Boost.CI + # [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . + # rm -rf boost-ci-cloned + + # - name: Setup Boost + # env: + # B2_COMPILER: ${{matrix.compiler}} + # B2_CXXSTD: ${{matrix.cxxstd}} + # B2_SANITIZE: ${{matrix.sanitize}} + # B2_STDLIB: ${{matrix.stdlib}} + # B2_CXXFLAGS: ${{matrix.cxxflags}} + # run: ci/github/install.sh + + # - name: Run tests + # run: ci/build.sh + + + posix-cmake-subdir-modules: + runs-on: ubuntu-latest + container: ubuntu:24.10 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages - if: matrix.install - run: sudo apt-get -y install ${{matrix.install}} + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y --no-install-recommends ninja-build cmake git ca-certificates python3 python-is-python3 \ + clang-19 llvm-19 libclang-rt-19-dev libc++-19-dev libc++abi-19-dev clang-tools-19 - name: Setup Boost run: | @@ -587,38 +795,35 @@ jobs: cd .. git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root cd boost-root - mkdir -p libs/$LIBRARY cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY git submodule update --init tools/boostdep - python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + python tools/boostdep/depinst/depinst.py $LIBRARY + python libs/charconv/tools/setup_boost_with_modules.py # Temporary - name: Use library with add_subdirectory run: | cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test mkdir __build__ && cd __build__ - cmake .. + cmake -DBOOST_USE_MODULES=1 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. cmake --build . ctest --output-on-failure --no-tests=error - posix-cmake-install: - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-20.04 - - os: ubuntu-22.04 - - os: macos-13 - - os: macos-14 - - os: macos-15 + posix-cmake-install-modules: + env: + CMAKE_ARGS: -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja - runs-on: ${{matrix.os}} + runs-on: ubuntu-latest + container: ubuntu:24.10 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages - if: matrix.install - run: sudo apt-get -y install ${{matrix.install}} + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y --no-install-recommends ninja-build cmake git ca-certificates python3 python-is-python3 \ + clang-19 llvm-19 libclang-rt-19-dev libc++-19-dev libc++abi-19-dev clang-tools-19 - name: Setup Boost run: | @@ -636,16 +841,16 @@ jobs: cd .. git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root cd boost-root - mkdir -p libs/$LIBRARY cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY git submodule update --init tools/boostdep - python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + python tools/boostdep/depinst/depinst.py $LIBRARY + python libs/charconv/tools/setup_boost_with_modules.py # Temporary - name: Configure run: | cd ../boost-root mkdir __build__ && cd __build__ - cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=ON .. + cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local -DBOOST_USE_MODULES=1 $CMAKE_ARGS .. - name: Install run: | @@ -655,29 +860,30 @@ jobs: - name: Use the installed library run: | cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__ - cmake -DCMAKE_PREFIX_PATH=~/.local .. + cmake -DCMAKE_INSTALL_PREFIX=~/.local $CMAKE_ARGS .. cmake --build . ctest --output-on-failure --no-tests=error - posix-cmake-test: + posix-cmake-test-modules: strategy: fail-fast: false matrix: include: - - os: ubuntu-20.04 - - os: ubuntu-22.04 - - os: macos-13 - - os: macos-14 - - os: macos-15 + - cmake-build-type: Debug + - cmake-build-type: Release - runs-on: ${{matrix.os}} + runs-on: ubuntu-latest + container: ubuntu:24.10 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install packages - if: matrix.install - run: sudo apt-get -y install ${{matrix.install}} + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y --no-install-recommends ninja-build cmake git ca-certificates python3 python-is-python3 \ + clang-19 llvm-19 libclang-rt-19-dev libc++-19-dev libc++abi-19-dev clang-tools-19 - name: Setup Boost run: | @@ -695,16 +901,16 @@ jobs: cd .. git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root cd boost-root - mkdir -p libs/$LIBRARY cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY git submodule update --init tools/boostdep - python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + python3 tools/boostdep/depinst/depinst.py $LIBRARY + python3 libs/charconv/tools/setup_boost_with_modules.py # Temporary - name: Configure run: | cd ../boost-root mkdir __build__ && cd __build__ - cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON .. + cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=${{matrix.cmake-build-type}} -DBOOST_USE_MODULES=1 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. - name: Build tests run: | @@ -716,50 +922,155 @@ jobs: cd ../boost-root/__build__ ctest --output-on-failure --no-tests=error - MSYS2: - defaults: - run: - shell: msys2 {0} + windows-cmake-subdir-modules: + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + run: choco install --no-progress ninja + + - name: Setup Boost + shell: cmd + run: | + echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% + for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi + echo LIBRARY: %LIBRARY% + echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% + echo GITHUB_BASE_REF: %GITHUB_BASE_REF% + echo GITHUB_REF: %GITHUB_REF% + if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% + set BOOST_BRANCH=develop + for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master + echo BOOST_BRANCH: %BOOST_BRANCH% + cd .. + git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + python libs/charconv/tools/setup_boost_with_modules.py # Temporary + + - name: Use library with add_subdirectory + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test + mkdir __build__ && cd __build__ + cmake -DBOOST_USE_MODULES=1 -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. + cmake --build . + ctest --output-on-failure --no-tests=error + + windows-cmake-install-modules: + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + run: choco install --no-progress ninja + + - name: Setup Boost + shell: cmd + run: | + echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% + for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi + echo LIBRARY: %LIBRARY% + echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% + echo GITHUB_BASE_REF: %GITHUB_BASE_REF% + echo GITHUB_REF: %GITHUB_REF% + if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% + set BOOST_BRANCH=develop + for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master + echo BOOST_BRANCH: %BOOST_BRANCH% + cd .. + git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + python libs/charconv/tools/setup_boost_with_modules.py # Temporary + + - name: Configure + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root + mkdir __build__ && cd __build__ + cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DBOOST_USE_MODULES=1 -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. + + - name: Install + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/__build__ + cmake --build . --target install + + - name: Use the installed library + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__ + cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. + cmake --build . + ctest --output-on-failure --no-tests=error + + windows-cmake-test-modules: strategy: fail-fast: false matrix: include: - - { sys: MINGW32, compiler: gcc, cxxstd: '03,11,17,20', cxxflags: "-fexcess-precision=fast" } - - { sys: MINGW64, compiler: gcc, cxxstd: '03,11,17,20', cxxflags: "-fexcess-precision=fast" } + - cmake-build-type: Debug + - cmake-build-type: Release - runs-on: windows-latest + runs-on: windows-2022 steps: - - uses: actions/checkout@v3 - - - name: Setup MSYS2 environment - uses: msys2/setup-msys2@v2 - with: - msystem: ${{matrix.sys}} - update: true - install: git python - pacboy: gcc:p cmake:p ninja:p - - - name: Fetch Boost.CI - uses: actions/checkout@v3 - with: - repository: boostorg/boost-ci - ref: master - path: boost-ci-cloned - - name: Get CI scripts folder - run: | - # Copy ci folder if not testing Boost.CI - [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . - rm -rf boost-ci-cloned + - uses: actions/checkout@v4 + + - name: Install packages + run: choco install --no-progress ninja - name: Setup Boost - env: - B2_COMPILER: ${{matrix.compiler}} - B2_CXXSTD: ${{matrix.cxxstd}} - B2_SANITIZE: ${{matrix.sanitize}} - B2_STDLIB: ${{matrix.stdlib}} - B2_CXXFLAGS: ${{matrix.cxxflags}} - run: ci/github/install.sh + shell: cmd + run: | + echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% + for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi + echo LIBRARY: %LIBRARY% + echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% + echo GITHUB_BASE_REF: %GITHUB_BASE_REF% + echo GITHUB_REF: %GITHUB_REF% + if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% + set BOOST_BRANCH=develop + for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master + echo BOOST_BRANCH: %BOOST_BRANCH% + cd .. + git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + python libs/charconv/tools/setup_boost_with_modules.py # Temporary + + - name: Configure + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root + mkdir __build__ && cd __build__ + cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DBUILD_TESTING=ON -DBOOST_USE_MODULES=1 -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -DCMAKE_BUILD_TYPE=${{matrix.cmake-build-type}} -G Ninja .. + + - name: Build tests + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/__build__ + cmake --build . --target tests - name: Run tests - run: ci/build.sh + shell: cmd + run: | + call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64 + cd ../boost-root/__build__ + ctest --output-on-failure --no-tests=error diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index a9781924e..000000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,202 +0,0 @@ -# Copyright 2020-2021 Peter Dimov -# Copyright 2021 Andrey Semashev -# Copyright 2021 Alexander Grund -# Copyright 2022 James E. King III -# Copyright 2023 Matt Borland -# -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) ---- -name: codecov - -on: - pull_request: - push: - branches: - - master - - develop - - bugfix/** - - feature/** - - fix/** - - pr/** - -env: - GIT_FETCH_JOBS: 8 - NET_RETRY_COUNT: 5 - B2_CI_VERSION: 1 - B2_VARIANT: debug,release - B2_LINK: shared,static - LCOV_BRANCH_COVERAGE: 0 - CODECOV_NAME: Github Actions - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - -jobs: - posix: - defaults: - run: - shell: bash - - strategy: - fail-fast: false - matrix: - include: - - { name: Collect coverage, coverage: yes, - compiler: gcc-13, cxxstd: '23', cxxflags: '-fexcess-precision=fast', os: ubuntu-24.04, install: 'g++-13-multilib', address-model: '32,64' } - - timeout-minutes: 120 - runs-on: ${{matrix.os}} - container: ${{matrix.container}} - env: {B2_USE_CCACHE: 1} - - steps: - - name: Setup environment - run: | - if [ -f "/etc/debian_version" ]; then - echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV - export DEBIAN_FRONTEND=noninteractive - fi - if [ -n "${{matrix.container}}" ] && [ -f "/etc/debian_version" ]; then - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common curl - # Need (newer) git, and the older Ubuntu container may require requesting the key manually using port 80 - curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg - for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - osver=$(lsb_release -sr | cut -f1 -d.) - pkgs="g++ git" - # Ubuntu 22+ has only Python 3 in the repos - if [ -n "$osver" ] && [ "$osver" -ge "22" ]; then - pkgs+=" python-is-python3 libpython3-dev" - else - pkgs+=" python libpython-dev" - fi - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs - fi - # For jobs not compatible with ccache, use "ccache: no" in the matrix - if [[ "${{ matrix.ccache }}" == "no" ]]; then - echo "B2_USE_CCACHE=0" >> $GITHUB_ENV - fi - git config --global pack.threads 0 - - - uses: actions/checkout@v3 - with: - # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' - fetch-depth: ${{ matrix.coverage && '0' || '1' }} - - - name: Cache ccache - uses: actions/cache@v3 - if: env.B2_USE_CCACHE - with: - path: ~/.ccache - key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} - restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- - - - name: Fetch Boost.CI - uses: actions/checkout@v3 - with: - repository: boostorg/boost-ci - ref: master - path: boost-ci-cloned - - - name: Get CI scripts folder - run: | - # Copy ci folder if not testing Boost.CI - [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . - rm -rf boost-ci-cloned - - - name: Install packages - if: startsWith(matrix.os, 'ubuntu') - run: | - SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}}) - SOURCES=(${{join(matrix.sources, ' ')}}) - # Add this by default - SOURCES+=(ppa:ubuntu-toolchain-r/test) - for key in "${SOURCE_KEYS[@]}"; do - for i in {1..$NET_RETRY_COUNT}; do - keyfilename=$(basename -s .key $key) - curl -sSL --retry ${NET_RETRY_COUNT:-5} "$key" | sudo gpg --dearmor > /etc/apt/trusted.gpg.d/${keyfilename} && break || sleep 10 - done - done - for source in "${SOURCES[@]}"; do - for i in {1..$NET_RETRY_COUNT}; do - sudo add-apt-repository $source && break || sleep 10 - done - done - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - if [[ -z "${{matrix.install}}" ]]; then - pkgs="${{matrix.compiler}}" - pkgs="${pkgs/gcc-/g++-}" - else - pkgs="${{matrix.install}}" - fi - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs locales - sudo locale-gen de_DE.UTF-8 - sudo update-locale - - - name: Setup GCC Toolchain - if: matrix.gcc_toolchain - run: | - GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" - echo "GCC_TOOLCHAIN_ROOT=$GCC_TOOLCHAIN_ROOT" >> $GITHUB_ENV - if ! command -v dpkg-architecture; then - apt-get install -y dpkg-dev - fi - MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" - mkdir -p "$GCC_TOOLCHAIN_ROOT" - ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" - ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" - mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" - ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" - - - name: Setup multiarch - if: matrix.multiarch - run: | - sudo apt-get install --no-install-recommends -y binfmt-support qemu-user-static - sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - git clone https://github.com/jeking3/bdde.git - echo "$(pwd)/bdde/bin/linux" >> ${GITHUB_PATH} - echo "BDDE_DISTRO=${{ matrix.distro }}" >> ${GITHUB_ENV} - echo "BDDE_EDITION=${{ matrix.edition }}" >> ${GITHUB_ENV} - echo "BDDE_ARCH=${{ matrix.arch }}" >> ${GITHUB_ENV} - echo "B2_WRAPPER=bdde" >> ${GITHUB_ENV} - - - name: Setup Boost - env: - B2_ADDRESS_MODEL: ${{matrix.address-model}} - B2_COMPILER: ${{matrix.compiler}} - B2_CXXSTD: ${{matrix.cxxstd}} - B2_SANITIZE: ${{matrix.sanitize}} - B2_STDLIB: ${{matrix.stdlib}} - B2_CXXFLAGS: ${{matrix.cxxflags}} - # More entries can be added in the same way, see the B2_ARGS assignment in ci/enforce.sh for the possible keys. - # B2_DEFINES: ${{matrix.defines}} - # Variables set here (to non-empty) will override the top-level environment variables, e.g. - # B2_VARIANT: ${{matrix.variant}} - # Set the (B2) target(s) to build, defaults to the test folder of the current library - # Can alternatively be done like this in the build step or in the build command of the build step, e.g. `run: B2_TARGETS=libs/$SELF/doc ci/build.sh` - # B2_TARGETS: libs/foo/test//bar - run: source ci/github/install.sh - - - name: Setup coverage collection - if: matrix.coverage - run: ci/github/codecov.sh "setup" - - - name: Run tests - if: '!matrix.coverity' - run: ci/build.sh - - - name: Upload coverage - if: matrix.coverage - run: ci/codecov.sh "upload" - env: - BOOST_CI_CODECOV_IO_UPLOAD: skip - - - name: Upload coverage - if: matrix.coverage - uses: codecov/codecov-action@v4 - with: - disable_search: true - file: coverage.info - name: Github Actions - token: ${{secrets.CODECOV_TOKEN}} - verbose: true diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml deleted file mode 100644 index 71b62bd2a..000000000 --- a/.github/workflows/fuzz.yml +++ /dev/null @@ -1,289 +0,0 @@ -# Copyright 2021-2022 Andrey Semashev -# Copyright 2024 Matt Borland -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) - -name: Fuzz - -on: - pull_request: - push: - branches: - - master - - develop - - feature/** - -env: - GIT_FETCH_JOBS: 8 - NET_RETRY_COUNT: 5 - DEFAULT_BUILD_VARIANT: debug,release - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - -jobs: - posix: - defaults: - run: - shell: bash - - strategy: - fail-fast: false - matrix: - include: - - # Linux, clang - # https://llvm.org/docs/LibFuzzer.html#fuzzer-usage - - toolset: clang - compiler: clang++-12 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - install: - - clang-12 - - toolset: clang - compiler: clang++-13 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - install: - - clang-13 - - toolset: clang - compiler: clang++-14 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - install: - - clang-14 - - toolset: clang - compiler: clang++-14 - cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu" - os: ubuntu-22.04 - install: - - clang-14 - - toolset: clang - compiler: clang++-15 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - install: - - clang-15 - sources: - - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" - source_keys: - - "https://apt.llvm.org/llvm-snapshot.gpg.key" - - toolset: clang - compiler: clang++-16 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - install: - - clang-16 - sources: - - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" - source_keys: - - "https://apt.llvm.org/llvm-snapshot.gpg.key" - - toolset: clang - compiler: clang++-17 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - install: - - clang-17 - sources: - - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" - source_keys: - - "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - timeout-minutes: 60 - runs-on: ${{matrix.os}} - container: ${{matrix.container}} - - steps: - - name: Setup environment - run: | - if [ -f "/etc/debian_version" ] - then - echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV - export DEBIAN_FRONTEND=noninteractive - fi - if [ -n "${{matrix.container}}" ] - then - echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV - if [ -f "/etc/debian_version" ] - then - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ] - then - PYTHON_PACKAGE="python-is-python3" - else - PYTHON_PACKAGE="python" - fi - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake - fi - fi - git config --global pack.threads 0 - - uses: actions/checkout@v3 - - - name: Install packages - if: matrix.install - run: | - declare -a SOURCE_KEYS SOURCES - if [ -n "${{join(matrix.source_keys, ' ')}}" ] - then - SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}") - fi - if [ -n "${{join(matrix.sources, ' ')}}" ] - then - SOURCES=("${{join(matrix.sources, '" "')}}") - fi - for key in "${SOURCE_KEYS[@]}" - do - for i in {1..$NET_RETRY_COUNT} - do - echo "Adding key: $key" - wget -O - "$key" | sudo apt-key add - && break || sleep 2 - done - done - if [ ${#SOURCES[@]} -gt 0 ] - then - APT_ADD_REPO_COMMON_ARGS=("-y") - APT_ADD_REPO_SUPPORTED_ARGS="$(apt-add-repository --help | perl -ne 'if (/^\s*-n/) { print "n"; } elsif (/^\s*-P/) { print "P"; } elsif (/^\s*-S/) { print "S"; } elsif (/^\s*-U/) { print "U"; }')" - if [ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*n*}" ] - then - APT_ADD_REPO_COMMON_ARGS+=("-n") - fi - APT_ADD_REPO_HAS_SOURCE_ARGS="$([ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*P*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*S*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*U*}" ] && echo 1 || echo 0)" - for source in "${SOURCES[@]}" - do - for i in {1..$NET_RETRY_COUNT} - do - APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}") - if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ] - then - case "$source" in - "ppa:"*) - APT_ADD_REPO_ARGS+=("-P") - ;; - "deb "*) - APT_ADD_REPO_ARGS+=("-S") - ;; - *) - APT_ADD_REPO_ARGS+=("-U") - ;; - esac - fi - APT_ADD_REPO_ARGS+=("$source") - echo "apt-add-repository ${APT_ADD_REPO_ARGS[@]}" - sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2 - done - done - fi - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} locales - sudo locale-gen de_DE.UTF-8 - sudo update-locale - - name: Setup GCC Toolchain - if: matrix.gcc_toolchain - run: | - GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" - echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV - MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" - mkdir -p "$GCC_TOOLCHAIN_ROOT" - ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" - ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" - mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" - ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" - - name: Setup Boost - run: | - echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY - LIBRARY=${GITHUB_REPOSITORY#*/} - echo LIBRARY: $LIBRARY - echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV - echo GITHUB_BASE_REF: $GITHUB_BASE_REF - echo GITHUB_REF: $GITHUB_REF - REF=${GITHUB_BASE_REF:-$GITHUB_REF} - REF=${REF#refs/heads/} - echo REF: $REF - BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true - echo BOOST_BRANCH: $BOOST_BRANCH - BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) - echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV - echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV - DEPINST_ARGS=() - GIT_VERSION="$(git --version | sed -e 's/git version //')" - GIT_HAS_JOBS=1 - if [ -f "/etc/debian_version" ] - then - if $(dpkg --compare-versions "$GIT_VERSION" lt 2.8.0) - then - GIT_HAS_JOBS=0 - fi - else - declare -a GIT_VER=(${GIT_VERSION//./ }) - declare -a GIT_MIN_VER=(2 8 0) - for ((i=0; i<${#GIT_VER[@]}; i++)) - do - if [ -z "${GIT_MIN_VER[i]}" ] - then - GIT_MIN_VER[i]=0 - fi - if [ "${GIT_VER[i]}" -lt "${GIT_MIN_VER[i]}" ] - then - GIT_HAS_JOBS=0 - break - fi - done - fi - if [ "$GIT_HAS_JOBS" -ne 0 ] - then - DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") - fi - cd .. - git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" - cd boost-root - mkdir -p libs/$LIBRARY - cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY - git submodule update --init tools/boostdep - DEPINST_ARGS+=("$LIBRARY") - python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" - if [ -z "${{matrix.cmake_tests}}" ] - then - ./bootstrap.sh - ./b2 headers - if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] - then - echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam - if [ -n "$GCC_TOOLCHAIN_ROOT" ] - then - echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam - fi - echo " ;" >> ~/user-config.jam - fi - fi - - name: Run tests - if: matrix.cmake_tests == '' - run: | - cd ../boost-root/libs/$LIBRARY/fuzzing - B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}" "link=static,shared") - if [ -n "${{matrix.build_variant}}" ] - then - B2_ARGS+=("variant=${{matrix.build_variant}}") - else - B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") - fi - if [ -n "${{matrix.threading}}" ] - then - B2_ARGS+=("threading=${{matrix.threading}}") - fi - if [ -n "${{matrix.ubsan}}" ] - then - export UBSAN_OPTIONS="print_stacktrace=1" - B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global") - fi - if [ -n "${{matrix.cxxflags}}" ] - then - B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") - fi - if [ -n "${{matrix.linkflags}}" ] - then - B2_ARGS+=("linkflags=${{matrix.linkflags}}") - fi - if [ -n "${{matrix.address_model}}" ] - then - B2_ARGS+=("address-model=${{matrix.address_model}}") - fi - ../../../b2 "${B2_ARGS[@]}" diff --git a/.github/workflows/qemu.yml b/.github/workflows/qemu.yml deleted file mode 100644 index 08df8eea8..000000000 --- a/.github/workflows/qemu.yml +++ /dev/null @@ -1,204 +0,0 @@ -# Copyright 2020-2021 Peter Dimov -# Copyright 2021 Andrey Semashev -# Copyright 2021 Alexander Grund -# Copyright 2022 James E. King III -# Copyright 2024 Matt Borland -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) ---- -name: qemu - -on: - pull_request: - push: - branches: - - master - - develop - - bugfix/** - - feature/** - - fix/** - - pr/** - -env: - GIT_FETCH_JOBS: 8 - NET_RETRY_COUNT: 5 - B2_CI_VERSION: 1 - B2_VARIANT: debug,release - B2_LINK: shared,static - LCOV_BRANCH_COVERAGE: 0 - CODECOV_NAME: Github Actions - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - -jobs: - posix: - defaults: - run: - shell: bash - - strategy: - fail-fast: false - matrix: - include: - # multiarch testing - - { name: PPC64LE-GCC, multiarch: yes, - compiler: gcc, cxxstd: '11', os: ubuntu-22.04, ccache: no, distro: alpine, edition: edge, arch: ppc64le } - - { name: PPC64LE-Clang, multiarch: yes, - compiler: clang, cxxstd: '11', os: ubuntu-22.04, ccache: no, distro: alpine, edition: edge, arch: ppc64le } - - - timeout-minutes: 360 - runs-on: ${{matrix.os}} - container: ${{matrix.container}} - env: {B2_USE_CCACHE: 1} - - steps: - - name: Setup environment - run: | - if [ -f "/etc/debian_version" ]; then - echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV - export DEBIAN_FRONTEND=noninteractive - fi - if [ -n "${{matrix.container}}" ] && [ -f "/etc/debian_version" ]; then - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common curl - # Need (newer) git, and the older Ubuntu container may require requesting the key manually using port 80 - curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg - for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - osver=$(lsb_release -sr | cut -f1 -d.) - pkgs="g++ git" - # Ubuntu 22+ has only Python 3 in the repos - if [ -n "$osver" ] && [ "$osver" -ge "22" ]; then - pkgs+=" python-is-python3 libpython3-dev" - else - pkgs+=" python libpython-dev" - fi - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs - fi - # For jobs not compatible with ccache, use "ccache: no" in the matrix - if [[ "${{ matrix.ccache }}" == "no" ]]; then - echo "B2_USE_CCACHE=0" >> $GITHUB_ENV - fi - git config --global pack.threads 0 - if [[ "${{matrix.container}}" == "ubuntu:16.04" ]] || [[ "${{matrix.container}}" == "ubuntu:18.04" ]]; then - # Ubuntu 16/18 can't run Node 20, so stick to older actions: https://github.com/actions/checkout/issues/1590 - echo "GHA_USE_NODE_20=false" >> $GITHUB_ENV - echo "ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true" >> $GITHUB_ENV - else - echo "GHA_USE_NODE_20=true" >> $GITHUB_ENV - fi - - - uses: actions/checkout@v3 - if: env.GHA_USE_NODE_20 == 'false' - with: - # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' - fetch-depth: ${{ matrix.coverage && '0' || '1' }} - - uses: actions/checkout@v4 - if: env.GHA_USE_NODE_20 == 'true' - with: - # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' - fetch-depth: ${{ matrix.coverage && '0' || '1' }} - - - name: Cache ccache - uses: actions/cache@v3 - if: env.B2_USE_CCACHE && env.GHA_USE_NODE_20 == 'false' - with: - path: ~/.ccache - key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} - restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- - - - name: Cache ccache - uses: actions/cache@v4 - if: env.B2_USE_CCACHE && env.GHA_USE_NODE_20 == 'true' - with: - path: ~/.ccache - key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} - restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- - - - name: Fetch Boost.CI - uses: actions/checkout@v3 - if: env.GHA_USE_NODE_20 == 'false' - with: - repository: boostorg/boost-ci - ref: master - path: boost-ci-cloned - - - name: Fetch Boost.CI - uses: actions/checkout@v4 - if: env.GHA_USE_NODE_20 == 'true' - with: - repository: boostorg/boost-ci - ref: master - path: boost-ci-cloned - - - name: Get CI scripts folder - run: | - # Copy ci folder if not testing Boost.CI - [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . - rm -rf boost-ci-cloned - - - name: Install packages - if: startsWith(matrix.os, 'ubuntu') - run: | - SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}}) - SOURCES=(${{join(matrix.sources, ' ')}}) - # Add this by default - SOURCE_KEYS+=('http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9377A2BA9EF27F') - SOURCES+=(ppa:ubuntu-toolchain-r/test) - - ci/add-apt-keys.sh "${SOURCE_KEYS[@]}" - # Initial update before adding sources required to get e.g. keys - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - ci/add-apt-repositories.sh "${SOURCES[@]}" - - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - if [[ -z "${{matrix.install}}" ]]; then - pkgs="${{matrix.compiler}}" - pkgs="${pkgs/gcc-/g++-}" - else - pkgs="${{matrix.install}}" - fi - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs - - - name: Setup GCC Toolchain - if: matrix.gcc_toolchain - run: | - GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" - echo "GCC_TOOLCHAIN_ROOT=$GCC_TOOLCHAIN_ROOT" >> $GITHUB_ENV - if ! command -v dpkg-architecture; then - apt-get install -y dpkg-dev - fi - MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" - mkdir -p "$GCC_TOOLCHAIN_ROOT" - ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" - ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" - mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" - ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" - - - name: Setup multiarch - if: matrix.multiarch - env: - BDDE_DISTRO: ${{matrix.distro}} - BDDE_EDITION: ${{matrix.edition}} - BDDE_ARCH: ${{matrix.arch}} - run: ci/github/setup_bdde.sh - - - name: Setup Boost - env: - B2_ADDRESS_MODEL: ${{matrix.address-model}} - B2_COMPILER: ${{matrix.compiler}} - B2_CXXSTD: ${{matrix.cxxstd}} - B2_SANITIZE: ${{matrix.sanitize}} - B2_STDLIB: ${{matrix.stdlib}} - # More entries can be added in the same way, see the B2_ARGS assignment in ci/enforce.sh for the possible keys. - # B2_DEFINES: ${{matrix.defines}} - # Variables set here (to non-empty) will override the top-level environment variables, e.g. - # B2_VARIANT: ${{matrix.variant}} - # Set the (B2) target(s) to build, defaults to the test folder of the current library - # Can alternatively be done like this in the build step or in the build command of the build step, e.g. `run: B2_TARGETS=libs/$SELF/doc ci/build.sh` - # B2_TARGETS: libs/foo/test//bar - run: source ci/github/install.sh - - - name: Run tests - if: '!matrix.coverity' - run: ci/build.sh diff --git a/tools/setup_boost_with_modules.py b/tools/setup_boost_with_modules.py new file mode 100644 index 000000000..443583b17 --- /dev/null +++ b/tools/setup_boost_with_modules.py @@ -0,0 +1,28 @@ +#!/usr/bin/python3 + +# This is a temporary workaround to make CIs use the +# "Boost with C++20 modules" proposal, instead of the regular develop branch +# Call it instead of depinst + +from subprocess import run +import os + +def main(): + + submodules = [ + ('tools/cmake', 'https://github.com/anarthal/boost-cmake'), + ('libs/assert', 'https://github.com/anarthal/assert'), + ('libs/core', 'https://github.com/anarthal/core'), + ('libs/throw_exception','https://github.com/anarthal/throw_exception'), + ] + + for submodule, url in submodules: + os.chdir(submodule) + run(['git', 'remote', 'add', 'modules', url]) + run(['git', 'fetch', '--depth', '1', 'modules', 'feature/cxx20-modules']) + run(['git', 'checkout', 'modules/feature/cxx20-modules']) + os.chdir('../..') + + +if __name__ == '__main__': + main() From 404b663c559b61142c55b4566d50c74596b4e638 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 19:42:13 +0100 Subject: [PATCH 60/84] Force run --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5204c1e45..e39458bf4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ name: CI on: - pull_request: + # pull_request: push: branches: - master From 8d587c023b0d61521bd9573a1be4df578215480f Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 19:54:28 +0100 Subject: [PATCH 61/84] Missing CMAKE_C_COMPILER --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e39458bf4..ae81b14a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -804,13 +804,13 @@ jobs: run: | cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test mkdir __build__ && cd __build__ - cmake -DBOOST_USE_MODULES=1 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. + cmake -DBOOST_USE_MODULES=1 -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. cmake --build . ctest --output-on-failure --no-tests=error posix-cmake-install-modules: env: - CMAKE_ARGS: -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja + CMAKE_ARGS: -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja runs-on: ubuntu-latest container: ubuntu:24.10 @@ -910,7 +910,7 @@ jobs: run: | cd ../boost-root mkdir __build__ && cd __build__ - cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=${{matrix.cmake-build-type}} -DBOOST_USE_MODULES=1 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. + cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=${{matrix.cmake-build-type}} -DBOOST_USE_MODULES=1 -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. - name: Build tests run: | From 1e11414e678c5c0ec358a2199674885095b14b06 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 20:00:08 +0100 Subject: [PATCH 62/84] Update CMake max version in tests --- test/cmake_install_test/CMakeLists.txt | 2 +- test/cmake_subdir_test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cmake_install_test/CMakeLists.txt b/test/cmake_install_test/CMakeLists.txt index a2531dec8..d2fbffdf9 100644 --- a/test/cmake_install_test/CMakeLists.txt +++ b/test/cmake_install_test/CMakeLists.txt @@ -2,7 +2,7 @@ # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required(VERSION 3.5...3.16) +cmake_minimum_required(VERSION 3.5...3.31) project(cmake_install_test LANGUAGES CXX) diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index bac5b891a..f50e84334 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -2,7 +2,7 @@ # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required(VERSION 3.5...3.20) +cmake_minimum_required(VERSION 3.5...3.31) project(cmake_subdir_test LANGUAGES CXX) From 9ebf983947aac380122a04e1e743df2e68703d67 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 20:00:24 +0100 Subject: [PATCH 63/84] Remove unnecessary CMAKE_C_COMPILER arg --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae81b14a7..21788cb60 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -810,7 +810,7 @@ jobs: posix-cmake-install-modules: env: - CMAKE_ARGS: -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja + CMAKE_ARGS: -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja runs-on: ubuntu-latest container: ubuntu:24.10 @@ -850,7 +850,8 @@ jobs: run: | cd ../boost-root mkdir __build__ && cd __build__ - cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local -DBOOST_USE_MODULES=1 $CMAKE_ARGS .. + cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local -DBOOST_USE_MODULES=1 \ + -DCMAKE_C_COMPILER=clang-19 $CMAKE_ARGS .. - name: Install run: | From b0b868382c925cf72d7e0e7365e2cfae09b73cdb Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 11 Jan 2025 14:58:20 +0100 Subject: [PATCH 64/84] Fix include ifdef --- src/float128_impl.hpp | 2 +- test/from_chars.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/float128_impl.hpp b/src/float128_impl.hpp index a85f72282..e3492d816 100644 --- a/src/float128_impl.hpp +++ b/src/float128_impl.hpp @@ -10,9 +10,9 @@ #include #include #include +#include #ifndef BOOST_USE_MODULES #include "quadmath_header.hpp" -#include #include #include #include diff --git a/test/from_chars.cpp b/test/from_chars.cpp index 98c4595ba..2ebfe93aa 100644 --- a/test/from_chars.cpp +++ b/test/from_chars.cpp @@ -4,7 +4,7 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES -#include +#include #include #include #include From c549dee0288b97a31ff92b08024e53460dbdf6ea Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 11 Jan 2025 15:34:45 +0100 Subject: [PATCH 65/84] Make certain variables inline constexpr --- include/boost/charconv/detail/from_chars_integer_impl.hpp | 4 ++-- include/boost/charconv/detail/to_chars_integer_impl.hpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/boost/charconv/detail/from_chars_integer_impl.hpp b/include/boost/charconv/detail/from_chars_integer_impl.hpp index 6490b4ffc..97b485fe0 100644 --- a/include/boost/charconv/detail/from_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/from_chars_integer_impl.hpp @@ -25,7 +25,7 @@ namespace boost { namespace charconv { namespace detail { -static constexpr unsigned char uchar_values[] = +BOOST_INLINE_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, @@ -45,7 +45,7 @@ static constexpr unsigned char uchar_values[] = static_assert(sizeof(uchar_values) == 256, "uchar_values should represent all 256 values of unsigned char"); -static constexpr double log_2_table[] = +BOOST_INLINE_CONSTEXPR double log_2_table[] = { 0.0, 0.0, diff --git a/include/boost/charconv/detail/to_chars_integer_impl.hpp b/include/boost/charconv/detail/to_chars_integer_impl.hpp index 52dce5f87..f2dc61887 100644 --- a/include/boost/charconv/detail/to_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/to_chars_integer_impl.hpp @@ -14,6 +14,7 @@ #include #include #ifndef BOOST_USE_MODULES +#include #include #include #include @@ -32,7 +33,7 @@ namespace boost { namespace charconv { namespace detail { -static constexpr char radix_table[] = { +BOOST_INLINE_CONSTEXPR char radix_table[] = { '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', @@ -55,7 +56,7 @@ static constexpr char radix_table[] = { '9', '5', '9', '6', '9', '7', '9', '8', '9', '9' }; -static constexpr char digit_table[] = { +BOOST_INLINE_CONSTEXPR char digit_table[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', From d9fd5c72d1f1d1a3346b9aa1e0417fea713bb01c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 11 Jan 2025 15:54:43 +0100 Subject: [PATCH 66/84] Migrate to import in GMF --- .../detail/global_module_fragment.hpp | 9 +++++++++ modules/boost_charconv.cppm | 8 +------- src/float128_impl.hpp | 4 +++- src/from_chars.cpp | 20 ++++++++----------- src/impl_macros.hpp | 15 -------------- src/quadmath_header.hpp | 14 ------------- src/to_chars.cpp | 17 +++++++--------- test/P2497.cpp | 2 +- test/from_chars_float.cpp | 7 ++++--- test/from_chars_float2.cpp | 4 ++-- test/from_chars_string_view.cpp | 7 +++---- test/github_issue_110.cpp | 5 +++-- test/github_issue_122.cpp | 7 ++++--- test/github_issue_152.cpp | 7 ++++--- test/github_issue_154.cpp | 5 +++-- test/github_issue_158.cpp | 5 +++-- test/github_issue_166.cpp | 5 +++-- test/github_issue_166_float128.cpp | 5 +++-- test/limits.cpp | 1 + test/limits_link_1.cpp | 5 ++++- test/limits_link_2.cpp | 5 ++++- test/roundtrip.cpp | 1 + test/test_128bit_emulation.cpp | 7 ++++--- test/test_128bit_native.cpp | 9 +++++---- test/test_boost_json_values.cpp | 2 +- test/test_compute_float32.cpp | 4 ++-- test/test_compute_float64.cpp | 4 ++-- test/test_compute_float80.cpp | 4 ++-- test/test_num_digits.cpp | 4 ++-- test/test_parser.cpp | 7 ++++--- test/to_chars_float.cpp | 7 ++++--- 31 files changed, 97 insertions(+), 109 deletions(-) delete mode 100644 src/impl_macros.hpp delete mode 100644 src/quadmath_header.hpp diff --git a/include/boost/charconv/detail/global_module_fragment.hpp b/include/boost/charconv/detail/global_module_fragment.hpp index 55a821e42..8ee26fd91 100644 --- a/include/boost/charconv/detail/global_module_fragment.hpp +++ b/include/boost/charconv/detail/global_module_fragment.hpp @@ -12,6 +12,8 @@ #include // for UINT64_C #include // for CHAR_BIT #include +#include // for HUGE_VAL +#include #include #include @@ -25,4 +27,11 @@ #include #endif +#ifdef BOOST_CHARCONV_HAS_QUADMATH +#include +#endif + +import std; +import boost.core; + #endif diff --git a/modules/boost_charconv.cppm b/modules/boost_charconv.cppm index a31ca93f8..67144cab0 100644 --- a/modules/boost_charconv.cppm +++ b/modules/boost_charconv.cppm @@ -1,16 +1,10 @@ module; #include +#include export module boost.charconv; -import std; -import boost.core; - -extern "C++" { -#include -} - export namespace boost::charconv { using charconv::chars_format; diff --git a/src/float128_impl.hpp b/src/float128_impl.hpp index e3492d816..1a23e2bc8 100644 --- a/src/float128_impl.hpp +++ b/src/float128_impl.hpp @@ -12,7 +12,9 @@ #include #include #ifndef BOOST_USE_MODULES -#include "quadmath_header.hpp" +#ifdef BOOST_CHARCONV_HAS_QUADMATH +#include +#endif #include #include #include diff --git a/src/from_chars.cpp b/src/from_chars.cpp index b815b74c8..ed1b650e9 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -4,19 +4,11 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES - -// Global module fragment with all required includes module; -#include "impl_macros.hpp" - -// This is an implementation unit -module boost.charconv; -import std; -import boost.core; - +#include +#include #endif - // https://stackoverflow.com/questions/38060411/visual-studio-2015-wont-suppress-error-c4996 #ifndef _SCL_SECURE_NO_WARNINGS # define _SCL_SECURE_NO_WARNINGS @@ -25,7 +17,6 @@ import boost.core; # define NO_WARN_MBCS_MFC_DEPRECATION #endif -extern "C++" { #include "float128_impl.hpp" #include "from_chars_float_impl.hpp" #include @@ -33,7 +24,12 @@ extern "C++" { # include # include #endif -} + +#ifdef BOOST_USE_MODULES +// This is an implementation unit +module boost.charconv; +#endif + #ifndef BOOST_USE_MODULES #include diff --git a/src/impl_macros.hpp b/src/impl_macros.hpp deleted file mode 100644 index d2e21415e..000000000 --- a/src/impl_macros.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2024 Matt Borland -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -#ifndef BOOST_CHARCONV_SRC_IMPL_MACROS_HPP -#define BOOST_CHARCONV_SRC_IMPL_MACROS_HPP - -// Brings all macros required by both public and implementation headers. -// Suitable for cpp files in src/ and test/ when using C++20 modules -#include -#include // for HUGE_VAL -#include -#include "quadmath_header.hpp" - -#endif diff --git a/src/quadmath_header.hpp b/src/quadmath_header.hpp deleted file mode 100644 index 0d0fbab92..000000000 --- a/src/quadmath_header.hpp +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2024 Matt Borland -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -#ifndef BOOST_CHARCONV_QUADMATH_HPP -#define BOOST_CHARCONV_QUADMATH_HPP - -// Conditionally includes quadmath headers. -// Reduces duplication in modular builds -#ifdef BOOST_CHARCONV_HAS_QUADMATH -#include -#endif - -#endif diff --git a/src/to_chars.cpp b/src/to_chars.cpp index 32318ca10..94115f682 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -5,23 +5,20 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES - -// Global module fragment with all required includes module; -#include "impl_macros.hpp" +#include +#include +#endif + +#include "float128_impl.hpp" +#include "to_chars_float_impl.hpp" +#ifdef BOOST_USE_MODULES // This is an implementation unit module boost.charconv; -import std; -import boost.core; #endif -extern "C++" { -#include "float128_impl.hpp" -#include "to_chars_float_impl.hpp" -} - #ifndef BOOST_USE_MODULES // Public declarations already visible in modules #include diff --git a/test/P2497.cpp b/test/P2497.cpp index 71a3111c5..eceb4a3d7 100644 --- a/test/P2497.cpp +++ b/test/P2497.cpp @@ -3,10 +3,10 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include import std; import boost.core; import boost.charconv; -#include #else #include #include diff --git a/test/from_chars_float.cpp b/test/from_chars_float.cpp index 4455e7e13..fdb7477c1 100644 --- a/test/from_chars_float.cpp +++ b/test/from_chars_float.cpp @@ -3,13 +3,15 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include +#include "../src/from_chars_float_impl.hpp" import std; import boost.core; import boost.charconv; -#include -#include "../src/impl_macros.hpp" #else #include +#include "../src/from_chars_float_impl.hpp" #include #include #include @@ -22,7 +24,6 @@ import boost.charconv; #include #endif -#include "../src/from_chars_float_impl.hpp" template diff --git a/test/from_chars_float2.cpp b/test/from_chars_float2.cpp index b9561f17d..eea72cf90 100644 --- a/test/from_chars_float2.cpp +++ b/test/from_chars_float2.cpp @@ -3,17 +3,17 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include // stderr import std; import boost.core; import boost.charconv; -#include #else #include #include #include #endif -#include // stderr static boost::detail::splitmix64 rng; diff --git a/test/from_chars_string_view.cpp b/test/from_chars_string_view.cpp index b0e7ed55e..7fe1d06c3 100644 --- a/test/from_chars_string_view.cpp +++ b/test/from_chars_string_view.cpp @@ -3,14 +3,13 @@ // https://www.boost.org/LICENSE_1_0.txt -#include -#include - #ifdef BOOST_USE_MODULES +#include +#include +#include import std; import boost.core; import boost.charconv; -#include #else #include #include diff --git a/test/github_issue_110.cpp b/test/github_issue_110.cpp index 624a527c0..fa402cf2e 100644 --- a/test/github_issue_110.cpp +++ b/test/github_issue_110.cpp @@ -3,11 +3,12 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include +#include import std; import boost.core; import boost.charconv; -#include -#include #else #include #include diff --git a/test/github_issue_122.cpp b/test/github_issue_122.cpp index 01cb01148..42dc5b079 100644 --- a/test/github_issue_122.cpp +++ b/test/github_issue_122.cpp @@ -4,18 +4,19 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include +#include import std; import boost.core; -#include -#include "../src/impl_macros.hpp" #else #include #include #include +#include #include #endif -#include template void test() diff --git a/test/github_issue_152.cpp b/test/github_issue_152.cpp index 978e21a6c..cf5fef0cf 100644 --- a/test/github_issue_152.cpp +++ b/test/github_issue_152.cpp @@ -3,12 +3,13 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES -import std; -import boost.core; -import boost.charconv; #include #include +#include #include +import std; +import boost.core; +import boost.charconv; #else #include #include diff --git a/test/github_issue_154.cpp b/test/github_issue_154.cpp index bf5315331..d7b2d9ec7 100644 --- a/test/github_issue_154.cpp +++ b/test/github_issue_154.cpp @@ -5,11 +5,12 @@ // See: https://github.com/boostorg/charconv/issues/154 #ifdef BOOST_USE_MODULES +#include +#include +#include import std; import boost.core; import boost.charconv; -#include -#include #else #include #include diff --git a/test/github_issue_158.cpp b/test/github_issue_158.cpp index 373721738..01fc9e95f 100644 --- a/test/github_issue_158.cpp +++ b/test/github_issue_158.cpp @@ -6,11 +6,12 @@ // See: https://github.com/cppalliance/charconv/issues/158 #ifdef BOOST_USE_MODULES +#include +#include +#include import std; import boost.core; import boost.charconv; -#include -#include #else #include #include diff --git a/test/github_issue_166.cpp b/test/github_issue_166.cpp index 2bb1ba29a..9deb4db72 100644 --- a/test/github_issue_166.cpp +++ b/test/github_issue_166.cpp @@ -5,11 +5,12 @@ // See: https://github.com/cppalliance/charconv/issues/166 #ifdef BOOST_USE_MODULES +#include +#include +#include import std; import boost.core; import boost.charconv; -#include -#include #else #include #include diff --git a/test/github_issue_166_float128.cpp b/test/github_issue_166_float128.cpp index ee7196747..31090e8c9 100644 --- a/test/github_issue_166_float128.cpp +++ b/test/github_issue_166_float128.cpp @@ -5,11 +5,12 @@ // See: https://github.com/boostorg/charconv/issues/166 #ifdef BOOST_USE_MODULES +#include +#include +#include import std; import boost.core; import boost.charconv; -#include -#include #else #include #include diff --git a/test/limits.cpp b/test/limits.cpp index c09edb467..18ae1832c 100644 --- a/test/limits.cpp +++ b/test/limits.cpp @@ -5,6 +5,7 @@ #include #ifdef BOOST_USE_MODULES +#include #include #include import std; diff --git a/test/limits_link_1.cpp b/test/limits_link_1.cpp index 83fe87e54..13dfe8b7d 100644 --- a/test/limits_link_1.cpp +++ b/test/limits_link_1.cpp @@ -3,10 +3,13 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#include + #ifdef BOOST_USE_MODULES +#include +#include import boost.charconv; #else +#include #include #endif diff --git a/test/limits_link_2.cpp b/test/limits_link_2.cpp index bd0da30ec..450cbf0f6 100644 --- a/test/limits_link_2.cpp +++ b/test/limits_link_2.cpp @@ -3,11 +3,14 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#include + #ifdef BOOST_USE_MODULES +#include +#include import boost.charconv; #else #include +#include #endif void test_odr_use( int const* ); diff --git a/test/roundtrip.cpp b/test/roundtrip.cpp index dcd89fbf2..b5fa4b6f0 100644 --- a/test/roundtrip.cpp +++ b/test/roundtrip.cpp @@ -4,6 +4,7 @@ #ifdef BOOST_USE_MODULES #include +#include #include #include #include // for INT64_C diff --git a/test/test_128bit_emulation.cpp b/test/test_128bit_emulation.cpp index 3777f76b8..bdddf6a8b 100644 --- a/test/test_128bit_emulation.cpp +++ b/test/test_128bit_emulation.cpp @@ -3,18 +3,19 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES -import std; -import boost.core; #include #include +#include +import std; +import boost.core; #else +#include #include #include #include #include #endif -#include #include #include diff --git a/test/test_128bit_native.cpp b/test/test_128bit_native.cpp index e9d41bd77..d5ddcc90b 100644 --- a/test/test_128bit_native.cpp +++ b/test/test_128bit_native.cpp @@ -4,17 +4,18 @@ #ifdef BOOST_USE_MODULES -import std; -import boost.core; #include #include +#include +#include // UINT64_C +import std; +import boost.core; #else +#include #include #include #endif -#include -#include // Required by modular builds for UINT64_C void test128() { diff --git a/test/test_boost_json_values.cpp b/test/test_boost_json_values.cpp index 587860e18..60b7d4f08 100644 --- a/test/test_boost_json_values.cpp +++ b/test/test_boost_json_values.cpp @@ -8,10 +8,10 @@ // See: https://github.com/boostorg/json/blob/develop/test/double.cpp #ifdef BOOST_USE_MODULES +#include import std; import boost.core; import boost.charconv; -#include #else #include #include diff --git a/test/test_compute_float32.cpp b/test/test_compute_float32.cpp index 195f951e5..0991f1bd7 100644 --- a/test/test_compute_float32.cpp +++ b/test/test_compute_float32.cpp @@ -3,10 +3,10 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include import std; import boost.core; -#include -#include "../src/impl_macros.hpp" #else #include #include diff --git a/test/test_compute_float64.cpp b/test/test_compute_float64.cpp index 80474dfcd..7ec02870a 100644 --- a/test/test_compute_float64.cpp +++ b/test/test_compute_float64.cpp @@ -3,10 +3,10 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include import std; import boost.core; -#include -#include "../src/impl_macros.hpp" #else #include #include diff --git a/test/test_compute_float80.cpp b/test/test_compute_float80.cpp index ca2a3f7cd..0a7a4159a 100644 --- a/test/test_compute_float80.cpp +++ b/test/test_compute_float80.cpp @@ -3,10 +3,10 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include import std; import boost.core; -#include -#include "../src/impl_macros.hpp" #else #include #include diff --git a/test/test_num_digits.cpp b/test/test_num_digits.cpp index d02223185..2a342053a 100644 --- a/test/test_num_digits.cpp +++ b/test/test_num_digits.cpp @@ -4,10 +4,10 @@ #ifdef BOOST_USE_MODULES +#include +#include import std; import boost.core; -#include -#include "../src/impl_macros.hpp" #else #include #include diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 50ec2252f..55733b0ea 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -3,14 +3,16 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include +#include import std; import boost.core; import boost.charconv; -#include -#include "../src/impl_macros.hpp" #else #include #include +#include #include #include #include @@ -19,7 +21,6 @@ import boost.charconv; #include #endif -#include void test_integer() diff --git a/test/to_chars_float.cpp b/test/to_chars_float.cpp index 7a0a11b5c..5a0f58a54 100644 --- a/test/to_chars_float.cpp +++ b/test/to_chars_float.cpp @@ -4,13 +4,15 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include +#include import std; import boost.core; import boost.charconv; -#include -#include "../src/impl_macros.hpp" #else #include +#include #include #include #include @@ -26,7 +28,6 @@ import boost.charconv; #include #endif -#include // These numbers diverge from what the formatting is using printf // See: https://godbolt.org/z/zd34KcWMW From 9176eb3a8925de36d333d2dabf91a4277a311a1f Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 11 Jan 2025 18:23:27 +0100 Subject: [PATCH 67/84] Remove CMake warning suppression --- CMakeLists.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 339286a0f..bce35c041 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,13 +21,6 @@ if (BOOST_USE_MODULES) target_compile_features(boost_charconv PUBLIC cxx_std_23) set_target_properties(boost_charconv PROPERTIES CXX_MODULE_STD 1) target_compile_definitions(boost_charconv PUBLIC BOOST_USE_MODULES) - - # Silence warnings about includes in the purview - if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - target_compile_options(boost_charconv PRIVATE -Wno-include-angled-in-module-purview) - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - target_compile_options(boost_charconv PRIVATE /wd5244) - endif() endif() target_include_directories(boost_charconv PUBLIC include) From f55ea63be3392ba58b055e3f6a22ab1105479c3c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 11 Jan 2025 18:24:32 +0100 Subject: [PATCH 68/84] Remove explicit disabling of C++ extensions in CMake tests --- test/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7bf0e6e09..6e2c396d6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,8 +6,6 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) if(HAVE_BOOST_TEST) -# https://crascit.com/2015/03/28/enabling-cxx11-in-cmake/ -set(CMAKE_CXX_EXTENSIONS OFF) boost_test_jamfile(FILE Jamfile LINK_LIBRARIES Boost::charconv Boost::core Boost::assert) endif() From af5d88a318b54afcf883f87f636421e05bc663e2 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 11 Jan 2025 19:05:12 +0100 Subject: [PATCH 69/84] Restore bit_layouts & cleanup --- include/boost/charconv/config.hpp | 1 - include/boost/charconv/detail/bit_layouts.hpp | 15 ++++++++++++--- include/boost/charconv/detail/config.hpp | 15 +-------------- .../boost/charconv/detail/fallback_routines.hpp | 2 -- .../charconv/detail/from_chars_integer_impl.hpp | 1 - .../charconv/detail/global_module_fragment.hpp | 5 ++--- include/boost/charconv/detail/parser.hpp | 1 - .../boost/charconv/detail/significand_tables.hpp | 1 - include/boost/charconv/detail/to_chars_result.hpp | 1 - include/boost/charconv/from_chars.hpp | 2 +- include/boost/charconv/limits.hpp | 1 - src/float128_impl.hpp | 8 ++++---- src/from_chars_float_impl.hpp | 2 +- 13 files changed, 21 insertions(+), 34 deletions(-) diff --git a/include/boost/charconv/config.hpp b/include/boost/charconv/config.hpp index 3d726a332..7de401263 100644 --- a/include/boost/charconv/config.hpp +++ b/include/boost/charconv/config.hpp @@ -11,7 +11,6 @@ #include #endif - // This header implements separate compilation features as described in // http://www.boost.org/more/separate_compilation.html diff --git a/include/boost/charconv/detail/bit_layouts.hpp b/include/boost/charconv/detail/bit_layouts.hpp index 4b0db5c78..d5b280a46 100644 --- a/include/boost/charconv/detail/bit_layouts.hpp +++ b/include/boost/charconv/detail/bit_layouts.hpp @@ -59,7 +59,7 @@ struct ieee754_binary64 }; // 80 bit long double (e.g. x86-64) -#if BOOST_CHARCONV_LDBL_BITS == 80 +#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 struct IEEEl2bits { @@ -86,8 +86,10 @@ struct ieee754_binary80 static constexpr int decimal_digits = 18; }; +#define BOOST_CHARCONV_LDBL_BITS 80 + // 128 bit long double (e.g. s390x, ppcle64) -#elif BOOST_CHARCONV_LDBL_BITS == 128 +#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 struct IEEEl2bits { @@ -104,8 +106,10 @@ struct IEEEl2bits #endif }; +#define BOOST_CHARCONV_LDBL_BITS 128 + // 64 bit long double (double == long double on ARM) -#elif BOOST_CHARCONV_LDBL_BITS == 64 +#elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 struct IEEEl2bits { @@ -122,6 +126,11 @@ struct IEEEl2bits #endif }; +#define BOOST_CHARCONV_LDBL_BITS 64 + +#else // Unsupported long double representation +# define BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE +# define BOOST_CHARCONV_LDBL_BITS -1 #endif struct IEEEbinary128 diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index 5926b3af2..07dca3bbc 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -7,10 +7,9 @@ #ifndef BOOST_USE_MODULES #include +#include #include #include -#include -#include #endif #define BOOST_CHARCONV_ASSERT(expr) BOOST_ASSERT(expr) @@ -193,16 +192,4 @@ static_assert((BOOST_CHARCONV_ENDIAN_BIG_BYTE || BOOST_CHARCONV_ENDIAN_LITTLE_BY # define BOOST_CHARCONV_HAS_BRAINFLOAT16 #endif -// Detect long double and its number of bits -#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -# define BOOST_CHARCONV_LDBL_BITS 80 // 80 bit long double (e.g. x86-64) -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -# define BOOST_CHARCONV_LDBL_BITS 128 // 128 bit long double (e.g. s390x, ppcle64) -#elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -#define BOOST_CHARCONV_LDBL_BITS 64 // 64 bit long double (double == long double on ARM) -#else // Unsupported long double representation -# define BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE -# define BOOST_CHARCONV_LDBL_BITS -1 -#endif - #endif // BOOST_CHARCONV_DETAIL_CONFIG_HPP diff --git a/include/boost/charconv/detail/fallback_routines.hpp b/include/boost/charconv/detail/fallback_routines.hpp index 202c02ab0..ade23d9d5 100644 --- a/include/boost/charconv/detail/fallback_routines.hpp +++ b/include/boost/charconv/detail/fallback_routines.hpp @@ -11,8 +11,6 @@ #include #include #ifndef BOOST_USE_MODULES -#include -#include #include #include #include diff --git a/include/boost/charconv/detail/from_chars_integer_impl.hpp b/include/boost/charconv/detail/from_chars_integer_impl.hpp index 97b485fe0..69fe029a8 100644 --- a/include/boost/charconv/detail/from_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/from_chars_integer_impl.hpp @@ -22,7 +22,6 @@ #include #endif - namespace boost { namespace charconv { namespace detail { BOOST_INLINE_CONSTEXPR unsigned char uchar_values[] = diff --git a/include/boost/charconv/detail/global_module_fragment.hpp b/include/boost/charconv/detail/global_module_fragment.hpp index 8ee26fd91..35f532ded 100644 --- a/include/boost/charconv/detail/global_module_fragment.hpp +++ b/include/boost/charconv/detail/global_module_fragment.hpp @@ -5,9 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_GLOBAL_MODULE_FRAGMENT_HPP #define BOOST_CHARCONV_DETAIL_GLOBAL_MODULE_FRAGMENT_HPP -// Includes to be placed in the global module fragment. -// Reused by tests that include headers with names -// that are not exported from the module. +// Contents of the global module fragment. +// Used for all module units and in tests #include // for UINT64_C #include // for CHAR_BIT diff --git a/include/boost/charconv/detail/parser.hpp b/include/boost/charconv/detail/parser.hpp index 77833b431..73f3c04d0 100644 --- a/include/boost/charconv/detail/parser.hpp +++ b/include/boost/charconv/detail/parser.hpp @@ -20,7 +20,6 @@ #include #endif - #if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wmissing-field-initializers" diff --git a/include/boost/charconv/detail/significand_tables.hpp b/include/boost/charconv/detail/significand_tables.hpp index 736cb9824..4792177c0 100644 --- a/include/boost/charconv/detail/significand_tables.hpp +++ b/include/boost/charconv/detail/significand_tables.hpp @@ -11,7 +11,6 @@ #include #endif - // The significand of a floating point number is often referred to as the mantissa. // Using the term mantissa is discouraged by IEEE 1516 diff --git a/include/boost/charconv/detail/to_chars_result.hpp b/include/boost/charconv/detail/to_chars_result.hpp index e77e314f0..173a87c5a 100644 --- a/include/boost/charconv/detail/to_chars_result.hpp +++ b/include/boost/charconv/detail/to_chars_result.hpp @@ -9,7 +9,6 @@ #include #endif - // 22.13.2, Primitive numerical output conversion namespace boost { namespace charconv { diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index 58512ce65..4589cd168 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #ifndef BOOST_USE_MODULES @@ -16,7 +17,6 @@ #include #endif - namespace boost { namespace charconv { // integer overloads diff --git a/include/boost/charconv/limits.hpp b/include/boost/charconv/limits.hpp index 9fe93eee4..7c3985cac 100644 --- a/include/boost/charconv/limits.hpp +++ b/include/boost/charconv/limits.hpp @@ -11,7 +11,6 @@ #include #endif - namespace boost { namespace charconv { // limits::max_chars10: the minimum size of the buffer that needs to be diff --git a/src/float128_impl.hpp b/src/float128_impl.hpp index 1a23e2bc8..85e521c79 100644 --- a/src/float128_impl.hpp +++ b/src/float128_impl.hpp @@ -12,18 +12,18 @@ #include #include #ifndef BOOST_USE_MODULES -#ifdef BOOST_CHARCONV_HAS_QUADMATH -#include -#endif #include #include #include #endif - // Only add in float128 support if the build system says it can #ifdef BOOST_CHARCONV_HAS_QUADMATH +#ifndef BOOST_USE_MODULES +#include +#endif + namespace boost { namespace charconv { diff --git a/src/from_chars_float_impl.hpp b/src/from_chars_float_impl.hpp index 3968e4ea4..c43961728 100644 --- a/src/from_chars_float_impl.hpp +++ b/src/from_chars_float_impl.hpp @@ -6,6 +6,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FROM_CHARS_FLOAT_IMPL_HPP #define BOOST_CHARCONV_DETAIL_FROM_CHARS_FLOAT_IMPL_HPP +#include #include #include #include @@ -13,7 +14,6 @@ #include #include #ifndef BOOST_USE_MODULES -#include #include #include #include From 3bd370d9d4e384eb2e761d8a02925a6fbd0398cd Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 11 Jan 2025 19:08:30 +0100 Subject: [PATCH 70/84] Cleanup cpp files --- src/from_chars.cpp | 11 ++++------- src/to_chars.cpp | 15 +++++---------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/from_chars.cpp b/src/from_chars.cpp index ed1b650e9..6da029e24 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -6,7 +6,6 @@ #ifdef BOOST_USE_MODULES module; #include -#include #endif // https://stackoverflow.com/questions/38060411/visual-studio-2015-wont-suppress-error-c4996 @@ -25,12 +24,6 @@ module; # include #endif -#ifdef BOOST_USE_MODULES -// This is an implementation unit -module boost.charconv; -#endif - - #ifndef BOOST_USE_MODULES #include #include @@ -42,6 +35,10 @@ module boost.charconv; #include #endif +#ifdef BOOST_USE_MODULES +module boost.charconv; +#endif + #if defined(__GNUC__) && __GNUC__ < 5 # pragma GCC diagnostic ignored "-Wmissing-field-initializers" diff --git a/src/to_chars.cpp b/src/to_chars.cpp index 94115f682..6f4f60beb 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -7,22 +7,13 @@ #ifdef BOOST_USE_MODULES module; #include -#include #endif #include "float128_impl.hpp" #include "to_chars_float_impl.hpp" - -#ifdef BOOST_USE_MODULES -// This is an implementation unit -module boost.charconv; - -#endif - -#ifndef BOOST_USE_MODULES -// Public declarations already visible in modules #include #include +#ifndef BOOST_USE_MODULES #include #include #include @@ -30,6 +21,10 @@ module boost.charconv; #include #endif +#ifdef BOOST_USE_MODULES +module boost.charconv; +#endif + namespace boost { namespace charconv { namespace detail { namespace to_chars_detail { From 3e0d0db5b2dd038d626ff30b2a85a651af1bd079 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 11 Jan 2025 19:22:53 +0100 Subject: [PATCH 71/84] Add CIs back --- .github/workflows/ci.yml | 1480 ++++++++++++++++----------------- .github/workflows/codecov.yml | 202 +++++ .github/workflows/fuzz.yml | 289 +++++++ .github/workflows/qemu.yml | 204 +++++ 4 files changed, 1435 insertions(+), 740 deletions(-) create mode 100644 .github/workflows/codecov.yml create mode 100644 .github/workflows/fuzz.yml create mode 100644 .github/workflows/qemu.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21788cb60..3cabb5bd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ name: CI on: - # pull_request: + pull_request: push: branches: - master @@ -24,745 +24,745 @@ env: B2_CI_VERSION: 1 jobs: - # posix: - # defaults: - # run: - # shell: bash - - # strategy: - # fail-fast: false - # matrix: - # include: - # - toolset: gcc-5 - # cxxstd: "03,11,14,1z" - # address_model: 32,64 - # os: ubuntu-latest - # container: ubuntu:16.04 - # install: - # - g++-5-multilib - # - toolset: gcc-5 - # cxxstd: "03-gnu,11-gnu,14-gnu,1z-gnu" - # address_model: 32,64 - # os: ubuntu-latest - # container: ubuntu:16.04 - # install: - # - g++-5-multilib - # - toolset: gcc-6 - # cxxstd: "03,11,14,1z" - # address_model: 32,64 - # os: ubuntu-latest - # container: ubuntu:18.04 - # install: - # - g++-6-multilib - # - toolset: gcc-7 - # cxxstd: "03,11,14,17" - # address_model: 32,64 - # os: ubuntu-latest - # container: ubuntu:18.04 - # install: - # - g++-7-multilib - # - toolset: gcc-8 - # cxxstd: "03,11,14,17,2a" - # address_model: 32,64 - # os: ubuntu-latest - # container: ubuntu:18.04 - # install: - # - g++-8-multilib - # - toolset: gcc-9 - # cxxstd: "03,11,14,17,2a" - # address_model: 32,64 - # os: ubuntu-20.04 - # install: - # - g++-9-multilib - # - toolset: gcc-9 - # cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,2a-gnu" - # address_model: 32,64 - # os: ubuntu-20.04 - # install: - # - g++-9-multilib - # - toolset: gcc-10 - # cxxstd: "03,11,14,17,20" - # address_model: 32,64 - # os: ubuntu-20.04 - # install: - # - g++-10-multilib - # - toolset: gcc-11 - # cxxstd: "03,11,14,17,20,23" - # address_model: 32,64 - # os: ubuntu-22.04 - # install: - # - g++-11-multilib - # - toolset: gcc-12 - # cxxstd: "03,11,14,17,20,23" - # address_model: 32,64 - # os: ubuntu-22.04 - # install: - # - g++-12-multilib - # - toolset: gcc-12 - # cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu" - # address_model: 32,64 - # os: ubuntu-22.04 - # install: - # - g++-12-multilib - # - name: UBSAN - # toolset: gcc-12 - # cxxstd: "03,11,14,17,20,23" - # address_model: 32,64 - # ubsan: 1 - # os: ubuntu-22.04 - # install: - # - g++-12-multilib - # - toolset: gcc-13 - # cxxstd: "03,11,14,17,20,23" - # address_model: 32,64 - # os: ubuntu-24.04 - # install: - # - g++-13-multilib - # cxxflags: -fexcess-precision=fast - - # # Linux, clang - # - toolset: clang - # compiler: clang++-3.8 - # cxxstd: "03,11,14" - # os: ubuntu-latest - # container: ubuntu:16.04 - # install: - # - clang-3.8 - # - toolset: clang - # compiler: clang++-3.9 - # cxxstd: "03,11,14" - # os: ubuntu-latest - # container: ubuntu:18.04 - # install: - # - clang-3.9 - # - toolset: clang - # compiler: clang++-4.0 - # cxxstd: "03,11,14" - # os: ubuntu-latest - # container: ubuntu:18.04 - # install: - # - clang-4.0 - # - toolset: clang - # compiler: clang++-5.0 - # cxxstd: "03,11,14,1z" - # os: ubuntu-latest - # container: ubuntu:18.04 - # install: - # - clang-5.0 - # - toolset: clang - # compiler: clang++-6.0 - # cxxstd: "03,11,14,17" - # os: ubuntu-latest - # container: ubuntu:18.04 - # install: - # - clang-6.0 - # - toolset: clang - # compiler: clang++-7 - # cxxstd: "03,11,14,17" - # os: ubuntu-latest - # container: ubuntu:18.04 - # install: - # - clang-7 - # # Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode - # - toolset: clang - # compiler: clang++-8 - # cxxstd: "03,11,14,17,2a" - # os: ubuntu-latest - # container: ubuntu:18.04 - # install: - # - clang-8 - # - g++-7 - # gcc_toolchain: 7 - # - toolset: clang - # compiler: clang++-9 - # cxxstd: "03,11,14,17,2a" - # os: ubuntu-20.04 - # install: - # - clang-9 - # - toolset: clang - # compiler: clang++-10 - # cxxstd: "03,11,14,17,20" - # os: ubuntu-20.04 - # install: - # - clang-10 - # - toolset: clang - # compiler: clang++-11 - # cxxstd: "03,11,14,17,20" - # os: ubuntu-22.04 - # install: - # - clang-11 - # - toolset: clang - # compiler: clang++-12 - # cxxstd: "03,11,14,17,20" - # os: ubuntu-22.04 - # install: - # - clang-12 - # - toolset: clang - # compiler: clang++-13 - # cxxstd: "03,11,14,17,20" - # os: ubuntu-22.04 - # install: - # - clang-13 - # - toolset: clang - # compiler: clang++-14 - # cxxstd: "03,11,14,17,20" - # os: ubuntu-22.04 - # install: - # - clang-14 - # - toolset: clang - # compiler: clang++-14 - # cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu" - # os: ubuntu-22.04 - # install: - # - clang-14 - # - toolset: clang - # compiler: clang++-15 - # cxxstd: "03,11,14,17,20" - # os: ubuntu-22.04 - # install: - # - clang-15 - # sources: - # - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" - # source_keys: - # - "https://apt.llvm.org/llvm-snapshot.gpg.key" - # - toolset: clang - # compiler: clang++-15 - # cxxstd: "03,11,14,17,20,2b" - # os: ubuntu-22.04 - # install: - # - clang-15 - # - libc++-15-dev - # - libc++abi-15-dev - # sources: - # - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" - # source_keys: - # - "https://apt.llvm.org/llvm-snapshot.gpg.key" - # cxxflags: -stdlib=libc++ - # linkflags: -stdlib=libc++ - # - toolset: clang - # compiler: clang++-16 - # cxxstd: "03,11,14,17,20,2b" - # os: ubuntu-22.04 - # install: - # - clang-16 - # sources: - # - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" - # source_keys: - # - "https://apt.llvm.org/llvm-snapshot.gpg.key" - # - toolset: clang - # compiler: clang++-17 - # cxxstd: "03,11,14,17,20,2b" - # os: ubuntu-22.04 - # install: - # - clang-17 - # sources: - # - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" - # source_keys: - # - "https://apt.llvm.org/llvm-snapshot.gpg.key" - # - name: UBSAN - # toolset: clang - # compiler: clang++-14 - # cxxstd: "03,11,14,17,20,2b" - # cxxflags: -stdlib=libc++ - # linkflags: -stdlib=libc++ - # ubsan: 1 - # os: ubuntu-22.04 - # install: - # - clang-14 - # - libc++-14-dev - # - libc++abi-14-dev - - # - toolset: clang - # cxxstd: "03,11,14,17,20,2b" - # os: macos-13 - # - toolset: clang - # cxxstd: "03,11,14,17,20,2b" - # os: macos-14 - # - toolset: clang - # cxxstd: "03,11,14,17,20,2b" - # os: macos-15 - - # timeout-minutes: 60 - # runs-on: ${{matrix.os}} - # container: - # image: ${{matrix.container}} - # volumes: - # - /node20217:/node20217:rw,rshared - # - ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }} - - # steps: - # - name: Setup environment - # run: | - # if [ -f "/etc/debian_version" ] - # then - # echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV - # export DEBIAN_FRONTEND=noninteractive - # fi - # if [ -n "${{matrix.container}}" ] - # then - # echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV - # if [ -f "/etc/debian_version" ] - # then - # apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - # if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ] - # then - # PYTHON_PACKAGE="python-is-python3" - # else - # PYTHON_PACKAGE="python" - # fi - # apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake - # fi - # if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then - # # Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590 - # curl -sL https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217 - # fi - # fi - # git config --global pack.threads 0 - # - uses: actions/checkout@v4 - - # - name: Install packages - # if: matrix.install - # run: | - # declare -a SOURCE_KEYS SOURCES - # if [ -n "${{join(matrix.source_keys, ' ')}}" ] - # then - # SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}") - # fi - # if [ -n "${{join(matrix.sources, ' ')}}" ] - # then - # SOURCES=("${{join(matrix.sources, '" "')}}") - # fi - # for key in "${SOURCE_KEYS[@]}" - # do - # for i in {1..$NET_RETRY_COUNT} - # do - # echo "Adding key: $key" - # wget -O - "$key" | sudo apt-key add - && break || sleep 2 - # done - # done - # if [ ${#SOURCES[@]} -gt 0 ] - # then - # APT_ADD_REPO_COMMON_ARGS=("-y") - # APT_ADD_REPO_SUPPORTED_ARGS="$(apt-add-repository --help | perl -ne 'if (/^\s*-n/) { print "n"; } elsif (/^\s*-P/) { print "P"; } elsif (/^\s*-S/) { print "S"; } elsif (/^\s*-U/) { print "U"; }')" - # if [ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*n*}" ] - # then - # APT_ADD_REPO_COMMON_ARGS+=("-n") - # fi - # APT_ADD_REPO_HAS_SOURCE_ARGS="$([ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*P*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*S*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*U*}" ] && echo 1 || echo 0)" - # for source in "${SOURCES[@]}" - # do - # for i in {1..$NET_RETRY_COUNT} - # do - # APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}") - # if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ] - # then - # case "$source" in - # "ppa:"*) - # APT_ADD_REPO_ARGS+=("-P") - # ;; - # "deb "*) - # APT_ADD_REPO_ARGS+=("-S") - # ;; - # *) - # APT_ADD_REPO_ARGS+=("-U") - # ;; - # esac - # fi - # APT_ADD_REPO_ARGS+=("$source") - # echo "apt-add-repository ${APT_ADD_REPO_ARGS[@]}" - # sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2 - # done - # done - # fi - # sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - # sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} locales - # sudo locale-gen de_DE.UTF-8 - # sudo update-locale - # - name: Setup GCC Toolchain - # if: matrix.gcc_toolchain - # run: | - # GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" - # echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV - # MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" - # mkdir -p "$GCC_TOOLCHAIN_ROOT" - # ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" - # ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" - # mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" - # ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" - # - name: Setup Boost - # run: | - # echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY - # LIBRARY=${GITHUB_REPOSITORY#*/} - # echo LIBRARY: $LIBRARY - # echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV - # echo GITHUB_BASE_REF: $GITHUB_BASE_REF - # echo GITHUB_REF: $GITHUB_REF - # REF=${GITHUB_BASE_REF:-$GITHUB_REF} - # REF=${REF#refs/heads/} - # echo REF: $REF - # BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true - # echo BOOST_BRANCH: $BOOST_BRANCH - # BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) - # echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV - # echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV - # DEPINST_ARGS=() - # GIT_VERSION="$(git --version | sed -e 's/git version //')" - # GIT_HAS_JOBS=1 - # if [ -f "/etc/debian_version" ] - # then - # if $(dpkg --compare-versions "$GIT_VERSION" lt 2.8.0) - # then - # GIT_HAS_JOBS=0 - # fi - # else - # declare -a GIT_VER=(${GIT_VERSION//./ }) - # declare -a GIT_MIN_VER=(2 8 0) - # for ((i=0; i<${#GIT_VER[@]}; i++)) - # do - # if [ -z "${GIT_MIN_VER[i]}" ] - # then - # GIT_MIN_VER[i]=0 - # fi - # if [ "${GIT_VER[i]}" -lt "${GIT_MIN_VER[i]}" ] - # then - # GIT_HAS_JOBS=0 - # break - # fi - # done - # fi - # if [ "$GIT_HAS_JOBS" -ne 0 ] - # then - # DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") - # fi - # cd .. - # git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" - # cd boost-root - # mkdir -p libs/$LIBRARY - # cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY - # git submodule update --init tools/boostdep - # DEPINST_ARGS+=("$LIBRARY") - # python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" - # if [ -z "${{matrix.cmake_tests}}" ] - # then - # ./bootstrap.sh - # ./b2 headers - # if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] - # then - # echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam - # if [ -n "$GCC_TOOLCHAIN_ROOT" ] - # then - # echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam - # fi - # echo " ;" >> ~/user-config.jam - # fi - # fi - # - name: Run tests - # if: matrix.cmake_tests == '' - # run: | - # cd ../boost-root - # B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}" "link=static,shared") - # if [ -n "${{matrix.build_variant}}" ] - # then - # B2_ARGS+=("variant=${{matrix.build_variant}}") - # else - # B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") - # fi - # if [ -n "${{matrix.threading}}" ] - # then - # B2_ARGS+=("threading=${{matrix.threading}}") - # fi - # if [ -n "${{matrix.ubsan}}" ] - # then - # export UBSAN_OPTIONS="print_stacktrace=1" - # B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global") - # fi - # if [ -n "${{matrix.cxxflags}}" ] - # then - # B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") - # fi - # if [ -n "${{matrix.linkflags}}" ] - # then - # B2_ARGS+=("linkflags=${{matrix.linkflags}}") - # fi - # if [ -n "${{matrix.address_model}}" ] - # then - # B2_ARGS+=("address-model=${{matrix.address_model}}") - # fi - # B2_ARGS+=("libs/$LIBRARY/test") - # set -x - # ./b2 "${B2_ARGS[@]}" - - # windows: - # strategy: - # fail-fast: false - # matrix: - # include: - # - toolset: msvc-14.0 - # cxxstd: "14,latest" - # addrmd: 32,64 - # os: windows-2019 - # - toolset: msvc-14.2 - # cxxstd: "14,17,20,latest" - # addrmd: 32,64 - # os: windows-2019 - # - toolset: msvc-14.3 - # cxxstd: "14,17,20,latest" - # addrmd: 32,64 - # os: windows-2022 - # - toolset: clang-win - # cxxstd: "14,17,latest" - # addrmd: 32,64 - # os: windows-2022 - # - toolset: gcc - # cxxstd: "03,11,14,17,2a" - # addrmd: 64 - # os: windows-2019 - - # runs-on: ${{matrix.os}} - - # steps: - # - uses: actions/checkout@v3 - - # - name: Setup Boost - # shell: cmd - # run: | - # echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% - # for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi - # echo LIBRARY: %LIBRARY% - # echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% - # echo GITHUB_BASE_REF: %GITHUB_BASE_REF% - # echo GITHUB_REF: %GITHUB_REF% - # if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% - # set BOOST_BRANCH=develop - # for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master - # echo BOOST_BRANCH: %BOOST_BRANCH% - # cd .. - # git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root - # cd boost-root - # xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ - # git submodule update --init tools/boostdep - # python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% - # cmd /c bootstrap - # b2 -d0 headers - - # - name: Run tests - # shell: cmd - # run: | - # cd ../boost-root - # b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release link=static,shared embed-manifest-via=linker - - # posix-cmake-subdir: - # strategy: - # fail-fast: false - # matrix: - # include: - # - os: ubuntu-20.04 - # - os: ubuntu-22.04 - # - os: macos-13 - # - os: macos-14 - # - os: macos-15 - - # runs-on: ${{matrix.os}} - - # steps: - # - uses: actions/checkout@v3 - - # - name: Install packages - # if: matrix.install - # run: sudo apt-get -y install ${{matrix.install}} - - # - name: Setup Boost - # run: | - # echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY - # LIBRARY=${GITHUB_REPOSITORY#*/} - # echo LIBRARY: $LIBRARY - # echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV - # echo GITHUB_BASE_REF: $GITHUB_BASE_REF - # echo GITHUB_REF: $GITHUB_REF - # REF=${GITHUB_BASE_REF:-$GITHUB_REF} - # REF=${REF#refs/heads/} - # echo REF: $REF - # BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true - # echo BOOST_BRANCH: $BOOST_BRANCH - # cd .. - # git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root - # cd boost-root - # mkdir -p libs/$LIBRARY - # cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY - # git submodule update --init tools/boostdep - # python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY - - # - name: Use library with add_subdirectory - # run: | - # cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test - # mkdir __build__ && cd __build__ - # cmake .. - # cmake --build . - # ctest --output-on-failure --no-tests=error - - # posix-cmake-install: - # strategy: - # fail-fast: false - # matrix: - # include: - # - os: ubuntu-20.04 - # - os: ubuntu-22.04 - # - os: macos-13 - # - os: macos-14 - # - os: macos-15 - - # runs-on: ${{matrix.os}} - - # steps: - # - uses: actions/checkout@v3 - - # - name: Install packages - # if: matrix.install - # run: sudo apt-get -y install ${{matrix.install}} - - # - name: Setup Boost - # run: | - # echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY - # LIBRARY=${GITHUB_REPOSITORY#*/} - # echo LIBRARY: $LIBRARY - # echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV - # echo GITHUB_BASE_REF: $GITHUB_BASE_REF - # echo GITHUB_REF: $GITHUB_REF - # REF=${GITHUB_BASE_REF:-$GITHUB_REF} - # REF=${REF#refs/heads/} - # echo REF: $REF - # BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true - # echo BOOST_BRANCH: $BOOST_BRANCH - # cd .. - # git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root - # cd boost-root - # mkdir -p libs/$LIBRARY - # cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY - # git submodule update --init tools/boostdep - # python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY - - # - name: Configure - # run: | - # cd ../boost-root - # mkdir __build__ && cd __build__ - # cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=ON .. - - # - name: Install - # run: | - # cd ../boost-root/__build__ - # cmake --build . --target install - - # - name: Use the installed library - # run: | - # cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__ - # cmake -DCMAKE_PREFIX_PATH=~/.local .. - # cmake --build . - # ctest --output-on-failure --no-tests=error - - # posix-cmake-test: - # strategy: - # fail-fast: false - # matrix: - # include: - # - os: ubuntu-20.04 - # - os: ubuntu-22.04 - # - os: macos-13 - # - os: macos-14 - # - os: macos-15 - - # runs-on: ${{matrix.os}} - - # steps: - # - uses: actions/checkout@v3 - - # - name: Install packages - # if: matrix.install - # run: sudo apt-get -y install ${{matrix.install}} - - # - name: Setup Boost - # run: | - # echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY - # LIBRARY=${GITHUB_REPOSITORY#*/} - # echo LIBRARY: $LIBRARY - # echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV - # echo GITHUB_BASE_REF: $GITHUB_BASE_REF - # echo GITHUB_REF: $GITHUB_REF - # REF=${GITHUB_BASE_REF:-$GITHUB_REF} - # REF=${REF#refs/heads/} - # echo REF: $REF - # BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true - # echo BOOST_BRANCH: $BOOST_BRANCH - # cd .. - # git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root - # cd boost-root - # mkdir -p libs/$LIBRARY - # cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY - # git submodule update --init tools/boostdep - # python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY - - # - name: Configure - # run: | - # cd ../boost-root - # mkdir __build__ && cd __build__ - # cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON .. - - # - name: Build tests - # run: | - # cd ../boost-root/__build__ - # cmake --build . --target tests - - # - name: Run tests - # run: | - # cd ../boost-root/__build__ - # ctest --output-on-failure --no-tests=error - - # MSYS2: - # defaults: - # run: - # shell: msys2 {0} - # strategy: - # fail-fast: false - # matrix: - # include: - # - { sys: MINGW32, compiler: gcc, cxxstd: '03,11,17,20', cxxflags: "-fexcess-precision=fast" } - # - { sys: MINGW64, compiler: gcc, cxxstd: '03,11,17,20', cxxflags: "-fexcess-precision=fast" } - - # runs-on: windows-latest - - # steps: - # - uses: actions/checkout@v3 - - # - name: Setup MSYS2 environment - # uses: msys2/setup-msys2@v2 - # with: - # msystem: ${{matrix.sys}} - # update: true - # install: git python - # pacboy: gcc:p cmake:p ninja:p - - # - name: Fetch Boost.CI - # uses: actions/checkout@v3 - # with: - # repository: boostorg/boost-ci - # ref: master - # path: boost-ci-cloned - # - name: Get CI scripts folder - # run: | - # # Copy ci folder if not testing Boost.CI - # [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . - # rm -rf boost-ci-cloned - - # - name: Setup Boost - # env: - # B2_COMPILER: ${{matrix.compiler}} - # B2_CXXSTD: ${{matrix.cxxstd}} - # B2_SANITIZE: ${{matrix.sanitize}} - # B2_STDLIB: ${{matrix.stdlib}} - # B2_CXXFLAGS: ${{matrix.cxxflags}} - # run: ci/github/install.sh - - # - name: Run tests - # run: ci/build.sh + posix: + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + include: + - toolset: gcc-5 + cxxstd: "03,11,14,1z" + address_model: 32,64 + os: ubuntu-latest + container: ubuntu:16.04 + install: + - g++-5-multilib + - toolset: gcc-5 + cxxstd: "03-gnu,11-gnu,14-gnu,1z-gnu" + address_model: 32,64 + os: ubuntu-latest + container: ubuntu:16.04 + install: + - g++-5-multilib + - toolset: gcc-6 + cxxstd: "03,11,14,1z" + address_model: 32,64 + os: ubuntu-latest + container: ubuntu:18.04 + install: + - g++-6-multilib + - toolset: gcc-7 + cxxstd: "03,11,14,17" + address_model: 32,64 + os: ubuntu-latest + container: ubuntu:18.04 + install: + - g++-7-multilib + - toolset: gcc-8 + cxxstd: "03,11,14,17,2a" + address_model: 32,64 + os: ubuntu-latest + container: ubuntu:18.04 + install: + - g++-8-multilib + - toolset: gcc-9 + cxxstd: "03,11,14,17,2a" + address_model: 32,64 + os: ubuntu-20.04 + install: + - g++-9-multilib + - toolset: gcc-9 + cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,2a-gnu" + address_model: 32,64 + os: ubuntu-20.04 + install: + - g++-9-multilib + - toolset: gcc-10 + cxxstd: "03,11,14,17,20" + address_model: 32,64 + os: ubuntu-20.04 + install: + - g++-10-multilib + - toolset: gcc-11 + cxxstd: "03,11,14,17,20,23" + address_model: 32,64 + os: ubuntu-22.04 + install: + - g++-11-multilib + - toolset: gcc-12 + cxxstd: "03,11,14,17,20,23" + address_model: 32,64 + os: ubuntu-22.04 + install: + - g++-12-multilib + - toolset: gcc-12 + cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu" + address_model: 32,64 + os: ubuntu-22.04 + install: + - g++-12-multilib + - name: UBSAN + toolset: gcc-12 + cxxstd: "03,11,14,17,20,23" + address_model: 32,64 + ubsan: 1 + os: ubuntu-22.04 + install: + - g++-12-multilib + - toolset: gcc-13 + cxxstd: "03,11,14,17,20,23" + address_model: 32,64 + os: ubuntu-24.04 + install: + - g++-13-multilib + cxxflags: -fexcess-precision=fast + + # Linux, clang + - toolset: clang + compiler: clang++-3.8 + cxxstd: "03,11,14" + os: ubuntu-latest + container: ubuntu:16.04 + install: + - clang-3.8 + - toolset: clang + compiler: clang++-3.9 + cxxstd: "03,11,14" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-3.9 + - toolset: clang + compiler: clang++-4.0 + cxxstd: "03,11,14" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-4.0 + - toolset: clang + compiler: clang++-5.0 + cxxstd: "03,11,14,1z" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-5.0 + - toolset: clang + compiler: clang++-6.0 + cxxstd: "03,11,14,17" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-6.0 + - toolset: clang + compiler: clang++-7 + cxxstd: "03,11,14,17" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-7 + # Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode + - toolset: clang + compiler: clang++-8 + cxxstd: "03,11,14,17,2a" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-8 + - g++-7 + gcc_toolchain: 7 + - toolset: clang + compiler: clang++-9 + cxxstd: "03,11,14,17,2a" + os: ubuntu-20.04 + install: + - clang-9 + - toolset: clang + compiler: clang++-10 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + install: + - clang-10 + - toolset: clang + compiler: clang++-11 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 + install: + - clang-11 + - toolset: clang + compiler: clang++-12 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 + install: + - clang-12 + - toolset: clang + compiler: clang++-13 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 + install: + - clang-13 + - toolset: clang + compiler: clang++-14 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 + install: + - clang-14 + - toolset: clang + compiler: clang++-14 + cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu" + os: ubuntu-22.04 + install: + - clang-14 + - toolset: clang + compiler: clang++-15 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 + install: + - clang-15 + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + - toolset: clang + compiler: clang++-15 + cxxstd: "03,11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-15 + - libc++-15-dev + - libc++abi-15-dev + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + cxxflags: -stdlib=libc++ + linkflags: -stdlib=libc++ + - toolset: clang + compiler: clang++-16 + cxxstd: "03,11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-16 + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + - toolset: clang + compiler: clang++-17 + cxxstd: "03,11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-17 + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + - name: UBSAN + toolset: clang + compiler: clang++-14 + cxxstd: "03,11,14,17,20,2b" + cxxflags: -stdlib=libc++ + linkflags: -stdlib=libc++ + ubsan: 1 + os: ubuntu-22.04 + install: + - clang-14 + - libc++-14-dev + - libc++abi-14-dev + + - toolset: clang + cxxstd: "03,11,14,17,20,2b" + os: macos-13 + - toolset: clang + cxxstd: "03,11,14,17,20,2b" + os: macos-14 + - toolset: clang + cxxstd: "03,11,14,17,20,2b" + os: macos-15 + + timeout-minutes: 60 + runs-on: ${{matrix.os}} + container: + image: ${{matrix.container}} + volumes: + - /node20217:/node20217:rw,rshared + - ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }} + + steps: + - name: Setup environment + run: | + if [ -f "/etc/debian_version" ] + then + echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV + export DEBIAN_FRONTEND=noninteractive + fi + if [ -n "${{matrix.container}}" ] + then + echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV + if [ -f "/etc/debian_version" ] + then + apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ] + then + PYTHON_PACKAGE="python-is-python3" + else + PYTHON_PACKAGE="python" + fi + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake + fi + if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then + # Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590 + curl -sL https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217 + fi + fi + git config --global pack.threads 0 + - uses: actions/checkout@v4 + + - name: Install packages + if: matrix.install + run: | + declare -a SOURCE_KEYS SOURCES + if [ -n "${{join(matrix.source_keys, ' ')}}" ] + then + SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}") + fi + if [ -n "${{join(matrix.sources, ' ')}}" ] + then + SOURCES=("${{join(matrix.sources, '" "')}}") + fi + for key in "${SOURCE_KEYS[@]}" + do + for i in {1..$NET_RETRY_COUNT} + do + echo "Adding key: $key" + wget -O - "$key" | sudo apt-key add - && break || sleep 2 + done + done + if [ ${#SOURCES[@]} -gt 0 ] + then + APT_ADD_REPO_COMMON_ARGS=("-y") + APT_ADD_REPO_SUPPORTED_ARGS="$(apt-add-repository --help | perl -ne 'if (/^\s*-n/) { print "n"; } elsif (/^\s*-P/) { print "P"; } elsif (/^\s*-S/) { print "S"; } elsif (/^\s*-U/) { print "U"; }')" + if [ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*n*}" ] + then + APT_ADD_REPO_COMMON_ARGS+=("-n") + fi + APT_ADD_REPO_HAS_SOURCE_ARGS="$([ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*P*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*S*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*U*}" ] && echo 1 || echo 0)" + for source in "${SOURCES[@]}" + do + for i in {1..$NET_RETRY_COUNT} + do + APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}") + if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ] + then + case "$source" in + "ppa:"*) + APT_ADD_REPO_ARGS+=("-P") + ;; + "deb "*) + APT_ADD_REPO_ARGS+=("-S") + ;; + *) + APT_ADD_REPO_ARGS+=("-U") + ;; + esac + fi + APT_ADD_REPO_ARGS+=("$source") + echo "apt-add-repository ${APT_ADD_REPO_ARGS[@]}" + sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2 + done + done + fi + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} locales + sudo locale-gen de_DE.UTF-8 + sudo update-locale + - name: Setup GCC Toolchain + if: matrix.gcc_toolchain + run: | + GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" + echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV + MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" + mkdir -p "$GCC_TOOLCHAIN_ROOT" + ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" + ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" + mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" + ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) + echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV + echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV + DEPINST_ARGS=() + GIT_VERSION="$(git --version | sed -e 's/git version //')" + GIT_HAS_JOBS=1 + if [ -f "/etc/debian_version" ] + then + if $(dpkg --compare-versions "$GIT_VERSION" lt 2.8.0) + then + GIT_HAS_JOBS=0 + fi + else + declare -a GIT_VER=(${GIT_VERSION//./ }) + declare -a GIT_MIN_VER=(2 8 0) + for ((i=0; i<${#GIT_VER[@]}; i++)) + do + if [ -z "${GIT_MIN_VER[i]}" ] + then + GIT_MIN_VER[i]=0 + fi + if [ "${GIT_VER[i]}" -lt "${GIT_MIN_VER[i]}" ] + then + GIT_HAS_JOBS=0 + break + fi + done + fi + if [ "$GIT_HAS_JOBS" -ne 0 ] + then + DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") + fi + cd .. + git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" + cd boost-root + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + DEPINST_ARGS+=("$LIBRARY") + python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" + if [ -z "${{matrix.cmake_tests}}" ] + then + ./bootstrap.sh + ./b2 headers + if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam + if [ -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam + fi + echo " ;" >> ~/user-config.jam + fi + fi + - name: Run tests + if: matrix.cmake_tests == '' + run: | + cd ../boost-root + B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}" "link=static,shared") + if [ -n "${{matrix.build_variant}}" ] + then + B2_ARGS+=("variant=${{matrix.build_variant}}") + else + B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") + fi + if [ -n "${{matrix.threading}}" ] + then + B2_ARGS+=("threading=${{matrix.threading}}") + fi + if [ -n "${{matrix.ubsan}}" ] + then + export UBSAN_OPTIONS="print_stacktrace=1" + B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global") + fi + if [ -n "${{matrix.cxxflags}}" ] + then + B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") + fi + if [ -n "${{matrix.linkflags}}" ] + then + B2_ARGS+=("linkflags=${{matrix.linkflags}}") + fi + if [ -n "${{matrix.address_model}}" ] + then + B2_ARGS+=("address-model=${{matrix.address_model}}") + fi + B2_ARGS+=("libs/$LIBRARY/test") + set -x + ./b2 "${B2_ARGS[@]}" + + windows: + strategy: + fail-fast: false + matrix: + include: + - toolset: msvc-14.0 + cxxstd: "14,latest" + addrmd: 32,64 + os: windows-2019 + - toolset: msvc-14.2 + cxxstd: "14,17,20,latest" + addrmd: 32,64 + os: windows-2019 + - toolset: msvc-14.3 + cxxstd: "14,17,20,latest" + addrmd: 32,64 + os: windows-2022 + - toolset: clang-win + cxxstd: "14,17,latest" + addrmd: 32,64 + os: windows-2022 + - toolset: gcc + cxxstd: "03,11,14,17,2a" + addrmd: 64 + os: windows-2019 + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v3 + + - name: Setup Boost + shell: cmd + run: | + echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% + for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi + echo LIBRARY: %LIBRARY% + echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% + echo GITHUB_BASE_REF: %GITHUB_BASE_REF% + echo GITHUB_REF: %GITHUB_REF% + if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% + set BOOST_BRANCH=develop + for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master + echo BOOST_BRANCH: %BOOST_BRANCH% + cd .. + git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY% + cmd /c bootstrap + b2 -d0 headers + + - name: Run tests + shell: cmd + run: | + cd ../boost-root + b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release link=static,shared embed-manifest-via=linker + + posix-cmake-subdir: + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-20.04 + - os: ubuntu-22.04 + - os: macos-13 + - os: macos-14 + - os: macos-15 + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v3 + + - name: Install packages + if: matrix.install + run: sudo apt-get -y install ${{matrix.install}} + + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + cd .. + git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + + - name: Use library with add_subdirectory + run: | + cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test + mkdir __build__ && cd __build__ + cmake .. + cmake --build . + ctest --output-on-failure --no-tests=error + + posix-cmake-install: + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-20.04 + - os: ubuntu-22.04 + - os: macos-13 + - os: macos-14 + - os: macos-15 + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v3 + + - name: Install packages + if: matrix.install + run: sudo apt-get -y install ${{matrix.install}} + + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + cd .. + git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + + - name: Configure + run: | + cd ../boost-root + mkdir __build__ && cd __build__ + cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=ON .. + + - name: Install + run: | + cd ../boost-root/__build__ + cmake --build . --target install + + - name: Use the installed library + run: | + cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__ + cmake -DCMAKE_PREFIX_PATH=~/.local .. + cmake --build . + ctest --output-on-failure --no-tests=error + + posix-cmake-test: + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-20.04 + - os: ubuntu-22.04 + - os: macos-13 + - os: macos-14 + - os: macos-15 + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v3 + + - name: Install packages + if: matrix.install + run: sudo apt-get -y install ${{matrix.install}} + + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + cd .. + git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY + + - name: Configure + run: | + cd ../boost-root + mkdir __build__ && cd __build__ + cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON .. + + - name: Build tests + run: | + cd ../boost-root/__build__ + cmake --build . --target tests + + - name: Run tests + run: | + cd ../boost-root/__build__ + ctest --output-on-failure --no-tests=error + + MSYS2: + defaults: + run: + shell: msys2 {0} + strategy: + fail-fast: false + matrix: + include: + - { sys: MINGW32, compiler: gcc, cxxstd: '03,11,17,20', cxxflags: "-fexcess-precision=fast" } + - { sys: MINGW64, compiler: gcc, cxxstd: '03,11,17,20', cxxflags: "-fexcess-precision=fast" } + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup MSYS2 environment + uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + update: true + install: git python + pacboy: gcc:p cmake:p ninja:p + + - name: Fetch Boost.CI + uses: actions/checkout@v3 + with: + repository: boostorg/boost-ci + ref: master + path: boost-ci-cloned + - name: Get CI scripts folder + run: | + # Copy ci folder if not testing Boost.CI + [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . + rm -rf boost-ci-cloned + + - name: Setup Boost + env: + B2_COMPILER: ${{matrix.compiler}} + B2_CXXSTD: ${{matrix.cxxstd}} + B2_SANITIZE: ${{matrix.sanitize}} + B2_STDLIB: ${{matrix.stdlib}} + B2_CXXFLAGS: ${{matrix.cxxflags}} + run: ci/github/install.sh + + - name: Run tests + run: ci/build.sh posix-cmake-subdir-modules: diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 000000000..a9781924e --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,202 @@ +# Copyright 2020-2021 Peter Dimov +# Copyright 2021 Andrey Semashev +# Copyright 2021 Alexander Grund +# Copyright 2022 James E. King III +# Copyright 2023 Matt Borland +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) +--- +name: codecov + +on: + pull_request: + push: + branches: + - master + - develop + - bugfix/** + - feature/** + - fix/** + - pr/** + +env: + GIT_FETCH_JOBS: 8 + NET_RETRY_COUNT: 5 + B2_CI_VERSION: 1 + B2_VARIANT: debug,release + B2_LINK: shared,static + LCOV_BRANCH_COVERAGE: 0 + CODECOV_NAME: Github Actions + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + +jobs: + posix: + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + include: + - { name: Collect coverage, coverage: yes, + compiler: gcc-13, cxxstd: '23', cxxflags: '-fexcess-precision=fast', os: ubuntu-24.04, install: 'g++-13-multilib', address-model: '32,64' } + + timeout-minutes: 120 + runs-on: ${{matrix.os}} + container: ${{matrix.container}} + env: {B2_USE_CCACHE: 1} + + steps: + - name: Setup environment + run: | + if [ -f "/etc/debian_version" ]; then + echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV + export DEBIAN_FRONTEND=noninteractive + fi + if [ -n "${{matrix.container}}" ] && [ -f "/etc/debian_version" ]; then + apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common curl + # Need (newer) git, and the older Ubuntu container may require requesting the key manually using port 80 + curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg + for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done + apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + osver=$(lsb_release -sr | cut -f1 -d.) + pkgs="g++ git" + # Ubuntu 22+ has only Python 3 in the repos + if [ -n "$osver" ] && [ "$osver" -ge "22" ]; then + pkgs+=" python-is-python3 libpython3-dev" + else + pkgs+=" python libpython-dev" + fi + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs + fi + # For jobs not compatible with ccache, use "ccache: no" in the matrix + if [[ "${{ matrix.ccache }}" == "no" ]]; then + echo "B2_USE_CCACHE=0" >> $GITHUB_ENV + fi + git config --global pack.threads 0 + + - uses: actions/checkout@v3 + with: + # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' + fetch-depth: ${{ matrix.coverage && '0' || '1' }} + + - name: Cache ccache + uses: actions/cache@v3 + if: env.B2_USE_CCACHE + with: + path: ~/.ccache + key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} + restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- + + - name: Fetch Boost.CI + uses: actions/checkout@v3 + with: + repository: boostorg/boost-ci + ref: master + path: boost-ci-cloned + + - name: Get CI scripts folder + run: | + # Copy ci folder if not testing Boost.CI + [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . + rm -rf boost-ci-cloned + + - name: Install packages + if: startsWith(matrix.os, 'ubuntu') + run: | + SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}}) + SOURCES=(${{join(matrix.sources, ' ')}}) + # Add this by default + SOURCES+=(ppa:ubuntu-toolchain-r/test) + for key in "${SOURCE_KEYS[@]}"; do + for i in {1..$NET_RETRY_COUNT}; do + keyfilename=$(basename -s .key $key) + curl -sSL --retry ${NET_RETRY_COUNT:-5} "$key" | sudo gpg --dearmor > /etc/apt/trusted.gpg.d/${keyfilename} && break || sleep 10 + done + done + for source in "${SOURCES[@]}"; do + for i in {1..$NET_RETRY_COUNT}; do + sudo add-apt-repository $source && break || sleep 10 + done + done + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + if [[ -z "${{matrix.install}}" ]]; then + pkgs="${{matrix.compiler}}" + pkgs="${pkgs/gcc-/g++-}" + else + pkgs="${{matrix.install}}" + fi + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs locales + sudo locale-gen de_DE.UTF-8 + sudo update-locale + + - name: Setup GCC Toolchain + if: matrix.gcc_toolchain + run: | + GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" + echo "GCC_TOOLCHAIN_ROOT=$GCC_TOOLCHAIN_ROOT" >> $GITHUB_ENV + if ! command -v dpkg-architecture; then + apt-get install -y dpkg-dev + fi + MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" + mkdir -p "$GCC_TOOLCHAIN_ROOT" + ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" + ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" + mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" + ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" + + - name: Setup multiarch + if: matrix.multiarch + run: | + sudo apt-get install --no-install-recommends -y binfmt-support qemu-user-static + sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + git clone https://github.com/jeking3/bdde.git + echo "$(pwd)/bdde/bin/linux" >> ${GITHUB_PATH} + echo "BDDE_DISTRO=${{ matrix.distro }}" >> ${GITHUB_ENV} + echo "BDDE_EDITION=${{ matrix.edition }}" >> ${GITHUB_ENV} + echo "BDDE_ARCH=${{ matrix.arch }}" >> ${GITHUB_ENV} + echo "B2_WRAPPER=bdde" >> ${GITHUB_ENV} + + - name: Setup Boost + env: + B2_ADDRESS_MODEL: ${{matrix.address-model}} + B2_COMPILER: ${{matrix.compiler}} + B2_CXXSTD: ${{matrix.cxxstd}} + B2_SANITIZE: ${{matrix.sanitize}} + B2_STDLIB: ${{matrix.stdlib}} + B2_CXXFLAGS: ${{matrix.cxxflags}} + # More entries can be added in the same way, see the B2_ARGS assignment in ci/enforce.sh for the possible keys. + # B2_DEFINES: ${{matrix.defines}} + # Variables set here (to non-empty) will override the top-level environment variables, e.g. + # B2_VARIANT: ${{matrix.variant}} + # Set the (B2) target(s) to build, defaults to the test folder of the current library + # Can alternatively be done like this in the build step or in the build command of the build step, e.g. `run: B2_TARGETS=libs/$SELF/doc ci/build.sh` + # B2_TARGETS: libs/foo/test//bar + run: source ci/github/install.sh + + - name: Setup coverage collection + if: matrix.coverage + run: ci/github/codecov.sh "setup" + + - name: Run tests + if: '!matrix.coverity' + run: ci/build.sh + + - name: Upload coverage + if: matrix.coverage + run: ci/codecov.sh "upload" + env: + BOOST_CI_CODECOV_IO_UPLOAD: skip + + - name: Upload coverage + if: matrix.coverage + uses: codecov/codecov-action@v4 + with: + disable_search: true + file: coverage.info + name: Github Actions + token: ${{secrets.CODECOV_TOKEN}} + verbose: true diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml new file mode 100644 index 000000000..71b62bd2a --- /dev/null +++ b/.github/workflows/fuzz.yml @@ -0,0 +1,289 @@ +# Copyright 2021-2022 Andrey Semashev +# Copyright 2024 Matt Borland +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + +name: Fuzz + +on: + pull_request: + push: + branches: + - master + - develop + - feature/** + +env: + GIT_FETCH_JOBS: 8 + NET_RETRY_COUNT: 5 + DEFAULT_BUILD_VARIANT: debug,release + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + +jobs: + posix: + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + include: + + # Linux, clang + # https://llvm.org/docs/LibFuzzer.html#fuzzer-usage + - toolset: clang + compiler: clang++-12 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 + install: + - clang-12 + - toolset: clang + compiler: clang++-13 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 + install: + - clang-13 + - toolset: clang + compiler: clang++-14 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 + install: + - clang-14 + - toolset: clang + compiler: clang++-14 + cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu" + os: ubuntu-22.04 + install: + - clang-14 + - toolset: clang + compiler: clang++-15 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 + install: + - clang-15 + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + - toolset: clang + compiler: clang++-16 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 + install: + - clang-16 + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + - toolset: clang + compiler: clang++-17 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 + install: + - clang-17 + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + + + timeout-minutes: 60 + runs-on: ${{matrix.os}} + container: ${{matrix.container}} + + steps: + - name: Setup environment + run: | + if [ -f "/etc/debian_version" ] + then + echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV + export DEBIAN_FRONTEND=noninteractive + fi + if [ -n "${{matrix.container}}" ] + then + echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV + if [ -f "/etc/debian_version" ] + then + apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ] + then + PYTHON_PACKAGE="python-is-python3" + else + PYTHON_PACKAGE="python" + fi + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake + fi + fi + git config --global pack.threads 0 + - uses: actions/checkout@v3 + + - name: Install packages + if: matrix.install + run: | + declare -a SOURCE_KEYS SOURCES + if [ -n "${{join(matrix.source_keys, ' ')}}" ] + then + SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}") + fi + if [ -n "${{join(matrix.sources, ' ')}}" ] + then + SOURCES=("${{join(matrix.sources, '" "')}}") + fi + for key in "${SOURCE_KEYS[@]}" + do + for i in {1..$NET_RETRY_COUNT} + do + echo "Adding key: $key" + wget -O - "$key" | sudo apt-key add - && break || sleep 2 + done + done + if [ ${#SOURCES[@]} -gt 0 ] + then + APT_ADD_REPO_COMMON_ARGS=("-y") + APT_ADD_REPO_SUPPORTED_ARGS="$(apt-add-repository --help | perl -ne 'if (/^\s*-n/) { print "n"; } elsif (/^\s*-P/) { print "P"; } elsif (/^\s*-S/) { print "S"; } elsif (/^\s*-U/) { print "U"; }')" + if [ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*n*}" ] + then + APT_ADD_REPO_COMMON_ARGS+=("-n") + fi + APT_ADD_REPO_HAS_SOURCE_ARGS="$([ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*P*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*S*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*U*}" ] && echo 1 || echo 0)" + for source in "${SOURCES[@]}" + do + for i in {1..$NET_RETRY_COUNT} + do + APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}") + if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ] + then + case "$source" in + "ppa:"*) + APT_ADD_REPO_ARGS+=("-P") + ;; + "deb "*) + APT_ADD_REPO_ARGS+=("-S") + ;; + *) + APT_ADD_REPO_ARGS+=("-U") + ;; + esac + fi + APT_ADD_REPO_ARGS+=("$source") + echo "apt-add-repository ${APT_ADD_REPO_ARGS[@]}" + sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2 + done + done + fi + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} locales + sudo locale-gen de_DE.UTF-8 + sudo update-locale + - name: Setup GCC Toolchain + if: matrix.gcc_toolchain + run: | + GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" + echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV + MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" + mkdir -p "$GCC_TOOLCHAIN_ROOT" + ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" + ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" + mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" + ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) + echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV + echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV + DEPINST_ARGS=() + GIT_VERSION="$(git --version | sed -e 's/git version //')" + GIT_HAS_JOBS=1 + if [ -f "/etc/debian_version" ] + then + if $(dpkg --compare-versions "$GIT_VERSION" lt 2.8.0) + then + GIT_HAS_JOBS=0 + fi + else + declare -a GIT_VER=(${GIT_VERSION//./ }) + declare -a GIT_MIN_VER=(2 8 0) + for ((i=0; i<${#GIT_VER[@]}; i++)) + do + if [ -z "${GIT_MIN_VER[i]}" ] + then + GIT_MIN_VER[i]=0 + fi + if [ "${GIT_VER[i]}" -lt "${GIT_MIN_VER[i]}" ] + then + GIT_HAS_JOBS=0 + break + fi + done + fi + if [ "$GIT_HAS_JOBS" -ne 0 ] + then + DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") + fi + cd .. + git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" + cd boost-root + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + DEPINST_ARGS+=("$LIBRARY") + python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" + if [ -z "${{matrix.cmake_tests}}" ] + then + ./bootstrap.sh + ./b2 headers + if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam + if [ -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam + fi + echo " ;" >> ~/user-config.jam + fi + fi + - name: Run tests + if: matrix.cmake_tests == '' + run: | + cd ../boost-root/libs/$LIBRARY/fuzzing + B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}" "link=static,shared") + if [ -n "${{matrix.build_variant}}" ] + then + B2_ARGS+=("variant=${{matrix.build_variant}}") + else + B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") + fi + if [ -n "${{matrix.threading}}" ] + then + B2_ARGS+=("threading=${{matrix.threading}}") + fi + if [ -n "${{matrix.ubsan}}" ] + then + export UBSAN_OPTIONS="print_stacktrace=1" + B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global") + fi + if [ -n "${{matrix.cxxflags}}" ] + then + B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") + fi + if [ -n "${{matrix.linkflags}}" ] + then + B2_ARGS+=("linkflags=${{matrix.linkflags}}") + fi + if [ -n "${{matrix.address_model}}" ] + then + B2_ARGS+=("address-model=${{matrix.address_model}}") + fi + ../../../b2 "${B2_ARGS[@]}" diff --git a/.github/workflows/qemu.yml b/.github/workflows/qemu.yml new file mode 100644 index 000000000..08df8eea8 --- /dev/null +++ b/.github/workflows/qemu.yml @@ -0,0 +1,204 @@ +# Copyright 2020-2021 Peter Dimov +# Copyright 2021 Andrey Semashev +# Copyright 2021 Alexander Grund +# Copyright 2022 James E. King III +# Copyright 2024 Matt Borland +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) +--- +name: qemu + +on: + pull_request: + push: + branches: + - master + - develop + - bugfix/** + - feature/** + - fix/** + - pr/** + +env: + GIT_FETCH_JOBS: 8 + NET_RETRY_COUNT: 5 + B2_CI_VERSION: 1 + B2_VARIANT: debug,release + B2_LINK: shared,static + LCOV_BRANCH_COVERAGE: 0 + CODECOV_NAME: Github Actions + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + +jobs: + posix: + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + include: + # multiarch testing + - { name: PPC64LE-GCC, multiarch: yes, + compiler: gcc, cxxstd: '11', os: ubuntu-22.04, ccache: no, distro: alpine, edition: edge, arch: ppc64le } + - { name: PPC64LE-Clang, multiarch: yes, + compiler: clang, cxxstd: '11', os: ubuntu-22.04, ccache: no, distro: alpine, edition: edge, arch: ppc64le } + + + timeout-minutes: 360 + runs-on: ${{matrix.os}} + container: ${{matrix.container}} + env: {B2_USE_CCACHE: 1} + + steps: + - name: Setup environment + run: | + if [ -f "/etc/debian_version" ]; then + echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV + export DEBIAN_FRONTEND=noninteractive + fi + if [ -n "${{matrix.container}}" ] && [ -f "/etc/debian_version" ]; then + apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common curl + # Need (newer) git, and the older Ubuntu container may require requesting the key manually using port 80 + curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg + for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done + apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + osver=$(lsb_release -sr | cut -f1 -d.) + pkgs="g++ git" + # Ubuntu 22+ has only Python 3 in the repos + if [ -n "$osver" ] && [ "$osver" -ge "22" ]; then + pkgs+=" python-is-python3 libpython3-dev" + else + pkgs+=" python libpython-dev" + fi + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs + fi + # For jobs not compatible with ccache, use "ccache: no" in the matrix + if [[ "${{ matrix.ccache }}" == "no" ]]; then + echo "B2_USE_CCACHE=0" >> $GITHUB_ENV + fi + git config --global pack.threads 0 + if [[ "${{matrix.container}}" == "ubuntu:16.04" ]] || [[ "${{matrix.container}}" == "ubuntu:18.04" ]]; then + # Ubuntu 16/18 can't run Node 20, so stick to older actions: https://github.com/actions/checkout/issues/1590 + echo "GHA_USE_NODE_20=false" >> $GITHUB_ENV + echo "ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true" >> $GITHUB_ENV + else + echo "GHA_USE_NODE_20=true" >> $GITHUB_ENV + fi + + - uses: actions/checkout@v3 + if: env.GHA_USE_NODE_20 == 'false' + with: + # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' + fetch-depth: ${{ matrix.coverage && '0' || '1' }} + - uses: actions/checkout@v4 + if: env.GHA_USE_NODE_20 == 'true' + with: + # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' + fetch-depth: ${{ matrix.coverage && '0' || '1' }} + + - name: Cache ccache + uses: actions/cache@v3 + if: env.B2_USE_CCACHE && env.GHA_USE_NODE_20 == 'false' + with: + path: ~/.ccache + key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} + restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- + + - name: Cache ccache + uses: actions/cache@v4 + if: env.B2_USE_CCACHE && env.GHA_USE_NODE_20 == 'true' + with: + path: ~/.ccache + key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} + restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- + + - name: Fetch Boost.CI + uses: actions/checkout@v3 + if: env.GHA_USE_NODE_20 == 'false' + with: + repository: boostorg/boost-ci + ref: master + path: boost-ci-cloned + + - name: Fetch Boost.CI + uses: actions/checkout@v4 + if: env.GHA_USE_NODE_20 == 'true' + with: + repository: boostorg/boost-ci + ref: master + path: boost-ci-cloned + + - name: Get CI scripts folder + run: | + # Copy ci folder if not testing Boost.CI + [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . + rm -rf boost-ci-cloned + + - name: Install packages + if: startsWith(matrix.os, 'ubuntu') + run: | + SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}}) + SOURCES=(${{join(matrix.sources, ' ')}}) + # Add this by default + SOURCE_KEYS+=('http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9377A2BA9EF27F') + SOURCES+=(ppa:ubuntu-toolchain-r/test) + + ci/add-apt-keys.sh "${SOURCE_KEYS[@]}" + # Initial update before adding sources required to get e.g. keys + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + ci/add-apt-repositories.sh "${SOURCES[@]}" + + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + if [[ -z "${{matrix.install}}" ]]; then + pkgs="${{matrix.compiler}}" + pkgs="${pkgs/gcc-/g++-}" + else + pkgs="${{matrix.install}}" + fi + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs + + - name: Setup GCC Toolchain + if: matrix.gcc_toolchain + run: | + GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" + echo "GCC_TOOLCHAIN_ROOT=$GCC_TOOLCHAIN_ROOT" >> $GITHUB_ENV + if ! command -v dpkg-architecture; then + apt-get install -y dpkg-dev + fi + MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" + mkdir -p "$GCC_TOOLCHAIN_ROOT" + ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" + ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" + mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" + ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" + + - name: Setup multiarch + if: matrix.multiarch + env: + BDDE_DISTRO: ${{matrix.distro}} + BDDE_EDITION: ${{matrix.edition}} + BDDE_ARCH: ${{matrix.arch}} + run: ci/github/setup_bdde.sh + + - name: Setup Boost + env: + B2_ADDRESS_MODEL: ${{matrix.address-model}} + B2_COMPILER: ${{matrix.compiler}} + B2_CXXSTD: ${{matrix.cxxstd}} + B2_SANITIZE: ${{matrix.sanitize}} + B2_STDLIB: ${{matrix.stdlib}} + # More entries can be added in the same way, see the B2_ARGS assignment in ci/enforce.sh for the possible keys. + # B2_DEFINES: ${{matrix.defines}} + # Variables set here (to non-empty) will override the top-level environment variables, e.g. + # B2_VARIANT: ${{matrix.variant}} + # Set the (B2) target(s) to build, defaults to the test folder of the current library + # Can alternatively be done like this in the build step or in the build command of the build step, e.g. `run: B2_TARGETS=libs/$SELF/doc ci/build.sh` + # B2_TARGETS: libs/foo/test//bar + run: source ci/github/install.sh + + - name: Run tests + if: '!matrix.coverity' + run: ci/build.sh From 0b43cfba2885e94a1f2a65753caf73536f9499d1 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 11 Jan 2025 19:34:36 +0100 Subject: [PATCH 72/84] Test cleanup 1 --- test/from_chars_float2.cpp | 4 ++-- test/from_chars_string_view.cpp | 4 +++- test/github_issue_110.cpp | 2 +- test/github_issue_122.cpp | 1 - test/github_issue_152.cpp | 1 + test/github_issue_186.cpp | 2 +- test/github_issue_212.cpp | 5 +++-- test/limits.cpp | 1 + test/limits_link_1.cpp | 6 ++---- test/limits_link_2.cpp | 5 ++--- test/quick.cpp | 1 - test/roundtrip.cpp | 4 ++-- test/test_128bit_native.cpp | 2 +- test/test_boost_json_values.cpp | 7 +++---- test/to_chars_float.cpp | 1 + test/to_chars_sprintf.cpp | 2 ++ 16 files changed, 25 insertions(+), 23 deletions(-) diff --git a/test/from_chars_float2.cpp b/test/from_chars_float2.cpp index eea72cf90..267dcd2ed 100644 --- a/test/from_chars_float2.cpp +++ b/test/from_chars_float2.cpp @@ -4,7 +4,7 @@ #ifdef BOOST_USE_MODULES #include -#include // stderr +#include import std; import boost.core; import boost.charconv; @@ -12,9 +12,9 @@ import boost.charconv; #include #include #include +#include #endif - static boost::detail::splitmix64 rng; template void zero_extend_test() diff --git a/test/from_chars_string_view.cpp b/test/from_chars_string_view.cpp index 7fe1d06c3..e82579e3c 100644 --- a/test/from_chars_string_view.cpp +++ b/test/from_chars_string_view.cpp @@ -6,12 +6,14 @@ #ifdef BOOST_USE_MODULES #include #include -#include +#include +#include import std; import boost.core; import boost.charconv; #else #include +#include #include #include #include diff --git a/test/github_issue_110.cpp b/test/github_issue_110.cpp index fa402cf2e..564fbb760 100644 --- a/test/github_issue_110.cpp +++ b/test/github_issue_110.cpp @@ -5,6 +5,7 @@ #ifdef BOOST_USE_MODULES #include #include +#include #include import std; import boost.core; @@ -14,7 +15,6 @@ import boost.charconv; #include #endif - template void overflow_spot_value(const std::string& buffer, boost::charconv::chars_format fmt = boost::charconv::chars_format::general) { diff --git a/test/github_issue_122.cpp b/test/github_issue_122.cpp index 42dc5b079..c9d8e6539 100644 --- a/test/github_issue_122.cpp +++ b/test/github_issue_122.cpp @@ -17,7 +17,6 @@ import boost.core; #include #endif - template void test() { diff --git a/test/github_issue_152.cpp b/test/github_issue_152.cpp index cf5fef0cf..23a62d01f 100644 --- a/test/github_issue_152.cpp +++ b/test/github_issue_152.cpp @@ -7,6 +7,7 @@ #include #include #include +#include import std; import boost.core; import boost.charconv; diff --git a/test/github_issue_186.cpp b/test/github_issue_186.cpp index f8f7ed8a2..d49193291 100644 --- a/test/github_issue_186.cpp +++ b/test/github_issue_186.cpp @@ -5,10 +5,10 @@ // See: https://github.com/boostorg/charconv/issues/186 #ifdef BOOST_USE_MODULES +#include import std; import boost.core; import boost.charconv; -#include #else #include #include diff --git a/test/github_issue_212.cpp b/test/github_issue_212.cpp index f1dba572a..94dcda33c 100644 --- a/test/github_issue_212.cpp +++ b/test/github_issue_212.cpp @@ -3,18 +3,19 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include import std; import boost.core; import boost.charconv; -#include #else #include #include #include +#include #include #endif -#include template diff --git a/test/limits.cpp b/test/limits.cpp index 18ae1832c..40882f56a 100644 --- a/test/limits.cpp +++ b/test/limits.cpp @@ -7,6 +7,7 @@ #ifdef BOOST_USE_MODULES #include #include +#include #include import std; import boost.charconv; diff --git a/test/limits_link_1.cpp b/test/limits_link_1.cpp index 13dfe8b7d..36825456e 100644 --- a/test/limits_link_1.cpp +++ b/test/limits_link_1.cpp @@ -2,18 +2,16 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include - #ifdef BOOST_USE_MODULES #include #include +#include import boost.charconv; #else -#include #include +#include #endif - void test_odr_use( int const* ); template void test() diff --git a/test/limits_link_2.cpp b/test/limits_link_2.cpp index 450cbf0f6..c65611608 100644 --- a/test/limits_link_2.cpp +++ b/test/limits_link_2.cpp @@ -2,15 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include - #ifdef BOOST_USE_MODULES #include #include +#include import boost.charconv; #else #include -#include +#include #endif void test_odr_use( int const* ); diff --git a/test/quick.cpp b/test/quick.cpp index 88a2d477e..e05be9869 100644 --- a/test/quick.cpp +++ b/test/quick.cpp @@ -13,7 +13,6 @@ import boost.charconv; #include #endif - int main() { char buffer[ 32 ]; diff --git a/test/roundtrip.cpp b/test/roundtrip.cpp index b5fa4b6f0..16f963e30 100644 --- a/test/roundtrip.cpp +++ b/test/roundtrip.cpp @@ -2,17 +2,17 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES #include +#ifdef BOOST_USE_MODULES #include #include +#include #include #include // for INT64_C import std; import boost.charconv; import boost.core; #else -#include #include #include #include diff --git a/test/test_128bit_native.cpp b/test/test_128bit_native.cpp index d5ddcc90b..9a660da13 100644 --- a/test/test_128bit_native.cpp +++ b/test/test_128bit_native.cpp @@ -2,7 +2,6 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt - #ifdef BOOST_USE_MODULES #include #include @@ -14,6 +13,7 @@ import boost.core; #include #include #include +#include #endif diff --git a/test/test_boost_json_values.cpp b/test/test_boost_json_values.cpp index 60b7d4f08..77ff29df5 100644 --- a/test/test_boost_json_values.cpp +++ b/test/test_boost_json_values.cpp @@ -9,6 +9,8 @@ #ifdef BOOST_USE_MODULES #include +#include // PRId64 +#include // stderr import std; import boost.core; import boost.charconv; @@ -24,12 +26,9 @@ import boost.charconv; #include #include #include +#include #endif -#include // PRId64 -#include // stderr - - template void grind(const std::string& str, const T expected_value) { diff --git a/test/to_chars_float.cpp b/test/to_chars_float.cpp index 5a0f58a54..f01451650 100644 --- a/test/to_chars_float.cpp +++ b/test/to_chars_float.cpp @@ -7,6 +7,7 @@ #include #include #include +#include import std; import boost.core; import boost.charconv; diff --git a/test/to_chars_sprintf.cpp b/test/to_chars_sprintf.cpp index 8d3a122ce..76f0dc37b 100644 --- a/test/to_chars_sprintf.cpp +++ b/test/to_chars_sprintf.cpp @@ -4,7 +4,9 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include #include +#include #include import std; import boost.core; From 65e535635e5bc14741101af39b2044151be6a0c0 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 11 Jan 2025 19:47:36 +0100 Subject: [PATCH 73/84] Test cleanup 2 --- test/from_chars.cpp | 2 +- test/from_chars_float2.cpp | 2 +- test/from_chars_string_view.cpp | 2 +- test/github_issue_110.cpp | 2 +- test/github_issue_152.cpp | 2 +- test/github_issue_212.cpp | 4 +--- test/limits.cpp | 2 +- test/roundtrip.cpp | 7 ++++--- test/test_128bit_emulation.cpp | 7 +++---- test/test_boost_json_values.cpp | 2 +- test/test_compute_float32.cpp | 10 ++++++---- test/test_compute_float64.cpp | 8 +++++--- test/test_compute_float80.cpp | 11 ++++++----- test/test_num_digits.cpp | 12 ++++++------ test/test_parser.cpp | 4 +--- test/to_chars.cpp | 5 ++--- test/to_chars_float.cpp | 3 +-- test/to_chars_sprintf.cpp | 7 +++---- 18 files changed, 45 insertions(+), 47 deletions(-) diff --git a/test/from_chars.cpp b/test/from_chars.cpp index 2ebfe93aa..f10b2c178 100644 --- a/test/from_chars.cpp +++ b/test/from_chars.cpp @@ -4,10 +4,10 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include #include #include #include -#include import std; import boost.charconv; import boost.core; diff --git a/test/from_chars_float2.cpp b/test/from_chars_float2.cpp index 267dcd2ed..9f1ecc6f1 100644 --- a/test/from_chars_float2.cpp +++ b/test/from_chars_float2.cpp @@ -3,8 +3,8 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES -#include #include +#include import std; import boost.core; import boost.charconv; diff --git a/test/from_chars_string_view.cpp b/test/from_chars_string_view.cpp index e82579e3c..126ed87d6 100644 --- a/test/from_chars_string_view.cpp +++ b/test/from_chars_string_view.cpp @@ -4,10 +4,10 @@ #ifdef BOOST_USE_MODULES +#include #include #include #include -#include import std; import boost.core; import boost.charconv; diff --git a/test/github_issue_110.cpp b/test/github_issue_110.cpp index 564fbb760..9161f1df7 100644 --- a/test/github_issue_110.cpp +++ b/test/github_issue_110.cpp @@ -3,10 +3,10 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include #include #include #include -#include import std; import boost.core; import boost.charconv; diff --git a/test/github_issue_152.cpp b/test/github_issue_152.cpp index 23a62d01f..4d47db56f 100644 --- a/test/github_issue_152.cpp +++ b/test/github_issue_152.cpp @@ -3,8 +3,8 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES -#include #include +#include #include #include #include diff --git a/test/github_issue_212.cpp b/test/github_issue_212.cpp index 94dcda33c..7cb3fcdf0 100644 --- a/test/github_issue_212.cpp +++ b/test/github_issue_212.cpp @@ -3,8 +3,8 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES -#include #include +#include import std; import boost.core; import boost.charconv; @@ -16,8 +16,6 @@ import boost.charconv; #include #endif - - template void test() { diff --git a/test/limits.cpp b/test/limits.cpp index 40882f56a..0428d9181 100644 --- a/test/limits.cpp +++ b/test/limits.cpp @@ -5,10 +5,10 @@ #include #ifdef BOOST_USE_MODULES +#include #include #include #include -#include import std; import boost.charconv; import boost.core; diff --git a/test/roundtrip.cpp b/test/roundtrip.cpp index 16f963e30..2e1f6a6f1 100644 --- a/test/roundtrip.cpp +++ b/test/roundtrip.cpp @@ -4,11 +4,12 @@ #include #ifdef BOOST_USE_MODULES +#include // for INT64_C +#include +#include #include #include #include -#include -#include // for INT64_C import std; import boost.charconv; import boost.core; @@ -23,9 +24,9 @@ import boost.core; #include #include #include +#include #endif -#include #ifdef BOOST_HAS_INT128 diff --git a/test/test_128bit_emulation.cpp b/test/test_128bit_emulation.cpp index bdddf6a8b..c688a7813 100644 --- a/test/test_128bit_emulation.cpp +++ b/test/test_128bit_emulation.cpp @@ -2,7 +2,9 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #ifdef BOOST_USE_MODULES +#include #include #include #include @@ -14,11 +16,8 @@ import boost.core; #include #include #include -#endif - -#include #include - +#endif #ifdef BOOST_HAS_INT128 diff --git a/test/test_boost_json_values.cpp b/test/test_boost_json_values.cpp index 77ff29df5..b6009899c 100644 --- a/test/test_boost_json_values.cpp +++ b/test/test_boost_json_values.cpp @@ -8,9 +8,9 @@ // See: https://github.com/boostorg/json/blob/develop/test/double.cpp #ifdef BOOST_USE_MODULES -#include #include // PRId64 #include // stderr +#include import std; import boost.core; import boost.charconv; diff --git a/test/test_compute_float32.cpp b/test/test_compute_float32.cpp index 0991f1bd7..ec8dc22fa 100644 --- a/test/test_compute_float32.cpp +++ b/test/test_compute_float32.cpp @@ -3,18 +3,20 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include #include #include +#include import std; import boost.core; #else +#include #include #include -#endif - -#include -#include #include +#include +#endif using boost::charconv::detail::compute_float32; diff --git a/test/test_compute_float64.cpp b/test/test_compute_float64.cpp index 7ec02870a..6162dc0c0 100644 --- a/test/test_compute_float64.cpp +++ b/test/test_compute_float64.cpp @@ -3,19 +3,21 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include #include #include +#include import std; import boost.core; #else +#include #include #include #include -#endif - -#include #include #include +#endif using boost::charconv::detail::compute_float64; diff --git a/test/test_compute_float80.cpp b/test/test_compute_float80.cpp index 0a7a4159a..f660bde02 100644 --- a/test/test_compute_float80.cpp +++ b/test/test_compute_float80.cpp @@ -5,9 +5,15 @@ #ifdef BOOST_USE_MODULES #include #include +#include +#include +#include import std; import boost.core; #else +#include +#include +#include #include #include #include @@ -17,11 +23,6 @@ import boost.core; #include #endif -#include -#include -#include - - // MSVC uses long double = double // Darwin sometimes uses double-double instead of long double #if BOOST_CHARCONV_LDBL_BITS > 64 && !defined(__APPLE__) && !defined(_WIN32) && !defined(_WIN64) diff --git a/test/test_num_digits.cpp b/test/test_num_digits.cpp index 2a342053a..6613a3dc9 100644 --- a/test/test_num_digits.cpp +++ b/test/test_num_digits.cpp @@ -2,23 +2,23 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt - #ifdef BOOST_USE_MODULES #include #include +#include +#include +#include import std; import boost.core; #else +#include +#include +#include #include #include #include #endif -#include -#include -#include - - #if defined(__GNUC__) && (__GNUC__ < 7) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Woverflow" diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 55733b0ea..8aa061514 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -10,9 +10,9 @@ import std; import boost.core; import boost.charconv; #else +#include #include #include -#include #include #include #include @@ -21,8 +21,6 @@ import boost.charconv; #include #endif - - void test_integer() { std::uint64_t significand {}; diff --git a/test/to_chars.cpp b/test/to_chars.cpp index 0a1709a46..98568e1bb 100644 --- a/test/to_chars.cpp +++ b/test/to_chars.cpp @@ -4,6 +4,8 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include // for INT_MIN +#include // for UINT64_C #include #include #include @@ -21,9 +23,6 @@ import boost.core; #include #endif -#include // for INT_MIN -#include // for UINT64_C - #ifdef BOOST_CHARCONV_HAS_INT128 template void test_128bit_int() diff --git a/test/to_chars_float.cpp b/test/to_chars_float.cpp index f01451650..556806017 100644 --- a/test/to_chars_float.cpp +++ b/test/to_chars_float.cpp @@ -15,7 +15,6 @@ import boost.charconv; #include #include #include -#include #include #include #include @@ -27,9 +26,9 @@ import boost.charconv; #include #include #include +#include #endif - // These numbers diverge from what the formatting is using printf // See: https://godbolt.org/z/zd34KcWMW template diff --git a/test/to_chars_sprintf.cpp b/test/to_chars_sprintf.cpp index 76f0dc37b..70d3306cf 100644 --- a/test/to_chars_sprintf.cpp +++ b/test/to_chars_sprintf.cpp @@ -4,10 +4,11 @@ // https://www.boost.org/LICENSE_1_0.txt #ifdef BOOST_USE_MODULES +#include +#include #include #include #include -#include import std; import boost.core; import boost.charconv; @@ -22,12 +23,10 @@ import boost.charconv; #include #include #include +#include #include #endif -#include -#include - int const N = 1024; static boost::detail::splitmix64 rng; From 3c62c5de911f6b2b6e1e7dc21de53276be11525d Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 14 Jan 2025 17:10:22 +0100 Subject: [PATCH 74/84] Initial implementation of compatibility headers --- include/boost/charconv/chars_format.hpp | 8 +++++++ include/boost/charconv/from_chars.hpp | 8 +++++++ include/boost/charconv/limits.hpp | 8 +++++++ include/boost/charconv/to_chars.hpp | 8 +++++++ test/before_impl_headers.hpp | 7 ++++++ test/from_chars.cpp | 29 +++++++++---------------- test/quick.cpp | 4 ---- test/to_chars.cpp | 25 +++++++-------------- 8 files changed, 57 insertions(+), 40 deletions(-) create mode 100644 test/before_impl_headers.hpp diff --git a/include/boost/charconv/chars_format.hpp b/include/boost/charconv/chars_format.hpp index 0542372bf..ffbc42d47 100644 --- a/include/boost/charconv/chars_format.hpp +++ b/include/boost/charconv/chars_format.hpp @@ -5,6 +5,12 @@ #ifndef BOOST_CHARCONV_CHARS_FORMAT_HPP #define BOOST_CHARCONV_CHARS_FORMAT_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_SOURCE) + +import boost.charconv; + +#else + namespace boost { namespace charconv { // Floating-point format for primitive numerical conversion @@ -19,4 +25,6 @@ enum class chars_format : unsigned }} // Namespaces +#endif + #endif // BOOST_CHARCONV_CHARS_FORMAT_HPP diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index 4589cd168..6ffc8ce5f 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -6,6 +6,12 @@ #ifndef BOOST_CHARCONV_FROM_CHARS_HPP_INCLUDED #define BOOST_CHARCONV_FROM_CHARS_HPP_INCLUDED +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_SOURCE) + +import boost.charconv; + +#else + #include #include #include @@ -254,4 +260,6 @@ BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, st } // namespace charconv } // namespace boost +#endif + #endif // #ifndef BOOST_CHARCONV_FROM_CHARS_HPP_INCLUDED diff --git a/include/boost/charconv/limits.hpp b/include/boost/charconv/limits.hpp index 7c3985cac..26fafd5f0 100644 --- a/include/boost/charconv/limits.hpp +++ b/include/boost/charconv/limits.hpp @@ -5,6 +5,12 @@ #ifndef BOOST_CHARCONV_LIMITS_HPP #define BOOST_CHARCONV_LIMITS_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_SOURCE) + +import boost.charconv; + +#else + #include #ifndef BOOST_USE_MODULES #include @@ -95,4 +101,6 @@ template BOOST_ATTRIBUTE_UNUSED constexpr int limits::max_chars; }} // namespace boost::charconv +#endif + #endif // BOOST_CHARCONV_LIMITS_HPP diff --git a/include/boost/charconv/to_chars.hpp b/include/boost/charconv/to_chars.hpp index 7192fda57..db0c1ce60 100644 --- a/include/boost/charconv/to_chars.hpp +++ b/include/boost/charconv/to_chars.hpp @@ -7,6 +7,12 @@ #ifndef BOOST_CHARCONV_TO_CHARS_HPP_INCLUDED #define BOOST_CHARCONV_TO_CHARS_HPP_INCLUDED +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_SOURCE) + +import boost.charconv; + +#else + #include #include #include @@ -144,4 +150,6 @@ BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::bfloa } // namespace charconv } // namespace boost +#endif + #endif // #ifndef BOOST_CHARCONV_TO_CHARS_HPP_INCLUDED diff --git a/test/before_impl_headers.hpp b/test/before_impl_headers.hpp new file mode 100644 index 000000000..76dd4eb9f --- /dev/null +++ b/test/before_impl_headers.hpp @@ -0,0 +1,7 @@ +#ifndef BOOST_CHARCONV_TEST_BEFORE_IMPL_HEADERS +#define BOOST_CHARCONV_TEST_BEFORE_IMPL_HEADERS + +#include +#define BOOST_CHARCONV_SOURCE // prevent ifdefs in public headers. TODO: does this cause trouble in Windows? + +#endif diff --git a/test/from_chars.cpp b/test/from_chars.cpp index f10b2c178..1d61b513e 100644 --- a/test/from_chars.cpp +++ b/test/from_chars.cpp @@ -3,31 +3,22 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -import std; -import boost.charconv; -import boost.core; -#else #include #include -#include -#include -#include -#include -#include -#include -#include +#include "before_impl_headers.hpp" +#include +#include +#include +#include +#include +#include +#include +#include #if defined(__has_include) # if __has_include() -# include +# include # endif #endif -#endif - #ifdef BOOST_CHARCONV_HAS_INT128 template diff --git a/test/quick.cpp b/test/quick.cpp index e05be9869..5d71c37a8 100644 --- a/test/quick.cpp +++ b/test/quick.cpp @@ -7,11 +7,7 @@ # pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif -#ifdef BOOST_USE_MODULES -import boost.charconv; -#else #include -#endif int main() { diff --git a/test/to_chars.cpp b/test/to_chars.cpp index 98568e1bb..7209b6eb9 100644 --- a/test/to_chars.cpp +++ b/test/to_chars.cpp @@ -3,25 +3,16 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include // for INT_MIN -#include // for UINT64_C -#include -#include -#include -import std; -import boost.charconv; -import boost.core; -#else #include #include -#include -#include -#include -#include -#include -#include -#endif +#include "before_impl_headers.hpp" +#include +#include +#include +#include +#include +#include +#include #ifdef BOOST_CHARCONV_HAS_INT128 template From fbc1c421d3349ad6d4df481456c2f963776dae43 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 14 Jan 2025 18:12:58 +0100 Subject: [PATCH 75/84] Refactor public macros --- include/boost/charconv/detail/bit_layouts.hpp | 15 +--- include/boost/charconv/detail/config.hpp | 1 + .../detail/global_module_fragment.hpp | 2 +- include/boost/charconv/detail/macros.hpp | 72 +++++++++++++++++++ include/boost/charconv/from_chars.hpp | 1 + include/boost/charconv/limits.hpp | 1 + include/boost/charconv/to_chars.hpp | 1 + 7 files changed, 80 insertions(+), 13 deletions(-) create mode 100644 include/boost/charconv/detail/macros.hpp diff --git a/include/boost/charconv/detail/bit_layouts.hpp b/include/boost/charconv/detail/bit_layouts.hpp index d5b280a46..4b0db5c78 100644 --- a/include/boost/charconv/detail/bit_layouts.hpp +++ b/include/boost/charconv/detail/bit_layouts.hpp @@ -59,7 +59,7 @@ struct ieee754_binary64 }; // 80 bit long double (e.g. x86-64) -#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 +#if BOOST_CHARCONV_LDBL_BITS == 80 struct IEEEl2bits { @@ -86,10 +86,8 @@ struct ieee754_binary80 static constexpr int decimal_digits = 18; }; -#define BOOST_CHARCONV_LDBL_BITS 80 - // 128 bit long double (e.g. s390x, ppcle64) -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 +#elif BOOST_CHARCONV_LDBL_BITS == 128 struct IEEEl2bits { @@ -106,10 +104,8 @@ struct IEEEl2bits #endif }; -#define BOOST_CHARCONV_LDBL_BITS 128 - // 64 bit long double (double == long double on ARM) -#elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +#elif BOOST_CHARCONV_LDBL_BITS == 64 struct IEEEl2bits { @@ -126,11 +122,6 @@ struct IEEEl2bits #endif }; -#define BOOST_CHARCONV_LDBL_BITS 64 - -#else // Unsupported long double representation -# define BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE -# define BOOST_CHARCONV_LDBL_BITS -1 #endif struct IEEEbinary128 diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index 07dca3bbc..bf2670455 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -5,6 +5,7 @@ #ifndef BOOST_CHARCONV_DETAIL_CONFIG_HPP #define BOOST_CHARCONV_DETAIL_CONFIG_HPP +#include #ifndef BOOST_USE_MODULES #include #include diff --git a/include/boost/charconv/detail/global_module_fragment.hpp b/include/boost/charconv/detail/global_module_fragment.hpp index 35f532ded..347375b19 100644 --- a/include/boost/charconv/detail/global_module_fragment.hpp +++ b/include/boost/charconv/detail/global_module_fragment.hpp @@ -11,7 +11,7 @@ #include // for UINT64_C #include // for CHAR_BIT #include -#include // for HUGE_VAL +#include // for HUGE_VAL #include #include #include diff --git a/include/boost/charconv/detail/macros.hpp b/include/boost/charconv/detail/macros.hpp new file mode 100644 index 000000000..2c82b430e --- /dev/null +++ b/include/boost/charconv/detail/macros.hpp @@ -0,0 +1,72 @@ +// Copyright 2023 Matt Borland +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_CHARCONV_DETAIL_MACROS_HPP +#define BOOST_CHARCONV_DETAIL_MACROS_HPP + +// Extracted from config.hpp, with macros that should be public +// or are used in the tests +#include +#include + +// Use 128-bit integers and suppress warnings for using extensions +#if defined(BOOST_HAS_INT128) +# define BOOST_CHARCONV_HAS_INT128 +# define BOOST_CHARCONV_INT128_MAX static_cast((static_cast(1) << 127) - 1) +# define BOOST_CHARCONV_INT128_MIN (-BOOST_CHARCONV_INT128_MAX - 1) +# define BOOST_CHARCONV_UINT128_MAX (2 * static_cast(BOOST_CHARCONV_INT128_MAX) + 1) +#endif + +#ifndef BOOST_NO_CXX14_CONSTEXPR +# define BOOST_CHARCONV_CXX14_CONSTEXPR BOOST_CXX14_CONSTEXPR +# define BOOST_CHARCONV_CXX14_CONSTEXPR_NO_INLINE BOOST_CXX14_CONSTEXPR +#else +# define BOOST_CHARCONV_CXX14_CONSTEXPR inline +# define BOOST_CHARCONV_CXX14_CONSTEXPR_NO_INLINE +#endif + +#if defined(__GNUC__) && __GNUC__ == 5 +# define BOOST_CHARCONV_GCC5_CONSTEXPR inline +#else +# define BOOST_CHARCONV_GCC5_CONSTEXPR BOOST_CHARCONV_CXX14_CONSTEXPR +#endif + +// C++17 allowed for constexpr lambdas +#if defined(__cpp_constexpr) && __cpp_constexpr >= 201603L +# define BOOST_CHARCONV_CXX17_CONSTEXPR constexpr +#else +# define BOOST_CHARCONV_CXX17_CONSTEXPR inline +#endif + +// Detection for C++23 fixed width floating point types +// All of these types are optional so check for each of them individually +#ifdef __STDCPP_FLOAT16_T__ +# define BOOST_CHARCONV_HAS_FLOAT16 +#endif +#ifdef __STDCPP_FLOAT32_T__ +# define BOOST_CHARCONV_HAS_FLOAT32 +#endif +#ifdef __STDCPP_FLOAT64_T__ +# define BOOST_CHARCONV_HAS_FLOAT64 +#endif +#ifdef __STDCPP_FLOAT128_T__ +# define BOOST_CHARCONV_HAS_STDFLOAT128 +#endif +#ifdef __STDCPP_BFLOAT16_T__ +# define BOOST_CHARCONV_HAS_BRAINFLOAT16 +#endif + +// Long double support +#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 // 80 bit long double (e.g. x86-64) +# define BOOST_CHARCONV_LDBL_BITS 80 +#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 // 128 bit long double (e.g. s390x, ppcle64) +# define BOOST_CHARCONV_LDBL_BITS 128 +#elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 // 64 bit long double (double == long double on ARM) +# define BOOST_CHARCONV_LDBL_BITS 64 +#else // Unsupported long double representation +# define BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE +# define BOOST_CHARCONV_LDBL_BITS -1 +#endif + +#endif // BOOST_CHARCONV_DETAIL_CONFIG_HPP diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index 6ffc8ce5f..67f7fac10 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -8,6 +8,7 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_SOURCE) +#include import boost.charconv; #else diff --git a/include/boost/charconv/limits.hpp b/include/boost/charconv/limits.hpp index 26fafd5f0..1d50bc428 100644 --- a/include/boost/charconv/limits.hpp +++ b/include/boost/charconv/limits.hpp @@ -7,6 +7,7 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_SOURCE) +#include import boost.charconv; #else diff --git a/include/boost/charconv/to_chars.hpp b/include/boost/charconv/to_chars.hpp index db0c1ce60..f7105f259 100644 --- a/include/boost/charconv/to_chars.hpp +++ b/include/boost/charconv/to_chars.hpp @@ -9,6 +9,7 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_SOURCE) +#include import boost.charconv; #else From 2956bc36b975d512595a9d9914069e06be0a9f38 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 14 Jan 2025 18:13:12 +0100 Subject: [PATCH 76/84] Move some tests to compatibility headers --- test/from_chars.cpp | 2 -- test/limits.cpp | 18 ++++-------------- test/limits_link_1.cpp | 8 -------- test/limits_link_2.cpp | 8 -------- test/roundtrip.cpp | 27 +++++++-------------------- test/test_128bit_emulation.cpp | 21 ++++++--------------- test/test_128bit_native.cpp | 14 +++----------- test/test_compute_float32.cpp | 15 +++------------ test/test_compute_float64.cpp | 17 ++++------------- test/test_compute_float80.cpp | 25 ++++++++----------------- test/test_num_digits.cpp | 17 ++++------------- test/test_parser.cpp | 20 ++++++-------------- test/to_chars.cpp | 4 ++-- test/to_chars_sprintf.cpp | 29 +++++++++-------------------- 14 files changed, 56 insertions(+), 169 deletions(-) diff --git a/test/from_chars.cpp b/test/from_chars.cpp index 1d61b513e..f72009da3 100644 --- a/test/from_chars.cpp +++ b/test/from_chars.cpp @@ -5,8 +5,6 @@ #include #include -#include "before_impl_headers.hpp" -#include #include #include #include diff --git a/test/limits.cpp b/test/limits.cpp index 0428d9181..ebfa47a51 100644 --- a/test/limits.cpp +++ b/test/limits.cpp @@ -4,24 +4,14 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -import std; -import boost.charconv; -import boost.core; -#else #include #include #include #include -#include -#include -#include -#include -#endif +#include +#include +#include +#include #ifdef BOOST_HAS_INT128 diff --git a/test/limits_link_1.cpp b/test/limits_link_1.cpp index 36825456e..cb61e962b 100644 --- a/test/limits_link_1.cpp +++ b/test/limits_link_1.cpp @@ -2,15 +2,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -import boost.charconv; -#else #include -#include -#endif void test_odr_use( int const* ); diff --git a/test/limits_link_2.cpp b/test/limits_link_2.cpp index c65611608..b6c2ff05a 100644 --- a/test/limits_link_2.cpp +++ b/test/limits_link_2.cpp @@ -2,15 +2,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -import boost.charconv; -#else #include -#include -#endif void test_odr_use( int const* ); diff --git a/test/roundtrip.cpp b/test/roundtrip.cpp index 2e1f6a6f1..f71d6a220 100644 --- a/test/roundtrip.cpp +++ b/test/roundtrip.cpp @@ -3,30 +3,17 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#ifdef BOOST_USE_MODULES -#include // for INT64_C -#include -#include -#include -#include -#include -import std; -import boost.charconv; -import boost.core; -#else #include #include #include -#include -#include -#include -#include -#include #include -#include -#include -#endif - +#include +#include +#include +#include +#include +#include +#include #ifdef BOOST_HAS_INT128 diff --git a/test/test_128bit_emulation.cpp b/test/test_128bit_emulation.cpp index c688a7813..6411d2169 100644 --- a/test/test_128bit_emulation.cpp +++ b/test/test_128bit_emulation.cpp @@ -2,22 +2,13 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -import std; -import boost.core; -#else -#include #include -#include -#include -#include -#include -#endif +#include "before_impl_headers.hpp" +#include +#include +#include +#include +#include #ifdef BOOST_HAS_INT128 diff --git a/test/test_128bit_native.cpp b/test/test_128bit_native.cpp index 9a660da13..5d265d768 100644 --- a/test/test_128bit_native.cpp +++ b/test/test_128bit_native.cpp @@ -2,19 +2,11 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include // UINT64_C -import std; -import boost.core; -#else -#include #include -#include +#include "before_impl_headers.hpp" +#include +#include #include -#endif void test128() diff --git a/test/test_compute_float32.cpp b/test/test_compute_float32.cpp index ec8dc22fa..2e17710f9 100644 --- a/test/test_compute_float32.cpp +++ b/test/test_compute_float32.cpp @@ -2,21 +2,12 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -#include -import std; -import boost.core; -#else +#include "before_impl_headers.hpp" #include #include -#include +#include #include -#include -#endif +#include using boost::charconv::detail::compute_float32; diff --git a/test/test_compute_float64.cpp b/test/test_compute_float64.cpp index 6162dc0c0..a1eb657e3 100644 --- a/test/test_compute_float64.cpp +++ b/test/test_compute_float64.cpp @@ -2,22 +2,13 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -#include -import std; -import boost.core; -#else +#include "before_impl_headers.hpp" #include #include -#include -#include +#include +#include #include -#include -#endif +#include using boost::charconv::detail::compute_float64; diff --git a/test/test_compute_float80.cpp b/test/test_compute_float80.cpp index f660bde02..c2f9fbeb8 100644 --- a/test/test_compute_float80.cpp +++ b/test/test_compute_float80.cpp @@ -2,26 +2,17 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -#include -import std; -import boost.core; -#else +#include +#include "before_impl_headers.hpp" #include #include #include -#include -#include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include +#include // MSVC uses long double = double // Darwin sometimes uses double-double instead of long double diff --git a/test/test_num_digits.cpp b/test/test_num_digits.cpp index 6613a3dc9..82117a15f 100644 --- a/test/test_num_digits.cpp +++ b/test/test_num_digits.cpp @@ -2,22 +2,13 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -#include -import std; -import boost.core; -#else +#include "before_impl_headers.hpp" +#include #include #include #include -#include -#include -#include -#endif +#include +#include #if defined(__GNUC__) && (__GNUC__ < 7) # pragma GCC diagnostic push diff --git a/test/test_parser.cpp b/test/test_parser.cpp index 8aa061514..fb88244ff 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -2,24 +2,16 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -import std; -import boost.core; -import boost.charconv; -#else -#include +#include #include #include -#include -#include -#include +#include "before_impl_headers.hpp" +#include +#include +#include +#include #include -#include #include -#endif void test_integer() { diff --git a/test/to_chars.cpp b/test/to_chars.cpp index 7209b6eb9..c5c8a6edb 100644 --- a/test/to_chars.cpp +++ b/test/to_chars.cpp @@ -5,8 +5,8 @@ #include #include -#include "before_impl_headers.hpp" -#include +#include +#include #include #include #include diff --git a/test/to_chars_sprintf.cpp b/test/to_chars_sprintf.cpp index 70d3306cf..7cbc6dad4 100644 --- a/test/to_chars_sprintf.cpp +++ b/test/to_chars_sprintf.cpp @@ -3,29 +3,18 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include int const N = 1024; From 2f423f6f55ecd9efb81b7e487bf2fecfafcc2f93 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 14 Jan 2025 18:40:50 +0100 Subject: [PATCH 77/84] Migrate the library to compatibility headers --- include/boost/charconv/config.hpp | 4 +-- include/boost/charconv/detail/apply_sign.hpp | 4 +-- include/boost/charconv/detail/bit_layouts.hpp | 6 ++-- .../boost/charconv/detail/buffer_sizing.hpp | 4 +-- .../boost/charconv/detail/compute_float32.hpp | 9 +++-- .../boost/charconv/detail/compute_float64.hpp | 12 +++---- .../boost/charconv/detail/compute_float80.hpp | 24 ++++++------- include/boost/charconv/detail/config.hpp | 15 +++----- .../charconv/detail/dragonbox/dragonbox.hpp | 10 +++--- .../detail/dragonbox/dragonbox_common.hpp | 14 ++++---- .../boost/charconv/detail/dragonbox/floff.hpp | 14 ++++---- include/boost/charconv/detail/emulated128.hpp | 13 ++++--- .../charconv/detail/fallback_routines.hpp | 1 + .../detail/fast_float/ascii_number.hpp | 10 +++--- .../charconv/detail/fast_float/bigint.hpp | 10 +++--- .../fast_float/constexpr_feature_detect.hpp | 2 -- .../detail/fast_float/decimal_to_binary.hpp | 14 ++++---- .../detail/fast_float/digit_comparison.hpp | 10 +++--- .../charconv/detail/fast_float/fast_table.hpp | 4 +-- .../detail/fast_float/float_common.hpp | 17 +++++---- .../detail/fast_float/parse_number.hpp | 12 +++---- .../detail/from_chars_integer_impl.hpp | 16 ++++----- .../charconv/detail/from_chars_result.hpp | 4 +-- .../detail/global_module_fragment.hpp | 36 ------------------- .../charconv/detail/integer_search_trees.hpp | 9 +++-- include/boost/charconv/detail/issignaling.hpp | 1 + include/boost/charconv/detail/memcpy.hpp | 6 ++-- include/boost/charconv/detail/parser.hpp | 14 ++++---- .../boost/charconv/detail/ryu/generic_128.hpp | 5 ++- .../charconv/detail/ryu/ryu_generic_128.hpp | 10 +++--- .../charconv/detail/significand_tables.hpp | 4 +-- .../charconv/detail/to_chars_integer_impl.hpp | 28 +++++++-------- .../boost/charconv/detail/to_chars_result.hpp | 4 +-- include/boost/charconv/detail/type_traits.hpp | 4 +-- include/boost/charconv/from_chars.hpp | 4 +-- include/boost/charconv/limits.hpp | 6 ++-- modules/boost_charconv.cppm | 1 - src/float128_impl.hpp | 10 ++---- src/from_chars.cpp | 20 +++++------ src/from_chars_float_impl.hpp | 8 ++--- src/to_chars.cpp | 13 +++---- src/to_chars_float_impl.hpp | 28 +++++++-------- 42 files changed, 165 insertions(+), 275 deletions(-) delete mode 100644 include/boost/charconv/detail/global_module_fragment.hpp diff --git a/include/boost/charconv/config.hpp b/include/boost/charconv/config.hpp index 7de401263..04f5b912a 100644 --- a/include/boost/charconv/config.hpp +++ b/include/boost/charconv/config.hpp @@ -6,10 +6,8 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_USE_MODULES #include -#include -#endif +#include // This header implements separate compilation features as described in // http://www.boost.org/more/separate_compilation.html diff --git a/include/boost/charconv/detail/apply_sign.hpp b/include/boost/charconv/detail/apply_sign.hpp index d20ec2192..9b6680df2 100644 --- a/include/boost/charconv/detail/apply_sign.hpp +++ b/include/boost/charconv/detail/apply_sign.hpp @@ -7,10 +7,8 @@ #include #include -#ifndef BOOST_USE_MODULES #include -#include -#endif +#include // We are purposefully converting values here diff --git a/include/boost/charconv/detail/bit_layouts.hpp b/include/boost/charconv/detail/bit_layouts.hpp index 4b0db5c78..2266c096c 100644 --- a/include/boost/charconv/detail/bit_layouts.hpp +++ b/include/boost/charconv/detail/bit_layouts.hpp @@ -7,10 +7,8 @@ #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#endif +#include +#include // Layouts of floating point types as specified by IEEE 754 diff --git a/include/boost/charconv/detail/buffer_sizing.hpp b/include/boost/charconv/detail/buffer_sizing.hpp index 629b7fa93..d61e03b17 100644 --- a/include/boost/charconv/detail/buffer_sizing.hpp +++ b/include/boost/charconv/detail/buffer_sizing.hpp @@ -7,9 +7,7 @@ #include #include -#ifndef BOOST_USE_MODULES -#include -#endif +#include namespace boost { diff --git a/include/boost/charconv/detail/compute_float32.hpp b/include/boost/charconv/detail/compute_float32.hpp index 18868e297..08bd3d82b 100644 --- a/include/boost/charconv/detail/compute_float32.hpp +++ b/include/boost/charconv/detail/compute_float32.hpp @@ -6,11 +6,10 @@ #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT32_HPP #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#endif +#include +#include +#include +#include // HUGE_VAL namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/compute_float64.hpp b/include/boost/charconv/detail/compute_float64.hpp index 4b806a3d2..f151065ec 100644 --- a/include/boost/charconv/detail/compute_float64.hpp +++ b/include/boost/charconv/detail/compute_float64.hpp @@ -9,13 +9,13 @@ #include #include #include -#ifndef BOOST_USE_MODULES #include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include // UINT64_C +#include // HUGE_VAL namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/compute_float80.hpp b/include/boost/charconv/detail/compute_float80.hpp index b82fd98e5..ebfce01b8 100644 --- a/include/boost/charconv/detail/compute_float80.hpp +++ b/include/boost/charconv/detail/compute_float80.hpp @@ -8,22 +8,20 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include // HUGE_VAL #ifdef BOOST_CHARCONV_DEBUG_FLOAT128 #include +#include +#include #endif -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#include -#include -#include -#ifdef BOOST_CHARCONV_DEBUG_FLOAT128 -#include -#include -#endif -#endif + namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index bf2670455..8de10fd51 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -6,12 +6,9 @@ #define BOOST_CHARCONV_DETAIL_CONFIG_HPP #include -#ifndef BOOST_USE_MODULES -#include #include -#include -#include -#endif +#include +#include #define BOOST_CHARCONV_ASSERT(expr) BOOST_ASSERT(expr) #define BOOST_CHARCONV_ASSERT_MSG(expr, msg) BOOST_ASSERT_MSG(expr, msg) @@ -70,9 +67,7 @@ // Inclue intrinsics if available #if defined(BOOST_MSVC) -# ifndef BOOST_USE_MODULES -# include -# endif +# include # if defined(_WIN64) # define BOOST_CHARCONV_HAS_MSVC_64BIT_INTRINSICS # else @@ -172,9 +167,9 @@ static_assert((BOOST_CHARCONV_ENDIAN_BIG_BYTE || BOOST_CHARCONV_ENDIAN_LITTLE_BY // Detection for C++23 fixed width floating point types // All of these types are optional so check for each of them individually -#if !defined(BOOST_USE_MODULES) && ((defined(_MSVC_LANG) && _MSVC_LANG > 202002L) || __cplusplus > 202002L) +#if ((defined(_MSVC_LANG) && _MSVC_LANG > 202002L) || __cplusplus > 202002L) # if __has_include() -# include +# include # endif #endif #ifdef __STDCPP_FLOAT16_T__ diff --git a/include/boost/charconv/detail/dragonbox/dragonbox.hpp b/include/boost/charconv/detail/dragonbox/dragonbox.hpp index 02ab8e1f1..9de3a879a 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox.hpp @@ -29,13 +29,11 @@ #include #include #include -#ifndef BOOST_USE_MODULES #include -#include -#include -#include -#include -#endif +#include +#include +#include +#include // UINT64_C #ifdef BOOST_MSVC # pragma warning(push) diff --git a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp index 077f92e44..8241b70cd 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp @@ -28,15 +28,13 @@ #include #include #include -#ifndef BOOST_USE_MODULES #include -#include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include // UINT64_C +#include // CHAR_BIT namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/dragonbox/floff.hpp b/include/boost/charconv/detail/dragonbox/floff.hpp index b85153f21..85bb7cfb8 100644 --- a/include/boost/charconv/detail/dragonbox/floff.hpp +++ b/include/boost/charconv/detail/dragonbox/floff.hpp @@ -30,15 +30,13 @@ #include #include #include -#ifndef BOOST_USE_MODULES #include -#include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include +#include // UINT64_C #ifdef BOOST_MSVC # pragma warning(push) diff --git a/include/boost/charconv/detail/emulated128.hpp b/include/boost/charconv/detail/emulated128.hpp index dce867958..e83946038 100644 --- a/include/boost/charconv/detail/emulated128.hpp +++ b/include/boost/charconv/detail/emulated128.hpp @@ -10,14 +10,13 @@ #include #include -#ifndef BOOST_USE_MODULES #include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include +#include // UINT64_C namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/fallback_routines.hpp b/include/boost/charconv/detail/fallback_routines.hpp index ade23d9d5..443cbd561 100644 --- a/include/boost/charconv/detail/fallback_routines.hpp +++ b/include/boost/charconv/detail/fallback_routines.hpp @@ -18,6 +18,7 @@ #include #include #endif +#include // HUGE_VAL namespace boost { namespace charconv { diff --git a/include/boost/charconv/detail/fast_float/ascii_number.hpp b/include/boost/charconv/detail/fast_float/ascii_number.hpp index 00c3639fd..89e88abe8 100644 --- a/include/boost/charconv/detail/fast_float/ascii_number.hpp +++ b/include/boost/charconv/detail/fast_float/ascii_number.hpp @@ -9,12 +9,10 @@ #define BOOST_CHARCONV_DETAIL_FASTFLOAT_ASCII_NUMBER_HPP #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#endif +#include +#include +#include +#include namespace boost { namespace charconv { namespace detail { namespace fast_float { diff --git a/include/boost/charconv/detail/fast_float/bigint.hpp b/include/boost/charconv/detail/fast_float/bigint.hpp index 11499da76..c3dbf9e71 100644 --- a/include/boost/charconv/detail/fast_float/bigint.hpp +++ b/include/boost/charconv/detail/fast_float/bigint.hpp @@ -9,12 +9,10 @@ #define BOOST_CHARCONV_DETAIL_FASTFLOAT_BIGINT_HPP #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#endif +#include +#include +#include +#include namespace boost { namespace charconv { namespace detail { namespace fast_float { diff --git a/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp b/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp index 76ff92e4b..1ac1e4aab 100644 --- a/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp +++ b/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp @@ -8,13 +8,11 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_CONSTEXPR_FEATURE_DETECT_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_CONSTEXPR_FEATURE_DETECT_HPP -#ifndef BOOST_USE_MODULES #ifdef __has_include #if __has_include() #include #endif #endif -#endif // Testing for https://wg21.link/N3652, adopted in C++14 #if __cpp_constexpr >= 201304 diff --git a/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp b/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp index 03b02f682..5a107d2a0 100644 --- a/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp +++ b/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp @@ -10,14 +10,12 @@ #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include +#include namespace boost { namespace charconv { namespace detail { namespace fast_float { diff --git a/include/boost/charconv/detail/fast_float/digit_comparison.hpp b/include/boost/charconv/detail/fast_float/digit_comparison.hpp index b33aebc53..3b223649c 100644 --- a/include/boost/charconv/detail/fast_float/digit_comparison.hpp +++ b/include/boost/charconv/detail/fast_float/digit_comparison.hpp @@ -11,12 +11,10 @@ #include #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#endif +#include +#include +#include +#include namespace boost { namespace charconv { namespace detail { namespace fast_float { diff --git a/include/boost/charconv/detail/fast_float/fast_table.hpp b/include/boost/charconv/detail/fast_float/fast_table.hpp index d39847b4e..ce9b13adf 100644 --- a/include/boost/charconv/detail/fast_float/fast_table.hpp +++ b/include/boost/charconv/detail/fast_float/fast_table.hpp @@ -9,9 +9,7 @@ #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_TABLE_HPP #include -#ifndef BOOST_USE_MODULES -#include -#endif +#include namespace boost { namespace charconv { namespace detail { namespace fast_float { diff --git a/include/boost/charconv/detail/fast_float/float_common.hpp b/include/boost/charconv/detail/fast_float/float_common.hpp index 9044b6b6e..e303470c5 100644 --- a/include/boost/charconv/detail/fast_float/float_common.hpp +++ b/include/boost/charconv/detail/fast_float/float_common.hpp @@ -12,14 +12,13 @@ #include #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include +#include +#include // UINT64_C namespace boost { namespace charconv { namespace detail { namespace fast_float { @@ -40,7 +39,7 @@ using parse_options = parse_options_t; }}}} #if BOOST_CHARCONV_FASTFLOAT_HAS_BIT_CAST && !defined(BOOST_USE_MODULES) -#include +#include #endif #if (defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) \ diff --git a/include/boost/charconv/detail/fast_float/parse_number.hpp b/include/boost/charconv/detail/fast_float/parse_number.hpp index 9cd270acf..0aef862bd 100644 --- a/include/boost/charconv/detail/fast_float/parse_number.hpp +++ b/include/boost/charconv/detail/fast_float/parse_number.hpp @@ -12,12 +12,10 @@ #include #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#endif +#include +#include +#include +#include namespace boost { namespace charconv { namespace detail { namespace fast_float { @@ -100,7 +98,7 @@ BOOST_FORCEINLINE bool rounds_to_nearest() noexcept { // https://lemire.me/blog/2022/11/16/a-fast-function-to-check-your-floating-point-rounding-mode/ // // This function is meant to be equivalent to : - // prior: #include + // prior: #include // return fegetround() == FE_TONEAREST; // However, it is expected to be much faster than the fegetround() // function call. diff --git a/include/boost/charconv/detail/from_chars_integer_impl.hpp b/include/boost/charconv/detail/from_chars_integer_impl.hpp index 69fe029a8..5de5eafae 100644 --- a/include/boost/charconv/detail/from_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/from_chars_integer_impl.hpp @@ -11,16 +11,14 @@ #include #include #include -#ifndef BOOST_USE_MODULES #include -#include -#include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include +#include +#include namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/from_chars_result.hpp b/include/boost/charconv/detail/from_chars_result.hpp index dd914faa1..b44fa8d51 100644 --- a/include/boost/charconv/detail/from_chars_result.hpp +++ b/include/boost/charconv/detail/from_chars_result.hpp @@ -5,9 +5,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP #define BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP -#ifndef BOOST_USE_MODULES -#include -#endif +#include namespace boost { namespace charconv { diff --git a/include/boost/charconv/detail/global_module_fragment.hpp b/include/boost/charconv/detail/global_module_fragment.hpp deleted file mode 100644 index 347375b19..000000000 --- a/include/boost/charconv/detail/global_module_fragment.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2023 Matt Borland -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -#ifndef BOOST_CHARCONV_DETAIL_GLOBAL_MODULE_FRAGMENT_HPP -#define BOOST_CHARCONV_DETAIL_GLOBAL_MODULE_FRAGMENT_HPP - -// Contents of the global module fragment. -// Used for all module units and in tests - -#include // for UINT64_C -#include // for CHAR_BIT -#include -#include // for HUGE_VAL -#include -#include -#include - -#ifdef __has_include -#if __has_include() -#include -#endif -#endif - -#if defined(BOOST_MSVC) -#include -#endif - -#ifdef BOOST_CHARCONV_HAS_QUADMATH -#include -#endif - -import std; -import boost.core; - -#endif diff --git a/include/boost/charconv/detail/integer_search_trees.hpp b/include/boost/charconv/detail/integer_search_trees.hpp index 432db3da0..9d139185d 100644 --- a/include/boost/charconv/detail/integer_search_trees.hpp +++ b/include/boost/charconv/detail/integer_search_trees.hpp @@ -10,11 +10,10 @@ #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#endif +#include +#include +#include +#include // UINT64_C namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/issignaling.hpp b/include/boost/charconv/detail/issignaling.hpp index 686ea8386..0cd710843 100644 --- a/include/boost/charconv/detail/issignaling.hpp +++ b/include/boost/charconv/detail/issignaling.hpp @@ -11,6 +11,7 @@ #include #include #endif +#include // UINT64_C namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/memcpy.hpp b/include/boost/charconv/detail/memcpy.hpp index 99153829a..a614b2dc4 100644 --- a/include/boost/charconv/detail/memcpy.hpp +++ b/include/boost/charconv/detail/memcpy.hpp @@ -6,10 +6,8 @@ #define BOOST_CHARCONV_DETAIL_MEMCPY_HPP #include -#ifndef BOOST_USE_MODULES -#include -#include -#endif +#include +#include // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89689 // GCC 10 added checks for length of memcpy which yields the following warning (converted to error with -Werror) diff --git a/include/boost/charconv/detail/parser.hpp b/include/boost/charconv/detail/parser.hpp index 73f3c04d0..c851a62d2 100644 --- a/include/boost/charconv/detail/parser.hpp +++ b/include/boost/charconv/detail/parser.hpp @@ -11,14 +11,12 @@ #include #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include +#include #if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__) # pragma GCC diagnostic push diff --git a/include/boost/charconv/detail/ryu/generic_128.hpp b/include/boost/charconv/detail/ryu/generic_128.hpp index 5f5c8c3d7..4a9f508b6 100644 --- a/include/boost/charconv/detail/ryu/generic_128.hpp +++ b/include/boost/charconv/detail/ryu/generic_128.hpp @@ -9,9 +9,8 @@ #include #include #include -#ifndef BOOST_USE_MODULES -#include -#endif +#include +#include // UINT64_C #define BOOST_CHARCONV_POW5_TABLE_SIZE 56 #define BOOST_CHARCONV_POW5_BITCOUNT 249 diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index 172181f81..d0f661b0a 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -11,14 +11,12 @@ #include #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#include +#include +#include +#include #ifdef BOOST_CHARCONV_DEBUG -# include -#endif +# include #endif namespace boost { namespace charconv { namespace detail { namespace ryu { diff --git a/include/boost/charconv/detail/significand_tables.hpp b/include/boost/charconv/detail/significand_tables.hpp index 4792177c0..b55d4cb2c 100644 --- a/include/boost/charconv/detail/significand_tables.hpp +++ b/include/boost/charconv/detail/significand_tables.hpp @@ -7,9 +7,7 @@ #define BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP #include -#ifndef BOOST_USE_MODULES -#include -#endif +#include // The significand of a floating point number is often referred to as the mantissa. // Using the term mantissa is discouraged by IEEE 1516 diff --git a/include/boost/charconv/detail/to_chars_integer_impl.hpp b/include/boost/charconv/detail/to_chars_integer_impl.hpp index f2dc61887..0bbc82302 100644 --- a/include/boost/charconv/detail/to_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/to_chars_integer_impl.hpp @@ -13,21 +13,21 @@ #include #include #include -#ifndef BOOST_USE_MODULES #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // UINT64_C +#include // CHAR_BIT namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/to_chars_result.hpp b/include/boost/charconv/detail/to_chars_result.hpp index 173a87c5a..60b2e18e7 100644 --- a/include/boost/charconv/detail/to_chars_result.hpp +++ b/include/boost/charconv/detail/to_chars_result.hpp @@ -5,9 +5,7 @@ #ifndef BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP #define BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP -#ifndef BOOST_USE_MODULES -#include -#endif +#include // 22.13.2, Primitive numerical output conversion diff --git a/include/boost/charconv/detail/type_traits.hpp b/include/boost/charconv/detail/type_traits.hpp index 7d405c997..3400d845e 100644 --- a/include/boost/charconv/detail/type_traits.hpp +++ b/include/boost/charconv/detail/type_traits.hpp @@ -6,9 +6,7 @@ #define BOOST_CHARCONV_DETAIL_TYPE_TRAITS_HPP #include -#ifndef BOOST_USE_MODULES -#include -#endif +#include namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index 67f7fac10..dbf2d176c 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -19,10 +19,8 @@ import boost.charconv; #include #include #include -#ifndef BOOST_USE_MODULES #include -#include -#endif +#include namespace boost { namespace charconv { diff --git a/include/boost/charconv/limits.hpp b/include/boost/charconv/limits.hpp index 1d50bc428..7669a0d7e 100644 --- a/include/boost/charconv/limits.hpp +++ b/include/boost/charconv/limits.hpp @@ -13,10 +13,8 @@ import boost.charconv; #else #include -#ifndef BOOST_USE_MODULES -#include -#include -#endif +#include +#include namespace boost { namespace charconv { diff --git a/modules/boost_charconv.cppm b/modules/boost_charconv.cppm index 67144cab0..4a4dcbfa9 100644 --- a/modules/boost_charconv.cppm +++ b/modules/boost_charconv.cppm @@ -1,6 +1,5 @@ module; -#include #include export module boost.charconv; diff --git a/src/float128_impl.hpp b/src/float128_impl.hpp index 85e521c79..670f2792e 100644 --- a/src/float128_impl.hpp +++ b/src/float128_impl.hpp @@ -11,18 +11,14 @@ #include #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#endif +#include +#include +#include // Only add in float128 support if the build system says it can #ifdef BOOST_CHARCONV_HAS_QUADMATH -#ifndef BOOST_USE_MODULES #include -#endif namespace boost { namespace charconv { diff --git a/src/from_chars.cpp b/src/from_chars.cpp index 6da029e24..08539cadf 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -5,7 +5,6 @@ #ifdef BOOST_USE_MODULES module; -#include #endif // https://stackoverflow.com/questions/38060411/visual-studio-2015-wont-suppress-error-c4996 @@ -19,22 +18,19 @@ module; #include "float128_impl.hpp" #include "from_chars_float_impl.hpp" #include +#include +#include +#include +#include +#include +#include +#include +#include #if BOOST_CHARCONV_LDBL_BITS > 64 # include # include #endif -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#include -#include -#include -#include -#endif - #ifdef BOOST_USE_MODULES module boost.charconv; #endif diff --git a/src/from_chars_float_impl.hpp b/src/from_chars_float_impl.hpp index c43961728..6063af931 100644 --- a/src/from_chars_float_impl.hpp +++ b/src/from_chars_float_impl.hpp @@ -13,12 +13,10 @@ #include #include #include -#ifndef BOOST_USE_MODULES #include -#include -#include -#include -#endif +#include +#include +#include namespace boost { namespace charconv { namespace detail { diff --git a/src/to_chars.cpp b/src/to_chars.cpp index 6f4f60beb..e60934bfc 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -6,20 +6,17 @@ #ifdef BOOST_USE_MODULES module; -#include #endif #include "float128_impl.hpp" #include "to_chars_float_impl.hpp" #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include #ifdef BOOST_USE_MODULES module boost.charconv; diff --git a/src/to_chars_float_impl.hpp b/src/to_chars_float_impl.hpp index 66e52675c..10e5822e8 100644 --- a/src/to_chars_float_impl.hpp +++ b/src/to_chars_float_impl.hpp @@ -28,22 +28,20 @@ # include #endif -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef BOOST_CHARCONV_DEBUG_FIXED -#include -#include -#endif +#include +#include #endif namespace boost { From 2c54c754a410f3e04aeed0feab28651b56f9a033 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 14 Jan 2025 18:53:06 +0100 Subject: [PATCH 78/84] Migrate more tests to compatibility headers --- test/before_impl_headers.hpp | 1 - test/from_chars_float.cpp | 29 +++++++++----------------- test/from_chars_float2.cpp | 10 +-------- test/from_chars_string_view.cpp | 20 +++++------------- test/github_issue_110.cpp | 10 --------- test/github_issue_122.cpp | 15 ++++---------- test/github_issue_152.cpp | 23 ++++++--------------- test/github_issue_154.cpp | 9 -------- test/github_issue_158.cpp | 9 -------- test/github_issue_166.cpp | 9 -------- test/github_issue_166_float128.cpp | 11 +--------- test/github_issue_186.cpp | 11 ++-------- test/github_issue_212.cpp | 14 +++---------- test/test_boost_json_values.cpp | 29 +++++++++----------------- test/test_compute_float32.cpp | 2 +- test/test_float128.cpp | 15 +++++++------- test/test_parser.cpp | 4 ++-- test/to_chars.cpp | 4 ++-- test/to_chars_float.cpp | 33 +++++++++++------------------- 19 files changed, 67 insertions(+), 191 deletions(-) diff --git a/test/before_impl_headers.hpp b/test/before_impl_headers.hpp index 76dd4eb9f..4f30ed460 100644 --- a/test/before_impl_headers.hpp +++ b/test/before_impl_headers.hpp @@ -1,7 +1,6 @@ #ifndef BOOST_CHARCONV_TEST_BEFORE_IMPL_HEADERS #define BOOST_CHARCONV_TEST_BEFORE_IMPL_HEADERS -#include #define BOOST_CHARCONV_SOURCE // prevent ifdefs in public headers. TODO: does this cause trouble in Windows? #endif diff --git a/test/from_chars_float.cpp b/test/from_chars_float.cpp index fdb7477c1..dfbe60f61 100644 --- a/test/from_chars_float.cpp +++ b/test/from_chars_float.cpp @@ -2,28 +2,19 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include "../src/from_chars_float_impl.hpp" -import std; -import boost.core; -import boost.charconv; -#else #include +#include "before_impl_headers.hpp" #include "../src/from_chars_float_impl.hpp" #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif - +#include +#include +#include +#include +#include +#include +#include +#include +#include template diff --git a/test/from_chars_float2.cpp b/test/from_chars_float2.cpp index 9f1ecc6f1..dd177608b 100644 --- a/test/from_chars_float2.cpp +++ b/test/from_chars_float2.cpp @@ -2,18 +2,10 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include #include -#include -#endif +#include static boost::detail::splitmix64 rng; diff --git a/test/from_chars_string_view.cpp b/test/from_chars_string_view.cpp index 126ed87d6..f9cf6a6b9 100644 --- a/test/from_chars_string_view.cpp +++ b/test/from_chars_string_view.cpp @@ -3,26 +3,16 @@ // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) -# include -#endif +# include #endif diff --git a/test/github_issue_110.cpp b/test/github_issue_110.cpp index 9161f1df7..7a196d8c0 100644 --- a/test/github_issue_110.cpp +++ b/test/github_issue_110.cpp @@ -2,18 +2,8 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include -#endif template void overflow_spot_value(const std::string& buffer, boost::charconv::chars_format fmt = boost::charconv::chars_format::general) diff --git a/test/github_issue_122.cpp b/test/github_issue_122.cpp index c9d8e6539..29db47d3d 100644 --- a/test/github_issue_122.cpp +++ b/test/github_issue_122.cpp @@ -3,19 +3,12 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -import std; -import boost.core; -#else -#include -#include +#include +#include +#include #include +#include "before_impl_headers.hpp" #include -#include -#endif template void test() diff --git a/test/github_issue_152.cpp b/test/github_issue_152.cpp index 4d47db56f..66de8b9af 100644 --- a/test/github_issue_152.cpp +++ b/test/github_issue_152.cpp @@ -2,25 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include -#include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include +#include constexpr std::size_t N = 1024; static std::mt19937_64 rng(42); diff --git a/test/github_issue_154.cpp b/test/github_issue_154.cpp index d7b2d9ec7..a7866a0be 100644 --- a/test/github_issue_154.cpp +++ b/test/github_issue_154.cpp @@ -4,17 +4,8 @@ // // See: https://github.com/boostorg/charconv/issues/154 -#ifdef BOOST_USE_MODULES -#include -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include -#endif int main() { diff --git a/test/github_issue_158.cpp b/test/github_issue_158.cpp index 01fc9e95f..f1333e037 100644 --- a/test/github_issue_158.cpp +++ b/test/github_issue_158.cpp @@ -5,17 +5,8 @@ // // See: https://github.com/cppalliance/charconv/issues/158 -#ifdef BOOST_USE_MODULES -#include -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include -#endif void test_values_with_negative_exp() { diff --git a/test/github_issue_166.cpp b/test/github_issue_166.cpp index 9deb4db72..bde1b0aea 100644 --- a/test/github_issue_166.cpp +++ b/test/github_issue_166.cpp @@ -4,17 +4,8 @@ // // See: https://github.com/cppalliance/charconv/issues/166 -#ifdef BOOST_USE_MODULES -#include -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include -#endif template void simple_test() diff --git a/test/github_issue_166_float128.cpp b/test/github_issue_166_float128.cpp index 31090e8c9..6e375efce 100644 --- a/test/github_issue_166_float128.cpp +++ b/test/github_issue_166_float128.cpp @@ -4,18 +4,9 @@ // // See: https://github.com/boostorg/charconv/issues/166 -#ifdef BOOST_USE_MODULES -#include -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include -#include -#endif +#include template void test() diff --git a/test/github_issue_186.cpp b/test/github_issue_186.cpp index d49193291..83c41d3b4 100644 --- a/test/github_issue_186.cpp +++ b/test/github_issue_186.cpp @@ -4,17 +4,10 @@ // // See: https://github.com/boostorg/charconv/issues/186 -#ifdef BOOST_USE_MODULES -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include -#include -#include -#endif +#include +#include template void force_overflow(T value) diff --git a/test/github_issue_212.cpp b/test/github_issue_212.cpp index 7cb3fcdf0..c02eb8eb9 100644 --- a/test/github_issue_212.cpp +++ b/test/github_issue_212.cpp @@ -2,19 +2,11 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include -#include -#include -#include -#endif +#include +#include +#include template void test() diff --git a/test/test_boost_json_values.cpp b/test/test_boost_json_values.cpp index b6009899c..7dee5f494 100644 --- a/test/test_boost_json_values.cpp +++ b/test/test_boost_json_values.cpp @@ -7,27 +7,18 @@ // See: https://github.com/boostorg/json/issues/599 // See: https://github.com/boostorg/json/blob/develop/test/double.cpp -#ifdef BOOST_USE_MODULES -#include // PRId64 -#include // stderr -#include -import std; -import boost.core; -import boost.charconv; -#else #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include template void grind(const std::string& str, const T expected_value) diff --git a/test/test_compute_float32.cpp b/test/test_compute_float32.cpp index 2e17710f9..c468e885e 100644 --- a/test/test_compute_float32.cpp +++ b/test/test_compute_float32.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include using boost::charconv::detail::compute_float32; diff --git a/test/test_float128.cpp b/test/test_float128.cpp index 823666c7c..342048d1b 100644 --- a/test/test_float128.cpp +++ b/test/test_float128.cpp @@ -6,11 +6,11 @@ #if defined(BOOST_CHARCONV_HAS_QUADMATH) && defined(BOOST_HAS_INT128) -#include +#include #include #ifdef BOOST_CHARCONV_HAS_STDFLOAT128 -#include +#include std::ostream& operator<<( std::ostream& os, __float128 v ) { @@ -87,11 +87,12 @@ std::ostream& operator<<( std::ostream& os, boost::int128_type v ) #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include "before_impl_headers.hpp" #include "../src/float128_impl.hpp" constexpr int N = 1024; diff --git a/test/test_parser.cpp b/test/test_parser.cpp index fb88244ff..a8e5e1d65 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -10,8 +10,8 @@ #include #include #include -#include -#include +#include +#include void test_integer() { diff --git a/test/to_chars.cpp b/test/to_chars.cpp index c5c8a6edb..7fb886846 100644 --- a/test/to_chars.cpp +++ b/test/to_chars.cpp @@ -5,8 +5,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/test/to_chars_float.cpp b/test/to_chars_float.cpp index 556806017..d71c4eaf5 100644 --- a/test/to_chars_float.cpp +++ b/test/to_chars_float.cpp @@ -3,31 +3,22 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifdef BOOST_USE_MODULES -#include -#include -#include -#include -import std; -import boost.core; -import boost.charconv; -#else #include +#include "before_impl_headers.hpp" #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#endif // These numbers diverge from what the formatting is using printf // See: https://godbolt.org/z/zd34KcWMW From bcc472018a2b6b0e2893c357dedc57e17486cf2c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 14 Jan 2025 20:04:33 +0100 Subject: [PATCH 79/84] Remove uses of macro HUGE_VAL* --- .../boost/charconv/detail/compute_float32.hpp | 5 ++--- .../boost/charconv/detail/compute_float64.hpp | 3 +-- .../boost/charconv/detail/compute_float80.hpp | 3 +-- .../charconv/detail/fallback_routines.hpp | 21 ++++++++----------- include/boost/charconv/detail/issignaling.hpp | 6 ++---- src/from_chars.cpp | 3 ++- src/from_chars_float_impl.hpp | 6 +++--- src/to_chars.cpp | 1 + 8 files changed, 21 insertions(+), 27 deletions(-) diff --git a/include/boost/charconv/detail/compute_float32.hpp b/include/boost/charconv/detail/compute_float32.hpp index 08bd3d82b..351f61b91 100644 --- a/include/boost/charconv/detail/compute_float32.hpp +++ b/include/boost/charconv/detail/compute_float32.hpp @@ -9,7 +9,6 @@ #include #include #include -#include // HUGE_VAL namespace boost { namespace charconv { namespace detail { @@ -28,7 +27,7 @@ inline float compute_float32(std::int64_t power, std::uint64_t i, bool negative, if (d > static_cast((std::numeric_limits::max)()) || d < static_cast((std::numeric_limits::lowest)())) { - return_val = negative ? -HUGE_VALF : HUGE_VALF; + return_val = negative ? -std::numeric_limits::infinity() : std::numeric_limits::infinity(); success = false; } else @@ -40,7 +39,7 @@ inline float compute_float32(std::int64_t power, std::uint64_t i, bool negative, { if (power > 38) { - return_val = negative ? -HUGE_VALF : HUGE_VALF; + return_val = negative ? -std::numeric_limits::infinity() : std::numeric_limits::infinity(); } else { diff --git a/include/boost/charconv/detail/compute_float64.hpp b/include/boost/charconv/detail/compute_float64.hpp index f151065ec..c9b1c8793 100644 --- a/include/boost/charconv/detail/compute_float64.hpp +++ b/include/boost/charconv/detail/compute_float64.hpp @@ -15,7 +15,6 @@ #include #include #include // UINT64_C -#include // HUGE_VAL namespace boost { namespace charconv { namespace detail { @@ -98,7 +97,7 @@ inline double compute_float64(std::int64_t power, std::uint64_t i, bool negative } else if (power > largest_power) { - return negative ? -HUGE_VAL : HUGE_VAL; + return negative ? -std::numeric_limits::infinity() : std::numeric_limits::infinity(); } const std::uint64_t factor_significand = significands_table::significand_64[power - smallest_power]; diff --git a/include/boost/charconv/detail/compute_float80.hpp b/include/boost/charconv/detail/compute_float80.hpp index ebfce01b8..239c09423 100644 --- a/include/boost/charconv/detail/compute_float80.hpp +++ b/include/boost/charconv/detail/compute_float80.hpp @@ -15,7 +15,6 @@ #include #include #include -#include // HUGE_VAL #ifdef BOOST_CHARCONV_DEBUG_FLOAT128 #include #include @@ -96,7 +95,7 @@ inline ResultType compute_float80(std::int64_t q, Unsigned_Integer w, bool negat else if (q > largest_power) { success = std::errc::result_out_of_range; - return negative ? -HUGE_VALL : HUGE_VALL; + return negative ? -std::numeric_limits::infinity() : std::numeric_limits::infinity(); } else if (q < smallest_power) { diff --git a/include/boost/charconv/detail/fallback_routines.hpp b/include/boost/charconv/detail/fallback_routines.hpp index 443cbd561..9d7c502f2 100644 --- a/include/boost/charconv/detail/fallback_routines.hpp +++ b/include/boost/charconv/detail/fallback_routines.hpp @@ -10,15 +10,12 @@ #include #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#include -#include -#include -#include -#endif -#include // HUGE_VAL +#include +#include +#include +#include +#include +#include namespace boost { namespace charconv { @@ -159,7 +156,7 @@ from_chars_result from_chars_strtod_impl(const char* first, const char* last, T& return_value = std::strtof(buffer, &str_end); #ifndef __INTEL_LLVM_COMPILER - if (return_value == HUGE_VALF) + if (return_value == std::numeric_limits::infinity()) #else if (return_value >= (std::numeric_limits::max)()) #endif @@ -172,7 +169,7 @@ from_chars_result from_chars_strtod_impl(const char* first, const char* last, T& return_value = std::strtod(buffer, &str_end); #ifndef __INTEL_LLVM_COMPILER - if (return_value == HUGE_VAL) + if (return_value == std::numeric_limits::infinity()) #else if (return_value >= (std::numeric_limits::max)()) #endif @@ -185,7 +182,7 @@ from_chars_result from_chars_strtod_impl(const char* first, const char* last, T& return_value = std::strtold(buffer, &str_end); #ifndef __INTEL_LLVM_COMPILER - if (return_value == HUGE_VALL) + if (return_value == std::numeric_limits::infinity()) #else if (return_value >= (std::numeric_limits::max)()) #endif diff --git a/include/boost/charconv/detail/issignaling.hpp b/include/boost/charconv/detail/issignaling.hpp index 0cd710843..f9f759fc3 100644 --- a/include/boost/charconv/detail/issignaling.hpp +++ b/include/boost/charconv/detail/issignaling.hpp @@ -7,10 +7,8 @@ #include #include -#ifndef BOOST_USE_MODULES -#include -#include -#endif +#include +#include #include // UINT64_C diff --git a/src/from_chars.cpp b/src/from_chars.cpp index 08539cadf..9eabda114 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -15,6 +15,7 @@ module; # define NO_WARN_MBCS_MFC_DEPRECATION #endif +#include // must be before import std #include "float128_impl.hpp" #include "from_chars_float_impl.hpp" #include @@ -83,7 +84,7 @@ boost::charconv::from_chars_result boost::charconv::from_chars_erange(const char #if BOOST_CHARCONV_HAS_BUILTIN(__builtin_inf) value = sign ? -static_cast<__float128>(__builtin_inf()) : static_cast<__float128>(__builtin_inf()); #else // Conversion from HUGE_VALL should work - value = sign ? -static_cast<__float128>(HUGE_VALL) : static_cast<__float128>(HUGE_VALL); + value = sign ? -static_cast<__float128>(std::numeric_limits::infinity()) : static_cast<__float128>(std::numeric_limits::infinity()); #endif return r; diff --git a/src/from_chars_float_impl.hpp b/src/from_chars_float_impl.hpp index 6063af931..fcefcceee 100644 --- a/src/from_chars_float_impl.hpp +++ b/src/from_chars_float_impl.hpp @@ -104,7 +104,7 @@ from_chars_result from_chars_float_impl(const char* first, const char* last, T& BOOST_IF_CONSTEXPR (std::is_same::value) { #ifndef __INTEL_LLVM_COMPILER - if (return_val == HUGE_VALF || return_val == -HUGE_VALF) + if (return_val == std::numeric_limits::infinity() || return_val == -std::numeric_limits::infinity()) #else if (return_val >= (std::numeric_limits::max)() || return_val <= std::numeric_limits::lowest()) #endif @@ -125,7 +125,7 @@ from_chars_result from_chars_float_impl(const char* first, const char* last, T& else BOOST_IF_CONSTEXPR (std::is_same::value) { #ifndef __INTEL_LLVM_COMPILER - if (return_val == HUGE_VAL || return_val == -HUGE_VAL) + if (return_val == std::numeric_limits::infinity() || return_val == -std::numeric_limits::infinity()) #else if (return_val >= (std::numeric_limits::max)() || return_val <= std::numeric_limits::lowest()) #endif @@ -146,7 +146,7 @@ from_chars_result from_chars_float_impl(const char* first, const char* last, T& else BOOST_IF_CONSTEXPR (std::is_same::value) { #ifndef __INTEL_LLVM_COMPILER - if (return_val == HUGE_VALL || return_val == -HUGE_VALL) + if (return_val == std::numeric_limits::infinity() || return_val == -std::numeric_limits::infinity()) #else if (return_val >= (std::numeric_limits::max)() || return_val <= std::numeric_limits::lowest()) #endif diff --git a/src/to_chars.cpp b/src/to_chars.cpp index e60934bfc..dd44d8911 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -8,6 +8,7 @@ module; #endif +#include // must be before import std #include "float128_impl.hpp" #include "to_chars_float_impl.hpp" #include From 128fd88438d66d0e584e3ff59af8b21d869ab71c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 14 Jan 2025 20:05:44 +0100 Subject: [PATCH 80/84] Migrate all tests to compatibility headers --- test/from_chars_float.cpp | 6 ++++-- test/from_chars_float2.cpp | 2 +- test/github_issue_122.cpp | 8 +++++--- test/github_issue_152_float128.cpp | 18 ++++++++---------- test/github_issue_212.cpp | 2 +- test/test_128bit_emulation.cpp | 2 +- test/test_boost_json_values.cpp | 3 ++- test/test_compute_float32.cpp | 2 +- test/test_compute_float64.cpp | 2 +- test/test_float128.cpp | 26 +++++++++++++------------- test/to_chars.cpp | 2 ++ test/to_chars_float.cpp | 7 ++++--- 12 files changed, 43 insertions(+), 37 deletions(-) diff --git a/test/from_chars_float.cpp b/test/from_chars_float.cpp index dfbe60f61..09e935d78 100644 --- a/test/from_chars_float.cpp +++ b/test/from_chars_float.cpp @@ -2,9 +2,11 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include "before_impl_headers.hpp" +#include +#define BOOST_CHARCONV_SOURCE #include "../src/from_chars_float_impl.hpp" +#undef BOOST_CHARCONV_SOURCE +#include #include #include #include diff --git a/test/from_chars_float2.cpp b/test/from_chars_float2.cpp index dd177608b..eb96919fe 100644 --- a/test/from_chars_float2.cpp +++ b/test/from_chars_float2.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include // stderr static boost::detail::splitmix64 rng; diff --git a/test/github_issue_122.cpp b/test/github_issue_122.cpp index 29db47d3d..4e01176dc 100644 --- a/test/github_issue_122.cpp +++ b/test/github_issue_122.cpp @@ -3,12 +3,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#define BOOST_CHARCONV_SOURCE +#include +#undef BOOST_CHARCONV_SOURCE + +#include #include #include #include -#include -#include "before_impl_headers.hpp" -#include template void test() diff --git a/test/github_issue_152_float128.cpp b/test/github_issue_152_float128.cpp index 6c64ea4d8..106fe854e 100644 --- a/test/github_issue_152_float128.cpp +++ b/test/github_issue_152_float128.cpp @@ -2,8 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef BOOST_CHARCONV_HAS_QUADMATH @@ -25,14 +31,6 @@ std::ostream& operator<<( std::ostream& os, std::float128_t v ) } #endif -#include -#include -#include -#include -#include -#include -#include - constexpr std::size_t N = 1024; static std::mt19937_64 rng(42); diff --git a/test/github_issue_212.cpp b/test/github_issue_212.cpp index c02eb8eb9..64bad2d4d 100644 --- a/test/github_issue_212.cpp +++ b/test/github_issue_212.cpp @@ -5,8 +5,8 @@ #include #include #include -#include #include +#include template void test() diff --git a/test/test_128bit_emulation.cpp b/test/test_128bit_emulation.cpp index 6411d2169..1c593e035 100644 --- a/test/test_128bit_emulation.cpp +++ b/test/test_128bit_emulation.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include // CHAR_BIT #ifdef BOOST_HAS_INT128 diff --git a/test/test_boost_json_values.cpp b/test/test_boost_json_values.cpp index 7dee5f494..11dfe9fc8 100644 --- a/test/test_boost_json_values.cpp +++ b/test/test_boost_json_values.cpp @@ -18,7 +18,8 @@ #include #include #include -#include +#include +#include // stderr template void grind(const std::string& str, const T expected_value) diff --git a/test/test_compute_float32.cpp b/test/test_compute_float32.cpp index c468e885e..8b19ed16d 100644 --- a/test/test_compute_float32.cpp +++ b/test/test_compute_float32.cpp @@ -2,12 +2,12 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #include "before_impl_headers.hpp" #include #include #include #include -#include using boost::charconv::detail::compute_float32; diff --git a/test/test_compute_float64.cpp b/test/test_compute_float64.cpp index a1eb657e3..c3324b9d4 100644 --- a/test/test_compute_float64.cpp +++ b/test/test_compute_float64.cpp @@ -2,13 +2,13 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #include "before_impl_headers.hpp" #include #include #include #include #include -#include using boost::charconv::detail::compute_float64; diff --git a/test/test_float128.cpp b/test/test_float128.cpp index 342048d1b..03015e804 100644 --- a/test/test_float128.cpp +++ b/test/test_float128.cpp @@ -2,7 +2,19 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include + +#define BOOST_CHARCONV_SOURCE +#include +#include "../src/float128_impl.hpp" +#undef BOOST_CHARCONV_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include #if defined(BOOST_CHARCONV_HAS_QUADMATH) && defined(BOOST_HAS_INT128) @@ -83,18 +95,6 @@ std::ostream& operator<<( std::ostream& os, boost::int128_type v ) } -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "before_impl_headers.hpp" -#include "../src/float128_impl.hpp" - constexpr int N = 1024; static boost::detail::splitmix64 rng; diff --git a/test/to_chars.cpp b/test/to_chars.cpp index 7fb886846..243f74033 100644 --- a/test/to_chars.cpp +++ b/test/to_chars.cpp @@ -13,6 +13,8 @@ #include #include #include +#include // UINT64_C +#include // INT_MIN #ifdef BOOST_CHARCONV_HAS_INT128 template diff --git a/test/to_chars_float.cpp b/test/to_chars_float.cpp index d71c4eaf5..a8f99297a 100644 --- a/test/to_chars_float.cpp +++ b/test/to_chars_float.cpp @@ -3,10 +3,12 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include "before_impl_headers.hpp" +#define BOOST_CHARCONV_SOURCE #include +#undef BOOST_CHARCONV_SOURCE +#include #include +#include #include #include #include @@ -18,7 +20,6 @@ #include #include #include -#include // These numbers diverge from what the formatting is using printf // See: https://godbolt.org/z/zd34KcWMW From 78464f34cf6140ab75978a6fa7e59e52e2e37c85 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 15 Jan 2025 11:53:03 +0100 Subject: [PATCH 81/84] Missing includes in tests --- include/boost/charconv/detail/fallback_routines.hpp | 1 + test/from_chars_float2.cpp | 1 + test/github_issue_110.cpp | 1 + test/github_issue_158.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/include/boost/charconv/detail/fallback_routines.hpp b/include/boost/charconv/detail/fallback_routines.hpp index 9d7c502f2..80963dde2 100644 --- a/include/boost/charconv/detail/fallback_routines.hpp +++ b/include/boost/charconv/detail/fallback_routines.hpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace boost { namespace charconv { diff --git a/test/from_chars_float2.cpp b/test/from_chars_float2.cpp index eb96919fe..178db296e 100644 --- a/test/from_chars_float2.cpp +++ b/test/from_chars_float2.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include // stderr static boost::detail::splitmix64 rng; diff --git a/test/github_issue_110.cpp b/test/github_issue_110.cpp index 7a196d8c0..dba529704 100644 --- a/test/github_issue_110.cpp +++ b/test/github_issue_110.cpp @@ -4,6 +4,7 @@ #include #include +#include template void overflow_spot_value(const std::string& buffer, boost::charconv::chars_format fmt = boost::charconv::chars_format::general) diff --git a/test/github_issue_158.cpp b/test/github_issue_158.cpp index f1333e037..ee3a71ffa 100644 --- a/test/github_issue_158.cpp +++ b/test/github_issue_158.cpp @@ -7,6 +7,7 @@ #include #include +#include void test_values_with_negative_exp() { From e019bcd940621a176140c8fde54e2f3d0a10f554 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 15 Jan 2025 11:55:58 +0100 Subject: [PATCH 82/84] Remove before_impl_headers --- test/before_impl_headers.hpp | 6 ------ test/test_128bit_emulation.cpp | 1 - test/test_128bit_native.cpp | 1 - test/test_compute_float32.cpp | 4 +--- test/test_compute_float64.cpp | 4 +--- test/test_compute_float80.cpp | 1 - test/test_num_digits.cpp | 1 - test/test_parser.cpp | 1 - 8 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 test/before_impl_headers.hpp diff --git a/test/before_impl_headers.hpp b/test/before_impl_headers.hpp deleted file mode 100644 index 4f30ed460..000000000 --- a/test/before_impl_headers.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef BOOST_CHARCONV_TEST_BEFORE_IMPL_HEADERS -#define BOOST_CHARCONV_TEST_BEFORE_IMPL_HEADERS - -#define BOOST_CHARCONV_SOURCE // prevent ifdefs in public headers. TODO: does this cause trouble in Windows? - -#endif diff --git a/test/test_128bit_emulation.cpp b/test/test_128bit_emulation.cpp index 1c593e035..82df66828 100644 --- a/test/test_128bit_emulation.cpp +++ b/test/test_128bit_emulation.cpp @@ -3,7 +3,6 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#include "before_impl_headers.hpp" #include #include #include diff --git a/test/test_128bit_native.cpp b/test/test_128bit_native.cpp index 5d265d768..e5873da41 100644 --- a/test/test_128bit_native.cpp +++ b/test/test_128bit_native.cpp @@ -3,7 +3,6 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#include "before_impl_headers.hpp" #include #include #include diff --git a/test/test_compute_float32.cpp b/test/test_compute_float32.cpp index 8b19ed16d..7e7e9d606 100644 --- a/test/test_compute_float32.cpp +++ b/test/test_compute_float32.cpp @@ -2,8 +2,6 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include "before_impl_headers.hpp" #include #include #include @@ -21,7 +19,7 @@ inline void simple_test() BOOST_TEST_EQ(compute_float32(38, 1, false, success), 1e38F); // out of range - BOOST_TEST_EQ(compute_float32(310, 5, false, success), HUGE_VALF); + BOOST_TEST_EQ(compute_float32(310, 5, false, success), std::numeric_limits::infinity()); BOOST_TEST_EQ(compute_float32(-325, 5, false, success), 0.0F); // Composite diff --git a/test/test_compute_float64.cpp b/test/test_compute_float64.cpp index c3324b9d4..e9cc2d051 100644 --- a/test/test_compute_float64.cpp +++ b/test/test_compute_float64.cpp @@ -2,8 +2,6 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include "before_impl_headers.hpp" #include #include #include @@ -22,7 +20,7 @@ inline void simple_test() BOOST_TEST_EQ(compute_float64(308, 1, false, success), 1e308); // out of range - BOOST_TEST_EQ(compute_float64(310, 5, false, success), HUGE_VAL); + BOOST_TEST_EQ(compute_float64(310, 5, false, success), std::numeric_limits::infinity()); BOOST_TEST_EQ(compute_float64(-325, 5, false, success), 0); // Composite diff --git a/test/test_compute_float80.cpp b/test/test_compute_float80.cpp index c2f9fbeb8..85031cea6 100644 --- a/test/test_compute_float80.cpp +++ b/test/test_compute_float80.cpp @@ -3,7 +3,6 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#include "before_impl_headers.hpp" #include #include #include diff --git a/test/test_num_digits.cpp b/test/test_num_digits.cpp index 82117a15f..79996c3dc 100644 --- a/test/test_num_digits.cpp +++ b/test/test_num_digits.cpp @@ -2,7 +2,6 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include "before_impl_headers.hpp" #include #include #include diff --git a/test/test_parser.cpp b/test/test_parser.cpp index a8e5e1d65..f35aa92ce 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -5,7 +5,6 @@ #include #include #include -#include "before_impl_headers.hpp" #include #include #include From 76f9b77d568ccbea4c59e94d4d2df4f96bb7c710 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 15 Jan 2025 12:01:08 +0100 Subject: [PATCH 83/84] Remove instances of BOOST_CHARCONV_SOURCE --- include/boost/charconv/detail/ryu/ryu_generic_128.hpp | 9 +++++---- test/from_chars_float.cpp | 4 +--- test/github_issue_122.cpp | 3 --- test/test_float128.cpp | 4 +--- test/to_chars_float.cpp | 2 -- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index d0f661b0a..b41c023ac 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -6,9 +6,10 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP +#include #include #include -#include +#include #include #include #include @@ -354,7 +355,7 @@ static inline int copy_special_str(char* result, const std::ptrdiff_t result_siz if (result_size >= 3 + static_cast(fd.sign)) { - memcpy(result, "inf", 3); + std::memcpy(result, "inf", 3); return static_cast(fd.sign) + 3; } @@ -428,7 +429,7 @@ static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, ch std::memmove(result + current_len + v.exponent + 1, result + current_len + v.exponent, static_cast(-v.exponent)); const auto shift = result + current_len + v.exponent; const auto shift_width = (shift - result) + 1; - memcpy(shift, ".", 1U); + std::memcpy(shift, ".", 1U); ++current_len; if (current_len - shift_width > precision) { @@ -481,7 +482,7 @@ static inline int generic_to_chars_fixed(const struct floating_decimal_128 v, ch } std::memmove(result - v.exponent - current_len + 2, result, static_cast(current_len)); - memcpy(result, "0.", 2U); + std::memcpy(result, "0.", 2U); std::memset(result + 2, '0', static_cast(0 - v.exponent - current_len)); current_len = -v.exponent + 2; precision -= current_len - 2; diff --git a/test/from_chars_float.cpp b/test/from_chars_float.cpp index 09e935d78..fc5358afc 100644 --- a/test/from_chars_float.cpp +++ b/test/from_chars_float.cpp @@ -2,10 +2,8 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#define BOOST_CHARCONV_SOURCE +#include // Needs to be before import std in modular builds #include "../src/from_chars_float_impl.hpp" -#undef BOOST_CHARCONV_SOURCE #include #include #include diff --git a/test/github_issue_122.cpp b/test/github_issue_122.cpp index 4e01176dc..49cfe3859 100644 --- a/test/github_issue_122.cpp +++ b/test/github_issue_122.cpp @@ -3,10 +3,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#define BOOST_CHARCONV_SOURCE #include -#undef BOOST_CHARCONV_SOURCE - #include #include #include diff --git a/test/test_float128.cpp b/test/test_float128.cpp index 03015e804..4288cadb3 100644 --- a/test/test_float128.cpp +++ b/test/test_float128.cpp @@ -3,10 +3,8 @@ // https://www.boost.org/LICENSE_1_0.txt -#define BOOST_CHARCONV_SOURCE -#include #include "../src/float128_impl.hpp" -#undef BOOST_CHARCONV_SOURCE +#include #include #include #include diff --git a/test/to_chars_float.cpp b/test/to_chars_float.cpp index a8f99297a..9c2de8a38 100644 --- a/test/to_chars_float.cpp +++ b/test/to_chars_float.cpp @@ -3,9 +3,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#define BOOST_CHARCONV_SOURCE #include -#undef BOOST_CHARCONV_SOURCE #include #include #include From 4f27753cb6ec669a0c43a3ae923d7c54b345f0f9 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 15 Jan 2025 12:02:05 +0100 Subject: [PATCH 84/84] Add config to CI --- tools/setup_boost_with_modules.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/setup_boost_with_modules.py b/tools/setup_boost_with_modules.py index 443583b17..e0842e953 100644 --- a/tools/setup_boost_with_modules.py +++ b/tools/setup_boost_with_modules.py @@ -13,6 +13,7 @@ def main(): ('tools/cmake', 'https://github.com/anarthal/boost-cmake'), ('libs/assert', 'https://github.com/anarthal/assert'), ('libs/core', 'https://github.com/anarthal/core'), + ('libs/config', 'https://github.com/anarthal/config'), ('libs/throw_exception','https://github.com/anarthal/throw_exception'), ]