From 38386f0b5da86c6040deca34787c49a1d0e4134d Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 27 Feb 2026 16:17:34 +0100 Subject: [PATCH 01/19] Initial impl --- CMakeLists.txt | 11 +- include/boost/charconv/config.hpp | 14 +- include/boost/charconv/detail/apply_sign.hpp | 2 +- include/boost/charconv/detail/bit_layouts.hpp | 4 +- .../boost/charconv/detail/buffer_sizing.hpp | 2 +- .../boost/charconv/detail/compute_float32.hpp | 6 +- .../boost/charconv/detail/compute_float64.hpp | 8 +- .../boost/charconv/detail/compute_float80.hpp | 18 +-- include/boost/charconv/detail/config.hpp | 11 +- .../charconv/detail/dragonbox/dragonbox.hpp | 8 +- .../detail/dragonbox/dragonbox_common.hpp | 12 +- .../boost/charconv/detail/dragonbox/floff.hpp | 12 +- include/boost/charconv/detail/emulated128.hpp | 10 +- .../charconv/detail/fallback_routines.hpp | 12 +- .../detail/fast_float/ascii_number.hpp | 8 +- .../charconv/detail/fast_float/bigint.hpp | 8 +- .../fast_float/constexpr_feature_detect.hpp | 5 + .../detail/fast_float/decimal_to_binary.hpp | 12 +- .../detail/fast_float/digit_comparison.hpp | 8 +- .../charconv/detail/fast_float/fast_table.hpp | 2 +- .../detail/fast_float/float_common.hpp | 14 +- .../detail/fast_float/parse_number.hpp | 8 +- .../detail/from_chars_integer_impl.hpp | 14 +- .../charconv/detail/from_chars_result.hpp | 6 +- .../charconv/detail/integer_search_trees.hpp | 6 +- include/boost/charconv/detail/issignaling.hpp | 4 +- include/boost/charconv/detail/memcpy.hpp | 4 +- include/boost/charconv/detail/parser.hpp | 12 +- .../boost/charconv/detail/ryu/generic_128.hpp | 2 +- .../charconv/detail/ryu/ryu_generic_128.hpp | 8 +- .../charconv/detail/significand_tables.hpp | 2 +- .../charconv/detail/to_chars_integer_impl.hpp | 24 ++-- .../boost/charconv/detail/to_chars_result.hpp | 4 +- include/boost/charconv/detail/type_traits.hpp | 2 +- include/boost/charconv/from_chars.hpp | 130 +++++++++--------- include/boost/charconv/limits.hpp | 7 +- 36 files changed, 226 insertions(+), 194 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d4525678d..49cb2b6b0 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,15 @@ add_library(boost_charconv add_library(Boost::charconv ALIAS boost_charconv) +if (BOOST_USE_MODULES) + 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) +endif() + target_include_directories(boost_charconv PUBLIC include) diff --git a/include/boost/charconv/config.hpp b/include/boost/charconv/config.hpp index 0d94ccd4a..a9d85b25e 100644 --- a/include/boost/charconv/config.hpp +++ b/include/boost/charconv/config.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CHARCONV_CONFIG_HPP_INCLUDED) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CHARCONV_CONFIG_HPP_INCLUDED #define BOOST_CHARCONV_CONFIG_HPP_INCLUDED @@ -7,7 +12,7 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#include +#include // This header implements separate compilation features as described in // http://www.boost.org/more/separate_compilation.html @@ -36,4 +41,11 @@ #endif +// Modules +#ifdef BOOST_USE_MODULES +# define BOOST_CHARCONV_MODULE_EXPORT export +#else +# define BOOST_CHARCONV_MODULE_EXPORT +#endif + #endif // BOOST_CHARCONV_CONFIG_HPP_INCLUDED diff --git a/include/boost/charconv/detail/apply_sign.hpp b/include/boost/charconv/detail/apply_sign.hpp index ef6db7143..56c68cf56 100644 --- a/include/boost/charconv/detail/apply_sign.hpp +++ b/include/boost/charconv/detail/apply_sign.hpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include // We are purposefully converting values here #ifdef BOOST_MSVC diff --git a/include/boost/charconv/detail/bit_layouts.hpp b/include/boost/charconv/detail/bit_layouts.hpp index c163ce06a..4cf8ded5e 100644 --- a/include/boost/charconv/detail/bit_layouts.hpp +++ b/include/boost/charconv/detail/bit_layouts.hpp @@ -7,8 +7,8 @@ #include #include -#include -#include +#include +#include // Layouts of floating point types as specified by IEEE 754 // See page 23 of IEEE 754-2008 diff --git a/include/boost/charconv/detail/buffer_sizing.hpp b/include/boost/charconv/detail/buffer_sizing.hpp index 3115ee39e..b7b6957b2 100644 --- a/include/boost/charconv/detail/buffer_sizing.hpp +++ b/include/boost/charconv/detail/buffer_sizing.hpp @@ -7,7 +7,7 @@ #include #include -#include +#include namespace boost { namespace charconv { diff --git a/include/boost/charconv/detail/compute_float32.hpp b/include/boost/charconv/detail/compute_float32.hpp index 85ece7f8c..287c9515f 100644 --- a/include/boost/charconv/detail/compute_float32.hpp +++ b/include/boost/charconv/detail/compute_float32.hpp @@ -6,9 +6,9 @@ #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT32_HPP #include -#include -#include -#include +#include +#include +#include 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 3cb83537f..0958f05ee 100644 --- a/include/boost/charconv/detail/compute_float64.hpp +++ b/include/boost/charconv/detail/compute_float64.hpp @@ -10,10 +10,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include 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 ad1e51486..892b83656 100644 --- a/include/boost/charconv/detail/compute_float80.hpp +++ b/include/boost/charconv/detail/compute_float80.hpp @@ -8,17 +8,17 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #ifdef BOOST_CHARCONV_DEBUG_FLOAT128 -#include -#include +#include +#include #include #endif diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index 9feb609fe..8ad4dba7b 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -2,12 +2,17 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +// Make this header safe to include in our purview +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CHARCONV_DETAIL_CONFIG_HPP) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CHARCONV_DETAIL_CONFIG_HPP #define BOOST_CHARCONV_DETAIL_CONFIG_HPP #include -#include -#include +#include +#include #include #define BOOST_CHARCONV_ASSERT(expr) BOOST_ASSERT(expr) @@ -169,7 +174,7 @@ static_assert((BOOST_CHARCONV_ENDIAN_BIG_BYTE || BOOST_CHARCONV_ENDIAN_LITTLE_BY // All of these types are optional so check for each of them individually #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 f2d3449ac..abbff3f52 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox.hpp @@ -30,10 +30,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #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..0fb86943e 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp @@ -29,12 +29,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include 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 8eaaffd80..698712f0c 100644 --- a/include/boost/charconv/detail/dragonbox/floff.hpp +++ b/include/boost/charconv/detail/dragonbox/floff.hpp @@ -31,12 +31,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #ifdef BOOST_MSVC # pragma warning(push) diff --git a/include/boost/charconv/detail/emulated128.hpp b/include/boost/charconv/detail/emulated128.hpp index 281b031cb..6fabda2cb 100644 --- a/include/boost/charconv/detail/emulated128.hpp +++ b/include/boost/charconv/detail/emulated128.hpp @@ -11,11 +11,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include 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 94f87b82b..db34a3db2 100644 --- a/include/boost/charconv/detail/fallback_routines.hpp +++ b/include/boost/charconv/detail/fallback_routines.hpp @@ -10,12 +10,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include 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 159a7661d..bd5bd4a19 100644 --- a/include/boost/charconv/detail/fast_float/ascii_number.hpp +++ b/include/boost/charconv/detail/fast_float/ascii_number.hpp @@ -9,10 +9,10 @@ #define BOOST_CHARCONV_DETAIL_FASTFLOAT_ASCII_NUMBER_HPP #include -#include -#include -#include -#include +#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 fd98590cd..c3dbf9e71 100644 --- a/include/boost/charconv/detail/fast_float/bigint.hpp +++ b/include/boost/charconv/detail/fast_float/bigint.hpp @@ -9,10 +9,10 @@ #define BOOST_CHARCONV_DETAIL_FASTFLOAT_BIGINT_HPP #include -#include -#include -#include -#include +#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 1ac1e4aab..2a5eb4843 100644 --- a/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp +++ b/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp @@ -5,6 +5,11 @@ // // Derivative of: https://github.com/fastfloat/fast_float +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CHARCONV_DETAIL_FASTFLOAT_CONSTEXPR_FEATURE_DETECT_HPP) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_CONSTEXPR_FEATURE_DETECT_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_CONSTEXPR_FEATURE_DETECT_HPP 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..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,12 +10,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#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 231279410..0c5fc7799 100644 --- a/include/boost/charconv/detail/fast_float/digit_comparison.hpp +++ b/include/boost/charconv/detail/fast_float/digit_comparison.hpp @@ -11,10 +11,10 @@ #include #include #include -#include -#include -#include -#include +#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 e08eb3145..ce9b13adf 100644 --- a/include/boost/charconv/detail/fast_float/fast_table.hpp +++ b/include/boost/charconv/detail/fast_float/fast_table.hpp @@ -9,7 +9,7 @@ #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_TABLE_HPP #include -#include +#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 0b9d3aee5..e6e320d4b 100644 --- a/include/boost/charconv/detail/fast_float/float_common.hpp +++ b/include/boost/charconv/detail/fast_float/float_common.hpp @@ -12,12 +12,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace boost { namespace charconv { namespace detail { namespace fast_float { @@ -38,7 +38,7 @@ using parse_options = parse_options_t; }}}} #if BOOST_CHARCONV_FASTFLOAT_HAS_BIT_CAST -#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 9f71d45c2..e76b4a846 100644 --- a/include/boost/charconv/detail/fast_float/parse_number.hpp +++ b/include/boost/charconv/detail/fast_float/parse_number.hpp @@ -13,10 +13,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include 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 69d5e5f95..3171265af 100644 --- a/include/boost/charconv/detail/from_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/from_chars_integer_impl.hpp @@ -12,13 +12,13 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +#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 e4302cfab..d257945dd 100644 --- a/include/boost/charconv/detail/from_chars_result.hpp +++ b/include/boost/charconv/detail/from_chars_result.hpp @@ -5,13 +5,13 @@ #ifndef BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP #define BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP -#include +#include namespace boost { namespace charconv { // 22.13.3, Primitive numerical input conversion -template +BOOST_CHARCONV_MODULE_EXPORT template struct from_chars_result_t { const UC* ptr; @@ -34,7 +34,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_CHARCONV_MODULE_EXPORT using from_chars_result = from_chars_result_t; }} // Namespaces diff --git a/include/boost/charconv/detail/integer_search_trees.hpp b/include/boost/charconv/detail/integer_search_trees.hpp index 52e8ec12d..d2c47da99 100644 --- a/include/boost/charconv/detail/integer_search_trees.hpp +++ b/include/boost/charconv/detail/integer_search_trees.hpp @@ -10,9 +10,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/issignaling.hpp b/include/boost/charconv/detail/issignaling.hpp index 0780c2e89..0c5efe641 100644 --- a/include/boost/charconv/detail/issignaling.hpp +++ b/include/boost/charconv/detail/issignaling.hpp @@ -7,8 +7,8 @@ #include #include -#include -#include +#include +#include namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/detail/memcpy.hpp b/include/boost/charconv/detail/memcpy.hpp index 1e68315f4..a614b2dc4 100644 --- a/include/boost/charconv/detail/memcpy.hpp +++ b/include/boost/charconv/detail/memcpy.hpp @@ -6,8 +6,8 @@ #define BOOST_CHARCONV_DETAIL_MEMCPY_HPP #include -#include -#include +#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 660de6884..c851a62d2 100644 --- a/include/boost/charconv/detail/parser.hpp +++ b/include/boost/charconv/detail/parser.hpp @@ -11,12 +11,12 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#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 23c5234dd..748d8b129 100644 --- a/include/boost/charconv/detail/ryu/generic_128.hpp +++ b/include/boost/charconv/detail/ryu/generic_128.hpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #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 2047d9a70..38b440496 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -11,12 +11,12 @@ #include #include #include -#include -#include -#include +#include +#include +#include #ifdef BOOST_CHARCONV_DEBUG -# include +# 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 51dd71f45..b55d4cb2c 100644 --- a/include/boost/charconv/detail/significand_tables.hpp +++ b/include/boost/charconv/detail/significand_tables.hpp @@ -7,7 +7,7 @@ #define BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP #include -#include +#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 5b256c26f..dc69bb1ab 100644 --- a/include/boost/charconv/detail/to_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/to_chars_integer_impl.hpp @@ -13,18 +13,18 @@ #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 +#include +#include 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..85f92be87 100644 --- a/include/boost/charconv/detail/to_chars_result.hpp +++ b/include/boost/charconv/detail/to_chars_result.hpp @@ -5,13 +5,13 @@ #ifndef BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP #define BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP -#include +#include // 22.13.2, Primitive numerical output conversion namespace boost { namespace charconv { -struct to_chars_result +BOOST_CHARCONV_MODULE_EXPORT struct to_chars_result { char *ptr; std::errc ec; diff --git a/include/boost/charconv/detail/type_traits.hpp b/include/boost/charconv/detail/type_traits.hpp index 416055516..3400d845e 100644 --- a/include/boost/charconv/detail/type_traits.hpp +++ b/include/boost/charconv/detail/type_traits.hpp @@ -6,7 +6,7 @@ #define BOOST_CHARCONV_DETAIL_TYPE_TRAITS_HPP #include -#include +#include namespace boost { namespace charconv { namespace detail { diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index 0bef0b5f5..d647694dc 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -13,121 +13,121 @@ #include #include #include -#include +#include namespace boost { namespace charconv { // integer overloads -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, bool& value, int base = 10) noexcept = delete; -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, char& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, bool& value, int base = 10) noexcept = delete; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, char& value, int base = 10) noexcept { return detail::from_chars(first, last, value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, signed char& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, signed char& value, int base = 10) noexcept { return detail::from_chars(first, last, value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, unsigned char& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, unsigned char& value, int base = 10) noexcept { return detail::from_chars(first, last, value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, short& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, short& value, int base = 10) noexcept { return detail::from_chars(first, last, value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, unsigned short& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, unsigned short& value, int base = 10) noexcept { return detail::from_chars(first, last, value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, int& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, int& value, int base = 10) noexcept { return detail::from_chars(first, last, value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, unsigned int& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, unsigned int& value, int base = 10) noexcept { return detail::from_chars(first, last, value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, long& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, long& value, int base = 10) noexcept { return detail::from_chars(first, last, value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, unsigned long& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, unsigned long& value, int base = 10) noexcept { return detail::from_chars(first, last, value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, long long& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, long long& value, int base = 10) noexcept { return detail::from_chars(first, last, value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, unsigned long long& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, unsigned long long& value, int base = 10) noexcept { return detail::from_chars(first, last, value, base); } #ifdef BOOST_CHARCONV_HAS_INT128 -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, boost::int128_type& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, boost::int128_type& value, int base = 10) noexcept { return detail::from_chars128(first, last, value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, boost::uint128_type& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(const char* first, const char* last, boost::uint128_type& value, int base = 10) noexcept { return detail::from_chars128(first, last, value, base); } #endif -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, bool& value, int base = 10) noexcept = delete; -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, char& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, bool& value, int base = 10) noexcept = delete; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, char& value, int base = 10) noexcept { return detail::from_chars(sv.data(), sv.data() + sv.size(), value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, signed char& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, signed char& value, int base = 10) noexcept { return detail::from_chars(sv.data(), sv.data() + sv.size(), value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, unsigned char& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, unsigned char& value, int base = 10) noexcept { return detail::from_chars(sv.data(), sv.data() + sv.size(), value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, short& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, short& value, int base = 10) noexcept { return detail::from_chars(sv.data(), sv.data() + sv.size(), value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, unsigned short& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, unsigned short& value, int base = 10) noexcept { return detail::from_chars(sv.data(), sv.data() + sv.size(), value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, int& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, int& value, int base = 10) noexcept { return detail::from_chars(sv.data(), sv.data() + sv.size(), value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, unsigned int& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, unsigned int& value, int base = 10) noexcept { return detail::from_chars(sv.data(), sv.data() + sv.size(), value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, long& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, long& value, int base = 10) noexcept { return detail::from_chars(sv.data(), sv.data() + sv.size(), value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, unsigned long& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, unsigned long& value, int base = 10) noexcept { return detail::from_chars(sv.data(), sv.data() + sv.size(), value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, long long& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, long long& value, int base = 10) noexcept { return detail::from_chars(sv.data(), sv.data() + sv.size(), value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, unsigned long long& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, unsigned long long& value, int base = 10) noexcept { return detail::from_chars(sv.data(), sv.data() + sv.size(), value, base); } #ifdef BOOST_CHARCONV_HAS_INT128 -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, boost::int128_type& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, boost::int128_type& value, int base = 10) noexcept { return detail::from_chars128(sv.data(), sv.data() + sv.size(), value, base); } -BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, boost::uint128_type& value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_view sv, boost::uint128_type& value, int base = 10) noexcept { return detail::from_chars128(sv.data(), sv.data() + sv.size(), value, base); } @@ -137,116 +137,116 @@ BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars(boost::core::string_v // Floating Point //---------------------------------------------------------------------------------------------------------------------- -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, float& value, chars_format fmt = chars_format::general) noexcept; -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, double& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, float& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, double& value, chars_format fmt = chars_format::general) noexcept; #ifndef BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, long double& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, long double& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_QUADMATH -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, __float128& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, __float128& value, chars_format fmt = chars_format::general) noexcept; #endif // types #ifdef BOOST_CHARCONV_HAS_FLOAT16 -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, std::float16_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, std::float16_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT32 -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, std::float32_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, std::float32_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT64 -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, std::float64_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, std::float64_t& value, chars_format fmt = chars_format::general) noexcept; #endif #if defined(BOOST_CHARCONV_HAS_STDFLOAT128) && defined(BOOST_CHARCONV_HAS_QUADMATH) -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, std::float128_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, std::float128_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_BRAINFLOAT16 -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, std::bfloat16_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(const char* first, const char* last, std::bfloat16_t& value, chars_format fmt = chars_format::general) noexcept; #endif -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, float& value, chars_format fmt = chars_format::general) noexcept; -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, double& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, float& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, double& value, chars_format fmt = chars_format::general) noexcept; #ifndef BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, long double& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, long double& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_QUADMATH -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, __float128& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, __float128& value, chars_format fmt = chars_format::general) noexcept; #endif // types #ifdef BOOST_CHARCONV_HAS_FLOAT16 -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, std::float16_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, std::float16_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT32 -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, std::float32_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, std::float32_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT64 -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, std::float64_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, std::float64_t& value, chars_format fmt = chars_format::general) noexcept; #endif #if defined(BOOST_CHARCONV_HAS_STDFLOAT128) && defined(BOOST_CHARCONV_HAS_QUADMATH) -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, std::float128_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, std::float128_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_BRAINFLOAT16 -BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, std::bfloat16_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars_erange(boost::core::string_view sv, std::bfloat16_t& value, chars_format fmt = chars_format::general) noexcept; #endif // The following adhere to the standard library definition with std::errc::result_out_of_range // Returns value unmodified // See: https://github.com/cppalliance/charconv/issues/110 -BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, float& value, chars_format fmt = chars_format::general) noexcept; -BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, double& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, float& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, double& value, chars_format fmt = chars_format::general) noexcept; #ifndef BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE -BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, long double& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, long double& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_QUADMATH -BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, __float128& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, __float128& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT16 -BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, std::float16_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, std::float16_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT32 -BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, std::float32_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, std::float32_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT64 -BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, std::float64_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, std::float64_t& value, chars_format fmt = chars_format::general) noexcept; #endif #if defined(BOOST_CHARCONV_HAS_STDFLOAT128) && defined(BOOST_CHARCONV_HAS_QUADMATH) -BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, std::float128_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, std::float128_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_BRAINFLOAT16 -BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, std::bfloat16_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(const char* first, const char* last, std::bfloat16_t& value, chars_format fmt = chars_format::general) noexcept; #endif -BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, float& value, chars_format fmt = chars_format::general) noexcept; -BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, double& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, float& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, double& value, chars_format fmt = chars_format::general) noexcept; #ifndef BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE -BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, long double& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, long double& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_QUADMATH -BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, __float128& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, __float128& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT16 -BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, std::float16_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, std::float16_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT32 -BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, std::float32_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, std::float32_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT64 -BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, std::float64_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, std::float64_t& value, chars_format fmt = chars_format::general) noexcept; #endif #if defined(BOOST_CHARCONV_HAS_STDFLOAT128) && defined(BOOST_CHARCONV_HAS_QUADMATH) -BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, std::float128_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, std::float128_t& value, chars_format fmt = chars_format::general) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_BRAINFLOAT16 -BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, std::bfloat16_t& value, chars_format fmt = chars_format::general) noexcept; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(boost::core::string_view sv, std::bfloat16_t& value, chars_format fmt = chars_format::general) noexcept; #endif } // namespace charconv diff --git a/include/boost/charconv/limits.hpp b/include/boost/charconv/limits.hpp index f62809f30..07df42208 100644 --- a/include/boost/charconv/limits.hpp +++ b/include/boost/charconv/limits.hpp @@ -6,8 +6,9 @@ #define BOOST_CHARCONV_LIMITS_HPP #include -#include -#include +#include +#include +#include namespace boost { namespace charconv { @@ -41,7 +42,7 @@ template struct is_uint128: std::false_type {}; } // namespace detail -template struct limits +BOOST_CHARCONV_MODULE_EXPORT template struct limits { BOOST_ATTRIBUTE_UNUSED static constexpr int max_chars10 = From 1cab8239d10183708bf62ad017da5700605f8ebd Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 27 Feb 2026 16:26:30 +0100 Subject: [PATCH 02/19] Remaining headers --- include/boost/charconv/chars_format.hpp | 4 +- include/boost/charconv/to_chars.hpp | 64 ++++++++++++------------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/include/boost/charconv/chars_format.hpp b/include/boost/charconv/chars_format.hpp index 0542372bf..2fa5c87ce 100644 --- a/include/boost/charconv/chars_format.hpp +++ b/include/boost/charconv/chars_format.hpp @@ -5,11 +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) -enum class chars_format : unsigned +BOOST_CHARCONV_MODULE_EXPORT enum class chars_format : unsigned { scientific = 1 << 0, fixed = 1 << 1, diff --git a/include/boost/charconv/to_chars.hpp b/include/boost/charconv/to_chars.hpp index 7192fda57..207696a52 100644 --- a/include/boost/charconv/to_chars.hpp +++ b/include/boost/charconv/to_chars.hpp @@ -16,58 +16,58 @@ namespace boost { namespace charconv { // integer overloads -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, bool value, int base) noexcept = delete; -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, char value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, bool value, int base) noexcept = delete; +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, char value, int base = 10) noexcept { return detail::to_chars_int(first, last, value, base); } -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, signed char value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, signed char value, int base = 10) noexcept { return detail::to_chars_int(first, last, value, base); } -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned char value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned char value, int base = 10) noexcept { return detail::to_chars_int(first, last, value, base); } -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, short value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, short value, int base = 10) noexcept { return detail::to_chars_int(first, last, value, base); } -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned short value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned short value, int base = 10) noexcept { return detail::to_chars_int(first, last, value, base); } -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, int value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, int value, int base = 10) noexcept { return detail::to_chars_int(first, last, value, base); } -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned int value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned int value, int base = 10) noexcept { return detail::to_chars_int(first, last, value, base); } -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, long value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, long value, int base = 10) noexcept { return detail::to_chars_int(first, last, value, base); } -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned long value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned long value, int base = 10) noexcept { return detail::to_chars_int(first, last, value, base); } -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, long long value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, long long value, int base = 10) noexcept { return detail::to_chars_int(first, last, value, base); } -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned long long value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, unsigned long long value, int base = 10) noexcept { return detail::to_chars_int(first, last, value, base); } #ifdef BOOST_CHARCONV_HAS_INT128 -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, boost::int128_type value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, boost::int128_type value, int base = 10) noexcept { return detail::to_chars128(first, last, value, base); } -BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, boost::uint128_type value, int base = 10) noexcept +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, boost::uint128_type value, int base = 10) noexcept { return detail::to_chars128(first, last, value, base); } @@ -77,67 +77,67 @@ BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars(char* first, char* last, boost // Floating Point //---------------------------------------------------------------------------------------------------------------------- -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, float value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, float value, chars_format fmt = chars_format::general) noexcept; -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, double value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, double value, chars_format fmt = chars_format::general) noexcept; #ifndef BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, long double value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, long double value, chars_format fmt = chars_format::general) noexcept; #endif -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, float value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, float value, chars_format fmt, int precision) noexcept; -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, double value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, double value, chars_format fmt, int precision) noexcept; #ifndef BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, long double value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, long double value, chars_format fmt, int precision) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_QUADMATH -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, __float128 value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, __float128 value, chars_format fmt = chars_format::general) noexcept; -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, __float128 value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, __float128 value, chars_format fmt, int precision) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT16 -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float16_t value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float16_t value, chars_format fmt = chars_format::general) noexcept; -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float16_t value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float16_t value, chars_format fmt, int precision) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT32 -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float32_t value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float32_t value, chars_format fmt = chars_format::general) noexcept; -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float32_t value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float32_t value, chars_format fmt, int precision) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_FLOAT64 -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float64_t value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float64_t value, chars_format fmt = chars_format::general) noexcept; -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float64_t value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float64_t value, chars_format fmt, int precision) noexcept; #endif #if defined(BOOST_CHARCONV_HAS_STDFLOAT128) && defined(BOOST_CHARCONV_HAS_QUADMATH) -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float128_t value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float128_t value, chars_format fmt = chars_format::general) noexcept; -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float128_t value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::float128_t value, chars_format fmt, int precision) noexcept; #endif #ifdef BOOST_CHARCONV_HAS_BRAINFLOAT16 -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::bfloat16_t value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::bfloat16_t value, chars_format fmt = chars_format::general) noexcept; -BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::bfloat16_t value, +BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, std::bfloat16_t value, chars_format fmt, int precision) noexcept; #endif From ae1ef028bba9eb498711846a9bf9ea1d930dffbe Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 27 Feb 2026 16:30:36 +0100 Subject: [PATCH 03/19] compat headers --- include/boost/charconv/chars_format.hpp | 13 +++++++++++++ include/boost/charconv/from_chars.hpp | 13 +++++++++++++ include/boost/charconv/limits.hpp | 13 +++++++++++++ include/boost/charconv/to_chars.hpp | 13 +++++++++++++ 4 files changed, 52 insertions(+) diff --git a/include/boost/charconv/chars_format.hpp b/include/boost/charconv/chars_format.hpp index 2fa5c87ce..2eb4d503a 100644 --- a/include/boost/charconv/chars_format.hpp +++ b/include/boost/charconv/chars_format.hpp @@ -5,6 +5,17 @@ #ifndef BOOST_CHARCONV_CHARS_FORMAT_HPP #define BOOST_CHARCONV_CHARS_FORMAT_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.charconv; +#ifndef BOOST_CHARCONV_CONSTEXPR +#define BOOST_CHARCONV_CONSTEXPR constexpr +#endif +#endif + +#else + #include namespace boost { namespace charconv { @@ -21,4 +32,6 @@ BOOST_CHARCONV_MODULE_EXPORT enum class chars_format : unsigned }} // Namespaces +#endif // defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_CHARS_FORMAT_HPP diff --git a/include/boost/charconv/from_chars.hpp b/include/boost/charconv/from_chars.hpp index d647694dc..d59faa6b2 100644 --- a/include/boost/charconv/from_chars.hpp +++ b/include/boost/charconv/from_chars.hpp @@ -6,6 +6,17 @@ #ifndef BOOST_CHARCONV_FROM_CHARS_HPP_INCLUDED #define BOOST_CHARCONV_FROM_CHARS_HPP_INCLUDED +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.charconv; +#ifndef BOOST_CHARCONV_CONSTEXPR +#define BOOST_CHARCONV_CONSTEXPR constexpr +#endif +#endif + +#else + #include #include #include @@ -252,4 +263,6 @@ BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL from_chars_result from_chars(bo } // namespace charconv } // namespace boost +#endif // defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // #ifndef BOOST_CHARCONV_FROM_CHARS_HPP_INCLUDED diff --git a/include/boost/charconv/limits.hpp b/include/boost/charconv/limits.hpp index 07df42208..4568b23a8 100644 --- a/include/boost/charconv/limits.hpp +++ b/include/boost/charconv/limits.hpp @@ -5,6 +5,17 @@ #ifndef BOOST_CHARCONV_LIMITS_HPP #define BOOST_CHARCONV_LIMITS_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.charconv; +#ifndef BOOST_CHARCONV_CONSTEXPR +#define BOOST_CHARCONV_CONSTEXPR constexpr +#endif +#endif + +#else + #include #include #include @@ -94,4 +105,6 @@ template BOOST_ATTRIBUTE_UNUSED constexpr int limits::max_chars; }} // namespace boost::charconv +#endif // defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_LIMITS_HPP diff --git a/include/boost/charconv/to_chars.hpp b/include/boost/charconv/to_chars.hpp index 207696a52..7e6cd0f23 100644 --- a/include/boost/charconv/to_chars.hpp +++ b/include/boost/charconv/to_chars.hpp @@ -7,6 +7,17 @@ #ifndef BOOST_CHARCONV_TO_CHARS_HPP_INCLUDED #define BOOST_CHARCONV_TO_CHARS_HPP_INCLUDED +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.charconv; +#ifndef BOOST_CHARCONV_CONSTEXPR +#define BOOST_CHARCONV_CONSTEXPR constexpr +#endif +#endif + +#else + #include #include #include @@ -144,4 +155,6 @@ BOOST_CHARCONV_MODULE_EXPORT BOOST_CHARCONV_DECL to_chars_result to_chars(char* } // namespace charconv } // namespace boost +#endif // defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // #ifndef BOOST_CHARCONV_TO_CHARS_HPP_INCLUDED From 0bdf8d60c7d5a1f9aad79981c53c04e38ef3aecf Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 10:56:12 +0100 Subject: [PATCH 04/19] header fixes --- include/boost/charconv/detail/apply_sign.hpp | 4 ++ include/boost/charconv/detail/bit_layouts.hpp | 19 +++----- .../boost/charconv/detail/buffer_sizing.hpp | 4 ++ .../boost/charconv/detail/compute_float32.hpp | 4 ++ .../boost/charconv/detail/compute_float64.hpp | 4 ++ .../boost/charconv/detail/compute_float80.hpp | 4 ++ include/boost/charconv/detail/config.hpp | 22 ++++++++- .../charconv/detail/dragonbox/dragonbox.hpp | 4 ++ .../detail/dragonbox/dragonbox_common.hpp | 4 ++ .../boost/charconv/detail/dragonbox/floff.hpp | 16 ++++--- include/boost/charconv/detail/emulated128.hpp | 6 ++- .../charconv/detail/fallback_routines.hpp | 4 ++ .../detail/fast_float/ascii_number.hpp | 4 ++ .../charconv/detail/fast_float/bigint.hpp | 4 ++ .../fast_float/constexpr_feature_detect.hpp | 2 +- .../detail/fast_float/decimal_to_binary.hpp | 4 ++ .../detail/fast_float/digit_comparison.hpp | 4 ++ .../charconv/detail/fast_float/fast_float.hpp | 5 ++ .../charconv/detail/fast_float/fast_table.hpp | 4 ++ .../detail/fast_float/float_common.hpp | 46 ++++++++++--------- .../detail/fast_float/parse_number.hpp | 4 ++ .../detail/from_chars_integer_impl.hpp | 4 ++ .../charconv/detail/from_chars_result.hpp | 5 ++ include/boost/charconv/detail/gmf.hpp | 16 +++++++ .../charconv/detail/integer_search_trees.hpp | 4 ++ include/boost/charconv/detail/issignaling.hpp | 6 ++- include/boost/charconv/detail/memcpy.hpp | 4 ++ .../boost/charconv/detail/ryu/generic_128.hpp | 24 ++++++---- .../charconv/detail/ryu/ryu_generic_128.hpp | 26 ++++++----- .../charconv/detail/significand_tables.hpp | 4 ++ .../charconv/detail/to_chars_integer_impl.hpp | 8 +++- .../boost/charconv/detail/to_chars_result.hpp | 4 ++ include/boost/charconv/detail/type_traits.hpp | 4 ++ 33 files changed, 215 insertions(+), 66 deletions(-) create mode 100644 include/boost/charconv/detail/gmf.hpp diff --git a/include/boost/charconv/detail/apply_sign.hpp b/include/boost/charconv/detail/apply_sign.hpp index 56c68cf56..fc2eadecc 100644 --- a/include/boost/charconv/detail/apply_sign.hpp +++ b/include/boost/charconv/detail/apply_sign.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_APPLY_SIGN_HPP #define BOOST_CHARCONV_DETAIL_APPLY_SIGN_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -47,4 +49,6 @@ constexpr Unsigned_Integer apply_sign(Unsigned_Integer val) noexcept # pragma clang diagnostic pop #endif +#endif // !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_APPLY_SIGN_HPP diff --git a/include/boost/charconv/detail/bit_layouts.hpp b/include/boost/charconv/detail/bit_layouts.hpp index 4cf8ded5e..b21a0050d 100644 --- a/include/boost/charconv/detail/bit_layouts.hpp +++ b/include/boost/charconv/detail/bit_layouts.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_BIT_LAYOUTS_HPP #define BOOST_CHARCONV_DETAIL_BIT_LAYOUTS_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -56,7 +58,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 +85,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 +103,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 +121,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 @@ -157,4 +150,6 @@ struct ieee754_binary128 }}} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_BIT_LAYOUTS_HPP diff --git a/include/boost/charconv/detail/buffer_sizing.hpp b/include/boost/charconv/detail/buffer_sizing.hpp index b7b6957b2..33659d868 100644 --- a/include/boost/charconv/detail/buffer_sizing.hpp +++ b/include/boost/charconv/detail/buffer_sizing.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP #define BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -69,4 +71,6 @@ inline int total_buffer_length(int real_precision, Int exp, bool signed_value) } //namespace charconv } //namespace boost +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif //BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP diff --git a/include/boost/charconv/detail/compute_float32.hpp b/include/boost/charconv/detail/compute_float32.hpp index 287c9515f..ae48a5115 100644 --- a/include/boost/charconv/detail/compute_float32.hpp +++ b/include/boost/charconv/detail/compute_float32.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT32_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT32_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -52,4 +54,6 @@ inline float compute_float32(std::int64_t power, std::uint64_t i, bool negative, }}} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT32_HPP diff --git a/include/boost/charconv/detail/compute_float64.hpp b/include/boost/charconv/detail/compute_float64.hpp index 0958f05ee..580877e3c 100644 --- a/include/boost/charconv/detail/compute_float64.hpp +++ b/include/boost/charconv/detail/compute_float64.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT64_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT64_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -198,4 +200,6 @@ inline double compute_float64(std::int64_t power, std::uint64_t i, bool negative }}} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT64_HPP diff --git a/include/boost/charconv/detail/compute_float80.hpp b/include/boost/charconv/detail/compute_float80.hpp index 892b83656..dc603de47 100644 --- a/include/boost/charconv/detail/compute_float80.hpp +++ b/include/boost/charconv/detail/compute_float80.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP #define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -111,4 +113,6 @@ inline ResultType compute_float80(std::int64_t q, Unsigned_Integer w, bool negat }}} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT80_HPP diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index 8ad4dba7b..b85300b57 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -12,7 +12,27 @@ #include #include -#include +#include + +// Long double characteristics + +// 80 bit long double (e.g. x86-64) +#if LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 +# define BOOST_CHARCONV_LDBL_BITS 80 + +// 128 bit long double (e.g. s390x, ppcle64) +#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 +# define BOOST_CHARCONV_LDBL_BITS 128 + +// 64 bit long double (double == long double on ARM) +#elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +# define BOOST_CHARCONV_LDBL_BITS 64 + +// Unsupported long double representation +# define BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE +# define BOOST_CHARCONV_LDBL_BITS -1 + +#endif // long double feature detection #include #define BOOST_CHARCONV_ASSERT(expr) BOOST_ASSERT(expr) diff --git a/include/boost/charconv/detail/dragonbox/dragonbox.hpp b/include/boost/charconv/detail/dragonbox/dragonbox.hpp index abbff3f52..1fe75f032 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox.hpp @@ -22,6 +22,8 @@ #ifndef BOOST_CHARCONV_DETAIL_DRAGONBOX_HPP #define BOOST_CHARCONV_DETAIL_DRAGONBOX_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -2749,4 +2751,6 @@ to_chars_result dragonbox_to_chars(Float x, char* first, char* last, chars_forma # pragma warning(pop) #endif +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_DRAGONBOX_HPP diff --git a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp index 0fb86943e..a3789fea4 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp @@ -24,6 +24,8 @@ #ifndef BOOST_CHARCONV_DETAIL_DRAGONBOX_COMMON_HPP #define BOOST_CHARCONV_DETAIL_DRAGONBOX_COMMON_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -826,4 +828,6 @@ struct compressed_cache_detail }}} +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_DRAGONBOX_COMMON_HPP diff --git a/include/boost/charconv/detail/dragonbox/floff.hpp b/include/boost/charconv/detail/dragonbox/floff.hpp index 698712f0c..cd0f88fde 100644 --- a/include/boost/charconv/detail/dragonbox/floff.hpp +++ b/include/boost/charconv/detail/dragonbox/floff.hpp @@ -24,6 +24,8 @@ #ifndef BOOST_CHARCONV_DETAIL_FLOFF #define BOOST_CHARCONV_DETAIL_FLOFF +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -575,7 +577,7 @@ struct uint_with_known_number_of_digits }; template ::value, bool>::type = true> -static BOOST_FORCEINLINE bool check_rounding_condition_inside_subsegment( +BOOST_FORCEINLINE bool check_rounding_condition_inside_subsegment( std::uint32_t current_digits, std::uint32_t fractional_part, int remaining_digits_in_the_current_subsegment, HasFurtherDigits has_further_digits, Args...) noexcept @@ -590,7 +592,7 @@ static BOOST_FORCEINLINE bool check_rounding_condition_inside_subsegment( template ::value, bool>::type = true> -static BOOST_FORCEINLINE bool check_rounding_condition_inside_subsegment( +BOOST_FORCEINLINE bool check_rounding_condition_inside_subsegment( std::uint32_t current_digits, std::uint32_t fractional_part, int remaining_digits_in_the_current_subsegment, HasFurtherDigits has_further_digits, Args... args) noexcept @@ -605,7 +607,7 @@ static BOOST_FORCEINLINE bool check_rounding_condition_inside_subsegment( template ::value, bool>::type = true> -static BOOST_FORCEINLINE bool check_rounding_condition_with_next_bit(std::uint32_t current_digits, bool next_bit, +BOOST_FORCEINLINE bool check_rounding_condition_with_next_bit(std::uint32_t current_digits, bool next_bit, HasFurtherDigits has_further_digits, Args...) noexcept { if (!next_bit) @@ -618,7 +620,7 @@ static BOOST_FORCEINLINE bool check_rounding_condition_with_next_bit(std::uint32 template ::value, bool>::type = true> -static BOOST_FORCEINLINE bool check_rounding_condition_with_next_bit(std::uint32_t current_digits, bool next_bit, +BOOST_FORCEINLINE bool check_rounding_condition_with_next_bit(std::uint32_t current_digits, bool next_bit, HasFurtherDigits has_further_digits, Args... args) noexcept { if (!next_bit) @@ -631,7 +633,7 @@ static BOOST_FORCEINLINE bool check_rounding_condition_with_next_bit(std::uint32 template ::value, bool>::type = true> -static BOOST_FORCEINLINE bool check_rounding_condition_subsegment_boundary_with_next_subsegment( +BOOST_FORCEINLINE bool check_rounding_condition_subsegment_boundary_with_next_subsegment( std::uint32_t current_digits, UintWithKnownDigits next_subsegment, HasFurtherDigits has_further_digits, Args...) noexcept { @@ -646,7 +648,7 @@ static BOOST_FORCEINLINE bool check_rounding_condition_subsegment_boundary_with_ template ::value, bool>::type = true> -static BOOST_FORCEINLINE bool check_rounding_condition_subsegment_boundary_with_next_subsegment( +BOOST_FORCEINLINE bool check_rounding_condition_subsegment_boundary_with_next_subsegment( std::uint32_t current_digits, UintWithKnownDigits next_subsegment, HasFurtherDigits has_further_digits, Args... args) noexcept { @@ -4053,4 +4055,6 @@ BOOST_CHARCONV_SAFEBUFFERS to_chars_result floff(const double x, int precision, # pragma warning(pop) #endif +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_FLOFF diff --git a/include/boost/charconv/detail/emulated128.hpp b/include/boost/charconv/detail/emulated128.hpp index 6fabda2cb..9dcbd6beb 100644 --- a/include/boost/charconv/detail/emulated128.hpp +++ b/include/boost/charconv/detail/emulated128.hpp @@ -8,6 +8,8 @@ #ifndef BOOST_CHARCONV_DETAIL_EMULATED128_HPP #define BOOST_CHARCONV_DETAIL_EMULATED128_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -825,7 +827,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) @@ -1002,4 +1004,6 @@ struct numeric_limits } // Namespace std +#endif // !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_EMULATED128_HPP diff --git a/include/boost/charconv/detail/fallback_routines.hpp b/include/boost/charconv/detail/fallback_routines.hpp index db34a3db2..b6ac05f54 100644 --- a/include/boost/charconv/detail/fallback_routines.hpp +++ b/include/boost/charconv/detail/fallback_routines.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_FALLBACK_ROUTINES_HPP #define BOOST_FALLBACK_ROUTINES_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -242,4 +244,6 @@ inline from_chars_result from_chars_strtod(const char* first, const char* last, } //namespace charconv } //namespace boost +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif //BOOST_FALLBACK_ROUTINES_HPP diff --git a/include/boost/charconv/detail/fast_float/ascii_number.hpp b/include/boost/charconv/detail/fast_float/ascii_number.hpp index bd5bd4a19..049e9f6de 100644 --- a/include/boost/charconv/detail/fast_float/ascii_number.hpp +++ b/include/boost/charconv/detail/fast_float/ascii_number.hpp @@ -8,6 +8,8 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_ASCII_NUMBER_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_ASCII_NUMBER_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -285,4 +287,6 @@ parsed_number_string_t parse_number_string(UC const *p, UC const * pend, par }}}} // namespace s +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif diff --git a/include/boost/charconv/detail/fast_float/bigint.hpp b/include/boost/charconv/detail/fast_float/bigint.hpp index c3dbf9e71..3f17452e1 100644 --- a/include/boost/charconv/detail/fast_float/bigint.hpp +++ b/include/boost/charconv/detail/fast_float/bigint.hpp @@ -8,6 +8,8 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_BIGINT_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_BIGINT_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -620,4 +622,6 @@ struct bigint : pow5_tables<> { }}}} // namespace fast_float +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif 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 2a5eb4843..ba6f18562 100644 --- a/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp +++ b/include/boost/charconv/detail/fast_float/constexpr_feature_detect.hpp @@ -7,7 +7,7 @@ // Make the header safe to include from libraries supporting modules #if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CHARCONV_DETAIL_FASTFLOAT_CONSTEXPR_FEATURE_DETECT_HPP) -# error "Please #include in your module global fragment" +# error "Please #include in your module global fragment" #endif #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_CONSTEXPR_FEATURE_DETECT_HPP 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 5a107d2a0..bd6a58f60 100644 --- a/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp +++ b/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp @@ -8,6 +8,8 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_DECIMAL_TO_BINARY_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_DECIMAL_TO_BINARY_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -193,4 +195,6 @@ adjusted_mantissa compute_float(int64_t q, uint64_t w) noexcept { }}}} // namespace fast_float +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif diff --git a/include/boost/charconv/detail/fast_float/digit_comparison.hpp b/include/boost/charconv/detail/fast_float/digit_comparison.hpp index 0c5fc7799..c7691e31b 100644 --- a/include/boost/charconv/detail/fast_float/digit_comparison.hpp +++ b/include/boost/charconv/detail/fast_float/digit_comparison.hpp @@ -8,6 +8,8 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_DIGIT_COMPARISON_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_DIGIT_COMPARISON_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -439,4 +441,6 @@ adjusted_mantissa digit_comp(parsed_number_string_t& num, adjusted_mantissa }}}} // namespace fast_float +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif diff --git a/include/boost/charconv/detail/fast_float/fast_float.hpp b/include/boost/charconv/detail/fast_float/fast_float.hpp index 00bb6c523..1947b8537 100644 --- a/include/boost/charconv/detail/fast_float/fast_float.hpp +++ b/include/boost/charconv/detail/fast_float/fast_float.hpp @@ -8,6 +8,8 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_FLOAT_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_FLOAT_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include namespace boost { namespace charconv { namespace detail { namespace fast_float { @@ -45,4 +47,7 @@ from_chars_result_t from_chars_advanced(UC const * first, UC const * last, }}}} // namespace fast_float #include + +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_FASTFLOAT_FAST_FLOAT_H diff --git a/include/boost/charconv/detail/fast_float/fast_table.hpp b/include/boost/charconv/detail/fast_float/fast_table.hpp index ce9b13adf..edf95f1ac 100644 --- a/include/boost/charconv/detail/fast_float/fast_table.hpp +++ b/include/boost/charconv/detail/fast_float/fast_table.hpp @@ -8,6 +8,8 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_TABLE_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_TABLE_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include @@ -705,4 +707,6 @@ using powers = powers_template<>; }}}} // namespace fast_float +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif diff --git a/include/boost/charconv/detail/fast_float/float_common.hpp b/include/boost/charconv/detail/fast_float/float_common.hpp index e6e320d4b..5ae9f8f64 100644 --- a/include/boost/charconv/detail/fast_float/float_common.hpp +++ b/include/boost/charconv/detail/fast_float/float_common.hpp @@ -8,6 +8,8 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_FLOAT_COMMON_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FLOAT_COMMON_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -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 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_TONEARES{} + 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_TONEARES{} + 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(){} }; template @@ -562,18 +564,18 @@ inline constexpr bool is_space(uint8_t c) { return space_lut<>::value[c]; } #endif template -static constexpr uint64_t int_cmp_zeros() +constexpr uint64_t int_cmp_zeros() { static_assert((sizeof(UC) == 1) || (sizeof(UC) == 2) || (sizeof(UC) == 4), "Unsupported character size"); return (sizeof(UC) == 1) ? 0x3030303030303030 : (sizeof(UC) == 2) ? (uint64_t(UC('0')) << 48 | uint64_t(UC('0')) << 32 | uint64_t(UC('0')) << 16 | UC('0')) : (uint64_t(UC('0')) << 32 | UC('0')); } template -static constexpr int int_cmp_len() +constexpr int int_cmp_len() { return sizeof(uint64_t) / sizeof(UC); } template -static constexpr UC const * str_const_nan() +constexpr UC const * str_const_nan() { return nullptr; } @@ -598,7 +600,7 @@ constexpr char32_t const * str_const_nan() return U"nan"; } template -static constexpr UC const * str_const_inf() +constexpr UC const * str_const_inf() { return nullptr; } @@ -625,4 +627,6 @@ constexpr char32_t const * str_const_inf() }}}} // namespaces +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif diff --git a/include/boost/charconv/detail/fast_float/parse_number.hpp b/include/boost/charconv/detail/fast_float/parse_number.hpp index e76b4a846..8fc97c75b 100644 --- a/include/boost/charconv/detail/fast_float/parse_number.hpp +++ b/include/boost/charconv/detail/fast_float/parse_number.hpp @@ -8,6 +8,8 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_PARSE_NUMBER_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_PARSE_NUMBER_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -244,4 +246,6 @@ from_chars_result_t from_chars_advanced(UC const * first, UC const * last, }}}} // namespace fast_float +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif diff --git a/include/boost/charconv/detail/from_chars_integer_impl.hpp b/include/boost/charconv/detail/from_chars_integer_impl.hpp index 3171265af..6df24d949 100644 --- a/include/boost/charconv/detail/from_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/from_chars_integer_impl.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_FROM_CHARS_INTEGER_IMPL_HPP #define BOOST_CHARCONV_DETAIL_FROM_CHARS_INTEGER_IMPL_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -332,4 +334,6 @@ BOOST_CHARCONV_GCC5_CONSTEXPR from_chars_result from_chars128(const char* first, }}} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_FROM_CHARS_INTEGER_IMPL_HPP diff --git a/include/boost/charconv/detail/from_chars_result.hpp b/include/boost/charconv/detail/from_chars_result.hpp index d257945dd..96d603b32 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 +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include +#include namespace boost { namespace charconv { @@ -38,4 +41,6 @@ BOOST_CHARCONV_MODULE_EXPORT using from_chars_result = from_chars_result_t }} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_FROM_CHARS_RESULT_HPP diff --git a/include/boost/charconv/detail/gmf.hpp b/include/boost/charconv/detail/gmf.hpp new file mode 100644 index 000000000..fe0e491eb --- /dev/null +++ b/include/boost/charconv/detail/gmf.hpp @@ -0,0 +1,16 @@ +// Copyright 2026 Ruben Perez +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +// Global module fragment +#include // floating-point macros +#include // stdfloat macros are pulled by this header, too +#include // math macros +#include // int macros +#include // CHAR_BIT and other C limits macros +#include // printf format constants +#include +#include +#include +#include +#include diff --git a/include/boost/charconv/detail/integer_search_trees.hpp b/include/boost/charconv/detail/integer_search_trees.hpp index d2c47da99..2b9a219fc 100644 --- a/include/boost/charconv/detail/integer_search_trees.hpp +++ b/include/boost/charconv/detail/integer_search_trees.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_INTEGER_SEARCH_TREES_HPP #define BOOST_CHARCONV_DETAIL_INTEGER_SEARCH_TREES_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + // 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 @@ -271,4 +273,6 @@ BOOST_CHARCONV_CXX14_CONSTEXPR int num_digits(boost::uint128_type x) noexcept }}} // Namespace boost::charconv::detail +#endif // !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_INTEGER_SEARCH_TREES_HPP diff --git a/include/boost/charconv/detail/issignaling.hpp b/include/boost/charconv/detail/issignaling.hpp index 0c5efe641..bb600d301 100644 --- a/include/boost/charconv/detail/issignaling.hpp +++ b/include/boost/charconv/detail/issignaling.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_ISSIGNALING_HPP #define BOOST_CHARCONV_DETAIL_ISSIGNALING_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -13,7 +15,7 @@ namespace boost { namespace charconv { namespace detail { template -inline bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (T x) noexcept; +inline bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (T x) noexcept { static_assert(false); } #if BOOST_CHARCONV_LDBL_BITS == 128 || defined(BOOST_CHARCONV_HAS_QUADMATH) @@ -82,4 +84,6 @@ inline bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (std:: }}} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_ISSIGNALING_HPP diff --git a/include/boost/charconv/detail/memcpy.hpp b/include/boost/charconv/detail/memcpy.hpp index a614b2dc4..4023db55f 100644 --- a/include/boost/charconv/detail/memcpy.hpp +++ b/include/boost/charconv/detail/memcpy.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_MEMCPY_HPP #define BOOST_CHARCONV_DETAIL_MEMCPY_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -75,4 +77,6 @@ inline void* memcpy(void* dest, const void* src, std::size_t count) # pragma GCC diagnostic pop #endif +#endif // !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_MEMCPY_HPP diff --git a/include/boost/charconv/detail/ryu/generic_128.hpp b/include/boost/charconv/detail/ryu/generic_128.hpp index 748d8b129..5c456e6f4 100644 --- a/include/boost/charconv/detail/ryu/generic_128.hpp +++ b/include/boost/charconv/detail/ryu/generic_128.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -383,13 +385,13 @@ using ryu_tables = ryu_tables_template; #endif // Returns e == 0 ? 1 : ceil(log_2(5^e)); requires 0 <= e <= 32768. -static BOOST_CHARCONV_CXX14_CONSTEXPR uint32_t pow5bits(const uint32_t e) noexcept +BOOST_CHARCONV_CXX14_CONSTEXPR uint32_t pow5bits(const uint32_t e) noexcept { BOOST_CHARCONV_ASSERT(e <= 1 << 15); return static_cast(((e * UINT64_C(163391164108059)) >> 46) + 1); } -static BOOST_CHARCONV_CXX14_CONSTEXPR +BOOST_CHARCONV_CXX14_CONSTEXPR void mul_128_256_shift( const uint64_t* const a, const uint64_t* const b, const uint32_t shift, const uint32_t corr, @@ -452,7 +454,7 @@ void mul_128_256_shift( } // Computes 5^i in the form required by Ryu, and stores it in the given pointer. -static BOOST_CXX14_CONSTEXPR void generic_computePow5(const uint32_t i, uint64_t* const result) noexcept +BOOST_CXX14_CONSTEXPR void generic_computePow5(const uint32_t i, uint64_t* const result) noexcept { const uint32_t base = i / BOOST_CHARCONV_POW5_TABLE_SIZE; const uint32_t base2 = base * BOOST_CHARCONV_POW5_TABLE_SIZE; @@ -475,7 +477,7 @@ static BOOST_CXX14_CONSTEXPR void generic_computePow5(const uint32_t i, uint64_t } // Computes 5^-i in the form required by Ryu, and stores it in the given pointer. -static BOOST_CXX14_CONSTEXPR void generic_computeInvPow5(const uint32_t i, uint64_t* const result) noexcept +BOOST_CXX14_CONSTEXPR void generic_computeInvPow5(const uint32_t i, uint64_t* const result) noexcept { const uint32_t base = (i + BOOST_CHARCONV_POW5_TABLE_SIZE - 1) / BOOST_CHARCONV_POW5_TABLE_SIZE; const uint32_t base2 = base * BOOST_CHARCONV_POW5_TABLE_SIZE; @@ -497,7 +499,7 @@ static BOOST_CXX14_CONSTEXPR void generic_computeInvPow5(const uint32_t i, uint6 } } -static BOOST_CXX14_CONSTEXPR uint32_t pow5Factor(unsigned_128_type value) noexcept +BOOST_CXX14_CONSTEXPR uint32_t pow5Factor(unsigned_128_type value) noexcept { for (uint32_t count = 0; value > 0; ++count) { @@ -511,19 +513,19 @@ static BOOST_CXX14_CONSTEXPR uint32_t pow5Factor(unsigned_128_type value) noexce } // Returns true if value is divisible by 5^p. -static BOOST_CHARCONV_CXX14_CONSTEXPR bool multipleOfPowerOf5(const unsigned_128_type value, const uint32_t p) noexcept +BOOST_CHARCONV_CXX14_CONSTEXPR bool multipleOfPowerOf5(const unsigned_128_type value, const uint32_t p) noexcept { // I tried a case distinction on p, but there was no performance difference. return pow5Factor(value) >= p; } // Returns true if value is divisible by 2^p. -static BOOST_CHARCONV_CXX14_CONSTEXPR bool multipleOfPowerOf2(const unsigned_128_type value, const uint32_t p) noexcept +BOOST_CHARCONV_CXX14_CONSTEXPR bool multipleOfPowerOf2(const unsigned_128_type value, const uint32_t p) noexcept { return (value & ((static_cast(1) << p) - 1)) == 0; } -static BOOST_CHARCONV_CXX14_CONSTEXPR +BOOST_CHARCONV_CXX14_CONSTEXPR unsigned_128_type mulShift(const unsigned_128_type m, const uint64_t* const mul, const int32_t j) noexcept { BOOST_CHARCONV_ASSERT(j > 128); @@ -536,7 +538,7 @@ unsigned_128_type mulShift(const unsigned_128_type m, const uint64_t* const mul, } // Returns floor(log_10(2^e)). -static BOOST_CHARCONV_CXX14_CONSTEXPR uint32_t log10Pow2(const int32_t e) noexcept +BOOST_CHARCONV_CXX14_CONSTEXPR uint32_t log10Pow2(const int32_t e) noexcept { // The first value this approximation fails for is 2^1651 which is just greater than 10^297. BOOST_CHARCONV_ASSERT(e >= 0); @@ -545,7 +547,7 @@ static BOOST_CHARCONV_CXX14_CONSTEXPR uint32_t log10Pow2(const int32_t e) noexce } // Returns floor(log_10(5^e)). -static BOOST_CHARCONV_CXX14_CONSTEXPR uint32_t log10Pow5(const int32_t e) noexcept +BOOST_CHARCONV_CXX14_CONSTEXPR uint32_t log10Pow5(const int32_t e) noexcept { // The first value this approximation fails for is 5^2621 which is just greater than 10^1832. assert(e >= 0); @@ -555,4 +557,6 @@ static BOOST_CHARCONV_CXX14_CONSTEXPR uint32_t log10Pow5(const int32_t e) noexce }}}} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index 38b440496..6b64a67ae 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -32,7 +34,7 @@ struct floating_decimal_128 }; #ifdef BOOST_CHARCONV_DEBUG -static char* s(unsigned_128_type v) { +inline char* s(unsigned_128_type v) { int len = num_digits(v); char* b = static_cast(malloc((len + 1) * sizeof(char))); for (int i = 0; i < len; i++) { @@ -45,7 +47,7 @@ static char* s(unsigned_128_type v) { } #endif -static inline struct floating_decimal_128 generic_binary_to_decimal( +inline struct floating_decimal_128 generic_binary_to_decimal( const unsigned_128_type bits, const uint32_t mantissaBits, const uint32_t exponentBits, const bool explicitLeadingBit) noexcept { @@ -282,7 +284,7 @@ static inline struct floating_decimal_128 generic_binary_to_decimal( return {output, exp, ieeeSign}; } -static inline int copy_special_str(char* result, const std::ptrdiff_t result_size, const struct floating_decimal_128 fd) noexcept +inline int copy_special_str(char* result, const std::ptrdiff_t result_size, const struct floating_decimal_128 fd) noexcept { if (fd.sign) { @@ -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 +inline int generic_to_chars_fixed(const struct floating_decimal_128 v, char* result, const ptrdiff_t result_size, int precision) noexcept { if (v.exponent == fd128_exceptional_exponent) { @@ -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, +inline int generic_to_chars(const struct floating_decimal_128 v, char* result, const ptrdiff_t result_size, chars_format fmt = chars_format::general, int precision = -1) noexcept { if (v.exponent == fd128_exceptional_exponent) @@ -678,7 +680,7 @@ static inline int generic_to_chars(const struct floating_decimal_128 v, char* re return static_cast(index); } -static inline struct floating_decimal_128 float_to_fd128(float f) noexcept +inline struct floating_decimal_128 float_to_fd128(float f) noexcept { static_assert(sizeof(float) == sizeof(uint32_t), "Float is not 32 bits"); uint32_t bits = 0; @@ -686,7 +688,7 @@ static inline struct floating_decimal_128 float_to_fd128(float f) noexcept return generic_binary_to_decimal(bits, 23, 8, false); } -static inline struct floating_decimal_128 double_to_fd128(double d) noexcept +inline struct floating_decimal_128 double_to_fd128(double d) noexcept { static_assert(sizeof(double) == sizeof(uint64_t), "Double is not 64 bits"); uint64_t bits = 0; @@ -698,7 +700,7 @@ static inline struct floating_decimal_128 double_to_fd128(double d) noexcept #ifdef BOOST_CHARCONV_HAS_FLOAT16 -static inline struct floating_decimal_128 float16_t_to_fd128(std::float16_t f) noexcept +inline struct floating_decimal_128 float16_t_to_fd128(std::float16_t f) noexcept { uint16_t bits = 0; std::memcpy(&bits, &f, sizeof(std::float16_t)); @@ -709,7 +711,7 @@ static inline struct floating_decimal_128 float16_t_to_fd128(std::float16_t f) n #ifdef BOOST_CHARCONV_HAS_BRAINFLOAT16 -static inline struct floating_decimal_128 float16_t_to_fd128(std::bfloat16_t f) noexcept +inline struct floating_decimal_128 float16_t_to_fd128(std::bfloat16_t f) noexcept { uint16_t bits = 0; std::memcpy(&bits, &f, sizeof(std::bfloat16_t)); @@ -720,7 +722,7 @@ static inline struct floating_decimal_128 float16_t_to_fd128(std::bfloat16_t f) #if BOOST_CHARCONV_LDBL_BITS == 80 -static inline struct floating_decimal_128 long_double_to_fd128(long double d) noexcept +inline struct floating_decimal_128 long_double_to_fd128(long double d) noexcept { #ifdef BOOST_CHARCONV_HAS_INT128 unsigned_128_type bits = 0; @@ -744,7 +746,7 @@ static inline struct floating_decimal_128 long_double_to_fd128(long double d) no #elif BOOST_CHARCONV_LDBL_BITS == 128 -static inline struct floating_decimal_128 long_double_to_fd128(long double d) noexcept +inline struct floating_decimal_128 long_double_to_fd128(long double d) noexcept { unsigned_128_type bits = 0; std::memcpy(&bits, &d, sizeof(long double)); @@ -764,4 +766,6 @@ static inline struct floating_decimal_128 long_double_to_fd128(long double d) no }}}} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif //BOOST_RYU_GENERIC_128_HPP diff --git a/include/boost/charconv/detail/significand_tables.hpp b/include/boost/charconv/detail/significand_tables.hpp index b55d4cb2c..281492daf 100644 --- a/include/boost/charconv/detail/significand_tables.hpp +++ b/include/boost/charconv/detail/significand_tables.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP #define BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include @@ -688,4 +690,6 @@ using significands_table = significand_template; }}} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif // BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP diff --git a/include/boost/charconv/detail/to_chars_integer_impl.hpp b/include/boost/charconv/detail/to_chars_integer_impl.hpp index dc69bb1ab..6ba99557e 100644 --- a/include/boost/charconv/detail/to_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/to_chars_integer_impl.hpp @@ -7,6 +7,8 @@ #ifndef BOOST_CHARCONV_DETAIL_TO_CHARS_INTEGER_IMPL_HPP #define BOOST_CHARCONV_DETAIL_TO_CHARS_INTEGER_IMPL_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include #include @@ -29,7 +31,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', @@ -52,7 +54,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', @@ -456,4 +458,6 @@ BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars128(char* first, char* last, In }}} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif //BOOST_CHARCONV_DETAIL_TO_CHARS_INTEGER_IMPL_HPP diff --git a/include/boost/charconv/detail/to_chars_result.hpp b/include/boost/charconv/detail/to_chars_result.hpp index 85f92be87..71d3359c6 100644 --- a/include/boost/charconv/detail/to_chars_result.hpp +++ b/include/boost/charconv/detail/to_chars_result.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP #define BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include // 22.13.2, Primitive numerical output conversion @@ -31,4 +33,6 @@ BOOST_CHARCONV_MODULE_EXPORT struct to_chars_result }} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif //BOOST_CHARCONV_DETAIL_TO_CHARS_RESULT_HPP diff --git a/include/boost/charconv/detail/type_traits.hpp b/include/boost/charconv/detail/type_traits.hpp index 3400d845e..f5377abd6 100644 --- a/include/boost/charconv/detail/type_traits.hpp +++ b/include/boost/charconv/detail/type_traits.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_DETAIL_TYPE_TRAITS_HPP #define BOOST_CHARCONV_DETAIL_TYPE_TRAITS_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) + #include #include @@ -64,4 +66,6 @@ struct make_signed { using type = boost::int128_type; }; }}} // Namespaces +#endif // !defined(BOOST_USE_MODULES) || !defined(BOOST_CHARCONV_INTERFACE_UNIT) + #endif //BOOST_CHARCONV_DETAIL_TYPE_TRAITS_HPP From b95a8968e1fb88372ad54cca67143e2ea48af151 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 11:00:35 +0100 Subject: [PATCH 05/19] Initial src impl --- include/boost/charconv/detail/gmf.hpp | 16 --------- modules/boost_charconv.cppm | 48 +++++++++++++++++++++++++++ src/float128_impl.hpp | 8 ++--- src/from_chars.cpp | 38 +++++++++++++++++---- src/from_chars_float_impl.hpp | 6 ++-- src/quadmath_wrapper.hpp | 7 ++++ src/to_chars.cpp | 36 +++++++++++++++++--- src/to_chars_float_impl.hpp | 28 ++++++++-------- 8 files changed, 139 insertions(+), 48 deletions(-) delete mode 100644 include/boost/charconv/detail/gmf.hpp create mode 100644 modules/boost_charconv.cppm create mode 100644 src/quadmath_wrapper.hpp diff --git a/include/boost/charconv/detail/gmf.hpp b/include/boost/charconv/detail/gmf.hpp deleted file mode 100644 index fe0e491eb..000000000 --- a/include/boost/charconv/detail/gmf.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2026 Ruben Perez -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -// Global module fragment -#include // floating-point macros -#include // stdfloat macros are pulled by this header, too -#include // math macros -#include // int macros -#include // CHAR_BIT and other C limits macros -#include // printf format constants -#include -#include -#include -#include -#include diff --git a/modules/boost_charconv.cppm b/modules/boost_charconv.cppm new file mode 100644 index 000000000..dc465fac9 --- /dev/null +++ b/modules/boost_charconv.cppm @@ -0,0 +1,48 @@ +module; + +#include // floating-point macros +#include // stdfloat macros are pulled by this header, too +#include // math macros +#include // int macros +#include // CHAR_BIT and other C limits macros +#include // printf format constants +#include +#include +#include +#include +#include +#include + +export module boost.charconv; + +import std; +import std.compat; +import boost.core; + +#define BOOST_CHARCONV_INTERFACE_UNIT +#define BOOST_IN_MODULE_PURVIEW + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" +#endif + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 5244) +#endif + +#include + +// TODO: move +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/float128_impl.hpp b/src/float128_impl.hpp index 3b9e44ab6..9fdf06f30 100644 --- a/src/float128_impl.hpp +++ b/src/float128_impl.hpp @@ -11,14 +11,14 @@ #include #include #include -#include -#include -#include +#include +#include +#include // Only add in float128 support if the build system says it can #ifdef BOOST_CHARCONV_HAS_QUADMATH -#include +#include "quadmath_wrapper.hpp" namespace boost { namespace charconv { diff --git a/src/from_chars.cpp b/src/from_chars.cpp index 0c313fad4..04b185b5c 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -2,6 +2,7 @@ // Copyright 2023 Matt Borland // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +module; // https://stackoverflow.com/questions/38060411/visual-studio-2015-wont-suppress-error-c4996 #ifndef _SCL_SECURE_NO_WARNINGS @@ -11,17 +12,42 @@ # define NO_WARN_MBCS_MFC_DEPRECATION #endif +#include +#include +#include +#include + + +#ifdef BOOST_USE_MODULES +module boost.charconv; +import std; +import std.compat; +import boost.core; + +#define BOOST_IN_MODULE_PURVIEW + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" +#endif + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 5244) +#endif +#endif // BOOST_USE_MODULES + #include "float128_impl.hpp" #include "from_chars_float_impl.hpp" #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #if BOOST_CHARCONV_LDBL_BITS > 64 # include diff --git a/src/from_chars_float_impl.hpp b/src/from_chars_float_impl.hpp index b0ed68d6b..6063af931 100644 --- a/src/from_chars_float_impl.hpp +++ b/src/from_chars_float_impl.hpp @@ -14,9 +14,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace charconv { namespace detail { diff --git a/src/quadmath_wrapper.hpp b/src/quadmath_wrapper.hpp new file mode 100644 index 000000000..751b44d81 --- /dev/null +++ b/src/quadmath_wrapper.hpp @@ -0,0 +1,7 @@ +// Module-safe wrapper for quadmath +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CHARCONV_QUADMATH_INCLUDED) +# error "Please #include in your module global fragment" +#endif + +#define BOOST_CHARCONV_QUADMATH_INCLUDED +#include diff --git a/src/to_chars.cpp b/src/to_chars.cpp index 0bdde32ea..3711ff26c 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -3,16 +3,42 @@ // Copyright 2023 Matt Borland // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +module; + +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_USE_MODULES +module boost.charconv; +import std; +import boost.core; + +#define BOOST_IN_MODULE_PURVIEW + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" +#endif + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 5244) +#endif +#endif // BOOST_USE_MODULES #include "float128_impl.hpp" #include "to_chars_float_impl.hpp" #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include 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 916d0c4e8..62a8d4d99 100644 --- a/src/to_chars_float_impl.hpp +++ b/src/to_chars_float_impl.hpp @@ -22,21 +22,21 @@ #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 #ifdef BOOST_CHARCONV_DEBUG_FIXED -#include -#include +#include +#include #endif #if (BOOST_CHARCONV_LDBL_BITS == 80 || BOOST_CHARCONV_LDBL_BITS == 128) @@ -49,7 +49,7 @@ namespace charconv { namespace detail { template -inline to_chars_result to_chars_nonfinite(char* first, char* last, Real value, int classification) noexcept; +inline to_chars_result to_chars_nonfinite(char* first, char* last, Real value, int classification) noexcept { static_assert(false); } #if BOOST_CHARCONV_LDBL_BITS == 128 || defined(BOOST_CHARCONV_HAS_STDFLOAT128) || defined(BOOST_CHARCONV_HAS_FLOAT16) || defined(BOOST_CHARCONV_HAS_BRAINFLOAT16) From 389ad151e017889b2c35de4aa41cc43e4ffb28ad Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 11:46:01 +0100 Subject: [PATCH 06/19] Internal unit --- CMakeLists.txt | 3 +- .../boost/charconv/detail/buffer_sizing.hpp | 2 +- .../boost/charconv/detail/compute_float32.hpp | 2 +- .../boost/charconv/detail/compute_float64.hpp | 2 +- .../boost/charconv/detail/compute_float80.hpp | 2 +- .../detail/disable_module_warnings.hpp | 15 +++++++++ .../charconv/detail/dragonbox/dragonbox.hpp | 2 +- .../detail/dragonbox/dragonbox_common.hpp | 2 +- .../boost/charconv/detail/dragonbox/floff.hpp | 2 +- .../charconv/detail/fallback_routines.hpp | 2 +- .../detail/fast_float/ascii_number.hpp | 2 +- .../charconv/detail/fast_float/bigint.hpp | 2 +- .../detail/fast_float/decimal_to_binary.hpp | 2 +- .../detail/fast_float/digit_comparison.hpp | 2 +- .../charconv/detail/fast_float/fast_float.hpp | 2 +- .../charconv/detail/fast_float/fast_table.hpp | 2 +- .../detail/fast_float/float_common.hpp | 2 +- .../detail/fast_float/parse_number.hpp | 2 +- include/boost/charconv/detail/issignaling.hpp | 2 +- .../boost/charconv/detail/ryu/generic_128.hpp | 2 +- .../charconv/detail/ryu/ryu_generic_128.hpp | 2 +- .../charconv/detail/significand_tables.hpp | 2 +- modules/boost_charconv.cppm | 24 +------------- src/from_chars.cpp | 12 ++----- src/internal.cppm | 32 +++++++++++++++++++ src/to_chars.cpp | 14 ++------ 26 files changed, 74 insertions(+), 66 deletions(-) create mode 100644 include/boost/charconv/detail/disable_module_warnings.hpp create mode 100644 src/internal.cppm diff --git a/CMakeLists.txt b/CMakeLists.txt index 49cb2b6b0..1488bad35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,8 @@ add_library(boost_charconv add_library(Boost::charconv ALIAS boost_charconv) if (BOOST_USE_MODULES) - target_sources(boost_charconv PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES modules/boost_charconv.cppm) + target_sources(boost_charconv PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES modules/boost_charconv.cppm + PRIVATE FILE_SET internal_unit TYPE CXX_MODULES BASE_DIRS src FILES src/internal.cppm) # Enable and propagate C++23, import std, and the modules macro target_compile_features(boost_charconv PUBLIC cxx_std_23) diff --git a/include/boost/charconv/detail/buffer_sizing.hpp b/include/boost/charconv/detail/buffer_sizing.hpp index 33659d868..f3f756dca 100644 --- a/include/boost/charconv/detail/buffer_sizing.hpp +++ b/include/boost/charconv/detail/buffer_sizing.hpp @@ -5,7 +5,7 @@ #ifndef BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP #define BOOST_CHARCONV_DETAIL_BUFFER_SIZING_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/compute_float32.hpp b/include/boost/charconv/detail/compute_float32.hpp index ae48a5115..fcd03743d 100644 --- a/include/boost/charconv/detail/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 -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/compute_float64.hpp b/include/boost/charconv/detail/compute_float64.hpp index 580877e3c..c99f3a816 100644 --- a/include/boost/charconv/detail/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 -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/compute_float80.hpp b/include/boost/charconv/detail/compute_float80.hpp index dc603de47..ba6563b7f 100644 --- a/include/boost/charconv/detail/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 -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/disable_module_warnings.hpp b/include/boost/charconv/detail/disable_module_warnings.hpp new file mode 100644 index 000000000..75db379e4 --- /dev/null +++ b/include/boost/charconv/detail/disable_module_warnings.hpp @@ -0,0 +1,15 @@ +// Copyright 2026 Ruben Perez +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifdef BOOST_USE_MODULES +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" +#endif + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 5244) +#endif +#endif \ No newline at end of file diff --git a/include/boost/charconv/detail/dragonbox/dragonbox.hpp b/include/boost/charconv/detail/dragonbox/dragonbox.hpp index 1fe75f032..389d31315 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox.hpp @@ -22,7 +22,7 @@ #ifndef BOOST_CHARCONV_DETAIL_DRAGONBOX_HPP #define BOOST_CHARCONV_DETAIL_DRAGONBOX_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp index a3789fea4..c8ba59198 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 -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/dragonbox/floff.hpp b/include/boost/charconv/detail/dragonbox/floff.hpp index cd0f88fde..f79a25bfe 100644 --- a/include/boost/charconv/detail/dragonbox/floff.hpp +++ b/include/boost/charconv/detail/dragonbox/floff.hpp @@ -24,7 +24,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FLOFF #define BOOST_CHARCONV_DETAIL_FLOFF -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/fallback_routines.hpp b/include/boost/charconv/detail/fallback_routines.hpp index b6ac05f54..321ffaee5 100644 --- a/include/boost/charconv/detail/fallback_routines.hpp +++ b/include/boost/charconv/detail/fallback_routines.hpp @@ -5,7 +5,7 @@ #ifndef BOOST_FALLBACK_ROUTINES_HPP #define BOOST_FALLBACK_ROUTINES_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/fast_float/ascii_number.hpp b/include/boost/charconv/detail/fast_float/ascii_number.hpp index 049e9f6de..36a4f07e1 100644 --- a/include/boost/charconv/detail/fast_float/ascii_number.hpp +++ b/include/boost/charconv/detail/fast_float/ascii_number.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_ASCII_NUMBER_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_ASCII_NUMBER_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/fast_float/bigint.hpp b/include/boost/charconv/detail/fast_float/bigint.hpp index 3f17452e1..9397bfded 100644 --- a/include/boost/charconv/detail/fast_float/bigint.hpp +++ b/include/boost/charconv/detail/fast_float/bigint.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_BIGINT_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_BIGINT_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include 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 bd6a58f60..5e63d8daa 100644 --- a/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp +++ b/include/boost/charconv/detail/fast_float/decimal_to_binary.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_DECIMAL_TO_BINARY_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_DECIMAL_TO_BINARY_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/fast_float/digit_comparison.hpp b/include/boost/charconv/detail/fast_float/digit_comparison.hpp index c7691e31b..88205e36f 100644 --- a/include/boost/charconv/detail/fast_float/digit_comparison.hpp +++ b/include/boost/charconv/detail/fast_float/digit_comparison.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_DIGIT_COMPARISON_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_DIGIT_COMPARISON_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/fast_float/fast_float.hpp b/include/boost/charconv/detail/fast_float/fast_float.hpp index 1947b8537..aba1daecb 100644 --- a/include/boost/charconv/detail/fast_float/fast_float.hpp +++ b/include/boost/charconv/detail/fast_float/fast_float.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_FLOAT_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_FLOAT_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include diff --git a/include/boost/charconv/detail/fast_float/fast_table.hpp b/include/boost/charconv/detail/fast_float/fast_table.hpp index edf95f1ac..5f5cebd68 100644 --- a/include/boost/charconv/detail/fast_float/fast_table.hpp +++ b/include/boost/charconv/detail/fast_float/fast_table.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_TABLE_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_TABLE_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #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 5ae9f8f64..3577919ac 100644 --- a/include/boost/charconv/detail/fast_float/float_common.hpp +++ b/include/boost/charconv/detail/fast_float/float_common.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_FLOAT_COMMON_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_FLOAT_COMMON_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/fast_float/parse_number.hpp b/include/boost/charconv/detail/fast_float/parse_number.hpp index 8fc97c75b..8b4de59a8 100644 --- a/include/boost/charconv/detail/fast_float/parse_number.hpp +++ b/include/boost/charconv/detail/fast_float/parse_number.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_PARSE_NUMBER_HPP #define BOOST_CHARCONV_DETAIL_FASTFLOAT_PARSE_NUMBER_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/issignaling.hpp b/include/boost/charconv/detail/issignaling.hpp index bb600d301..7c1247ce2 100644 --- a/include/boost/charconv/detail/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 -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/ryu/generic_128.hpp b/include/boost/charconv/detail/ryu/generic_128.hpp index 5c456e6f4..96ae08154 100644 --- a/include/boost/charconv/detail/ryu/generic_128.hpp +++ b/include/boost/charconv/detail/ryu/generic_128.hpp @@ -6,7 +6,7 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index 6b64a67ae..ba029b8eb 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -6,7 +6,7 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/significand_tables.hpp b/include/boost/charconv/detail/significand_tables.hpp index 281492daf..7825046b5 100644 --- a/include/boost/charconv/detail/significand_tables.hpp +++ b/include/boost/charconv/detail/significand_tables.hpp @@ -6,7 +6,7 @@ #ifndef BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP #define BOOST_CHARCONV_DETAIL_SIGNIFICAND_TABLES_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/modules/boost_charconv.cppm b/modules/boost_charconv.cppm index dc465fac9..17e045e28 100644 --- a/modules/boost_charconv.cppm +++ b/modules/boost_charconv.cppm @@ -11,7 +11,7 @@ module; #include #include #include -#include +#include export module boost.charconv; @@ -22,27 +22,5 @@ import boost.core; #define BOOST_CHARCONV_INTERFACE_UNIT #define BOOST_IN_MODULE_PURVIEW -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" -#endif - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 5244) -#endif - #include -// TODO: move -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/src/from_chars.cpp b/src/from_chars.cpp index 04b185b5c..1b3a2cfae 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -15,6 +15,7 @@ module; #include #include #include +#include #include @@ -23,18 +24,9 @@ module boost.charconv; import std; import std.compat; import boost.core; +import :internal; #define BOOST_IN_MODULE_PURVIEW - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" -#endif - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 5244) -#endif #endif // BOOST_USE_MODULES #include "float128_impl.hpp" diff --git a/src/internal.cppm b/src/internal.cppm new file mode 100644 index 000000000..c2079a1bb --- /dev/null +++ b/src/internal.cppm @@ -0,0 +1,32 @@ + +module; + +#include // math macros +#include // int macros +#include // CHAR_BIT and other C limits macros +#include +#include +#include +#include +#include +#include + +module boost.charconv:internal; +import std; +import boost.core; +import boost.charconv; + +#define BOOST_CHARCONV_INTERNAL_PARTITION_UNIT +#define BOOST_IN_MODULE_PURVIEW + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/to_chars.cpp b/src/to_chars.cpp index 3711ff26c..3dfb0783c 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -9,27 +9,17 @@ module; #include #include #include +#include #include #include -#ifdef BOOST_USE_MODULES module boost.charconv; import std; import boost.core; +import :internal; #define BOOST_IN_MODULE_PURVIEW -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" -#endif - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 5244) -#endif -#endif // BOOST_USE_MODULES - #include "float128_impl.hpp" #include "to_chars_float_impl.hpp" #include From 469f01a2a25344bed931cc2c4c5a34c652365d5b Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 11:48:48 +0100 Subject: [PATCH 07/19] from_chars test --- test/from_chars.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/from_chars.cpp b/test/from_chars.cpp index 091091e66..76c5000e3 100644 --- a/test/from_chars.cpp +++ b/test/from_chars.cpp @@ -3,19 +3,20 @@ // 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 +#include +#include +#include +#include +#include +#include +#include #if defined(__has_include) # if __has_include() -# include +# include # endif #endif From f500ede267ea1abb92666a04591ce632f535013e Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 12:24:07 +0100 Subject: [PATCH 08/19] test suite --- test/CMakeLists.txt | 6 ++++-- test/P2497.cpp | 15 ++++++++------- test/from_chars_STL_comp.cpp | 15 ++++++++------- test/from_chars_float.cpp | 10 ++++++++++ test/from_chars_string_view.cpp | 11 ++++++----- test/github_issue_122.cpp | 10 ++++++++++ test/github_issue_152.cpp | 13 +++++++------ test/github_issue_152_float128.cpp | 12 ++++++------ test/github_issue_156.cpp | 5 +++-- test/github_issue_166_float128.cpp | 3 ++- test/github_issue_186.cpp | 5 +++-- test/github_issue_212.cpp | 7 ++++--- test/github_issue_280.cpp | 3 ++- test/github_issue_int128_320.cpp | 5 +++-- test/limits.cpp | 9 +++++---- test/limits_link_1.cpp | 2 +- test/limits_link_2.cpp | 2 +- test/roundtrip.cpp | 21 ++++++++++++--------- test/test_128bit_emulation.cpp | 10 ++++++++++ test/test_128bit_native.cpp | 10 ++++++++++ test/test_boost_json_values.cpp | 22 ++++++++++++---------- test/test_compute_float32.cpp | 10 ++++++++++ test/test_compute_float64.cpp | 10 ++++++++++ test/test_compute_float80.cpp | 10 ++++++++++ test/test_float128.cpp | 20 +++++++++++++++----- test/test_num_digits.cpp | 10 ++++++++++ test/test_parser.cpp | 10 ++++++++++ test/to_chars.cpp | 15 +++++++++------ test/to_chars_float.cpp | 10 ++++++++++ test/to_chars_float_STL_comp.cpp | 23 ++++++++++++----------- test/to_chars_integer_STL_comp.cpp | 23 ++++++++++++----------- test/to_chars_sprintf.cpp | 19 ++++++++++--------- 32 files changed, 245 insertions(+), 111 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7bf0e6e09..6a81d450b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,8 +6,10 @@ 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) +if(BOOST_USE_MODULES) + set(CMAKE_CXX_MODULE_STD ON) +endif() + boost_test_jamfile(FILE Jamfile LINK_LIBRARIES Boost::charconv Boost::core Boost::assert) endif() diff --git a/test/P2497.cpp b/test/P2497.cpp index 9359f9c03..5218439b5 100644 --- a/test/P2497.cpp +++ b/test/P2497.cpp @@ -2,15 +2,16 @@ // 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 +#include +#include +#include +#include +#include +#include +#include // No overflows, negative numbers, locales, etc. template diff --git a/test/from_chars_STL_comp.cpp b/test/from_chars_STL_comp.cpp index 7823a34c0..59dd31f2a 100644 --- a/test/from_chars_STL_comp.cpp +++ b/test/from_chars_STL_comp.cpp @@ -6,15 +6,16 @@ #if !defined(BOOST_NO_CXX17_HDR_CHARCONV) && (!defined(__clang_major__) || (defined(__clang_major__) && __clang_major__ > 7)) +#include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include template void test() diff --git a/test/from_chars_float.cpp b/test/from_chars_float.cpp index cf810b559..401470db4 100644 --- a/test/from_chars_float.cpp +++ b/test/from_chars_float.cpp @@ -2,6 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include +BOOST_PRAGMA_MESSAGE("This test targets an implementation detail, and is skipped when building with modules") +int main() {} + +#else + #include "../src/from_chars_float_impl.hpp" #include #include @@ -1930,3 +1938,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/from_chars_string_view.cpp b/test/from_chars_string_view.cpp index 358894281..c9b2c8134 100644 --- a/test/from_chars_string_view.cpp +++ b/test/from_chars_string_view.cpp @@ -2,17 +2,18 @@ // 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 +#include +#include +#include #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) -# include +# include #endif static std::mt19937_64 rng(42); diff --git a/test/github_issue_122.cpp b/test/github_issue_122.cpp index c8495b285..93c943571 100644 --- a/test/github_issue_122.cpp +++ b/test/github_issue_122.cpp @@ -3,6 +3,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include +BOOST_PRAGMA_MESSAGE("This test targets an implementation detail, and is skipped when building with modules") +int main() {} + +#else + #include #include #include @@ -68,3 +76,5 @@ int main() } #endif + +#endif diff --git a/test/github_issue_152.cpp b/test/github_issue_152.cpp index 51c188df9..6182be591 100644 --- a/test/github_issue_152.cpp +++ b/test/github_issue_152.cpp @@ -2,14 +2,15 @@ // 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 +#include +#include +#include +#include +#include constexpr std::size_t N = 1024; static std::mt19937_64 rng(42); diff --git a/test/github_issue_152_float128.cpp b/test/github_issue_152_float128.cpp index 6c64ea4d8..ade355bbc 100644 --- a/test/github_issue_152_float128.cpp +++ b/test/github_issue_152_float128.cpp @@ -3,7 +3,7 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#include +#include #ifdef BOOST_CHARCONV_HAS_QUADMATH @@ -27,11 +27,11 @@ std::ostream& operator<<( std::ostream& os, std::float128_t v ) #include #include -#include -#include -#include -#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_156.cpp b/test/github_issue_156.cpp index 95398be1e..ba67ab967 100644 --- a/test/github_issue_156.cpp +++ b/test/github_issue_156.cpp @@ -4,10 +4,11 @@ // // See: https://github.com/cppalliance/charconv/issues/156 +#include #include #include -#include -#include +#include +#include #ifdef BOOST_CHARCONV_HAS_BRAINFLOAT16 diff --git a/test/github_issue_166_float128.cpp b/test/github_issue_166_float128.cpp index 9812bdb71..409d398ab 100644 --- a/test/github_issue_166_float128.cpp +++ b/test/github_issue_166_float128.cpp @@ -4,9 +4,10 @@ // // See: https://github.com/boostorg/charconv/issues/166 +#include #include #include -#include +#include template void test() diff --git a/test/github_issue_186.cpp b/test/github_issue_186.cpp index 628da1e7f..ed19e97a6 100644 --- a/test/github_issue_186.cpp +++ b/test/github_issue_186.cpp @@ -4,10 +4,11 @@ // // See: https://github.com/boostorg/charconv/issues/186 +#include #include #include -#include -#include +#include +#include template void force_overflow(T value) diff --git a/test/github_issue_212.cpp b/test/github_issue_212.cpp index 110774e2d..beafd2c06 100644 --- a/test/github_issue_212.cpp +++ b/test/github_issue_212.cpp @@ -2,11 +2,12 @@ // 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 template void test() diff --git a/test/github_issue_280.cpp b/test/github_issue_280.cpp index 5dafef9f7..f6e371877 100644 --- a/test/github_issue_280.cpp +++ b/test/github_issue_280.cpp @@ -4,9 +4,10 @@ // // See: https://github.com/boostorg/charconv/issues/280 +#include #include #include -#include +#include template void test(const char* result_string) diff --git a/test/github_issue_int128_320.cpp b/test/github_issue_int128_320.cpp index 4d4842da4..f2b6fe467 100644 --- a/test/github_issue_int128_320.cpp +++ b/test/github_issue_int128_320.cpp @@ -4,6 +4,7 @@ // // See: https://github.com/cppalliance/int128/issues/320 +#include #include #ifdef BOOST_CHARCONV_HAS_INT128 @@ -14,8 +15,8 @@ #endif #include -#include -#include +#include +#include void toChars(char* ptr, char* ptrEnd, boost::int128_type i128) { diff --git a/test/limits.cpp b/test/limits.cpp index 7fe02ca76..4d489654b 100644 --- a/test/limits.cpp +++ b/test/limits.cpp @@ -3,6 +3,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #include #ifdef BOOST_HAS_INT128 @@ -12,7 +13,7 @@ // won't be visible to BOOST_TEST_EQ // LCOV_EXCL_START -#include +#include static char* mini_to_chars( char (&buffer)[ 64 ], boost::uint128_type v ) { @@ -64,9 +65,9 @@ std::ostream& operator<<( std::ostream& os, boost::int128_type v ) #include #include #include -#include -#include -#include +#include +#include +#include void test_odr_use( int const* ); diff --git a/test/limits_link_1.cpp b/test/limits_link_1.cpp index a7b2eaf9b..7030438e2 100644 --- a/test/limits_link_1.cpp +++ b/test/limits_link_1.cpp @@ -2,8 +2,8 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #include -#include void test_odr_use( int const* ); diff --git a/test/limits_link_2.cpp b/test/limits_link_2.cpp index b45c627fd..c619a23b9 100644 --- a/test/limits_link_2.cpp +++ b/test/limits_link_2.cpp @@ -2,8 +2,8 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #include -#include void test_odr_use( int const* ); diff --git a/test/roundtrip.cpp b/test/roundtrip.cpp index 6c16cb65e..bc4870dd9 100644 --- a/test/roundtrip.cpp +++ b/test/roundtrip.cpp @@ -2,6 +2,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #include #ifdef BOOST_HAS_INT128 @@ -11,7 +12,7 @@ // won't be visible to BOOST_TEST_EQ // LCOV_EXCL_START -#include +#include static char* mini_to_chars( char (&buffer)[ 64 ], boost::uint128_type v ) { @@ -62,14 +63,16 @@ std::ostream& operator<<( std::ostream& os, boost::int128_type v ) #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include int const N = 1024; @@ -296,7 +299,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; diff --git a/test/test_128bit_emulation.cpp b/test/test_128bit_emulation.cpp index 570e764c6..c9d50248c 100644 --- a/test/test_128bit_emulation.cpp +++ b/test/test_128bit_emulation.cpp @@ -2,6 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include +BOOST_PRAGMA_MESSAGE("This test targets an implementation detail, and is skipped when building with modules") +int main() {} + +#else + #include #ifdef BOOST_HAS_INT128 @@ -249,3 +257,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/test_128bit_native.cpp b/test/test_128bit_native.cpp index cd96a8eb8..dce619c48 100644 --- a/test/test_128bit_native.cpp +++ b/test/test_128bit_native.cpp @@ -2,6 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include +BOOST_PRAGMA_MESSAGE("This test targets an implementation detail, and is skipped when building with modules") +int main() {} + +#else + #include #include #include @@ -27,3 +35,5 @@ int main() test128(); return boost::report_errors(); } + +#endif diff --git a/test/test_boost_json_values.cpp b/test/test_boost_json_values.cpp index fb3e5963c..735485c95 100644 --- a/test/test_boost_json_values.cpp +++ b/test/test_boost_json_values.cpp @@ -7,18 +7,20 @@ // See: https://github.com/boostorg/json/issues/599 // See: https://github.com/boostorg/json/blob/develop/test/double.cpp +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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 d3fa83465..1e7ed4b30 100644 --- a/test/test_compute_float32.cpp +++ b/test/test_compute_float32.cpp @@ -2,6 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include +BOOST_PRAGMA_MESSAGE("This test targets an implementation detail, and is skipped when building with modules") +int main() {} + +#else + #include #include #include @@ -34,3 +42,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/test_compute_float64.cpp b/test/test_compute_float64.cpp index 945276281..bbb95e051 100644 --- a/test/test_compute_float64.cpp +++ b/test/test_compute_float64.cpp @@ -2,6 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include +BOOST_PRAGMA_MESSAGE("This test targets an implementation detail, and is skipped when building with modules") +int main() {} + +#else + #include #include #include @@ -35,3 +43,5 @@ int main(void) return boost::report_errors(); } + +#endif diff --git a/test/test_compute_float80.cpp b/test/test_compute_float80.cpp index a800f9572..8af7ed479 100644 --- a/test/test_compute_float80.cpp +++ b/test/test_compute_float80.cpp @@ -2,6 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include +BOOST_PRAGMA_MESSAGE("This test targets an implementation detail, and is skipped when building with modules") +int main() {} + +#else + #include #include #include @@ -48,3 +56,5 @@ int main() return 0; } #endif + +#endif diff --git a/test/test_float128.cpp b/test/test_float128.cpp index 823666c7c..6b34aa79c 100644 --- a/test/test_float128.cpp +++ b/test/test_float128.cpp @@ -2,6 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include +BOOST_PRAGMA_MESSAGE("This test targets an implementation detail, and is skipped when building with modules") +int main() {} + +#else + #include #if defined(BOOST_CHARCONV_HAS_QUADMATH) && defined(BOOST_HAS_INT128) @@ -87,11 +95,11 @@ std::ostream& operator<<( std::ostream& os, boost::int128_type v ) #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "../src/float128_impl.hpp" constexpr int N = 1024; @@ -843,3 +851,5 @@ int main() } #endif + +#endif diff --git a/test/test_num_digits.cpp b/test/test_num_digits.cpp index fde6d28d5..0024206a5 100644 --- a/test/test_num_digits.cpp +++ b/test/test_num_digits.cpp @@ -2,6 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include +BOOST_PRAGMA_MESSAGE("This test targets an implementation detail, and is skipped when building with modules") +int main() {} + +#else + #include #include #include @@ -106,3 +114,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/test_parser.cpp b/test/test_parser.cpp index c1fef8468..3b1de97d3 100644 --- a/test/test_parser.cpp +++ b/test/test_parser.cpp @@ -2,6 +2,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include +BOOST_PRAGMA_MESSAGE("This test targets an implementation detail, and is skipped when building with modules") +int main() {} + +#else + #include #include #include @@ -240,3 +248,5 @@ int main() test_zeroes(); return boost::report_errors(); } + +#endif diff --git a/test/to_chars.cpp b/test/to_chars.cpp index 91a605f15..839bf4b2f 100644 --- a/test/to_chars.cpp +++ b/test/to_chars.cpp @@ -3,14 +3,17 @@ // 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 -#include +#include +#include +#include +#include +#include +#include #ifdef BOOST_CHARCONV_HAS_INT128 template diff --git a/test/to_chars_float.cpp b/test/to_chars_float.cpp index 301c0df7f..a0da2c90d 100644 --- a/test/to_chars_float.cpp +++ b/test/to_chars_float.cpp @@ -3,6 +3,14 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +#include +BOOST_PRAGMA_MESSAGE("This test targets an implementation detail, and is skipped when building with modules") +int main() {} + +#else + #include #include #include @@ -1099,3 +1107,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/to_chars_float_STL_comp.cpp b/test/to_chars_float_STL_comp.cpp index dec006b75..b250260e5 100644 --- a/test/to_chars_float_STL_comp.cpp +++ b/test/to_chars_float_STL_comp.cpp @@ -9,19 +9,20 @@ ((defined(__clang__) && __clang_major__ >= 14 && !defined(__APPLE__)) || (defined(__clang__) && defined(__APPLE__) && __clang_major__ >= 16)) || \ (defined(_MSC_VER) && _MSC_VER >= 1924) +#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 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 89cdc1191..b0a245f7a 100644 --- a/test/to_chars_integer_STL_comp.cpp +++ b/test/to_chars_integer_STL_comp.cpp @@ -6,19 +6,20 @@ #if !defined(BOOST_NO_CXX17_HDR_CHARCONV) && (!defined(__clang_major__) || (defined(__clang_major__) && __clang_major__ > 7)) +#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 template void stress_test_worker() diff --git a/test/to_chars_sprintf.cpp b/test/to_chars_sprintf.cpp index 3b1d73ab8..9d21a5539 100644 --- a/test/to_chars_sprintf.cpp +++ b/test/to_chars_sprintf.cpp @@ -3,18 +3,19 @@ // 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 -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include int const N = 1024; From 02faea14463d3b7c20f8331bb2e64ca6ce7504cf Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 13:57:27 +0100 Subject: [PATCH 09/19] Fix some gcc problems --- .../boost/charconv/detail/compute_float64.hpp | 2 +- .../boost/charconv/detail/compute_float80.hpp | 2 +- .../detail/dragonbox/dragonbox_common.hpp | 22 +++++++++---------- .../detail/from_chars_integer_impl.hpp | 4 ++-- .../charconv/detail/integer_search_trees.hpp | 2 +- .../boost/charconv/detail/ryu/generic_128.hpp | 2 +- .../charconv/detail/ryu/ryu_generic_128.hpp | 6 ++--- modules/boost_charconv.cppm | 2 ++ src/float128_impl.hpp | 2 +- src/from_chars.cpp | 1 + src/internal.cppm | 3 +-- src/quadmath_wrapper.hpp | 5 ++++- src/to_chars.cpp | 3 ++- test/github_issue_152_float128.cpp | 5 ++--- test/roundtrip.cpp | 2 +- 15 files changed, 34 insertions(+), 29 deletions(-) diff --git a/include/boost/charconv/detail/compute_float64.hpp b/include/boost/charconv/detail/compute_float64.hpp index c99f3a816..9ab7d0421 100644 --- a/include/boost/charconv/detail/compute_float64.hpp +++ b/include/boost/charconv/detail/compute_float64.hpp @@ -19,7 +19,7 @@ namespace boost { namespace charconv { namespace detail { -static constexpr double powers_of_ten[] = { +BOOST_INLINE_CONSTEXPR double powers_of_ten[] = { 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22 }; diff --git a/include/boost/charconv/detail/compute_float80.hpp b/include/boost/charconv/detail/compute_float80.hpp index ba6563b7f..7132dba5d 100644 --- a/include/boost/charconv/detail/compute_float80.hpp +++ b/include/boost/charconv/detail/compute_float80.hpp @@ -28,7 +28,7 @@ namespace boost { namespace charconv { namespace detail { #if BOOST_CHARCONV_LDBL_BITS > 64 -static constexpr long double powers_of_ten_ld[] = { +BOOST_INLINE_CONSTEXPR long double powers_of_ten_ld[] = { 1e0L, 1e1L, 1e2L, 1e3L, 1e4L, 1e5L, 1e6L, 1e7L, 1e8L, 1e9L, 1e10L, 1e11L, 1e12L, 1e13L, 1e14L, 1e15L, 1e16L, 1e17L, 1e18L, 1e19L, 1e20L, diff --git a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp index c8ba59198..cef506002 100644 --- a/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp +++ b/include/boost/charconv/detail/dragonbox/dragonbox_common.hpp @@ -323,7 +323,7 @@ BOOST_CHARCONV_CXX14_CONSTEXPR Int compute_power(Int a, Int2 exp) noexcept return res; } -static constexpr std::uint64_t power_of_10[] = { +BOOST_INLINE_CONSTEXPR std::uint64_t power_of_10[] = { UINT64_C(1), UINT64_C(10), UINT64_C(100), UINT64_C(1000), UINT64_C(10000), UINT64_C(100000), UINT64_C(1000000), UINT64_C(10000000), UINT64_C(100000000), UINT64_C(1000000000), UINT64_C(10000000000), UINT64_C(100000000000), UINT64_C(1000000000000), @@ -383,9 +383,9 @@ BOOST_CHARCONV_CXX14_CONSTEXPR int floor_log2(UInt n) noexcept return count; } -static constexpr int floor_log10_pow2_min_exponent = -2620; +BOOST_INLINE_CONSTEXPR int floor_log10_pow2_min_exponent = -2620; -static constexpr int floor_log10_pow2_max_exponent = 2620; +BOOST_INLINE_CONSTEXPR int floor_log10_pow2_max_exponent = 2620; constexpr int floor_log10_pow2(int e) noexcept { @@ -395,9 +395,9 @@ constexpr int floor_log10_pow2(int e) noexcept max_exponent(floor_log10_pow2_max_exponent)>(e); } -static constexpr int floor_log2_pow10_min_exponent = -1233; +BOOST_INLINE_CONSTEXPR int floor_log2_pow10_min_exponent = -1233; -static constexpr int floor_log2_pow10_max_exponent = 1233; +BOOST_INLINE_CONSTEXPR int floor_log2_pow10_max_exponent = 1233; constexpr int floor_log2_pow10(int e) noexcept { @@ -407,9 +407,9 @@ constexpr int floor_log2_pow10(int e) noexcept max_exponent(floor_log2_pow10_max_exponent)>(e); } -static constexpr int floor_log10_pow2_minus_log10_4_over_3_min_exponent = -2985; +BOOST_INLINE_CONSTEXPR int floor_log10_pow2_minus_log10_4_over_3_min_exponent = -2985; -static constexpr int floor_log10_pow2_minus_log10_4_over_3_max_exponent = 2936; +BOOST_INLINE_CONSTEXPR int floor_log10_pow2_minus_log10_4_over_3_max_exponent = 2936; constexpr int floor_log10_pow2_minus_log10_4_over_3(int e) noexcept { @@ -419,9 +419,9 @@ constexpr int floor_log10_pow2_minus_log10_4_over_3(int e) noexcept max_exponent(floor_log10_pow2_minus_log10_4_over_3_max_exponent)>(e); } -static constexpr int floor_log5_pow2_min_exponent = -1831; +BOOST_INLINE_CONSTEXPR int floor_log5_pow2_min_exponent = -1831; -static constexpr int floor_log5_pow2_max_exponent = 1831; +BOOST_INLINE_CONSTEXPR int floor_log5_pow2_max_exponent = 1831; constexpr int floor_log5_pow2(int e) noexcept { @@ -431,9 +431,9 @@ constexpr int floor_log5_pow2(int e) noexcept max_exponent(floor_log5_pow2_max_exponent)>(e); } -static constexpr int floor_log5_pow2_minus_log5_3_min_exponent = -3543; +BOOST_INLINE_CONSTEXPR int floor_log5_pow2_minus_log5_3_min_exponent = -3543; -static constexpr int floor_log5_pow2_minus_log5_3_max_exponent = 2427; +BOOST_INLINE_CONSTEXPR int floor_log5_pow2_minus_log5_3_max_exponent = 2427; constexpr int floor_log5_pow2_minus_log5_3(int e) noexcept { diff --git a/include/boost/charconv/detail/from_chars_integer_impl.hpp b/include/boost/charconv/detail/from_chars_integer_impl.hpp index 6df24d949..bbb1888d7 100644 --- a/include/boost/charconv/detail/from_chars_integer_impl.hpp +++ b/include/boost/charconv/detail/from_chars_integer_impl.hpp @@ -24,7 +24,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, @@ -44,7 +44,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/integer_search_trees.hpp b/include/boost/charconv/detail/integer_search_trees.hpp index 2b9a219fc..1308c3539 100644 --- a/include/boost/charconv/detail/integer_search_trees.hpp +++ b/include/boost/charconv/detail/integer_search_trees.hpp @@ -193,7 +193,7 @@ BOOST_CHARCONV_CXX14_CONSTEXPR int num_digits(uint128 x) noexcept #endif #ifdef BOOST_CHARCONV_HAS_INT128 -static constexpr std::array powers_of_10 = +BOOST_INLINE_CONSTEXPR std::array powers_of_10 = {{ UINT64_C(1), UINT64_C(10), UINT64_C(100), UINT64_C(1000), UINT64_C(10000), UINT64_C(100000), UINT64_C(1000000), UINT64_C(10000000), UINT64_C(100000000), UINT64_C(1000000000), UINT64_C(10000000000), UINT64_C(100000000000), diff --git a/include/boost/charconv/detail/ryu/generic_128.hpp b/include/boost/charconv/detail/ryu/generic_128.hpp index 96ae08154..5c456e6f4 100644 --- a/include/boost/charconv/detail/ryu/generic_128.hpp +++ b/include/boost/charconv/detail/ryu/generic_128.hpp @@ -6,7 +6,7 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) #include #include diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index ba029b8eb..e4dafe26b 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -6,7 +6,7 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) #include #include @@ -23,8 +23,8 @@ namespace boost { namespace charconv { namespace detail { namespace ryu { -static constexpr int32_t fd128_exceptional_exponent = 0x7FFFFFFF; -static constexpr unsigned_128_type one = 1; +BOOST_INLINE_CONSTEXPR int32_t fd128_exceptional_exponent = 0x7FFFFFFF; +BOOST_INLINE_CONSTEXPR unsigned_128_type one = 1; struct floating_decimal_128 { diff --git a/modules/boost_charconv.cppm b/modules/boost_charconv.cppm index 17e045e28..2952353db 100644 --- a/modules/boost_charconv.cppm +++ b/modules/boost_charconv.cppm @@ -23,4 +23,6 @@ import boost.core; #define BOOST_IN_MODULE_PURVIEW #include +#include +#include diff --git a/src/float128_impl.hpp b/src/float128_impl.hpp index 9fdf06f30..90ca67a3a 100644 --- a/src/float128_impl.hpp +++ b/src/float128_impl.hpp @@ -70,7 +70,7 @@ inline struct floating_decimal_128 stdfloat128_to_fd128(std::float128_t d) noexc // fast_float // -------------------------------------------------------------------------------------------------------------------- -static constexpr __float128 powers_of_tenq[] = { +BOOST_INLINE_CONSTEXPR __float128 powers_of_tenq[] = { 1e0Q, 1e1Q, 1e2Q, 1e3Q, 1e4Q, 1e5Q, 1e6Q, 1e7Q, 1e8Q, 1e9Q, 1e10Q, 1e11Q, 1e12Q, 1e13Q, 1e14Q, 1e15Q, 1e16Q, 1e17Q, 1e18Q, 1e19Q, 1e20Q, diff --git a/src/from_chars.cpp b/src/from_chars.cpp index 1b3a2cfae..aff461a48 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -17,6 +17,7 @@ module; #include #include #include +#include "quadmath_wrapper.hpp" #ifdef BOOST_USE_MODULES diff --git a/src/internal.cppm b/src/internal.cppm index c2079a1bb..08a10c847 100644 --- a/src/internal.cppm +++ b/src/internal.cppm @@ -13,6 +13,7 @@ module; module boost.charconv:internal; import std; +import std.compat; import boost.core; import boost.charconv; @@ -20,8 +21,6 @@ import boost.charconv; #define BOOST_IN_MODULE_PURVIEW #include -#include -#include #include #include #include diff --git a/src/quadmath_wrapper.hpp b/src/quadmath_wrapper.hpp index 751b44d81..d3231c911 100644 --- a/src/quadmath_wrapper.hpp +++ b/src/quadmath_wrapper.hpp @@ -1,7 +1,10 @@ // Module-safe wrapper for quadmath #if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CHARCONV_QUADMATH_INCLUDED) -# error "Please #include in your module global fragment" +# error "Please #include "quadmath_wrapper.hpp" in your module global fragment" #endif #define BOOST_CHARCONV_QUADMATH_INCLUDED + +#ifdef BOOST_CHARCONV_HAS_QUADMATH #include +#endif diff --git a/src/to_chars.cpp b/src/to_chars.cpp index 3dfb0783c..5e28636a2 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -12,6 +12,7 @@ module; #include #include #include +#include "quadmath_wrapper.hpp" module boost.charconv; import std; @@ -40,7 +41,7 @@ namespace boost { namespace charconv { namespace detail { namespace to_chars_det // These "//"'s are to prevent clang-format to ruin this nice alignment. // Thanks to reddit user u/mcmcc: // https://www.reddit.com/r/cpp/comments/so3wx9/dragonbox_110_is_released_a_fast_floattostring/hw8z26r/?context=3 - static constexpr char radix_100_head_table[] = { + BOOST_INLINE_CONSTEXPR char radix_100_head_table[] = { '0', '.', '1', '.', '2', '.', '3', '.', '4', '.', // '5', '.', '6', '.', '7', '.', '8', '.', '9', '.', // '1', '.', '1', '.', '1', '.', '1', '.', '1', '.', // diff --git a/test/github_issue_152_float128.cpp b/test/github_issue_152_float128.cpp index ade355bbc..d8641ed49 100644 --- a/test/github_issue_152_float128.cpp +++ b/test/github_issue_152_float128.cpp @@ -2,11 +2,10 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include -#include - #ifdef BOOST_CHARCONV_HAS_QUADMATH +#include +#include #include std::ostream& operator<<( std::ostream& os, __float128 v ) diff --git a/test/roundtrip.cpp b/test/roundtrip.cpp index bc4870dd9..76cbaedba 100644 --- a/test/roundtrip.cpp +++ b/test/roundtrip.cpp @@ -2,6 +2,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #include #include @@ -70,7 +71,6 @@ std::ostream& operator<<( std::ostream& os, boost::int128_type v ) #include #include #include -#include #include #include From 31455dcc3c02e2f2de68b67092a3ef154517f132 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 14:25:18 +0100 Subject: [PATCH 10/19] gcc fixes --- CMakeLists.txt | 3 +- .../detail/fast_float/digit_comparison.hpp | 2 +- .../detail/fast_float/float_common.hpp | 36 +++++++++---------- include/boost/charconv/detail/issignaling.hpp | 9 ++--- modules/boost_charconv.cppm | 16 ++++++++- src/from_chars.cpp | 8 ++--- src/internal.cppm | 31 ---------------- src/to_chars.cpp | 10 +++--- src/to_chars_float_impl.hpp | 6 +--- 9 files changed, 47 insertions(+), 74 deletions(-) delete mode 100644 src/internal.cppm diff --git a/CMakeLists.txt b/CMakeLists.txt index 1488bad35..49cb2b6b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,8 +15,7 @@ add_library(boost_charconv add_library(Boost::charconv ALIAS boost_charconv) if (BOOST_USE_MODULES) - target_sources(boost_charconv PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES modules/boost_charconv.cppm - PRIVATE FILE_SET internal_unit TYPE CXX_MODULES BASE_DIRS src FILES src/internal.cppm) + 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) diff --git a/include/boost/charconv/detail/fast_float/digit_comparison.hpp b/include/boost/charconv/detail/fast_float/digit_comparison.hpp index 88205e36f..9cb6569ea 100644 --- a/include/boost/charconv/detail/fast_float/digit_comparison.hpp +++ b/include/boost/charconv/detail/fast_float/digit_comparison.hpp @@ -21,7 +21,7 @@ namespace boost { namespace charconv { namespace detail { namespace fast_float { // 1e0 to 1e19 -constexpr static uint64_t powers_of_ten_uint64[] = { +BOOST_INLINE_CONSTEXPR uint64_t powers_of_ten_uint64[] = { 1UL, 10UL, 100UL, 1000UL, 10000UL, 100000UL, 1000000UL, 10000000UL, 100000000UL, 1000000000UL, 10000000000UL, 100000000000UL, 1000000000000UL, 10000000000000UL, 100000000000000UL, 1000000000000000UL, 10000000000000000UL, 100000000000000000UL, diff --git a/include/boost/charconv/detail/fast_float/float_common.hpp b/include/boost/charconv/detail/fast_float/float_common.hpp index 3577919ac..5aa52293e 100644 --- a/include/boost/charconv/detail/fast_float/float_common.hpp +++ b/include/boost/charconv/detail/fast_float/float_common.hpp @@ -279,7 +279,7 @@ struct adjusted_mantissa { }; // Bias so we can get the real exponent with an invalid adjusted_mantissa. -constexpr static int32_t invalid_am_bias = -0x8000; +BOOST_INLINE_CONSTEXPR int32_t invalid_am_bias = -0x8000; // used for binary_format_lookup_tables::max_mantissa constexpr uint64_t constant_55555 = 5 * 5 * 5 * 5 * 5; @@ -290,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_TONEARES{} - 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_TONEARES{} - 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 inline constexpr int mantissa_explicit_bits(){return {};} + static inline constexpr int minimum_exponent(){return {};} + static inline constexpr int infinite_power(){return {};} + static inline constexpr int sign_index(){return {};} + static inline constexpr int min_exponent_fast_path(){return {};} // used when fegetround() == FE_TONEARES{} + static inline constexpr int max_exponent_fast_path(){return {};} + static inline constexpr int max_exponent_round_to_even(){return {};} + static inline constexpr int min_exponent_round_to_even(){return {};} + static inline constexpr uint64_t max_mantissa_fast_path(int64_t power){return {};} + static inline constexpr uint64_t max_mantissa_fast_path(){return {};} // used when fegetround() == FE_TONEARES{} + static inline constexpr int largest_power_of_ten(){return {};} + static inline constexpr int smallest_power_of_ten(){return {};} + static inline constexpr T exact_power_of_ten(int64_t power){return {};} + static inline constexpr size_t max_digits(){return {};} + static inline constexpr equiv_uint exponent_mask(){return {};} + static inline constexpr equiv_uint mantissa_mask(){return {};} + static inline constexpr equiv_uint hidden_bit_mask(){return {};} }; template diff --git a/include/boost/charconv/detail/issignaling.hpp b/include/boost/charconv/detail/issignaling.hpp index 7c1247ce2..4c010615e 100644 --- a/include/boost/charconv/detail/issignaling.hpp +++ b/include/boost/charconv/detail/issignaling.hpp @@ -14,9 +14,6 @@ namespace boost { namespace charconv { namespace detail { -template -inline bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (T x) noexcept { static_assert(false); } - #if BOOST_CHARCONV_LDBL_BITS == 128 || defined(BOOST_CHARCONV_HAS_QUADMATH) struct words128 @@ -60,8 +57,7 @@ inline bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (T x) noexcept #ifdef BOOST_CHARCONV_HAS_FLOAT16 -template <> -inline bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (std::float16_t x) noexcept +inline bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (std::float16_t x) noexcept { std::uint16_t bits; std::memcpy(&bits, &x, sizeof(std::uint16_t)); @@ -72,8 +68,7 @@ inline bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (std::f #ifdef BOOST_CHARCONV_HAS_BRAINFLOAT16 -template <> -inline bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (std::bfloat16_t x) noexcept +inline bool issignaling BOOST_PREVENT_MACRO_SUBSTITUTION (std::bfloat16_t x) noexcept { std::uint16_t bits; std::memcpy(&bits, &x, sizeof(std::uint16_t)); diff --git a/modules/boost_charconv.cppm b/modules/boost_charconv.cppm index 2952353db..ea62a1496 100644 --- a/modules/boost_charconv.cppm +++ b/modules/boost_charconv.cppm @@ -13,6 +13,9 @@ module; #include #include +// TODO: remove this when gcc fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124309 +#include + export module boost.charconv; import std; @@ -21,8 +24,19 @@ import boost.core; #define BOOST_CHARCONV_INTERFACE_UNIT #define BOOST_IN_MODULE_PURVIEW +#define BOOST_CHARCONV_INTERNAL_PARTITION_UNIT #include + +// TODO: remove this when gcc fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124309 #include #include - +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/from_chars.cpp b/src/from_chars.cpp index aff461a48..c56ed737a 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -12,12 +12,13 @@ module; # define NO_WARN_MBCS_MFC_DEPRECATION #endif -#include +#include "quadmath_wrapper.hpp" +#include +#include +#include #include #include #include -#include -#include "quadmath_wrapper.hpp" #ifdef BOOST_USE_MODULES @@ -25,7 +26,6 @@ module boost.charconv; import std; import std.compat; import boost.core; -import :internal; #define BOOST_IN_MODULE_PURVIEW #endif // BOOST_USE_MODULES diff --git a/src/internal.cppm b/src/internal.cppm deleted file mode 100644 index 08a10c847..000000000 --- a/src/internal.cppm +++ /dev/null @@ -1,31 +0,0 @@ - -module; - -#include // math macros -#include // int macros -#include // CHAR_BIT and other C limits macros -#include -#include -#include -#include -#include -#include - -module boost.charconv:internal; -import std; -import std.compat; -import boost.core; -import boost.charconv; - -#define BOOST_CHARCONV_INTERNAL_PARTITION_UNIT -#define BOOST_IN_MODULE_PURVIEW - -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/src/to_chars.cpp b/src/to_chars.cpp index 5e28636a2..fa15c82bb 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -5,19 +5,19 @@ // https://www.boost.org/LICENSE_1_0.txt module; -#include +#include "quadmath_wrapper.hpp" +#include +#include +#include +#include #include #include #include #include -#include -#include -#include "quadmath_wrapper.hpp" module boost.charconv; import std; import boost.core; -import :internal; #define BOOST_IN_MODULE_PURVIEW diff --git a/src/to_chars_float_impl.hpp b/src/to_chars_float_impl.hpp index 62a8d4d99..3b5f83220 100644 --- a/src/to_chars_float_impl.hpp +++ b/src/to_chars_float_impl.hpp @@ -48,9 +48,6 @@ namespace boost { namespace charconv { namespace detail { -template -inline to_chars_result to_chars_nonfinite(char* first, char* last, Real value, int classification) noexcept { static_assert(false); } - #if BOOST_CHARCONV_LDBL_BITS == 128 || defined(BOOST_CHARCONV_HAS_STDFLOAT128) || defined(BOOST_CHARCONV_HAS_FLOAT16) || defined(BOOST_CHARCONV_HAS_BRAINFLOAT16) template @@ -129,8 +126,7 @@ inline to_chars_result to_chars_nonfinite(char* first, char* last, Real value, i # pragma GCC diagnostic ignored "-Wfloat-conversion" #endif -template <> -inline to_chars_result to_chars_nonfinite<__float128>(char* first, char* last, __float128 value, int classification) noexcept +inline to_chars_result to_chars_nonfinite(char* first, char* last, __float128 value, int classification) noexcept { std::ptrdiff_t offset {}; std::ptrdiff_t buffer_size = last - first; From 0aa3740483b4118b9c3b9cd09e94ba2bc46804b2 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 14:27:21 +0100 Subject: [PATCH 11/19] test fixes --- test/from_chars_float2.cpp | 3 ++- test/github_issue_152_float128.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/from_chars_float2.cpp b/test/from_chars_float2.cpp index 8e0e64260..65d2ae03e 100644 --- a/test/from_chars_float2.cpp +++ b/test/from_chars_float2.cpp @@ -2,10 +2,11 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #include +#include #include #include -#include static boost::detail::splitmix64 rng; diff --git a/test/github_issue_152_float128.cpp b/test/github_issue_152_float128.cpp index d8641ed49..0ffb2a663 100644 --- a/test/github_issue_152_float128.cpp +++ b/test/github_issue_152_float128.cpp @@ -4,9 +4,10 @@ #ifdef BOOST_CHARCONV_HAS_QUADMATH +#include +#include #include #include -#include std::ostream& operator<<( std::ostream& os, __float128 v ) { From 2a4d5549493bf72c9b41eb6512db09daaac8c14e Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 15:01:49 +0100 Subject: [PATCH 12/19] compatibility --- CMakeLists.txt | 12 ++++++++++-- src/from_chars.cc | 22 ++++++++++++++++++++++ src/from_chars.cpp | 19 ------------------- src/to_chars.cc | 22 ++++++++++++++++++++++ src/to_chars.cpp | 19 +------------------ 5 files changed, 55 insertions(+), 39 deletions(-) create mode 100644 src/from_chars.cc create mode 100644 src/to_chars.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 49cb2b6b0..388dc206a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,17 @@ cmake_minimum_required(VERSION 3.8...3.31) project(boost_charconv VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) +# We can't make source files conditionally module units. +# In module builds, use cc files that include their respective cpp, plus the module infrastructure +if (BOOST_USE_MODULES) + set(SOURCE_SUFFIX "cc") +else() + set(SOURCE_SUFFIX "cpp") +endif() + add_library(boost_charconv - src/from_chars.cpp - src/to_chars.cpp + src/from_chars.${SOURCE_SUFFIX} + src/to_chars.${SOURCE_SUFFIX} ) add_library(Boost::charconv ALIAS boost_charconv) diff --git a/src/from_chars.cc b/src/from_chars.cc new file mode 100644 index 000000000..aa67f84a5 --- /dev/null +++ b/src/from_chars.cc @@ -0,0 +1,22 @@ +// Copyright 2026 Ruben Perez +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt +module; + +#include "quadmath_wrapper.hpp" +#include +#include +#include +#include +#include +#include + + +module boost.charconv; +import std; +import std.compat; +import boost.core; + +#define BOOST_IN_MODULE_PURVIEW + +#include "from_chars.cpp" diff --git a/src/from_chars.cpp b/src/from_chars.cpp index c56ed737a..6bcc6d83c 100644 --- a/src/from_chars.cpp +++ b/src/from_chars.cpp @@ -2,7 +2,6 @@ // Copyright 2023 Matt Borland // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -module; // https://stackoverflow.com/questions/38060411/visual-studio-2015-wont-suppress-error-c4996 #ifndef _SCL_SECURE_NO_WARNINGS @@ -12,24 +11,6 @@ module; # define NO_WARN_MBCS_MFC_DEPRECATION #endif -#include "quadmath_wrapper.hpp" -#include -#include -#include -#include -#include -#include - - -#ifdef BOOST_USE_MODULES -module boost.charconv; -import std; -import std.compat; -import boost.core; - -#define BOOST_IN_MODULE_PURVIEW -#endif // BOOST_USE_MODULES - #include "float128_impl.hpp" #include "from_chars_float_impl.hpp" #include diff --git a/src/to_chars.cc b/src/to_chars.cc new file mode 100644 index 000000000..e50e84454 --- /dev/null +++ b/src/to_chars.cc @@ -0,0 +1,22 @@ +// Copyright 2026 Ruben Perez +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt +module; + +#include "quadmath_wrapper.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +module boost.charconv; +import std; +import boost.core; + +#define BOOST_IN_MODULE_PURVIEW + +#include "to_chars.cpp" diff --git a/src/to_chars.cpp b/src/to_chars.cpp index fa15c82bb..dba1b5692 100644 --- a/src/to_chars.cpp +++ b/src/to_chars.cpp @@ -3,23 +3,6 @@ // Copyright 2023 Matt Borland // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -module; - -#include "quadmath_wrapper.hpp" -#include -#include -#include -#include -#include -#include -#include -#include - -module boost.charconv; -import std; -import boost.core; - -#define BOOST_IN_MODULE_PURVIEW #include "float128_impl.hpp" #include "to_chars_float_impl.hpp" @@ -41,7 +24,7 @@ namespace boost { namespace charconv { namespace detail { namespace to_chars_det // These "//"'s are to prevent clang-format to ruin this nice alignment. // Thanks to reddit user u/mcmcc: // https://www.reddit.com/r/cpp/comments/so3wx9/dragonbox_110_is_released_a_fast_floattostring/hw8z26r/?context=3 - BOOST_INLINE_CONSTEXPR char radix_100_head_table[] = { + static constexpr char radix_100_head_table[] = { '0', '.', '1', '.', '2', '.', '3', '.', '4', '.', // '5', '.', '6', '.', '7', '.', '8', '.', '9', '.', // '1', '.', '1', '.', '1', '.', '1', '.', '1', '.', // From 4efaa91177a08689e5c63a7ad83fb0f3e78987c5 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 17:33:53 +0100 Subject: [PATCH 13/19] Module CI --- .github/workflows/ci.yml | 385 ++++++++++++++++++++++++++++++ tools/install-cmake.sh | 15 ++ tools/setup_boost_with_modules.py | 29 +++ 3 files changed, 429 insertions(+) create mode 100755 tools/install-cmake.sh create mode 100644 tools/setup_boost_with_modules.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1490bac7a..59ac5ce42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -458,6 +458,7 @@ jobs: git submodule update --init tools/boostdep DEPINST_ARGS+=("$LIBRARY") python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" + python libs/charconv/tools/setup_boost_with_modules.py # Temporary if [ -z "${{matrix.cmake_tests}}" ] then ./bootstrap.sh @@ -550,6 +551,7 @@ jobs: 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 cmd /c bootstrap b2 -d0 headers @@ -597,6 +599,7 @@ jobs: cp -r $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 run: | @@ -644,6 +647,7 @@ jobs: cp -r $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 run: | @@ -701,6 +705,7 @@ jobs: cp -r $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 run: | @@ -765,3 +770,383 @@ jobs: - name: Run tests run: ci/build.sh + + posix-cmake-subdir-modules: + strategy: + fail-fast: false + matrix: + include: + - name: "clang-21 Debug" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Debug" + - name: "clang-21 Release" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Release" + - name: "gcc-15 Debug" + packages: "g++-15" + cmake-args: "-DCMAKE_CXX_COMPILER=g++-15 -DCMAKE_BUILD_TYPE=Debug" + + name: CMake subdir modules ${{ matrix.name }} + + + runs-on: ubuntu-latest + container: ubuntu:26.04 + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y --no-install-recommends wget ninja-build git ca-certificates python3 python-is-python3 ${{ matrix.packages }} + ./tools/install-cmake.sh + + - 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 + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + 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 \ + -G Ninja \ + -DCMAKE_CXX_STANDARD=23 \ + -DBUILD_TESTING=ON \ + -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ + -DBOOST_USE_MODULES=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ + ${{ matrix.cmake-args }} \ + .. + cmake --build . + ctest --output-on-failure --no-tests=error + + posix-cmake-install-modules: + strategy: + fail-fast: false + matrix: + include: + - name: "clang-21 Debug" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Debug" + - name: "clang-21 Release" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Release" + - name: "gcc-15 Debug" + packages: "g++-15" + cmake-args: "-DCMAKE_CXX_COMPILER=g++-15 -DCMAKE_BUILD_TYPE=Debug" + + name: CMake install modules ${{ matrix.name }} + + runs-on: ubuntu-latest + container: ubuntu:26.04 + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y --no-install-recommends wget ninja-build git ca-certificates python3 python-is-python3 ${{ matrix.packages }} + ./tools/install-cmake.sh + + - 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 + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + 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 \ + -G Ninja \ + -DCMAKE_CXX_STANDARD=23 \ + -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ + -DCMAKE_INSTALL_PREFIX=~/.local \ + -DBOOST_USE_MODULES=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ + ${{ matrix.cmake-args }} \ + .. + + - 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 \ + -G Ninja \ + -DCMAKE_CXX_STANDARD=23 \ + -DCMAKE_INSTALL_PREFIX=~/.local \ + -DBOOST_USE_MODULES=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ + ${{ matrix.cmake-args }} \ + .. + cmake --build . + ctest --output-on-failure --no-tests=error + + posix-cmake-test-modules: + strategy: + fail-fast: false + matrix: + include: + - name: "clang-21 Debug" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Debug" + - name: "clang-21 Release" + packages: "clang-21 libc++-21-dev" + cmake-args: "-DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STDLIB_MODULES_JSON=/usr/lib/llvm-21/lib/libc++.modules.json -DCMAKE_BUILD_TYPE=Release" + - name: "gcc-15 Debug" + packages: "g++-15" + cmake-args: "-DCMAKE_CXX_COMPILER=g++-15 -DCMAKE_BUILD_TYPE=Debug" + + name: CMake test modules ${{ matrix.name }} + + runs-on: ubuntu-latest + container: ubuntu:26.04 + + steps: + - uses: actions/checkout@v4 + + - name: Install packages + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y --no-install-recommends wget ninja-build git ca-certificates python3 python-is-python3 ${{ matrix.packages }} + ./tools/install-cmake.sh + + - 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 + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + 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 \ + -G Ninja \ + -DCMAKE_CXX_STANDARD=23 \ + -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ + -DBUILD_TESTING=ON \ + -DBOOST_USE_MODULES=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ + ${{ matrix.cmake-args }} \ + .. + + - 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 + + 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: + - cmake-build-type: Debug + - cmake-build-type: Release + + 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% -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 + 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/tools/install-cmake.sh b/tools/install-cmake.sh new file mode 100755 index 000000000..d2fd0bbab --- /dev/null +++ b/tools/install-cmake.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# +# Copyright (c) 2026 Ruben Perez Hidalgo (rubenperez038 at gmail dot com) +# +# 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) +# + +set -e + +wget https://github.com/Kitware/CMake/releases/download/v4.2.3/cmake-4.2.3-linux-x86_64.tar.gz +tar -xf cmake-4.2.3-linux-x86_64.tar.gz +mv cmake-4.2.3-linux-x86_64 /opt/cmake +update-alternatives --install /usr/bin/cmake cmake /opt/cmake/bin/cmake 100 +update-alternatives --install /usr/bin/ctest ctest /opt/cmake/bin/ctest 100 diff --git a/tools/setup_boost_with_modules.py b/tools/setup_boost_with_modules.py new file mode 100644 index 000000000..37d7ef9cc --- /dev/null +++ b/tools/setup_boost_with_modules.py @@ -0,0 +1,29 @@ +#!/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/core', 'https://github.com/anarthal/core'), + ('libs/assert', 'https://github.com/anarthal/assert'), + ('libs/throw_exception','https://github.com/anarthal/throw_exception'), + ('libs/config', 'https://github.com/anarthal/config'), + ] + + 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 ea5b6a0ed3ed683d217377de093701920f07580c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 17:39:34 +0100 Subject: [PATCH 14/19] add setup to msys job --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59ac5ce42..a05af6c38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -769,7 +769,10 @@ jobs: run: ci/github/install.sh - name: Run tests - run: ci/build.sh + run: | + ./ci/build.sh + cd $BOOST_ROOT + python libs/charconv/tools/setup_boost_with_modules.py # Temporary posix-cmake-subdir-modules: strategy: From 08c85bbe1ea1702e06fe967f3f96c6ca732fe1c6 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 7 Mar 2026 17:59:52 +0100 Subject: [PATCH 15/19] Helpers out of the interface --- CMakeLists.txt | 8 +++- .../detail/disable_module_warnings.hpp | 15 ------- .../boost/charconv/detail/ryu/generic_128.hpp | 2 +- .../charconv/detail/ryu/ryu_generic_128.hpp | 2 +- modules/boost_charconv.cppm | 45 +++---------------- modules/boost_charconv_interface.cppm | 26 +++++++++++ src/float128_impl.hpp | 4 ++ src/from_chars.cc | 7 ++- src/helpers.cppm | 34 ++++++++++++++ src/to_chars.cc | 6 ++- 10 files changed, 88 insertions(+), 61 deletions(-) delete mode 100644 include/boost/charconv/detail/disable_module_warnings.hpp create mode 100644 modules/boost_charconv_interface.cppm create mode 100644 src/helpers.cppm diff --git a/CMakeLists.txt b/CMakeLists.txt index 388dc206a..c780d8658 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,13 @@ add_library(boost_charconv add_library(Boost::charconv ALIAS boost_charconv) if (BOOST_USE_MODULES) - target_sources(boost_charconv PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES modules/boost_charconv.cppm) + target_sources(boost_charconv + PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES + modules/boost_charconv.cppm + modules/boost_charconv_interface.cppm + PRIVATE FILE_SET helpers TYPE CXX_MODULES BASE_DIRS src FILES + src/helpers.cppm + ) # Enable and propagate C++23, import std, and the modules macro target_compile_features(boost_charconv PUBLIC cxx_std_23) diff --git a/include/boost/charconv/detail/disable_module_warnings.hpp b/include/boost/charconv/detail/disable_module_warnings.hpp deleted file mode 100644 index 75db379e4..000000000 --- a/include/boost/charconv/detail/disable_module_warnings.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2026 Ruben Perez -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -#ifdef BOOST_USE_MODULES -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" -#endif - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 5244) -#endif -#endif \ No newline at end of file diff --git a/include/boost/charconv/detail/ryu/generic_128.hpp b/include/boost/charconv/detail/ryu/generic_128.hpp index 5c456e6f4..96ae08154 100644 --- a/include/boost/charconv/detail/ryu/generic_128.hpp +++ b/include/boost/charconv/detail/ryu/generic_128.hpp @@ -6,7 +6,7 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_GENERIC_128_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp index e4dafe26b..1541fbed6 100644 --- a/include/boost/charconv/detail/ryu/ryu_generic_128.hpp +++ b/include/boost/charconv/detail/ryu/ryu_generic_128.hpp @@ -6,7 +6,7 @@ #ifndef BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP #define BOOST_CHARCONV_DETAIL_RYU_RYU_GENERIC_128_HPP -#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERFACE_UNIT) +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) #include #include diff --git a/modules/boost_charconv.cppm b/modules/boost_charconv.cppm index ea62a1496..661629b13 100644 --- a/modules/boost_charconv.cppm +++ b/modules/boost_charconv.cppm @@ -1,42 +1,9 @@ -module; +// Copyright 2026 Ruben Perez +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt -#include // floating-point macros -#include // stdfloat macros are pulled by this header, too -#include // math macros -#include // int macros -#include // CHAR_BIT and other C limits macros -#include // printf format constants -#include -#include -#include -#include -#include -#include - -// TODO: remove this when gcc fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124309 -#include +// Having the interface in a separate file works around this gcc bug: +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124309 export module boost.charconv; - -import std; -import std.compat; -import boost.core; - -#define BOOST_CHARCONV_INTERFACE_UNIT -#define BOOST_IN_MODULE_PURVIEW -#define BOOST_CHARCONV_INTERNAL_PARTITION_UNIT - -#include - -// TODO: remove this when gcc fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124309 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +export import :interface; diff --git a/modules/boost_charconv_interface.cppm b/modules/boost_charconv_interface.cppm new file mode 100644 index 000000000..08303e19a --- /dev/null +++ b/modules/boost_charconv_interface.cppm @@ -0,0 +1,26 @@ +// Copyright 2026 Ruben Perez +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +module; + +#include // floating-point macros +#include // stdfloat macros are pulled by this header, too +#include // int macros +#include // CHAR_BIT and other C limits macros +#include +#include +#include +#include +#include + +export module boost.charconv:interface; + +import std; +import std.compat; +import boost.core; + +#define BOOST_CHARCONV_INTERFACE_UNIT +#define BOOST_IN_MODULE_PURVIEW + +#include diff --git a/src/float128_impl.hpp b/src/float128_impl.hpp index 90ca67a3a..b6cb136e4 100644 --- a/src/float128_impl.hpp +++ b/src/float128_impl.hpp @@ -5,6 +5,8 @@ #ifndef BOOST_CHARCONV_FLOAT128_IMPL_HPP #define BOOST_CHARCONV_FLOAT128_IMPL_HPP +#if !defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) + #include #include #include @@ -354,4 +356,6 @@ inline bool issignaling<__float128> BOOST_PREVENT_MACRO_SUBSTITUTION (__float128 #endif //BOOST_CHARCONV_HAS_QUADMATH +#endif //!defined(BOOST_USE_MODULES) || defined(BOOST_CHARCONV_INTERNAL_PARTITION_UNIT) + #endif //BOOST_CHARCONV_FLOAT128_IMPL_HPP diff --git a/src/from_chars.cc b/src/from_chars.cc index aa67f84a5..99a525535 100644 --- a/src/from_chars.cc +++ b/src/from_chars.cc @@ -3,16 +3,19 @@ // https://www.boost.org/LICENSE_1_0.txt module; -#include "quadmath_wrapper.hpp" #include #include #include +#include "quadmath_wrapper.hpp" #include +#include #include -#include +#include module boost.charconv; + +import :helpers; import std; import std.compat; import boost.core; diff --git a/src/helpers.cppm b/src/helpers.cppm new file mode 100644 index 000000000..584293107 --- /dev/null +++ b/src/helpers.cppm @@ -0,0 +1,34 @@ +// Copyright 2026 Ruben Perez +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt +module; + +#include // printf format constants +#include // math macros +#include // CHAR_BIT and other C limits macros +#include +#include "quadmath_wrapper.hpp" + +#include +#include +#include + +module boost.charconv:helpers; + +import :interface; + +#define BOOST_IN_MODULE_PURVIEW +#define BOOST_CHARCONV_INTERNAL_PARTITION_UNIT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "float128_impl.hpp" diff --git a/src/to_chars.cc b/src/to_chars.cc index e50e84454..cb7e7ec69 100644 --- a/src/to_chars.cc +++ b/src/to_chars.cc @@ -3,17 +3,19 @@ // https://www.boost.org/LICENSE_1_0.txt module; -#include "quadmath_wrapper.hpp" #include #include #include #include +#include "quadmath_wrapper.hpp" #include #include #include -#include +#include module boost.charconv; + +import :helpers; import std; import boost.core; From de2e226ab8fb168214a9816ae403a767f13a69b6 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 7 Mar 2026 22:07:53 +0100 Subject: [PATCH 16/19] Missing else --- include/boost/charconv/detail/config.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/charconv/detail/config.hpp b/include/boost/charconv/detail/config.hpp index b85300b57..463d40331 100644 --- a/include/boost/charconv/detail/config.hpp +++ b/include/boost/charconv/detail/config.hpp @@ -29,6 +29,7 @@ # define BOOST_CHARCONV_LDBL_BITS 64 // Unsupported long double representation +#else # define BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE # define BOOST_CHARCONV_LDBL_BITS -1 From 29726d837bb5ef9825c81142413fa81cef7078f8 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 7 Mar 2026 22:08:51 +0100 Subject: [PATCH 17/19] Python 2.7 --- tools/setup_boost_with_modules.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/setup_boost_with_modules.py b/tools/setup_boost_with_modules.py index 37d7ef9cc..c4eab8797 100644 --- a/tools/setup_boost_with_modules.py +++ b/tools/setup_boost_with_modules.py @@ -1,10 +1,10 @@ -#!/usr/bin/python3 +#!/usr/bin/python # 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 +from subprocess import check_call import os def main(): @@ -19,9 +19,9 @@ def main(): 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']) + check_call(['git', 'remote', 'add', 'modules', url]) + check_call(['git', 'fetch', '--depth', '1', 'modules', 'feature/cxx20-modules']) + check_call(['git', 'checkout', 'modules/feature/cxx20-modules']) os.chdir('../..') From 4c62fb1c96ea903ff0a32b561b664e34a3f528eb Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 7 Mar 2026 22:10:37 +0100 Subject: [PATCH 18/19] Fix unused warnings --- include/boost/charconv/detail/fast_float/float_common.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/charconv/detail/fast_float/float_common.hpp b/include/boost/charconv/detail/fast_float/float_common.hpp index 5aa52293e..33148512b 100644 --- a/include/boost/charconv/detail/fast_float/float_common.hpp +++ b/include/boost/charconv/detail/fast_float/float_common.hpp @@ -298,11 +298,11 @@ template struct binary_format : binary_format_lookup_tables { static inline constexpr int max_exponent_fast_path(){return {};} static inline constexpr int max_exponent_round_to_even(){return {};} static inline constexpr int min_exponent_round_to_even(){return {};} - static inline constexpr uint64_t max_mantissa_fast_path(int64_t power){return {};} + static inline constexpr uint64_t max_mantissa_fast_path(int64_t /*power*/){return {};} static inline constexpr uint64_t max_mantissa_fast_path(){return {};} // used when fegetround() == FE_TONEARES{} static inline constexpr int largest_power_of_ten(){return {};} static inline constexpr int smallest_power_of_ten(){return {};} - static inline constexpr T exact_power_of_ten(int64_t power){return {};} + static inline constexpr T exact_power_of_ten(int64_t /*power*/){return {};} static inline constexpr size_t max_digits(){return {};} static inline constexpr equiv_uint exponent_mask(){return {};} static inline constexpr equiv_uint mantissa_mask(){return {};} From fd5ef6ad8c153f1901f239a961303d6716c3a93c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 7 Mar 2026 22:13:16 +0100 Subject: [PATCH 19/19] update cmake versions --- 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..5242651da 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...4.2) project(cmake_install_test LANGUAGES CXX) diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index 57a044253..0c5d2cdd8 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...4.2) project(cmake_subdir_test LANGUAGES CXX)