Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried this with C++20 instead of 23? I know officially import std and import std.compat are C++23, but all of the compiler implementors have said they'll allow it at 20.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think there's a use to it? My understanding was that using C++20 over C++23 is about being able to use older compilers that might not support C++23. Such compilers won't have proper module implementations, likely, since modules are quite behind everything else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standards like MISRA are pinned to language standards not toolchains. Theoretically someone could have a modern compiler but be stuck at C++20. Probably best to have someone in the real world complain before changing it.

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)


Expand Down
17 changes: 16 additions & 1 deletion include/boost/charconv/chars_format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,24 @@
#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 <boost/charconv/config.hpp>

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,
Expand All @@ -19,4 +32,6 @@ enum class chars_format : unsigned

}} // Namespaces

#endif // defined(BOOST_USE_MODULES) && !defined(BOOST_CHARCONV_INTERFACE_UNIT)

#endif // BOOST_CHARCONV_CHARS_FORMAT_HPP
14 changes: 13 additions & 1 deletion include/boost/charconv/config.hpp
Original file line number Diff line number Diff line change
@@ -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 <boost/charconv/config.hpp> in your module global fragment"
#endif

#ifndef BOOST_CHARCONV_CONFIG_HPP_INCLUDED
#define BOOST_CHARCONV_CONFIG_HPP_INCLUDED

Expand All @@ -7,7 +12,7 @@
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/config.hpp>
#include <climits>
#include <boost/config/std/climits.hpp>

// This header implements separate compilation features as described in
// http://www.boost.org/more/separate_compilation.html
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion include/boost/charconv/detail/apply_sign.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <boost/config.hpp>
#include <boost/charconv/detail/emulated128.hpp>
#include <boost/charconv/detail/type_traits.hpp>
#include <type_traits>
#include <boost/config/std/type_traits.hpp>

// We are purposefully converting values here
#ifdef BOOST_MSVC
Expand Down
4 changes: 2 additions & 2 deletions include/boost/charconv/detail/bit_layouts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include <boost/charconv/detail/config.hpp>
#include <boost/charconv/detail/emulated128.hpp>
#include <cstdint>
#include <cfloat>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cfloat.hpp>

// Layouts of floating point types as specified by IEEE 754
// See page 23 of IEEE 754-2008
Expand Down
2 changes: 1 addition & 1 deletion include/boost/charconv/detail/buffer_sizing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <boost/charconv/detail/config.hpp>
#include <boost/charconv/detail/integer_search_trees.hpp>
#include <type_traits>
#include <boost/config/std/type_traits.hpp>

namespace boost {
namespace charconv {
Expand Down
6 changes: 3 additions & 3 deletions include/boost/charconv/detail/compute_float32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#define BOOST_CHARCONV_DETAIL_COMPUTE_FLOAT32_HPP

#include <boost/charconv/detail/compute_float64.hpp>
#include <limits>
#include <cstdint>
#include <cmath>
#include <boost/config/std/limits.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cmath.hpp>

namespace boost { namespace charconv { namespace detail {

Expand Down
8 changes: 4 additions & 4 deletions include/boost/charconv/detail/compute_float64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#include <boost/charconv/detail/significand_tables.hpp>
#include <boost/charconv/detail/emulated128.hpp>
#include <boost/core/bit.hpp>
#include <cstdint>
#include <cfloat>
#include <cstring>
#include <cmath>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cfloat.hpp>
#include <boost/config/std/cstring.hpp>
#include <boost/config/std/cmath.hpp>

namespace boost { namespace charconv { namespace detail {

Expand Down
18 changes: 9 additions & 9 deletions include/boost/charconv/detail/compute_float80.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
#include <boost/charconv/detail/config.hpp>
#include <boost/charconv/detail/emulated128.hpp>
#include <boost/charconv/detail/bit_layouts.hpp>
#include <system_error>
#include <type_traits>
#include <limits>
#include <cstdint>
#include <cmath>
#include <climits>
#include <cfloat>
#include <boost/config/std/system_error.hpp>
#include <boost/config/std/type_traits.hpp>
#include <boost/config/std/limits.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cmath.hpp>
#include <boost/config/std/climits.hpp>
#include <boost/config/std/cfloat.hpp>

#ifdef BOOST_CHARCONV_DEBUG_FLOAT128
#include <iostream>
#include <iomanip>
#include <boost/config/std/iostream.hpp>
#include <boost/config/std/iomanip.hpp>
#include <boost/charconv/detail/to_chars_integer_impl.hpp>
#endif

Expand Down
11 changes: 8 additions & 3 deletions include/boost/charconv/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <boost/charconv/detail/config.hpp> in your module global fragment"
#endif

#ifndef BOOST_CHARCONV_DETAIL_CONFIG_HPP
#define BOOST_CHARCONV_DETAIL_CONFIG_HPP

#include <boost/config.hpp>
#include <type_traits>
#include <cfloat>
#include <boost/config/std/type_traits.hpp>
#include <boost/config/std/cfloat.hpp>

#include <boost/assert.hpp>
#define BOOST_CHARCONV_ASSERT(expr) BOOST_ASSERT(expr)
Expand Down Expand Up @@ -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(<stdfloat>)
# include <stdfloat>
# include <boost/config/std/stdfloat.hpp>
# endif
#endif
#ifdef __STDCPP_FLOAT16_T__
Expand Down
8 changes: 4 additions & 4 deletions include/boost/charconv/detail/dragonbox/dragonbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
#include <boost/charconv/detail/to_chars_result.hpp>
#include <boost/charconv/chars_format.hpp>
#include <boost/core/bit.hpp>
#include <type_traits>
#include <limits>
#include <cstdint>
#include <cstring>
#include <boost/config/std/type_traits.hpp>
#include <boost/config/std/limits.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cstring.hpp>

#ifdef BOOST_MSVC
# pragma warning(push)
Expand Down
12 changes: 6 additions & 6 deletions include/boost/charconv/detail/dragonbox/dragonbox_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
#include <boost/charconv/detail/emulated128.hpp>
#include <boost/charconv/chars_format.hpp>
#include <boost/core/bit.hpp>
#include <type_traits>
#include <limits>
#include <cstdint>
#include <cstring>
#include <cstddef>
#include <climits>
#include <boost/config/std/type_traits.hpp>
#include <boost/config/std/limits.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cstring.hpp>
#include <boost/config/std/cstddef.hpp>
#include <boost/config/std/climits.hpp>

namespace boost { namespace charconv { namespace detail {

Expand Down
12 changes: 6 additions & 6 deletions include/boost/charconv/detail/dragonbox/floff.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
#include <boost/charconv/detail/to_chars_result.hpp>
#include <boost/charconv/chars_format.hpp>
#include <boost/core/bit.hpp>
#include <type_traits>
#include <limits>
#include <cstdint>
#include <cstring>
#include <cstddef>
#include <climits>
#include <boost/config/std/type_traits.hpp>
#include <boost/config/std/limits.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cstring.hpp>
#include <boost/config/std/cstddef.hpp>
#include <boost/config/std/climits.hpp>

#ifdef BOOST_MSVC
# pragma warning(push)
Expand Down
10 changes: 5 additions & 5 deletions include/boost/charconv/detail/emulated128.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include <boost/charconv/detail/config.hpp>
#include <boost/charconv/config.hpp>
#include <boost/core/bit.hpp>
#include <type_traits>
#include <limits>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <boost/config/std/type_traits.hpp>
#include <boost/config/std/limits.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cassert.hpp>
#include <boost/config/std/cmath.hpp>

namespace boost { namespace charconv { namespace detail {

Expand Down
12 changes: 6 additions & 6 deletions include/boost/charconv/detail/fallback_routines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
#include <boost/charconv/detail/config.hpp>
#include <boost/charconv/detail/from_chars_result.hpp>
#include <boost/charconv/chars_format.hpp>
#include <system_error>
#include <type_traits>
#include <locale>
#include <clocale>
#include <cstring>
#include <cstdio>
#include <boost/config/std/system_error.hpp>
#include <boost/config/std/type_traits.hpp>
#include <boost/config/std/locale.hpp>
#include <boost/config/std/clocale.hpp>
#include <boost/config/std/cstring.hpp>
#include <boost/config/std/cstdio.hpp>

namespace boost {
namespace charconv {
Expand Down
8 changes: 4 additions & 4 deletions include/boost/charconv/detail/fast_float/ascii_number.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#define BOOST_CHARCONV_DETAIL_FASTFLOAT_ASCII_NUMBER_HPP

#include <boost/charconv/detail/fast_float/float_common.hpp>
#include <cctype>
#include <cstdint>
#include <cstring>
#include <iterator>
#include <boost/config/std/cctype.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cstring.hpp>
#include <boost/config/std/iterator.hpp>

namespace boost { namespace charconv { namespace detail { namespace fast_float {

Expand Down
8 changes: 4 additions & 4 deletions include/boost/charconv/detail/fast_float/bigint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#define BOOST_CHARCONV_DETAIL_FASTFLOAT_BIGINT_HPP

#include <boost/charconv/detail/fast_float/float_common.hpp>
#include <algorithm>
#include <cstdint>
#include <climits>
#include <cstring>
#include <boost/config/std/algorithm.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/climits.hpp>
#include <boost/config/std/cstring.hpp>

namespace boost { namespace charconv { namespace detail { namespace fast_float {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <boost/charconv/detail/fast_float/constexpr_feature_support.hpp> in your module global fragment"
#endif

#ifndef BOOST_CHARCONV_DETAIL_FASTFLOAT_CONSTEXPR_FEATURE_DETECT_HPP
#define BOOST_CHARCONV_DETAIL_FASTFLOAT_CONSTEXPR_FEATURE_DETECT_HPP

Expand Down
12 changes: 6 additions & 6 deletions include/boost/charconv/detail/fast_float/decimal_to_binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

#include <boost/charconv/detail/fast_float/float_common.hpp>
#include <boost/charconv/detail/fast_float/fast_table.hpp>
#include <cfloat>
#include <cinttypes>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <boost/config/std/cfloat.hpp>
#include <boost/config/std/cinttypes.hpp>
#include <boost/config/std/cmath.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cstdlib.hpp>
#include <boost/config/std/cstring.hpp>

namespace boost { namespace charconv { namespace detail { namespace fast_float {

Expand Down
8 changes: 4 additions & 4 deletions include/boost/charconv/detail/fast_float/digit_comparison.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include <boost/charconv/detail/fast_float/float_common.hpp>
#include <boost/charconv/detail/fast_float/bigint.hpp>
#include <boost/charconv/detail/fast_float/ascii_number.hpp>
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <iterator>
#include <boost/config/std/algorithm.hpp>
#include <boost/config/std/cstdint.hpp>
#include <boost/config/std/cstring.hpp>
#include <boost/config/std/iterator.hpp>

namespace boost { namespace charconv { namespace detail { namespace fast_float {

Expand Down
2 changes: 1 addition & 1 deletion include/boost/charconv/detail/fast_float/fast_table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define BOOST_CHARCONV_DETAIL_FASTFLOAT_FAST_TABLE_HPP

#include <boost/charconv/detail/fast_float/float_common.hpp>
#include <cstdint>
#include <boost/config/std/cstdint.hpp>

namespace boost { namespace charconv { namespace detail { namespace fast_float {

Expand Down
Loading
Loading