From 2eb3cdbb413a3da69159c92f2aa70ab4474e5c18 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sun, 22 Dec 2024 11:46:38 +0100 Subject: [PATCH 01/69] Initial implementation --- CMakeLists.txt | 41 ++++++--- include/boost/core/demangle.hpp | 35 ++------ include/boost/core/detail/cxxabi.hpp | 35 ++++++++ include/boost/core/lightweight_test.hpp | 83 +++++-------------- .../boost/core/lightweight_test_macros.hpp | 10 +++ .../core/lightweight_test_macros_impl.hpp | 62 ++++++++++++++ modules/core.cxx | 17 ++++ 7 files changed, 184 insertions(+), 99 deletions(-) create mode 100644 include/boost/core/detail/cxxabi.hpp create mode 100644 include/boost/core/lightweight_test_macros.hpp create mode 100644 include/boost/core/lightweight_test_macros_impl.hpp create mode 100644 modules/core.cxx diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d2e2202f..2201d6e77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,22 +3,39 @@ # Distributed under the Boost Software License, Version 1.0. # https://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required(VERSION 3.5...3.20) +cmake_minimum_required(VERSION 3.5...3.31) project(boost_core VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) -add_library(boost_core INTERFACE) -add_library(Boost::core ALIAS boost_core) - -target_include_directories(boost_core INTERFACE include) +if (BOOST_CXX20_MODULE) + add_library(boost_core) + target_sources(boost_core PUBLIC FILE_SET CXX_MODULES FILES modules/core.cxx) + target_include_directories(boost_core PUBLIC include) + target_compile_features(boost_core PUBLIC cxx_std_23) + set_target_properties(boost_core PROPERTIES CXX_MODULE_STD 1) + target_compile_definitions(boost_core PRIVATE BOOST_CXX20_MODULE) + target_compile_options(boost_core PUBLIC -Wno-include-angled-in-module-purview) # TODO: scope this to clang + target_link_libraries(boost_core + PUBLIC + Boost::assert + Boost::config + Boost::static_assert + Boost::throw_exception + ) + +else() + add_library(boost_core INTERFACE) + target_include_directories(boost_core INTERFACE include) + target_link_libraries(boost_core + INTERFACE + Boost::assert + Boost::config + Boost::static_assert + Boost::throw_exception + ) +endif() -target_link_libraries(boost_core - INTERFACE - Boost::assert - Boost::config - Boost::static_assert - Boost::throw_exception -) +add_library(Boost::core ALIAS boost_core) if(CMAKE_VERSION VERSION_GREATER 3.18 AND CMAKE_GENERATOR MATCHES "Visual Studio") diff --git a/include/boost/core/demangle.hpp b/include/boost/core/demangle.hpp index dc714d806..a0ea1ba67 100644 --- a/include/boost/core/demangle.hpp +++ b/include/boost/core/demangle.hpp @@ -10,36 +10,19 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +#include +#ifndef BOOST_CXX20_MODULE #include +#include #include +#include +#include +#endif #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif -// __has_include is currently supported by GCC and Clang. However GCC 4.9 may have issues and -// returns 1 for 'defined( __has_include )', while '__has_include' is actually not supported: -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63662 -#if defined( __has_include ) && (!defined( BOOST_GCC ) || (__GNUC__ + 0) >= 5) -# if __has_include() -# define BOOST_CORE_HAS_CXXABI_H -# endif -#elif defined( __GLIBCXX__ ) || defined( __GLIBCPP__ ) -# define BOOST_CORE_HAS_CXXABI_H -#endif - -#if defined( BOOST_CORE_HAS_CXXABI_H ) -# include -// For some archtectures (mips, mips64, x86, x86_64) cxxabi.h in Android NDK is implemented by gabi++ library -// (https://android.googlesource.com/platform/ndk/+/master/sources/cxx-stl/gabi++/), which does not implement -// abi::__cxa_demangle(). We detect this implementation by checking the include guard here. -# if defined( __GABIXX_CXXABI_H__ ) -# undef BOOST_CORE_HAS_CXXABI_H -# else -# include -# include -# endif -#endif namespace boost { @@ -47,10 +30,10 @@ namespace boost namespace core { -inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT; -inline void demangle_free( char const * name ) BOOST_NOEXCEPT; +BOOST_MODULE_EXPORT inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT; +BOOST_MODULE_EXPORT inline void demangle_free( char const * name ) BOOST_NOEXCEPT; -class scoped_demangled_name +BOOST_MODULE_EXPORT class scoped_demangled_name { private: char const * m_p; diff --git a/include/boost/core/detail/cxxabi.hpp b/include/boost/core/detail/cxxabi.hpp new file mode 100644 index 000000000..1586558d3 --- /dev/null +++ b/include/boost/core/detail/cxxabi.hpp @@ -0,0 +1,35 @@ +#ifndef BOOST_CORE_DETAIL_CXXABI_HPP_INCLUDED +#define BOOST_CORE_DETAIL_CXXABI_HPP_INCLUDED + +// Extracted from core::demangle +// +// Copyright 2014 Peter Dimov +// Copyright 2014 Andrey Semashev +// +// 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 + +// __has_include is currently supported by GCC and Clang. However GCC 4.9 may have issues and +// returns 1 for 'defined( __has_include )', while '__has_include' is actually not supported: +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63662 +#if defined( __has_include ) && (!defined( BOOST_GCC ) || (__GNUC__ + 0) >= 5) +# if __has_include() +# define BOOST_CORE_HAS_CXXABI_H +# endif +#elif defined( __GLIBCXX__ ) || defined( __GLIBCPP__ ) +# define BOOST_CORE_HAS_CXXABI_H +#endif + +#if defined( BOOST_CORE_HAS_CXXABI_H ) +# include +// For some archtectures (mips, mips64, x86, x86_64) cxxabi.h in Android NDK is implemented by gabi++ library +// (https://android.googlesource.com/platform/ndk/+/master/sources/cxx-stl/gabi++/), which does not implement +// abi::__cxa_demangle(). We detect this implementation by checking the include guard here. +# if defined( __GABIXX_CXXABI_H__ ) +# undef BOOST_CORE_HAS_CXXABI_H +# endif +#endif + + +#endif \ No newline at end of file diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index 43baea055..0fca95416 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -23,6 +23,8 @@ // #include +#include // BOOST_MODULE_EXPORT +#ifndef BOOST_CXX20_MODULE #include #include #include @@ -33,6 +35,7 @@ #include #include #include +#endif // IDE's like Visual Studio perform better if output goes to std::cout or // some other stream, so allow user to configure output stream: @@ -90,6 +93,7 @@ inline int& test_errors() return test_results().errors(); } +BOOST_MODULE_EXPORT inline bool test_impl(char const * expr, char const * file, int line, char const * function, bool v) { if( v ) @@ -107,6 +111,7 @@ inline bool test_impl(char const * expr, char const * file, int line, char const } } +BOOST_MODULE_EXPORT inline void error_impl(char const * msg, char const * file, int line, char const * function) { BOOST_LIGHTWEIGHT_TEST_OSTREAM @@ -115,6 +120,7 @@ inline void error_impl(char const * msg, char const * file, int line, char const ++test_results().errors(); } +BOOST_MODULE_EXPORT inline void throw_failed_impl(const char* expr, char const * excep, char const * file, int line, char const * function) { BOOST_LIGHTWEIGHT_TEST_OSTREAM @@ -123,6 +129,7 @@ inline void throw_failed_impl(const char* expr, char const * excep, char const * ++test_results().errors(); } +BOOST_MODULE_EXPORT inline void no_throw_failed_impl(const char* expr, const char* file, int line, const char* function) { BOOST_LIGHTWEIGHT_TEST_OSTREAM @@ -131,6 +138,7 @@ inline void no_throw_failed_impl(const char* expr, const char* file, int line, c ++test_results().errors(); } +BOOST_MODULE_EXPORT inline void no_throw_failed_impl(const char* expr, const char* what, const char* file, int line, const char* function) { BOOST_LIGHTWEIGHT_TEST_OSTREAM @@ -212,37 +220,37 @@ inline std::string test_output_impl( char const& v ) // predicates -struct lw_test_eq +BOOST_MODULE_EXPORT struct lw_test_eq { template bool operator()(const T& t, const U& u) const { return t == u; } }; -struct lw_test_ne +BOOST_MODULE_EXPORT struct lw_test_ne { template bool operator()(const T& t, const U& u) const { return t != u; } }; -struct lw_test_lt +BOOST_MODULE_EXPORT struct lw_test_lt { template bool operator()(const T& t, const U& u) const { return t < u; } }; -struct lw_test_le +BOOST_MODULE_EXPORT struct lw_test_le { template bool operator()(const T& t, const U& u) const { return t <= u; } }; -struct lw_test_gt +BOOST_MODULE_EXPORT struct lw_test_gt { template bool operator()(const T& t, const U& u) const { return t > u; } }; -struct lw_test_ge +BOOST_MODULE_EXPORT struct lw_test_ge { template bool operator()(const T& t, const U& u) const { return t >= u; } @@ -287,6 +295,7 @@ inline char const * lwt_predicate_name( lw_test_ge const& ) // +BOOST_MODULE_EXPORT template inline bool test_with_impl(BinaryPredicate pred, char const * expr1, char const * expr2, char const * file, int line, char const * function, @@ -308,6 +317,7 @@ inline bool test_with_impl(BinaryPredicate pred, char const * expr1, char const } } +BOOST_MODULE_EXPORT inline bool test_cstr_eq_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, char const * const t, char const * const u ) { @@ -326,6 +336,7 @@ inline bool test_cstr_eq_impl( char const * expr1, char const * expr2, } } +BOOST_MODULE_EXPORT inline bool test_cstr_ne_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, char const * const t, char const * const u ) { @@ -344,6 +355,7 @@ inline bool test_cstr_ne_impl( char const * expr1, char const * expr2, } } +BOOST_MODULE_EXPORT template bool test_all_eq_impl(FormattedOutputFunction& output, char const * file, int line, char const * function, @@ -414,6 +426,7 @@ bool test_all_eq_impl(FormattedOutputFunction& output, } } +BOOST_MODULE_EXPORT template bool test_all_with_impl(FormattedOutputFunction& output, char const * file, int line, char const * function, @@ -497,6 +510,7 @@ bool test_all_with_impl(FormattedOutputFunction& output, } // namespace detail +BOOST_MODULE_EXPORT inline int report_errors() { boost::detail::test_result& result = boost::detail::test_results(); @@ -522,6 +536,7 @@ inline int report_errors() namespace core { +BOOST_MODULE_EXPORT inline void lwt_init() { boost::detail::test_results(); @@ -530,60 +545,6 @@ inline void lwt_init() } // namespace core } // namespace boost -#define BOOST_TEST(expr) ( ::boost::detail::test_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (expr)? true: false) ) -#define BOOST_TEST_NOT(expr) BOOST_TEST(!(expr)) - -#define BOOST_ERROR(msg) ( ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) - -#define BOOST_TEST_WITH(expr1,expr2,predicate) ( ::boost::detail::test_with_impl(predicate, #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) - -#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_eq(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) -#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_ne(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) - -#define BOOST_TEST_LT(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_lt(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) -#define BOOST_TEST_LE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_le(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) -#define BOOST_TEST_GT(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_gt(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) -#define BOOST_TEST_GE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_ge(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) - -#define BOOST_TEST_CSTR_EQ(expr1,expr2) ( ::boost::detail::test_cstr_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) -#define BOOST_TEST_CSTR_NE(expr1,expr2) ( ::boost::detail::test_cstr_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) - -#define BOOST_TEST_ALL_EQ(begin1, end1, begin2, end2) ( ::boost::detail::test_all_eq_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2) ) -#define BOOST_TEST_ALL_WITH(begin1, end1, begin2, end2, predicate) ( ::boost::detail::test_all_with_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2, predicate) ) - -#ifndef BOOST_NO_EXCEPTIONS - #define BOOST_TEST_THROWS( EXPR, EXCEP ) \ - try { \ - EXPR; \ - ::boost::detail::throw_failed_impl \ - (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } \ - catch(EXCEP const&) { \ - ::boost::detail::test_results(); \ - } \ - catch(...) { \ - ::boost::detail::throw_failed_impl \ - (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } \ - // -#else - #define BOOST_TEST_THROWS( EXPR, EXCEP ) -#endif - -#ifndef BOOST_NO_EXCEPTIONS -# define BOOST_TEST_NO_THROW(EXPR) \ - try { \ - EXPR; \ - } catch (const std::exception& e) { \ - ::boost::detail::no_throw_failed_impl \ - (#EXPR, e.what(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } catch (...) { \ - ::boost::detail::no_throw_failed_impl \ - (#EXPR, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } - // -#else -# define BOOST_TEST_NO_THROW(EXPR) { EXPR; } -#endif +#include #endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_HPP diff --git a/include/boost/core/lightweight_test_macros.hpp b/include/boost/core/lightweight_test_macros.hpp new file mode 100644 index 000000000..027a198c0 --- /dev/null +++ b/include/boost/core/lightweight_test_macros.hpp @@ -0,0 +1,10 @@ +#ifndef BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_HPP +#define BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_HPP + +// Intended to be included by the user + +#include +#include +#include + +#endif \ No newline at end of file diff --git a/include/boost/core/lightweight_test_macros_impl.hpp b/include/boost/core/lightweight_test_macros_impl.hpp new file mode 100644 index 000000000..635191063 --- /dev/null +++ b/include/boost/core/lightweight_test_macros_impl.hpp @@ -0,0 +1,62 @@ +#ifndef BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_IMPL_HPP +#define BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_IMPL_HPP + +// Without includes + +#define BOOST_TEST(expr) ( ::boost::detail::test_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (expr)? true: false) ) +#define BOOST_TEST_NOT(expr) BOOST_TEST(!(expr)) + +#define BOOST_ERROR(msg) ( ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) + +#define BOOST_TEST_WITH(expr1,expr2,predicate) ( ::boost::detail::test_with_impl(predicate, #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) + +#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_eq(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) +#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_ne(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) + +#define BOOST_TEST_LT(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_lt(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) +#define BOOST_TEST_LE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_le(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) +#define BOOST_TEST_GT(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_gt(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) +#define BOOST_TEST_GE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_ge(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) + +#define BOOST_TEST_CSTR_EQ(expr1,expr2) ( ::boost::detail::test_cstr_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) +#define BOOST_TEST_CSTR_NE(expr1,expr2) ( ::boost::detail::test_cstr_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) + +#define BOOST_TEST_ALL_EQ(begin1, end1, begin2, end2) ( ::boost::detail::test_all_eq_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2) ) +#define BOOST_TEST_ALL_WITH(begin1, end1, begin2, end2, predicate) ( ::boost::detail::test_all_with_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2, predicate) ) + +#ifndef BOOST_NO_EXCEPTIONS + #define BOOST_TEST_THROWS( EXPR, EXCEP ) \ + try { \ + EXPR; \ + ::boost::detail::throw_failed_impl \ + (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } \ + catch(EXCEP const&) { \ + ::boost::detail::test_results(); \ + } \ + catch(...) { \ + ::boost::detail::throw_failed_impl \ + (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } \ + // +#else + #define BOOST_TEST_THROWS( EXPR, EXCEP ) +#endif + +#ifndef BOOST_NO_EXCEPTIONS +# define BOOST_TEST_NO_THROW(EXPR) \ + try { \ + EXPR; \ + } catch (const std::exception& e) { \ + ::boost::detail::no_throw_failed_impl \ + (#EXPR, e.what(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } catch (...) { \ + ::boost::detail::no_throw_failed_impl \ + (#EXPR, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } + // +#else +# define BOOST_TEST_NO_THROW(EXPR) { EXPR; } +#endif + +#endif \ No newline at end of file diff --git a/modules/core.cxx b/modules/core.cxx new file mode 100644 index 000000000..8ead1afdc --- /dev/null +++ b/modules/core.cxx @@ -0,0 +1,17 @@ +module; + +#include +#include +#include +#include +#include +#include + +export module boost.core; + +import std; +import boost.assert; +import boost.throw_exception; + +#include +#include \ No newline at end of file From 9b7ff239c1ce5a6b0906b6d3fdd8d8107e337171 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sun, 22 Dec 2024 11:48:11 +0100 Subject: [PATCH 02/69] type_name --- include/boost/core/type_name.hpp | 5 ++++- modules/core.cxx | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/boost/core/type_name.hpp b/include/boost/core/type_name.hpp index 81e00c203..265adc1d3 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -13,7 +13,9 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include // BOOST_MODULE_EXPORT #include +#ifndef BOOST_CXX20_MODULE #include #include #include @@ -26,6 +28,7 @@ #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) # include #endif +#endif namespace boost { @@ -1175,7 +1178,7 @@ template class L, class T, std::size_t N> struc } // namespace detail -template std::string type_name() +BOOST_MODULE_EXPORT template std::string type_name() { return core::detail::tn_holder::type_name( "" ); } diff --git a/modules/core.cxx b/modules/core.cxx index 8ead1afdc..3d4ae14cb 100644 --- a/modules/core.cxx +++ b/modules/core.cxx @@ -14,4 +14,5 @@ import boost.assert; import boost.throw_exception; #include -#include \ No newline at end of file +#include +#include \ No newline at end of file From a3620aa7649d140de89fee31b6f6820fec5ed651 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sun, 22 Dec 2024 11:52:13 +0100 Subject: [PATCH 03/69] Sanitize lwt_unattend.hpp --- include/boost/core/detail/crtdbg.hpp | 10 ++++++++++ include/boost/core/detail/lwt_unattended.hpp | 4 ++-- modules/core.cxx | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 include/boost/core/detail/crtdbg.hpp diff --git a/include/boost/core/detail/crtdbg.hpp b/include/boost/core/detail/crtdbg.hpp new file mode 100644 index 000000000..07d244be8 --- /dev/null +++ b/include/boost/core/detail/crtdbg.hpp @@ -0,0 +1,10 @@ +#ifndef BOOST_CORE_DETAIL_CRTDBG_HPP_INCLUDED +#define BOOST_CORE_DETAIL_CRTDBG_HPP_INCLUDED + +// Conditionally includes crtdbg.h. +// Helpful for the module infrastructure +#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG) +# include +#endif + +#endif \ No newline at end of file diff --git a/include/boost/core/detail/lwt_unattended.hpp b/include/boost/core/detail/lwt_unattended.hpp index 96fc5fc5a..0fc844381 100644 --- a/include/boost/core/detail/lwt_unattended.hpp +++ b/include/boost/core/detail/lwt_unattended.hpp @@ -5,9 +5,9 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifndef BOOST_CXX20_MODULE #include -#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG) -# include +#include #endif namespace boost diff --git a/modules/core.cxx b/modules/core.cxx index 3d4ae14cb..1effc1297 100644 --- a/modules/core.cxx +++ b/modules/core.cxx @@ -1,11 +1,13 @@ module; +#include #include #include #include #include #include #include +#include export module boost.core; From 1d7cf3337c86b135195f4cd1e4c0c0e41de04238 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sun, 22 Dec 2024 12:00:19 +0100 Subject: [PATCH 04/69] lightweight_test_trait --- include/boost/core/detail/is_same.hpp | 2 ++ include/boost/core/lightweight_test_trait.hpp | 19 +++++++------------ .../core/lightweight_test_trait_macros.hpp | 10 ++++++++++ .../lightweight_test_trait_macros_impl.hpp | 14 ++++++++++++++ modules/core.cxx | 1 + 5 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 include/boost/core/lightweight_test_trait_macros.hpp create mode 100644 include/boost/core/lightweight_test_trait_macros_impl.hpp diff --git a/include/boost/core/detail/is_same.hpp b/include/boost/core/detail/is_same.hpp index 634d30048..ee23e41cc 100644 --- a/include/boost/core/detail/is_same.hpp +++ b/include/boost/core/detail/is_same.hpp @@ -9,7 +9,9 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +#ifndef BOOST_CXX20_MODULE #include +#endif #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once diff --git a/include/boost/core/lightweight_test_trait.hpp b/include/boost/core/lightweight_test_trait.hpp index eea237170..1eeca52da 100644 --- a/include/boost/core/lightweight_test_trait.hpp +++ b/include/boost/core/lightweight_test_trait.hpp @@ -23,14 +23,17 @@ #include #include #include +#include +#ifndef BOOST_CXX20_MODULE #include +#endif namespace boost { namespace detail { -template< class T > inline void test_trait_impl( char const * trait, void (*)( T ), +BOOST_MODULE_EXPORT template< class T > inline void test_trait_impl( char const * trait, void (*)( T ), bool expected, char const * file, int line, char const * function ) { if( T::value == expected ) @@ -50,12 +53,12 @@ template< class T > inline void test_trait_impl( char const * trait, void (*)( T } } -template inline bool test_trait_same_impl_( T ) +BOOST_MODULE_EXPORT template inline bool test_trait_same_impl_( T ) { return T::value; } -template inline void test_trait_same_impl( char const * types, +BOOST_MODULE_EXPORT template inline void test_trait_same_impl( char const * types, boost::core::detail::is_same same, char const * file, int line, char const * function ) { if( test_trait_same_impl_( same ) ) @@ -78,14 +81,6 @@ template inline void test_trait_same_impl( char const * type } // namespace detail } // namespace boost -#define BOOST_TEST_TRAIT_TRUE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, true, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) -#define BOOST_TEST_TRAIT_FALSE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, false, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) - -#if defined(__GNUC__) -// ignoring -Wvariadic-macros with #pragma doesn't work under GCC -# pragma GCC system_header -#endif - -#define BOOST_TEST_TRAIT_SAME(...) ( ::boost::detail::test_trait_same_impl(#__VA_ARGS__, ::boost::core::detail::is_same< __VA_ARGS__ >(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) +#include #endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP diff --git a/include/boost/core/lightweight_test_trait_macros.hpp b/include/boost/core/lightweight_test_trait_macros.hpp new file mode 100644 index 000000000..f6d1f1998 --- /dev/null +++ b/include/boost/core/lightweight_test_trait_macros.hpp @@ -0,0 +1,10 @@ +#ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_HPP +#define BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_HPP + +// Intended to be included by the user + +#include +#include +#include + +#endif \ No newline at end of file diff --git a/include/boost/core/lightweight_test_trait_macros_impl.hpp b/include/boost/core/lightweight_test_trait_macros_impl.hpp new file mode 100644 index 000000000..97311cf44 --- /dev/null +++ b/include/boost/core/lightweight_test_trait_macros_impl.hpp @@ -0,0 +1,14 @@ +#ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_IMPL_HPP +#define BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_IMPL_HPP + +#define BOOST_TEST_TRAIT_TRUE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, true, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) +#define BOOST_TEST_TRAIT_FALSE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, false, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) + +#if defined(__GNUC__) +// ignoring -Wvariadic-macros with #pragma doesn't work under GCC +# pragma GCC system_header +#endif + +#define BOOST_TEST_TRAIT_SAME(...) ( ::boost::detail::test_trait_same_impl(#__VA_ARGS__, ::boost::core::detail::is_same< __VA_ARGS__ >(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) + +#endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_IMPL_HPP diff --git a/modules/core.cxx b/modules/core.cxx index 1effc1297..661444b6e 100644 --- a/modules/core.cxx +++ b/modules/core.cxx @@ -17,4 +17,5 @@ import boost.throw_exception; #include #include +#include #include \ No newline at end of file From 237a580c26e21051d64e4ef1d0ef2362c5697efc Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sun, 22 Dec 2024 13:06:11 +0100 Subject: [PATCH 05/69] Export is_same --- include/boost/core/detail/is_same.hpp | 3 ++- modules/core.cxx | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/core/detail/is_same.hpp b/include/boost/core/detail/is_same.hpp index ee23e41cc..2e83895d7 100644 --- a/include/boost/core/detail/is_same.hpp +++ b/include/boost/core/detail/is_same.hpp @@ -9,6 +9,7 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +#include #ifndef BOOST_CXX20_MODULE #include #endif @@ -24,7 +25,7 @@ namespace core namespace detail { -template< class T1, class T2 > struct is_same +BOOST_MODULE_EXPORT template< class T1, class T2 > struct is_same { BOOST_STATIC_CONSTANT( bool, value = false ); }; diff --git a/modules/core.cxx b/modules/core.cxx index 661444b6e..ee2650a8f 100644 --- a/modules/core.cxx +++ b/modules/core.cxx @@ -15,6 +15,7 @@ import std; import boost.assert; import boost.throw_exception; +#include #include #include #include From e787de0eeb05adc8400e8151a66e35c969430a57 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sun, 22 Dec 2024 13:06:18 +0100 Subject: [PATCH 06/69] CMake helper function --- CMakeLists.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2201d6e77..7246cdbe7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,13 +8,10 @@ cmake_minimum_required(VERSION 3.5...3.31) project(boost_core VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) if (BOOST_CXX20_MODULE) - add_library(boost_core) + add_library(boost_core STATIC) + boost_set_cxx20_module_settings(boost_core) target_sources(boost_core PUBLIC FILE_SET CXX_MODULES FILES modules/core.cxx) target_include_directories(boost_core PUBLIC include) - target_compile_features(boost_core PUBLIC cxx_std_23) - set_target_properties(boost_core PROPERTIES CXX_MODULE_STD 1) - target_compile_definitions(boost_core PRIVATE BOOST_CXX20_MODULE) - target_compile_options(boost_core PUBLIC -Wno-include-angled-in-module-purview) # TODO: scope this to clang target_link_libraries(boost_core PUBLIC Boost::assert From 4f27a9b744c32ea9ef092312b6b89d926f380cb4 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sun, 22 Dec 2024 13:09:11 +0100 Subject: [PATCH 07/69] Add __scope to reduce duplication --- CMakeLists.txt | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7246cdbe7..a9f36bd31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,28 +11,21 @@ if (BOOST_CXX20_MODULE) add_library(boost_core STATIC) boost_set_cxx20_module_settings(boost_core) target_sources(boost_core PUBLIC FILE_SET CXX_MODULES FILES modules/core.cxx) - target_include_directories(boost_core PUBLIC include) - target_link_libraries(boost_core - PUBLIC - Boost::assert - Boost::config - Boost::static_assert - Boost::throw_exception - ) - + set(__scope PUBLIC) else() add_library(boost_core INTERFACE) - target_include_directories(boost_core INTERFACE include) - target_link_libraries(boost_core - INTERFACE - Boost::assert - Boost::config - Boost::static_assert - Boost::throw_exception - ) + set(__scope INTERFACE) endif() add_library(Boost::core ALIAS boost_core) +target_include_directories(boost_core ${__scope} include) +target_link_libraries(boost_core + ${__scope} + Boost::assert + Boost::config + Boost::static_assert + Boost::throw_exception +) if(CMAKE_VERSION VERSION_GREATER 3.18 AND CMAKE_GENERATOR MATCHES "Visual Studio") From 4e3540a2f2ca91fd4418db71d038dcc60c549d5a Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Mon, 30 Dec 2024 10:47:40 +0100 Subject: [PATCH 08/69] Rename module to boost_xxx.cpppm --- CMakeLists.txt | 2 +- modules/{core.cxx => boost_core.cppm} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename modules/{core.cxx => boost_core.cppm} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9f36bd31..97af923d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ project(boost_core VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) if (BOOST_CXX20_MODULE) add_library(boost_core STATIC) boost_set_cxx20_module_settings(boost_core) - target_sources(boost_core PUBLIC FILE_SET CXX_MODULES FILES modules/core.cxx) + target_sources(boost_core PUBLIC FILE_SET CXX_MODULES FILES modules/boost_core.cppm) set(__scope PUBLIC) else() add_library(boost_core INTERFACE) diff --git a/modules/core.cxx b/modules/boost_core.cppm similarity index 100% rename from modules/core.cxx rename to modules/boost_core.cppm From 14253cbbc0a3ad4543400465a65659533fb116c5 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Mon, 30 Dec 2024 10:56:24 +0100 Subject: [PATCH 09/69] BASE_DIRS --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97af923d1..32f868597 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ project(boost_core VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) if (BOOST_CXX20_MODULE) add_library(boost_core STATIC) boost_set_cxx20_module_settings(boost_core) - target_sources(boost_core PUBLIC FILE_SET CXX_MODULES FILES modules/boost_core.cppm) + target_sources(boost_core PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES modules/boost_core.cppm) set(__scope PUBLIC) else() add_library(boost_core INTERFACE) From 232d0b0b91d25e9a4368806ef250178ecb27ccd4 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Mon, 30 Dec 2024 10:58:54 +0100 Subject: [PATCH 10/69] extern C++ --- modules/boost_core.cppm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index ee2650a8f..39b7a6efb 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -15,8 +15,10 @@ import std; import boost.assert; import boost.throw_exception; +extern "C++" { #include #include #include #include -#include \ No newline at end of file +#include +} \ No newline at end of file From 8d9426a995834633464f5e1df4ba6f3d4ddb760a Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Mon, 30 Dec 2024 11:20:37 +0100 Subject: [PATCH 11/69] Rename config macro to BOOST_USE_MODULES --- CMakeLists.txt | 2 +- include/boost/core/demangle.hpp | 2 +- include/boost/core/detail/is_same.hpp | 2 +- include/boost/core/detail/lwt_unattended.hpp | 2 +- include/boost/core/lightweight_test.hpp | 2 +- include/boost/core/lightweight_test_trait.hpp | 2 +- include/boost/core/type_name.hpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32f868597..9641f1457 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.5...3.31) project(boost_core VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) -if (BOOST_CXX20_MODULE) +if (BOOST_USE_MODULES) add_library(boost_core STATIC) boost_set_cxx20_module_settings(boost_core) target_sources(boost_core PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES modules/boost_core.cppm) diff --git a/include/boost/core/demangle.hpp b/include/boost/core/demangle.hpp index a0ea1ba67..f2270dbbf 100644 --- a/include/boost/core/demangle.hpp +++ b/include/boost/core/demangle.hpp @@ -11,7 +11,7 @@ // http://www.boost.org/LICENSE_1_0.txt #include -#ifndef BOOST_CXX20_MODULE +#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/core/detail/is_same.hpp b/include/boost/core/detail/is_same.hpp index 2e83895d7..eaf556c27 100644 --- a/include/boost/core/detail/is_same.hpp +++ b/include/boost/core/detail/is_same.hpp @@ -10,7 +10,7 @@ // http://www.boost.org/LICENSE_1_0.txt #include -#ifndef BOOST_CXX20_MODULE +#ifndef BOOST_USE_MODULES #include #endif diff --git a/include/boost/core/detail/lwt_unattended.hpp b/include/boost/core/detail/lwt_unattended.hpp index 0fc844381..52dc9e2d5 100644 --- a/include/boost/core/detail/lwt_unattended.hpp +++ b/include/boost/core/detail/lwt_unattended.hpp @@ -5,7 +5,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_CXX20_MODULE +#ifndef BOOST_USE_MODULES #include #include #endif diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index 0fca95416..30b7f3cb5 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -24,7 +24,7 @@ #include #include // BOOST_MODULE_EXPORT -#ifndef BOOST_CXX20_MODULE +#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/core/lightweight_test_trait.hpp b/include/boost/core/lightweight_test_trait.hpp index 1eeca52da..b276977e2 100644 --- a/include/boost/core/lightweight_test_trait.hpp +++ b/include/boost/core/lightweight_test_trait.hpp @@ -24,7 +24,7 @@ #include #include #include -#ifndef BOOST_CXX20_MODULE +#ifndef BOOST_USE_MODULES #include #endif diff --git a/include/boost/core/type_name.hpp b/include/boost/core/type_name.hpp index 265adc1d3..a8e14d1fc 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -15,7 +15,7 @@ #include // BOOST_MODULE_EXPORT #include -#ifndef BOOST_CXX20_MODULE +#ifndef BOOST_USE_MODULES #include #include #include From f9ef82487e59cd3d1aec8a9b33c1299c197746dd Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Mon, 30 Dec 2024 15:00:09 +0100 Subject: [PATCH 12/69] Modularized bit --- include/boost/core/bit.hpp | 45 +++++++++++++++++++++----------------- modules/boost_core.cppm | 5 +++++ 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/include/boost/core/bit.hpp b/include/boost/core/bit.hpp index cebc87877..7f3ed92f1 100644 --- a/include/boost/core/bit.hpp +++ b/include/boost/core/bit.hpp @@ -15,16 +15,21 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include +#ifndef BOOST_USE_MODULES #include #include #include #include #include #include +#if defined(_MSC_VER) +#include +#endif +#endif #if defined(_MSC_VER) -# include # pragma intrinsic(_BitScanForward) # pragma intrinsic(_BitScanReverse) @@ -69,7 +74,7 @@ namespace core #if defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST) -template +BOOST_MODULE_EXPORT template BOOST_CONSTEXPR To bit_cast( From const & from ) BOOST_NOEXCEPT { return __builtin_bit_cast( To, from ); @@ -77,7 +82,7 @@ BOOST_CONSTEXPR To bit_cast( From const & from ) BOOST_NOEXCEPT #else -template +BOOST_MODULE_EXPORT template To bit_cast( From const & from ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( sizeof(To) == sizeof(From) ); @@ -123,7 +128,7 @@ BOOST_CONSTEXPR inline int countl_impl( boost::ulong_long_type x ) BOOST_NOEXCEP } // namespace detail -template +BOOST_MODULE_EXPORT template BOOST_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -293,7 +298,7 @@ inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT } // namespace detail -template +BOOST_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -320,7 +325,7 @@ BOOST_CXX14_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT #endif // defined(__GNUC__) || defined(__clang__) -template +BOOST_MODULE_EXPORT template BOOST_CONSTEXPR int countl_one( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -362,7 +367,7 @@ BOOST_CONSTEXPR inline int countr_impl( boost::ulong_long_type x ) BOOST_NOEXCEP } // namespace detail -template +BOOST_MODULE_EXPORT template BOOST_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -518,7 +523,7 @@ inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT } // namespace detail -template +BOOST_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -545,7 +550,7 @@ BOOST_CXX14_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT #endif // defined(__GNUC__) || defined(__clang__) -template +BOOST_MODULE_EXPORT template BOOST_CONSTEXPR int countr_one( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -595,7 +600,7 @@ BOOST_CORE_POPCOUNT_CONSTEXPR inline int popcount_impl( boost::ulong_long_type x #undef BOOST_CORE_POPCOUNT_CONSTEXPR -template +BOOST_MODULE_EXPORT template BOOST_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -628,7 +633,7 @@ BOOST_CXX14_CONSTEXPR inline int popcount_impl( boost::uint64_t x ) BOOST_NOEXCE } // namespace detail -template +BOOST_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -649,7 +654,7 @@ BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT // rotating -template +BOOST_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T rotl( T x, int s ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -658,7 +663,7 @@ BOOST_CXX14_CONSTEXPR T rotl( T x, int s ) BOOST_NOEXCEPT return static_cast( x << (static_cast( s ) & mask) | x >> (static_cast( -s ) & mask) ); } -template +BOOST_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -669,7 +674,7 @@ BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT // integral powers of 2 -template +BOOST_MODULE_EXPORT template BOOST_CONSTEXPR bool has_single_bit( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -680,7 +685,7 @@ BOOST_CONSTEXPR bool has_single_bit( T x ) BOOST_NOEXCEPT // bit_width returns `int` now, https://cplusplus.github.io/LWG/issue3656 // has been applied to C++20 as a DR -template +BOOST_MODULE_EXPORT template BOOST_CONSTEXPR int bit_width( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -688,7 +693,7 @@ BOOST_CONSTEXPR int bit_width( T x ) BOOST_NOEXCEPT return std::numeric_limits::digits - boost::core::countl_zero( x ); } -template +BOOST_MODULE_EXPORT template BOOST_CONSTEXPR T bit_floor( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -742,7 +747,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x ) } // namespace detail -template +BOOST_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T bit_ceil( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -793,14 +798,14 @@ BOOST_CXX14_CONSTEXPR T bit_ceil( T x ) BOOST_NOEXCEPT #if !defined(BOOST_NO_CXX11_SCOPED_ENUMS) -enum class endian +BOOST_MODULE_EXPORT enum class endian { big, little, native BOOST_CORE_BIT_NATIVE_INITIALIZER }; -typedef endian endian_type; +BOOST_MODULE_EXPORT typedef endian endian_type; #else @@ -920,7 +925,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t byteswap_impl( boost::uint64_t x ) } // namespace detail -template BOOST_CXX14_CONSTEXPR T byteswap( T x ) BOOST_NOEXCEPT +BOOST_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T byteswap( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer ); diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 39b7a6efb..12ddc81ab 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -8,6 +8,10 @@ module; #include #include #include +#include +#if defined(_MSC_VER) +#include +#endif export module boost.core; @@ -21,4 +25,5 @@ extern "C++" { #include #include #include +#include } \ No newline at end of file From 79c8104aaf842fb09c84c76069c5f47a30b56fe9 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Mon, 30 Dec 2024 16:07:04 +0100 Subject: [PATCH 13/69] Modularize enable_if --- include/boost/core/enable_if.hpp | 7 +++++-- modules/boost_core.cppm | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/boost/core/enable_if.hpp b/include/boost/core/enable_if.hpp index 5dcef1e03..e6cccfc6e 100644 --- a/include/boost/core/enable_if.hpp +++ b/include/boost/core/enable_if.hpp @@ -14,14 +14,17 @@ #ifndef BOOST_CORE_ENABLE_IF_HPP #define BOOST_CORE_ENABLE_IF_HPP -#include "boost/config.hpp" +#include +#ifndef BOOST_USE_MODULES +#include +#endif // Even the definition of enable_if causes problems on some compilers, // so it's macroed out for all compilers that do not support SFINAE #ifndef BOOST_NO_SFINAE -namespace boost +BOOST_MODULE_EXPORT namespace boost { template struct enable_if_has_type diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 12ddc81ab..b7531cdf0 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -22,6 +22,7 @@ import boost.throw_exception; extern "C++" { #include #include +#include #include #include #include From 76794029f1442a17380a36b4d67ebd44bbf45980 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Mon, 30 Dec 2024 16:09:19 +0100 Subject: [PATCH 14/69] Modularize string_view --- include/boost/core/detail/string_view.hpp | 16 +++++++++++----- modules/boost_core.cppm | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/boost/core/detail/string_view.hpp b/include/boost/core/detail/string_view.hpp index 8f9ab3556..edd6350ac 100644 --- a/include/boost/core/detail/string_view.hpp +++ b/include/boost/core/detail/string_view.hpp @@ -15,6 +15,9 @@ #include #include +#include // BOOST_MODULE_EXPORT + +#ifndef BOOST_USE_MODULES #include #include #include @@ -34,6 +37,7 @@ #if !defined(BOOST_NO_CXX20_HDR_CONCEPTS) // std::common_reference_with # include #endif +#endif namespace boost { @@ -333,6 +337,7 @@ template BOOST_CXX14_CONSTEXPR std::size_t find_last_not_of( Ch const* } // namespace detail +BOOST_MODULE_EXPORT template class basic_string_view { private: @@ -1182,6 +1187,7 @@ template class basic_string_view // stream inserter +BOOST_MODULE_EXPORT template std::basic_ostream& operator<<( std::basic_ostream& os, basic_string_view str ) { Ch const* p = str.data(); @@ -1218,19 +1224,19 @@ template BOOST_CONSTEXPR_OR_CONST std::size_t basic_string_view::n // typedef names -typedef basic_string_view string_view; -typedef basic_string_view wstring_view; +BOOST_MODULE_EXPORT typedef basic_string_view string_view; +BOOST_MODULE_EXPORT typedef basic_string_view wstring_view; #if !defined(BOOST_NO_CXX11_CHAR16_T) -typedef basic_string_view u16string_view; +BOOST_MODULE_EXPORT typedef basic_string_view u16string_view; #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) -typedef basic_string_view u32string_view; +BOOST_MODULE_EXPORT typedef basic_string_view u32string_view; #endif #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L -typedef basic_string_view u8string_view; +BOOST_MODULE_EXPORT typedef basic_string_view u8string_view; #endif } // namespace core diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index b7531cdf0..a439850a6 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -21,6 +21,7 @@ import boost.throw_exception; extern "C++" { #include +#include #include #include #include From a33ad24215195bfd689cc7736c42161592b9832d Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 31 Dec 2024 14:14:33 +0100 Subject: [PATCH 15/69] Added detail/splitmix64 --- include/boost/core/detail/splitmix64.hpp | 5 +++++ modules/boost_core.cppm | 1 + 2 files changed, 6 insertions(+) diff --git a/include/boost/core/detail/splitmix64.hpp b/include/boost/core/detail/splitmix64.hpp index e91ab0a2a..255f18c87 100644 --- a/include/boost/core/detail/splitmix64.hpp +++ b/include/boost/core/detail/splitmix64.hpp @@ -9,13 +9,18 @@ // derived from Sebastiano Vigna's public domain implementation // http://xorshift.di.unimi.it/splitmix64.c +#include +#ifndef BOOST_USE_MODULES #include +#endif + namespace boost { namespace detail { +BOOST_MODULE_EXPORT class splitmix64 { private: diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index a439850a6..817fe91b5 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -22,6 +22,7 @@ import boost.throw_exception; extern "C++" { #include #include +#include #include #include #include From 465a09e050334b05ff5acff7249ff2415d72a6b6 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 1 Jan 2025 21:11:34 +0100 Subject: [PATCH 16/69] Fixed incorrect include in lightweight_test_trait.hpp --- include/boost/core/lightweight_test_trait.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/core/lightweight_test_trait.hpp b/include/boost/core/lightweight_test_trait.hpp index b276977e2..4adb455e7 100644 --- a/include/boost/core/lightweight_test_trait.hpp +++ b/include/boost/core/lightweight_test_trait.hpp @@ -81,6 +81,6 @@ BOOST_MODULE_EXPORT template inline void test_trait_same_imp } // namespace detail } // namespace boost -#include +#include #endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP From ff8719a5bdbc68f82d79a00bc1b50e97ec65a225 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 3 Jan 2025 17:31:20 +0100 Subject: [PATCH 17/69] Move away from BOOST_MODULE_EXPORT --- include/boost/core/bit.hpp | 40 +++++++++---------- include/boost/core/demangle.hpp | 8 ++-- include/boost/core/detail/is_same.hpp | 4 +- include/boost/core/detail/modules.hpp | 20 ++++++++++ include/boost/core/detail/splitmix64.hpp | 4 +- include/boost/core/detail/string_view.hpp | 16 ++++---- include/boost/core/enable_if.hpp | 4 +- include/boost/core/lightweight_test.hpp | 38 +++++++++--------- include/boost/core/lightweight_test_trait.hpp | 8 ++-- include/boost/core/type_name.hpp | 4 +- 10 files changed, 83 insertions(+), 63 deletions(-) create mode 100644 include/boost/core/detail/modules.hpp diff --git a/include/boost/core/bit.hpp b/include/boost/core/bit.hpp index 7f3ed92f1..9602ac0ef 100644 --- a/include/boost/core/bit.hpp +++ b/include/boost/core/bit.hpp @@ -15,7 +15,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include +#include #ifndef BOOST_USE_MODULES #include #include @@ -74,7 +74,7 @@ namespace core #if defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST) -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR To bit_cast( From const & from ) BOOST_NOEXCEPT { return __builtin_bit_cast( To, from ); @@ -82,7 +82,7 @@ BOOST_CONSTEXPR To bit_cast( From const & from ) BOOST_NOEXCEPT #else -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template To bit_cast( From const & from ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( sizeof(To) == sizeof(From) ); @@ -128,7 +128,7 @@ BOOST_CONSTEXPR inline int countl_impl( boost::ulong_long_type x ) BOOST_NOEXCEP } // namespace detail -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -298,7 +298,7 @@ inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT } // namespace detail -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -325,7 +325,7 @@ BOOST_CXX14_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT #endif // defined(__GNUC__) || defined(__clang__) -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int countl_one( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -367,7 +367,7 @@ BOOST_CONSTEXPR inline int countr_impl( boost::ulong_long_type x ) BOOST_NOEXCEP } // namespace detail -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -523,7 +523,7 @@ inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT } // namespace detail -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -550,7 +550,7 @@ BOOST_CXX14_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT #endif // defined(__GNUC__) || defined(__clang__) -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int countr_one( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -600,7 +600,7 @@ BOOST_CORE_POPCOUNT_CONSTEXPR inline int popcount_impl( boost::ulong_long_type x #undef BOOST_CORE_POPCOUNT_CONSTEXPR -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -633,7 +633,7 @@ BOOST_CXX14_CONSTEXPR inline int popcount_impl( boost::uint64_t x ) BOOST_NOEXCE } // namespace detail -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -654,7 +654,7 @@ BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT // rotating -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T rotl( T x, int s ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -663,7 +663,7 @@ BOOST_CXX14_CONSTEXPR T rotl( T x, int s ) BOOST_NOEXCEPT return static_cast( x << (static_cast( s ) & mask) | x >> (static_cast( -s ) & mask) ); } -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -674,7 +674,7 @@ BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT // integral powers of 2 -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR bool has_single_bit( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -685,7 +685,7 @@ BOOST_CONSTEXPR bool has_single_bit( T x ) BOOST_NOEXCEPT // bit_width returns `int` now, https://cplusplus.github.io/LWG/issue3656 // has been applied to C++20 as a DR -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int bit_width( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -693,7 +693,7 @@ BOOST_CONSTEXPR int bit_width( T x ) BOOST_NOEXCEPT return std::numeric_limits::digits - boost::core::countl_zero( x ); } -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR T bit_floor( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -747,7 +747,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x ) } // namespace detail -BOOST_MODULE_EXPORT template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T bit_ceil( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -798,14 +798,14 @@ BOOST_CXX14_CONSTEXPR T bit_ceil( T x ) BOOST_NOEXCEPT #if !defined(BOOST_NO_CXX11_SCOPED_ENUMS) -BOOST_MODULE_EXPORT enum class endian +BOOST_CORE_MODULE_EXPORT enum class endian { big, little, native BOOST_CORE_BIT_NATIVE_INITIALIZER }; -BOOST_MODULE_EXPORT typedef endian endian_type; +BOOST_CORE_MODULE_EXPORT typedef endian endian_type; #else @@ -925,7 +925,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t byteswap_impl( boost::uint64_t x ) } // namespace detail -BOOST_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T byteswap( T x ) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T byteswap( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer ); diff --git a/include/boost/core/demangle.hpp b/include/boost/core/demangle.hpp index f2270dbbf..ca8e3e75b 100644 --- a/include/boost/core/demangle.hpp +++ b/include/boost/core/demangle.hpp @@ -10,7 +10,7 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include +#include #ifndef BOOST_USE_MODULES #include #include @@ -30,10 +30,10 @@ namespace boost namespace core { -BOOST_MODULE_EXPORT inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT; -BOOST_MODULE_EXPORT inline void demangle_free( char const * name ) BOOST_NOEXCEPT; +BOOST_CORE_MODULE_EXPORT inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT; +BOOST_CORE_MODULE_EXPORT inline void demangle_free( char const * name ) BOOST_NOEXCEPT; -BOOST_MODULE_EXPORT class scoped_demangled_name +BOOST_CORE_MODULE_EXPORT class scoped_demangled_name { private: char const * m_p; diff --git a/include/boost/core/detail/is_same.hpp b/include/boost/core/detail/is_same.hpp index eaf556c27..7a484aadd 100644 --- a/include/boost/core/detail/is_same.hpp +++ b/include/boost/core/detail/is_same.hpp @@ -9,7 +9,7 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include +#include #ifndef BOOST_USE_MODULES #include #endif @@ -25,7 +25,7 @@ namespace core namespace detail { -BOOST_MODULE_EXPORT template< class T1, class T2 > struct is_same +BOOST_CORE_MODULE_EXPORT template< class T1, class T2 > struct is_same { BOOST_STATIC_CONSTANT( bool, value = false ); }; diff --git a/include/boost/core/detail/modules.hpp b/include/boost/core/detail/modules.hpp new file mode 100644 index 000000000..65018a41e --- /dev/null +++ b/include/boost/core/detail/modules.hpp @@ -0,0 +1,20 @@ +// +// Copyright (c) 2025 Ruben Perez Hidalgo +// +// 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) +// + +#ifndef BOOST_CORE_DETAIL_MODULES_HPP +#define BOOST_CORE_DETAIL_MODULES_HPP + +// BOOST_CORE_MODULE_EXPORT + +#ifdef BOOST_USE_MODULES +# define BOOST_CORE_MODULE_EXPORT export +#else +# define BOOST_CORE_MODULE_EXPORT +#endif + +#endif diff --git a/include/boost/core/detail/splitmix64.hpp b/include/boost/core/detail/splitmix64.hpp index 255f18c87..599d2b1d2 100644 --- a/include/boost/core/detail/splitmix64.hpp +++ b/include/boost/core/detail/splitmix64.hpp @@ -9,7 +9,7 @@ // derived from Sebastiano Vigna's public domain implementation // http://xorshift.di.unimi.it/splitmix64.c -#include +#include #ifndef BOOST_USE_MODULES #include #endif @@ -20,7 +20,7 @@ namespace boost namespace detail { -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT class splitmix64 { private: diff --git a/include/boost/core/detail/string_view.hpp b/include/boost/core/detail/string_view.hpp index edd6350ac..3f0f845d5 100644 --- a/include/boost/core/detail/string_view.hpp +++ b/include/boost/core/detail/string_view.hpp @@ -15,7 +15,7 @@ #include #include -#include // BOOST_MODULE_EXPORT +#include #ifndef BOOST_USE_MODULES #include @@ -337,7 +337,7 @@ template BOOST_CXX14_CONSTEXPR std::size_t find_last_not_of( Ch const* } // namespace detail -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT template class basic_string_view { private: @@ -1187,7 +1187,7 @@ template class basic_string_view // stream inserter -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT template std::basic_ostream& operator<<( std::basic_ostream& os, basic_string_view str ) { Ch const* p = str.data(); @@ -1224,19 +1224,19 @@ template BOOST_CONSTEXPR_OR_CONST std::size_t basic_string_view::n // typedef names -BOOST_MODULE_EXPORT typedef basic_string_view string_view; -BOOST_MODULE_EXPORT typedef basic_string_view wstring_view; +BOOST_CORE_MODULE_EXPORT typedef basic_string_view string_view; +BOOST_CORE_MODULE_EXPORT typedef basic_string_view wstring_view; #if !defined(BOOST_NO_CXX11_CHAR16_T) -BOOST_MODULE_EXPORT typedef basic_string_view u16string_view; +BOOST_CORE_MODULE_EXPORT typedef basic_string_view u16string_view; #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) -BOOST_MODULE_EXPORT typedef basic_string_view u32string_view; +BOOST_CORE_MODULE_EXPORT typedef basic_string_view u32string_view; #endif #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L -BOOST_MODULE_EXPORT typedef basic_string_view u8string_view; +BOOST_CORE_MODULE_EXPORT typedef basic_string_view u8string_view; #endif } // namespace core diff --git a/include/boost/core/enable_if.hpp b/include/boost/core/enable_if.hpp index e6cccfc6e..e8186d4a4 100644 --- a/include/boost/core/enable_if.hpp +++ b/include/boost/core/enable_if.hpp @@ -14,7 +14,7 @@ #ifndef BOOST_CORE_ENABLE_IF_HPP #define BOOST_CORE_ENABLE_IF_HPP -#include +#include #ifndef BOOST_USE_MODULES #include #endif @@ -24,7 +24,7 @@ #ifndef BOOST_NO_SFINAE -BOOST_MODULE_EXPORT namespace boost +BOOST_CORE_MODULE_EXPORT namespace boost { template struct enable_if_has_type diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index 30b7f3cb5..cd228497e 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -23,7 +23,7 @@ // #include -#include // BOOST_MODULE_EXPORT +#include #ifndef BOOST_USE_MODULES #include #include @@ -93,7 +93,7 @@ inline int& test_errors() return test_results().errors(); } -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT inline bool test_impl(char const * expr, char const * file, int line, char const * function, bool v) { if( v ) @@ -111,7 +111,7 @@ inline bool test_impl(char const * expr, char const * file, int line, char const } } -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT inline void error_impl(char const * msg, char const * file, int line, char const * function) { BOOST_LIGHTWEIGHT_TEST_OSTREAM @@ -120,7 +120,7 @@ inline void error_impl(char const * msg, char const * file, int line, char const ++test_results().errors(); } -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT inline void throw_failed_impl(const char* expr, char const * excep, char const * file, int line, char const * function) { BOOST_LIGHTWEIGHT_TEST_OSTREAM @@ -129,7 +129,7 @@ inline void throw_failed_impl(const char* expr, char const * excep, char const * ++test_results().errors(); } -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT inline void no_throw_failed_impl(const char* expr, const char* file, int line, const char* function) { BOOST_LIGHTWEIGHT_TEST_OSTREAM @@ -138,7 +138,7 @@ inline void no_throw_failed_impl(const char* expr, const char* file, int line, c ++test_results().errors(); } -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT inline void no_throw_failed_impl(const char* expr, const char* what, const char* file, int line, const char* function) { BOOST_LIGHTWEIGHT_TEST_OSTREAM @@ -220,37 +220,37 @@ inline std::string test_output_impl( char const& v ) // predicates -BOOST_MODULE_EXPORT struct lw_test_eq +BOOST_CORE_MODULE_EXPORT struct lw_test_eq { template bool operator()(const T& t, const U& u) const { return t == u; } }; -BOOST_MODULE_EXPORT struct lw_test_ne +BOOST_CORE_MODULE_EXPORT struct lw_test_ne { template bool operator()(const T& t, const U& u) const { return t != u; } }; -BOOST_MODULE_EXPORT struct lw_test_lt +BOOST_CORE_MODULE_EXPORT struct lw_test_lt { template bool operator()(const T& t, const U& u) const { return t < u; } }; -BOOST_MODULE_EXPORT struct lw_test_le +BOOST_CORE_MODULE_EXPORT struct lw_test_le { template bool operator()(const T& t, const U& u) const { return t <= u; } }; -BOOST_MODULE_EXPORT struct lw_test_gt +BOOST_CORE_MODULE_EXPORT struct lw_test_gt { template bool operator()(const T& t, const U& u) const { return t > u; } }; -BOOST_MODULE_EXPORT struct lw_test_ge +BOOST_CORE_MODULE_EXPORT struct lw_test_ge { template bool operator()(const T& t, const U& u) const { return t >= u; } @@ -295,7 +295,7 @@ inline char const * lwt_predicate_name( lw_test_ge const& ) // -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT template inline bool test_with_impl(BinaryPredicate pred, char const * expr1, char const * expr2, char const * file, int line, char const * function, @@ -317,7 +317,7 @@ inline bool test_with_impl(BinaryPredicate pred, char const * expr1, char const } } -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT inline bool test_cstr_eq_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, char const * const t, char const * const u ) { @@ -336,7 +336,7 @@ inline bool test_cstr_eq_impl( char const * expr1, char const * expr2, } } -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT inline bool test_cstr_ne_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, char const * const t, char const * const u ) { @@ -355,7 +355,7 @@ inline bool test_cstr_ne_impl( char const * expr1, char const * expr2, } } -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT template bool test_all_eq_impl(FormattedOutputFunction& output, char const * file, int line, char const * function, @@ -426,7 +426,7 @@ bool test_all_eq_impl(FormattedOutputFunction& output, } } -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT template bool test_all_with_impl(FormattedOutputFunction& output, char const * file, int line, char const * function, @@ -510,7 +510,7 @@ bool test_all_with_impl(FormattedOutputFunction& output, } // namespace detail -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT inline int report_errors() { boost::detail::test_result& result = boost::detail::test_results(); @@ -536,7 +536,7 @@ inline int report_errors() namespace core { -BOOST_MODULE_EXPORT +BOOST_CORE_MODULE_EXPORT inline void lwt_init() { boost::detail::test_results(); diff --git a/include/boost/core/lightweight_test_trait.hpp b/include/boost/core/lightweight_test_trait.hpp index 4adb455e7..4b355a168 100644 --- a/include/boost/core/lightweight_test_trait.hpp +++ b/include/boost/core/lightweight_test_trait.hpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #ifndef BOOST_USE_MODULES #include #endif @@ -33,7 +33,7 @@ namespace boost namespace detail { -BOOST_MODULE_EXPORT template< class T > inline void test_trait_impl( char const * trait, void (*)( T ), +BOOST_CORE_MODULE_EXPORT template< class T > inline void test_trait_impl( char const * trait, void (*)( T ), bool expected, char const * file, int line, char const * function ) { if( T::value == expected ) @@ -53,12 +53,12 @@ BOOST_MODULE_EXPORT template< class T > inline void test_trait_impl( char const } } -BOOST_MODULE_EXPORT template inline bool test_trait_same_impl_( T ) +BOOST_CORE_MODULE_EXPORT template inline bool test_trait_same_impl_( T ) { return T::value; } -BOOST_MODULE_EXPORT template inline void test_trait_same_impl( char const * types, +BOOST_CORE_MODULE_EXPORT template inline void test_trait_same_impl( char const * types, boost::core::detail::is_same same, char const * file, int line, char const * function ) { if( test_trait_same_impl_( same ) ) diff --git a/include/boost/core/type_name.hpp b/include/boost/core/type_name.hpp index a8e14d1fc..e6547b7d0 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -13,7 +13,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include // BOOST_MODULE_EXPORT +#include #include #ifndef BOOST_USE_MODULES #include @@ -1178,7 +1178,7 @@ template class L, class T, std::size_t N> struc } // namespace detail -BOOST_MODULE_EXPORT template std::string type_name() +BOOST_CORE_MODULE_EXPORT template std::string type_name() { return core::detail::tn_holder::type_name( "" ); } From b59969c545f9203825440f1a03f62d1ffc19a942 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 3 Jan 2025 17:46:10 +0100 Subject: [PATCH 18/69] lightweight test copyrights --- include/boost/core/lightweight_test_macros.hpp | 15 +++++++++++++++ .../boost/core/lightweight_test_macros_impl.hpp | 15 +++++++++++++++ .../boost/core/lightweight_test_trait_macros.hpp | 13 +++++++++++++ .../core/lightweight_test_trait_macros_impl.hpp | 13 +++++++++++++ 4 files changed, 56 insertions(+) diff --git a/include/boost/core/lightweight_test_macros.hpp b/include/boost/core/lightweight_test_macros.hpp index 027a198c0..ef4b45228 100644 --- a/include/boost/core/lightweight_test_macros.hpp +++ b/include/boost/core/lightweight_test_macros.hpp @@ -1,3 +1,18 @@ +// +// boost/core/lightweight_test.hpp - lightweight test library +// +// Copyright (c) 2002, 2009, 2014 Peter Dimov +// Copyright (2) Beman Dawes 2010, 2011 +// Copyright (3) Ion Gaztanaga 2013 +// +// Copyright 2018 Glen Joseph Fernandes +// (glenjofe@gmail.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 +// + #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_HPP #define BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_HPP diff --git a/include/boost/core/lightweight_test_macros_impl.hpp b/include/boost/core/lightweight_test_macros_impl.hpp index 635191063..122a4f81f 100644 --- a/include/boost/core/lightweight_test_macros_impl.hpp +++ b/include/boost/core/lightweight_test_macros_impl.hpp @@ -1,3 +1,18 @@ +// +// boost/core/lightweight_test.hpp - lightweight test library +// +// Copyright (c) 2002, 2009, 2014 Peter Dimov +// Copyright (2) Beman Dawes 2010, 2011 +// Copyright (3) Ion Gaztanaga 2013 +// +// Copyright 2018 Glen Joseph Fernandes +// (glenjofe@gmail.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 +// + #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_IMPL_HPP #define BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_IMPL_HPP diff --git a/include/boost/core/lightweight_test_trait_macros.hpp b/include/boost/core/lightweight_test_trait_macros.hpp index f6d1f1998..3a5f535d2 100644 --- a/include/boost/core/lightweight_test_trait_macros.hpp +++ b/include/boost/core/lightweight_test_trait_macros.hpp @@ -1,6 +1,19 @@ #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_HPP #define BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_HPP +// boost/core/lightweight_test_trait.hpp +// +// BOOST_TEST_TRAIT_TRUE, BOOST_TEST_TRAIT_FALSE, BOOST_TEST_TRAIT_SAME +// +// Copyright 2014, 2021 Peter Dimov +// +// Copyright 2019 Glen Joseph Fernandes +// (glenjofe@gmail.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 + // Intended to be included by the user #include diff --git a/include/boost/core/lightweight_test_trait_macros_impl.hpp b/include/boost/core/lightweight_test_trait_macros_impl.hpp index 97311cf44..341a23088 100644 --- a/include/boost/core/lightweight_test_trait_macros_impl.hpp +++ b/include/boost/core/lightweight_test_trait_macros_impl.hpp @@ -1,6 +1,19 @@ #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_IMPL_HPP #define BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_IMPL_HPP +// boost/core/lightweight_test_trait.hpp +// +// BOOST_TEST_TRAIT_TRUE, BOOST_TEST_TRAIT_FALSE, BOOST_TEST_TRAIT_SAME +// +// Copyright 2014, 2021 Peter Dimov +// +// Copyright 2019 Glen Joseph Fernandes +// (glenjofe@gmail.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 + #define BOOST_TEST_TRAIT_TRUE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, true, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) #define BOOST_TEST_TRAIT_FALSE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, false, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) From 219096dc0de20dbfa526507200496bc40b8aed38 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 10 Jan 2025 19:40:51 +0100 Subject: [PATCH 19/69] Move away from CMake common function --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9641f1457..7aa4703b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,9 +9,20 @@ project(boost_core VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) if (BOOST_USE_MODULES) add_library(boost_core STATIC) - boost_set_cxx20_module_settings(boost_core) target_sources(boost_core PUBLIC FILE_SET CXX_MODULES BASE_DIRS modules FILES modules/boost_core.cppm) set(__scope PUBLIC) + + # Enable and propagate C++23, import std, and the modules macro + target_compile_features(boost_core PUBLIC cxx_std_23) + set_target_properties(boost_core PROPERTIES CXX_MODULE_STD 1) + target_compile_definitions(boost_core PUBLIC BOOST_USE_MODULES) + + # Silence warnings about includes in the purview + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_compile_options(boost_core PRIVATE -Wno-include-angled-in-module-purview) + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + target_compile_options(boost_core PRIVATE /wd5244) + endif() else() add_library(boost_core INTERFACE) set(__scope INTERFACE) From 1586f4ad66b0ec2f4d407210e09bc797533e2550 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 14 Jan 2025 17:10:02 +0100 Subject: [PATCH 20/69] Initial implementation of compatibility headers --- include/boost/core/detail/splitmix64.hpp | 8 ++++++++ include/boost/core/lightweight_test.hpp | 12 ++++++++++++ include/boost/core/lightweight_test_trait.hpp | 11 +++++++++++ modules/boost_core.cppm | 2 ++ 4 files changed, 33 insertions(+) diff --git a/include/boost/core/detail/splitmix64.hpp b/include/boost/core/detail/splitmix64.hpp index 599d2b1d2..c03cafad5 100644 --- a/include/boost/core/detail/splitmix64.hpp +++ b/include/boost/core/detail/splitmix64.hpp @@ -9,6 +9,12 @@ // derived from Sebastiano Vigna's public domain implementation // http://xorshift.di.unimi.it/splitmix64.c +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +import boost.core; + +#else + #include #ifndef BOOST_USE_MODULES #include @@ -56,4 +62,6 @@ class splitmix64 } // namespace detail } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_DETAIL_SPLITMIX64_HPP_INCLUDED diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index cd228497e..4a2acad5b 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -7,6 +7,16 @@ # pragma once #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#include +#include +#include +import boost.core; + +#else + + // // boost/core/lightweight_test.hpp - lightweight test library // @@ -547,4 +557,6 @@ inline void lwt_init() #include +#endif + #endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_HPP diff --git a/include/boost/core/lightweight_test_trait.hpp b/include/boost/core/lightweight_test_trait.hpp index 4b355a168..546c2c7e8 100644 --- a/include/boost/core/lightweight_test_trait.hpp +++ b/include/boost/core/lightweight_test_trait.hpp @@ -7,6 +7,15 @@ # pragma once #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#include +#include +#include +import boost.core; + +#else + // boost/core/lightweight_test_trait.hpp // // BOOST_TEST_TRAIT_TRUE, BOOST_TEST_TRAIT_FALSE, BOOST_TEST_TRAIT_SAME @@ -83,4 +92,6 @@ BOOST_CORE_MODULE_EXPORT template inline void test_trait_sam #include +#endif + #endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 817fe91b5..54fe1bd3f 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -13,6 +13,8 @@ module; #include #endif +#define BOOST_CORE_INTERFACE_UNIT + export module boost.core; import std; From 5cd685fff1263ce87fda9a959d9e25cfa91c429c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Tue, 14 Jan 2025 20:08:17 +0100 Subject: [PATCH 21/69] Make core compatibility headers --- include/boost/core/bit.hpp | 8 ++++++++ include/boost/core/demangle.hpp | 8 ++++++++ include/boost/core/detail/is_same.hpp | 8 ++++++++ include/boost/core/detail/string_view.hpp | 8 ++++++++ include/boost/core/enable_if.hpp | 8 ++++++++ include/boost/core/type_name.hpp | 8 ++++++++ 6 files changed, 48 insertions(+) diff --git a/include/boost/core/bit.hpp b/include/boost/core/bit.hpp index 9602ac0ef..34f49baaa 100644 --- a/include/boost/core/bit.hpp +++ b/include/boost/core/bit.hpp @@ -7,6 +7,12 @@ # pragma once #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +import boost.core; + +#else + // boost/core/bit.hpp // // A portable version of the C++20 standard header @@ -956,4 +962,6 @@ BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T byteswap( T x # pragma warning(pop) #endif +#endif + #endif // #ifndef BOOST_CORE_BIT_HPP_INCLUDED diff --git a/include/boost/core/demangle.hpp b/include/boost/core/demangle.hpp index ca8e3e75b..d5f11b376 100644 --- a/include/boost/core/demangle.hpp +++ b/include/boost/core/demangle.hpp @@ -10,6 +10,12 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +import boost.core; + +#else + #include #ifndef BOOST_USE_MODULES #include @@ -106,4 +112,6 @@ inline std::string demangle( char const * name ) #undef BOOST_CORE_HAS_CXXABI_H +#endif + #endif // #ifndef BOOST_CORE_DEMANGLE_HPP_INCLUDED diff --git a/include/boost/core/detail/is_same.hpp b/include/boost/core/detail/is_same.hpp index 7a484aadd..f0a8216fb 100644 --- a/include/boost/core/detail/is_same.hpp +++ b/include/boost/core/detail/is_same.hpp @@ -9,6 +9,12 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +import boost.core; + +#else + #include #ifndef BOOST_USE_MODULES #include @@ -39,4 +45,6 @@ template< class T > struct is_same< T, T > } // namespace core } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_DETAIL_IS_SAME_HPP_INCLUDED diff --git a/include/boost/core/detail/string_view.hpp b/include/boost/core/detail/string_view.hpp index 3f0f845d5..619dcfcf9 100644 --- a/include/boost/core/detail/string_view.hpp +++ b/include/boost/core/detail/string_view.hpp @@ -7,6 +7,12 @@ # pragma once #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +import boost.core; + +#else + // boost::core::basic_string_view // // Copyright 2021 Peter Dimov @@ -1267,4 +1273,6 @@ struct std::basic_common_reference< #endif +#endif + #endif // #ifndef BOOST_CORE_STRING_VIEW_HPP_INCLUDED diff --git a/include/boost/core/enable_if.hpp b/include/boost/core/enable_if.hpp index e8186d4a4..ba9e368ea 100644 --- a/include/boost/core/enable_if.hpp +++ b/include/boost/core/enable_if.hpp @@ -14,6 +14,12 @@ #ifndef BOOST_CORE_ENABLE_IF_HPP #define BOOST_CORE_ENABLE_IF_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +import boost.core; + +#else + #include #ifndef BOOST_USE_MODULES #include @@ -129,3 +135,5 @@ namespace boost { #endif // BOOST_NO_SFINAE #endif + +#endif diff --git a/include/boost/core/type_name.hpp b/include/boost/core/type_name.hpp index e6547b7d0..c3cd328da 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -7,6 +7,12 @@ # pragma once #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +import boost.core; + +#else + // std::string boost::core::type_name() // // Copyright 2021 Peter Dimov @@ -1186,4 +1192,6 @@ BOOST_CORE_MODULE_EXPORT template std::string type_name() } // namespace core } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_TYPE_NAME_HPP_INCLUDED From f7395bf7fc28eda0562e03ec3581d6c57643bc21 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 15 Jan 2025 17:30:17 +0100 Subject: [PATCH 22/69] import std in lightweight test headers --- include/boost/core/lightweight_test.hpp | 1 + include/boost/core/lightweight_test_trait.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index 4a2acad5b..974086b72 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -12,6 +12,7 @@ #include #include #include +import std; // required by macros import boost.core; #else diff --git a/include/boost/core/lightweight_test_trait.hpp b/include/boost/core/lightweight_test_trait.hpp index 546c2c7e8..3c8c12990 100644 --- a/include/boost/core/lightweight_test_trait.hpp +++ b/include/boost/core/lightweight_test_trait.hpp @@ -12,6 +12,7 @@ #include #include #include +import std; // required by macros import boost.core; #else From a8b4fa8f4e8aec488664630791c74c5c3eb77755 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 30 Jan 2026 18:15:42 +0100 Subject: [PATCH 23/69] Missing file --- .../core/lightweight_test_macros_impl.hpp | 66 ++++++++++--------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/include/boost/core/lightweight_test_macros_impl.hpp b/include/boost/core/lightweight_test_macros_impl.hpp index 122a4f81f..d6ffa4573 100644 --- a/include/boost/core/lightweight_test_macros_impl.hpp +++ b/include/boost/core/lightweight_test_macros_impl.hpp @@ -18,9 +18,6 @@ // Without includes -#define BOOST_TEST(expr) ( ::boost::detail::test_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (expr)? true: false) ) -#define BOOST_TEST_NOT(expr) BOOST_TEST(!(expr)) - #define BOOST_ERROR(msg) ( ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) #define BOOST_TEST_WITH(expr1,expr2,predicate) ( ::boost::detail::test_with_impl(predicate, #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) @@ -39,39 +36,46 @@ #define BOOST_TEST_ALL_EQ(begin1, end1, begin2, end2) ( ::boost::detail::test_all_eq_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2) ) #define BOOST_TEST_ALL_WITH(begin1, end1, begin2, end2, predicate) ( ::boost::detail::test_all_with_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2, predicate) ) -#ifndef BOOST_NO_EXCEPTIONS - #define BOOST_TEST_THROWS( EXPR, EXCEP ) \ - try { \ - EXPR; \ - ::boost::detail::throw_failed_impl \ - (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } \ - catch(EXCEP const&) { \ - ::boost::detail::test_results(); \ - } \ - catch(...) { \ - ::boost::detail::throw_failed_impl \ - (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } \ - // +#if defined(BOOST_MSVC) && BOOST_MSVC < 1900 +# define BOOST_LWT_DETAIL_WHILE_FALSE __pragma(warning(push)) __pragma(warning(disable:4127)) while(false) __pragma(warning(pop)) #else - #define BOOST_TEST_THROWS( EXPR, EXCEP ) +# define BOOST_LWT_DETAIL_WHILE_FALSE while(false) #endif #ifndef BOOST_NO_EXCEPTIONS -# define BOOST_TEST_NO_THROW(EXPR) \ - try { \ - EXPR; \ - } catch (const std::exception& e) { \ - ::boost::detail::no_throw_failed_impl \ - (#EXPR, e.what(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } catch (...) { \ - ::boost::detail::no_throw_failed_impl \ - (#EXPR, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } - // + #define BOOST_TEST_THROWS( EXPR, EXCEP ) \ + do { \ + try { \ + EXPR; \ + ::boost::detail::throw_failed_impl \ + (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } \ + catch(EXCEP const&) { \ + ::boost::detail::test_results(); \ + } \ + catch(...) { \ + ::boost::detail::throw_failed_impl \ + (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } \ + } BOOST_LWT_DETAIL_WHILE_FALSE #else -# define BOOST_TEST_NO_THROW(EXPR) { EXPR; } + #define BOOST_TEST_THROWS( EXPR, EXCEP ) do {} BOOST_LWT_DETAIL_WHILE_FALSE #endif +#ifndef BOOST_NO_EXCEPTIONS +# define BOOST_TEST_NO_THROW(EXPR) \ + do { \ + try { \ + EXPR; \ + } catch (const std::exception& e) { \ + ::boost::detail::no_throw_failed_impl \ + (#EXPR, e.what(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } catch (...) { \ + ::boost::detail::no_throw_failed_impl \ + (#EXPR, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } \ + } BOOST_LWT_DETAIL_WHILE_FALSE +#else +# define BOOST_TEST_NO_THROW(EXPR) do { EXPR; } BOOST_LWT_DETAIL_WHILE_FALSE + #endif \ No newline at end of file From fc81b3a40038e01af8bd86ab8a40de6f18913943 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 30 Jan 2026 18:24:41 +0100 Subject: [PATCH 24/69] Post-merge fixes --- include/boost/core/bit.hpp | 2 +- include/boost/core/detail/string_view.hpp | 4 ++++ include/boost/core/lightweight_test_macros_impl.hpp | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/boost/core/bit.hpp b/include/boost/core/bit.hpp index d4d952587..9d93dc48b 100644 --- a/include/boost/core/bit.hpp +++ b/include/boost/core/bit.hpp @@ -22,8 +22,8 @@ import boost.core; // https://www.boost.org/LICENSE_1_0.txt #include -#ifndef BOOST_USE_MODULES #include +#ifndef BOOST_USE_MODULES #include #include #include diff --git a/include/boost/core/detail/string_view.hpp b/include/boost/core/detail/string_view.hpp index d50afcf42..dccc759fc 100644 --- a/include/boost/core/detail/string_view.hpp +++ b/include/boost/core/detail/string_view.hpp @@ -1274,6 +1274,8 @@ struct std::basic_common_reference< using type = boost::core::basic_string_view; }; +#endif + // std::format support #if !defined(BOOST_NO_CXX20_HDR_FORMAT) @@ -1285,4 +1287,6 @@ struct std::formatter, Ch2>: std::formatter Date: Sun, 1 Feb 2026 19:05:22 +0000 Subject: [PATCH 25/69] add missing export --- include/boost/core/lightweight_test.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index f6a74a022..6bfc1e4c0 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -93,6 +93,7 @@ class test_result int errors_; }; +BOOST_CORE_MODULE_EXPORT inline test_result& test_results() { static test_result instance; From b353b8bb71eefde96285af035ef81b695e2a4acd Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 25 Feb 2026 12:55:17 +0100 Subject: [PATCH 26/69] Boost.ThrowException is now header --- modules/boost_core.cppm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 54fe1bd3f..3ababb1f7 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -12,6 +12,7 @@ module; #if defined(_MSC_VER) #include #endif +#include #define BOOST_CORE_INTERFACE_UNIT @@ -19,7 +20,6 @@ export module boost.core; import std; import boost.assert; -import boost.throw_exception; extern "C++" { #include From 916af76a4a7799f365b82a0e495002186bb65476 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 12:37:48 +0100 Subject: [PATCH 27/69] Reorder --- modules/boost_core.cppm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 3ababb1f7..3ed1ec2b9 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -1,12 +1,12 @@ module; +#include // must be the 1st one to avoid conflicts with import std #include #include #include #include #include -#include -#include +#include #include #include #if defined(_MSC_VER) @@ -14,12 +14,12 @@ module; #endif #include -#define BOOST_CORE_INTERFACE_UNIT - export module boost.core; import std; -import boost.assert; + +#define BOOST_CORE_INTERFACE_UNIT +#define BOOST_IN_MODULE_PURVIEW extern "C++" { #include From 2896671b24af8e2462b155b68150bbc6c746e27d Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 12:39:19 +0100 Subject: [PATCH 28/69] Warning suppression to cpp --- CMakeLists.txt | 6 ------ modules/boost_core.cppm | 10 ++++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc89cffde..cfe1ff345 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,12 +17,6 @@ if (BOOST_USE_MODULES) set_target_properties(boost_core PROPERTIES CXX_MODULE_STD 1) target_compile_definitions(boost_core PUBLIC BOOST_USE_MODULES) - # Silence warnings about includes in the purview - if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - target_compile_options(boost_core PRIVATE -Wno-include-angled-in-module-purview) - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - target_compile_options(boost_core PRIVATE /wd5244) - endif() else() add_library(boost_core INTERFACE) set(__scope INTERFACE) diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 3ed1ec2b9..eb3b903c4 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -21,6 +21,16 @@ import std; #define BOOST_CORE_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 + extern "C++" { #include #include From 4d1582aaade10dceefa05c7138aeb4a8dce07fe3 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 12:46:44 +0100 Subject: [PATCH 29/69] Intrin wrapper --- include/boost/core/detail/intrin.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 include/boost/core/detail/intrin.hpp diff --git a/include/boost/core/detail/intrin.hpp b/include/boost/core/detail/intrin.hpp new file mode 100644 index 000000000..1b5e83f76 --- /dev/null +++ b/include/boost/core/detail/intrin.hpp @@ -0,0 +1,10 @@ +// Module-aware wrapper for +// Ensures that we don't accidentally pour names into Boost.Core's module purview +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_INTRIN_INCLUDED) +# error "Please #include in your module global fragment" +#endif + +#ifndef BOOST_CORE_INTRIN_INCLUDED +#define BOOST_CORE_INTRIN_INCLUDED +#include +#endif From bedfa5417eb5a3067c4ca55e978c1e8f6682962c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 12:47:39 +0100 Subject: [PATCH 30/69] Use the intrin wrapper --- include/boost/core/detail/sp_thread_pause.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/core/detail/sp_thread_pause.hpp b/include/boost/core/detail/sp_thread_pause.hpp index 8971fbd1e..a4e327f62 100644 --- a/include/boost/core/detail/sp_thread_pause.hpp +++ b/include/boost/core/detail/sp_thread_pause.hpp @@ -31,12 +31,12 @@ #elif defined(_MSC_VER) && ( defined(_M_IX86) || defined(_M_X64) ) -# include +# include # define BOOST_CORE_SP_PAUSE() _mm_pause() #elif defined(_MSC_VER) && ( defined(_M_ARM) || defined(_M_ARM64) ) -# include +# include # define BOOST_CORE_SP_PAUSE() __yield() #elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) From ece6ab84d9e3265b073b7d91cf6ff8ce41817c49 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 12:48:41 +0100 Subject: [PATCH 31/69] Sanitize bit includes --- include/boost/core/bit.hpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/include/boost/core/bit.hpp b/include/boost/core/bit.hpp index 9d93dc48b..9dfde71cc 100644 --- a/include/boost/core/bit.hpp +++ b/include/boost/core/bit.hpp @@ -9,7 +9,9 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW import boost.core; +#endif #else @@ -23,19 +25,14 @@ import boost.core; #include #include -#ifndef BOOST_USE_MODULES #include #include -#include -#include -#include -#if defined(_MSC_VER) -#include -#endif -#endif +#include +#include +#include #if defined(_MSC_VER) - +# include # pragma intrinsic(_BitScanForward) # pragma intrinsic(_BitScanReverse) From 6f134a17744c822577aefe855a4cf9ac8c684d87 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 12:50:37 +0100 Subject: [PATCH 32/69] whitespace --- include/boost/core/bit.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/core/bit.hpp b/include/boost/core/bit.hpp index 9dfde71cc..3652a3c77 100644 --- a/include/boost/core/bit.hpp +++ b/include/boost/core/bit.hpp @@ -32,6 +32,7 @@ import boost.core; #include #if defined(_MSC_VER) + # include # pragma intrinsic(_BitScanForward) # pragma intrinsic(_BitScanReverse) From 79d42814f8b6ad61b1318d2db70be65b720b6430 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 12:58:14 +0100 Subject: [PATCH 33/69] proper demangle handling --- include/boost/core/demangle.hpp | 38 +++---------------- .../{cxxabi.hpp => demangle_cxxabi.hpp} | 5 +++ modules/boost_core.cppm | 4 +- 3 files changed, 13 insertions(+), 34 deletions(-) rename include/boost/core/detail/{cxxabi.hpp => demangle_cxxabi.hpp} (84%) diff --git a/include/boost/core/demangle.hpp b/include/boost/core/demangle.hpp index 773598580..73afc6a10 100644 --- a/include/boost/core/demangle.hpp +++ b/include/boost/core/demangle.hpp @@ -12,49 +12,23 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW import boost.core; +#endif #else #include -#ifndef BOOST_USE_MODULES #include -#include -#include -#include -#include -#endif +#include +#include +#include +#include #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif -// __has_include is currently supported by GCC and Clang. However GCC 4.9 may have issues and -// returns 1 for 'defined( __has_include )', while '__has_include' is actually not supported: -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63662 -#if defined( __has_include ) && (!defined( BOOST_GCC ) || (__GNUC__ + 0) >= 5) -# if __has_include() -# define BOOST_CORE_HAS_CXXABI_H -# endif -#elif defined( __GLIBCXX__ ) || defined( __GLIBCPP__ ) -# define BOOST_CORE_HAS_CXXABI_H -#endif - -#if defined( BOOST_CORE_HAS_CXXABI_H ) -# include -// For some architectures (mips, mips64, x86, x86_64) cxxabi.h in Android NDK is implemented by gabi++ library -// (https://android.googlesource.com/platform/ndk/+/master/sources/cxx-stl/gabi++/), which does not implement -// abi::__cxa_demangle(). We detect this implementation by checking the include guard here. -# if defined( __GABIXX_CXXABI_H__ ) -# undef BOOST_CORE_HAS_CXXABI_H -# else -# ifndef BOOST_USE_MODULES -# include -# include -# endif -# endif -#endif - namespace boost { diff --git a/include/boost/core/detail/cxxabi.hpp b/include/boost/core/detail/demangle_cxxabi.hpp similarity index 84% rename from include/boost/core/detail/cxxabi.hpp rename to include/boost/core/detail/demangle_cxxabi.hpp index 1586558d3..2cc495916 100644 --- a/include/boost/core/detail/cxxabi.hpp +++ b/include/boost/core/detail/demangle_cxxabi.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from the purview +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_DETAIL_CXXABI_HPP_INCLUDED) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_DETAIL_CXXABI_HPP_INCLUDED #define BOOST_CORE_DETAIL_CXXABI_HPP_INCLUDED diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index eb3b903c4..c5a45feaf 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -1,6 +1,6 @@ module; -#include // must be the 1st one to avoid conflicts with import std +#include // must be the 1st one to avoid conflicts with import std #include #include #include @@ -10,7 +10,7 @@ module; #include #include #if defined(_MSC_VER) -#include +#include #endif #include From 9fc0397ee434dee5435838d80e211ea6fb81261f Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:01:00 +0100 Subject: [PATCH 34/69] demangle final fixes --- include/boost/core/demangle.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/boost/core/demangle.hpp b/include/boost/core/demangle.hpp index 73afc6a10..f5416d9e6 100644 --- a/include/boost/core/demangle.hpp +++ b/include/boost/core/demangle.hpp @@ -18,17 +18,20 @@ import boost.core; #else -#include #include -#include -#include -#include #include +#include #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif +#include +#if defined( BOOST_CORE_HAS_CXXABI_H ) +# include +# include +#endif + namespace boost { From 3ddc7a1fe9f4d521e959e5858b7fc3c1e7df2b55 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:01:59 +0100 Subject: [PATCH 35/69] restore enable_if --- include/boost/core/enable_if.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/core/enable_if.hpp b/include/boost/core/enable_if.hpp index ba9e368ea..c09f3d714 100644 --- a/include/boost/core/enable_if.hpp +++ b/include/boost/core/enable_if.hpp @@ -16,14 +16,14 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW import boost.core; +#endif #else #include -#ifndef BOOST_USE_MODULES #include -#endif // Even the definition of enable_if causes problems on some compilers, // so it's macroed out for all compilers that do not support SFINAE From db4ee9120199fb865edf3f285040375fdcffed49 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:08:52 +0100 Subject: [PATCH 36/69] lwt test 1 --- include/boost/core/lightweight_test.hpp | 64 +++++++++++++- .../boost/core/lightweight_test_macros.hpp | 25 ------ .../core/lightweight_test_macros_impl.hpp | 85 ------------------- 3 files changed, 61 insertions(+), 113 deletions(-) delete mode 100644 include/boost/core/lightweight_test_macros.hpp delete mode 100644 include/boost/core/lightweight_test_macros_impl.hpp diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index 6bfc1e4c0..ed09df818 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -35,7 +35,6 @@ import boost.core; #include #include -#ifndef BOOST_USE_MODULES #include #include #include @@ -46,7 +45,6 @@ import boost.core; #include #include #include -#endif // IDE's like Visual Studio perform better if output goes to std::cout or // some other stream, so allow user to configure output stream: @@ -564,8 +562,68 @@ inline void lwt_init() } // namespace core } // namespace boost -#include +#define BOOST_TEST(expr) ( ::boost::detail::test_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (expr)? true: false) ) +#define BOOST_TEST_NOT(expr) BOOST_TEST(!(expr)) + +#define BOOST_ERROR(msg) ( ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) + +#define BOOST_TEST_WITH(expr1,expr2,predicate) ( ::boost::detail::test_with_impl(predicate, #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) + +#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_eq(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) +#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_ne(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) + +#define BOOST_TEST_LT(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_lt(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) +#define BOOST_TEST_LE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_le(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) +#define BOOST_TEST_GT(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_gt(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) +#define BOOST_TEST_GE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_ge(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) + +#define BOOST_TEST_CSTR_EQ(expr1,expr2) ( ::boost::detail::test_cstr_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) +#define BOOST_TEST_CSTR_NE(expr1,expr2) ( ::boost::detail::test_cstr_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) + +#define BOOST_TEST_ALL_EQ(begin1, end1, begin2, end2) ( ::boost::detail::test_all_eq_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2) ) +#define BOOST_TEST_ALL_WITH(begin1, end1, begin2, end2, predicate) ( ::boost::detail::test_all_with_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2, predicate) ) +#if defined(BOOST_MSVC) && BOOST_MSVC < 1900 +# define BOOST_LWT_DETAIL_WHILE_FALSE __pragma(warning(push)) __pragma(warning(disable:4127)) while(false) __pragma(warning(pop)) +#else +# define BOOST_LWT_DETAIL_WHILE_FALSE while(false) +#endif + +#ifndef BOOST_NO_EXCEPTIONS + #define BOOST_TEST_THROWS( EXPR, EXCEP ) \ + do { \ + try { \ + EXPR; \ + ::boost::detail::throw_failed_impl \ + (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } \ + catch(EXCEP const&) { \ + ::boost::detail::test_results(); \ + } \ + catch(...) { \ + ::boost::detail::throw_failed_impl \ + (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } \ + } BOOST_LWT_DETAIL_WHILE_FALSE +#else + #define BOOST_TEST_THROWS( EXPR, EXCEP ) do {} BOOST_LWT_DETAIL_WHILE_FALSE +#endif + +#ifndef BOOST_NO_EXCEPTIONS +# define BOOST_TEST_NO_THROW(EXPR) \ + do { \ + try { \ + EXPR; \ + } catch (const std::exception& e) { \ + ::boost::detail::no_throw_failed_impl \ + (#EXPR, e.what(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } catch (...) { \ + ::boost::detail::no_throw_failed_impl \ + (#EXPR, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ + } \ + } BOOST_LWT_DETAIL_WHILE_FALSE +#else +# define BOOST_TEST_NO_THROW(EXPR) do { EXPR; } BOOST_LWT_DETAIL_WHILE_FALSE #endif #endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_HPP diff --git a/include/boost/core/lightweight_test_macros.hpp b/include/boost/core/lightweight_test_macros.hpp deleted file mode 100644 index ef4b45228..000000000 --- a/include/boost/core/lightweight_test_macros.hpp +++ /dev/null @@ -1,25 +0,0 @@ -// -// boost/core/lightweight_test.hpp - lightweight test library -// -// Copyright (c) 2002, 2009, 2014 Peter Dimov -// Copyright (2) Beman Dawes 2010, 2011 -// Copyright (3) Ion Gaztanaga 2013 -// -// Copyright 2018 Glen Joseph Fernandes -// (glenjofe@gmail.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 -// - -#ifndef BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_HPP -#define BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_HPP - -// Intended to be included by the user - -#include -#include -#include - -#endif \ No newline at end of file diff --git a/include/boost/core/lightweight_test_macros_impl.hpp b/include/boost/core/lightweight_test_macros_impl.hpp deleted file mode 100644 index 557767f6a..000000000 --- a/include/boost/core/lightweight_test_macros_impl.hpp +++ /dev/null @@ -1,85 +0,0 @@ -// -// boost/core/lightweight_test.hpp - lightweight test library -// -// Copyright (c) 2002, 2009, 2014 Peter Dimov -// Copyright (2) Beman Dawes 2010, 2011 -// Copyright (3) Ion Gaztanaga 2013 -// -// Copyright 2018 Glen Joseph Fernandes -// (glenjofe@gmail.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 -// - -#ifndef BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_IMPL_HPP -#define BOOST_CORE_LIGHTWEIGHT_TEST_MACROS_IMPL_HPP - -// Without includes - -#define BOOST_TEST(expr) ( ::boost::detail::test_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (expr)? true: false) ) -#define BOOST_TEST_NOT(expr) BOOST_TEST(!(expr)) - -#define BOOST_ERROR(msg) ( ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) - -#define BOOST_TEST_WITH(expr1,expr2,predicate) ( ::boost::detail::test_with_impl(predicate, #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) - -#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_eq(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) -#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_ne(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) - -#define BOOST_TEST_LT(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_lt(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) -#define BOOST_TEST_LE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_le(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) -#define BOOST_TEST_GT(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_gt(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) -#define BOOST_TEST_GE(expr1,expr2) ( ::boost::detail::test_with_impl(::boost::detail::lw_test_ge(), #expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) - -#define BOOST_TEST_CSTR_EQ(expr1,expr2) ( ::boost::detail::test_cstr_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) -#define BOOST_TEST_CSTR_NE(expr1,expr2) ( ::boost::detail::test_cstr_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) - -#define BOOST_TEST_ALL_EQ(begin1, end1, begin2, end2) ( ::boost::detail::test_all_eq_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2) ) -#define BOOST_TEST_ALL_WITH(begin1, end1, begin2, end2, predicate) ( ::boost::detail::test_all_with_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2, predicate) ) - -#if defined(BOOST_MSVC) && BOOST_MSVC < 1900 -# define BOOST_LWT_DETAIL_WHILE_FALSE __pragma(warning(push)) __pragma(warning(disable:4127)) while(false) __pragma(warning(pop)) -#else -# define BOOST_LWT_DETAIL_WHILE_FALSE while(false) -#endif - -#ifndef BOOST_NO_EXCEPTIONS - #define BOOST_TEST_THROWS( EXPR, EXCEP ) \ - do { \ - try { \ - EXPR; \ - ::boost::detail::throw_failed_impl \ - (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } \ - catch(EXCEP const&) { \ - ::boost::detail::test_results(); \ - } \ - catch(...) { \ - ::boost::detail::throw_failed_impl \ - (#EXPR, #EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } \ - } BOOST_LWT_DETAIL_WHILE_FALSE -#else - #define BOOST_TEST_THROWS( EXPR, EXCEP ) do {} BOOST_LWT_DETAIL_WHILE_FALSE -#endif - -#ifndef BOOST_NO_EXCEPTIONS -# define BOOST_TEST_NO_THROW(EXPR) \ - do { \ - try { \ - EXPR; \ - } catch (const std::exception& e) { \ - ::boost::detail::no_throw_failed_impl \ - (#EXPR, e.what(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } catch (...) { \ - ::boost::detail::no_throw_failed_impl \ - (#EXPR, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \ - } \ - } BOOST_LWT_DETAIL_WHILE_FALSE -#else -# define BOOST_TEST_NO_THROW(EXPR) do { EXPR; } BOOST_LWT_DETAIL_WHILE_FALSE -#endif - -#endif \ No newline at end of file From 02608c86f8857dadae39656a053756587b399317 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:14:46 +0100 Subject: [PATCH 37/69] lightweight_test --- include/boost/core/lightweight_test.hpp | 29 ++++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index ed09df818..d8403d42f 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -7,17 +7,6 @@ # pragma once #endif -#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) - -#include -#include -#include -import std; // required by macros -import boost.core; - -#else - - // // boost/core/lightweight_test.hpp - lightweight test library // @@ -33,10 +22,19 @@ import boost.core; // http://www.boost.org/LICENSE_1_0.txt // -#include -#include +// Subset of includes required for exported macros #include #include + +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +# ifndef BOOST_IN_MODULE_PURVIEW + import std; // required by macros + import boost.core; +# endif +#else + +#include +#include #include #include #include @@ -562,6 +560,11 @@ inline void lwt_init() } // namespace core } // namespace boost +#endif // defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +// Macros should be defined by this header regardless of whether +// modules are being used or not + #define BOOST_TEST(expr) ( ::boost::detail::test_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (expr)? true: false) ) #define BOOST_TEST_NOT(expr) BOOST_TEST(!(expr)) From afdf6ff0083b965145f740b8a2cca4f7a77f1b74 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:18:05 +0100 Subject: [PATCH 38/69] lightweight_test_trait --- include/boost/core/lightweight_test_trait.hpp | 43 +++++++++++-------- .../core/lightweight_test_trait_macros.hpp | 23 ---------- .../lightweight_test_trait_macros_impl.hpp | 27 ------------ 3 files changed, 25 insertions(+), 68 deletions(-) delete mode 100644 include/boost/core/lightweight_test_trait_macros.hpp delete mode 100644 include/boost/core/lightweight_test_trait_macros_impl.hpp diff --git a/include/boost/core/lightweight_test_trait.hpp b/include/boost/core/lightweight_test_trait.hpp index 3c8c12990..20f1c116e 100644 --- a/include/boost/core/lightweight_test_trait.hpp +++ b/include/boost/core/lightweight_test_trait.hpp @@ -7,16 +7,6 @@ # pragma once #endif -#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) - -#include -#include -#include -import std; // required by macros -import boost.core; - -#else - // boost/core/lightweight_test_trait.hpp // // BOOST_TEST_TRAIT_TRUE, BOOST_TEST_TRAIT_FALSE, BOOST_TEST_TRAIT_SAME @@ -30,20 +20,26 @@ import boost.core; // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +// Subset of includes required for exported macros #include +#include + +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +# ifndef BOOST_IN_MODULE_PURVIEW + import std; // required by macros + import boost.core; +# endif +#else + #include #include -#include -#ifndef BOOST_USE_MODULES -#include -#endif namespace boost { namespace detail { -BOOST_CORE_MODULE_EXPORT template< class T > inline void test_trait_impl( char const * trait, void (*)( T ), +template< class T > inline void test_trait_impl( char const * trait, void (*)( T ), bool expected, char const * file, int line, char const * function ) { if( T::value == expected ) @@ -63,12 +59,12 @@ BOOST_CORE_MODULE_EXPORT template< class T > inline void test_trait_impl( char c } } -BOOST_CORE_MODULE_EXPORT template inline bool test_trait_same_impl_( T ) +template inline bool test_trait_same_impl_( T ) { return T::value; } -BOOST_CORE_MODULE_EXPORT template inline void test_trait_same_impl( char const * types, +template inline void test_trait_same_impl( char const * types, boost::core::detail::is_same same, char const * file, int line, char const * function ) { if( test_trait_same_impl_( same ) ) @@ -91,8 +87,19 @@ BOOST_CORE_MODULE_EXPORT template inline void test_trait_sam } // namespace detail } // namespace boost -#include +#endif // defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +// Macros should be defined by this header regardless of whether +// modules are being used or not +#define BOOST_TEST_TRAIT_TRUE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, true, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) +#define BOOST_TEST_TRAIT_FALSE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, false, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) + +#if defined(__GNUC__) +// ignoring -Wvariadic-macros with #pragma doesn't work under GCC +# pragma GCC system_header #endif +#define BOOST_TEST_TRAIT_SAME(...) ( ::boost::detail::test_trait_same_impl(#__VA_ARGS__, ::boost::core::detail::is_same< __VA_ARGS__ >(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) + #endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP diff --git a/include/boost/core/lightweight_test_trait_macros.hpp b/include/boost/core/lightweight_test_trait_macros.hpp deleted file mode 100644 index 3a5f535d2..000000000 --- a/include/boost/core/lightweight_test_trait_macros.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_HPP -#define BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_HPP - -// boost/core/lightweight_test_trait.hpp -// -// BOOST_TEST_TRAIT_TRUE, BOOST_TEST_TRAIT_FALSE, BOOST_TEST_TRAIT_SAME -// -// Copyright 2014, 2021 Peter Dimov -// -// Copyright 2019 Glen Joseph Fernandes -// (glenjofe@gmail.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 - -// Intended to be included by the user - -#include -#include -#include - -#endif \ No newline at end of file diff --git a/include/boost/core/lightweight_test_trait_macros_impl.hpp b/include/boost/core/lightweight_test_trait_macros_impl.hpp deleted file mode 100644 index 341a23088..000000000 --- a/include/boost/core/lightweight_test_trait_macros_impl.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_IMPL_HPP -#define BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_IMPL_HPP - -// boost/core/lightweight_test_trait.hpp -// -// BOOST_TEST_TRAIT_TRUE, BOOST_TEST_TRAIT_FALSE, BOOST_TEST_TRAIT_SAME -// -// Copyright 2014, 2021 Peter Dimov -// -// Copyright 2019 Glen Joseph Fernandes -// (glenjofe@gmail.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 - -#define BOOST_TEST_TRAIT_TRUE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, true, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) -#define BOOST_TEST_TRAIT_FALSE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, false, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) - -#if defined(__GNUC__) -// ignoring -Wvariadic-macros with #pragma doesn't work under GCC -# pragma GCC system_header -#endif - -#define BOOST_TEST_TRAIT_SAME(...) ( ::boost::detail::test_trait_same_impl(#__VA_ARGS__, ::boost::core::detail::is_same< __VA_ARGS__ >(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) - -#endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_MACROS_IMPL_HPP From bf4552e04e3012e45b1fc00b0ac195df6b095b3b Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:19:57 +0100 Subject: [PATCH 39/69] type_name --- include/boost/core/type_name.hpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/boost/core/type_name.hpp b/include/boost/core/type_name.hpp index c3cd328da..75e36b55c 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -9,7 +9,9 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW import boost.core; +#endif #else @@ -21,19 +23,17 @@ import boost.core; #include #include -#ifndef BOOST_USE_MODULES #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) -# include -#endif +# include #endif namespace boost From 8a8eaa0c438e19182591219a1ea8f3f1a3d8ec20 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:20:47 +0100 Subject: [PATCH 40/69] is_same --- include/boost/core/detail/is_same.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/core/detail/is_same.hpp b/include/boost/core/detail/is_same.hpp index f0a8216fb..cca437507 100644 --- a/include/boost/core/detail/is_same.hpp +++ b/include/boost/core/detail/is_same.hpp @@ -11,14 +11,14 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW import boost.core; +#endif #else #include -#ifndef BOOST_USE_MODULES #include -#endif #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once From 620695ca08178e534b4e0f9edbc94e023256a1fd Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:20:58 +0100 Subject: [PATCH 41/69] lwt_unattend --- include/boost/core/detail/lwt_unattended.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/boost/core/detail/lwt_unattended.hpp b/include/boost/core/detail/lwt_unattended.hpp index 52dc9e2d5..0d3769f9d 100644 --- a/include/boost/core/detail/lwt_unattended.hpp +++ b/include/boost/core/detail/lwt_unattended.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_DETAIL_LWT_UNATTENDED_HPP_INCLUDED) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_DETAIL_LWT_UNATTENDED_HPP_INCLUDED #define BOOST_CORE_DETAIL_LWT_UNATTENDED_HPP_INCLUDED @@ -5,9 +10,9 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_USE_MODULES #include -#include +#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG) +# include #endif namespace boost From 880ec9e2a121da22490abeb678f532c86f2e7c21 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:22:49 +0100 Subject: [PATCH 42/69] splitmix64 --- include/boost/core/detail/splitmix64.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/boost/core/detail/splitmix64.hpp b/include/boost/core/detail/splitmix64.hpp index c03cafad5..cca23e764 100644 --- a/include/boost/core/detail/splitmix64.hpp +++ b/include/boost/core/detail/splitmix64.hpp @@ -11,15 +11,14 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW import boost.core; +#endif #else #include -#ifndef BOOST_USE_MODULES #include -#endif - namespace boost { From 3c1540c1d515a1c31636d4c252b6e04afa4b4b9e Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:24:25 +0100 Subject: [PATCH 43/69] remove crtdbg wrapper --- include/boost/core/detail/crtdbg.hpp | 10 ---------- modules/boost_core.cppm | 1 - 2 files changed, 11 deletions(-) delete mode 100644 include/boost/core/detail/crtdbg.hpp diff --git a/include/boost/core/detail/crtdbg.hpp b/include/boost/core/detail/crtdbg.hpp deleted file mode 100644 index 07d244be8..000000000 --- a/include/boost/core/detail/crtdbg.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef BOOST_CORE_DETAIL_CRTDBG_HPP_INCLUDED -#define BOOST_CORE_DETAIL_CRTDBG_HPP_INCLUDED - -// Conditionally includes crtdbg.h. -// Helpful for the module infrastructure -#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG) -# include -#endif - -#endif \ No newline at end of file diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index c5a45feaf..b4e3f35c0 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -7,7 +7,6 @@ module; #include #include #include -#include #include #if defined(_MSC_VER) #include From 4a9430df0d276e5959a30f71e03e96662f8fa782 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:26:00 +0100 Subject: [PATCH 44/69] string_view --- include/boost/core/detail/string_view.hpp | 29 +++++++++++------------ 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/include/boost/core/detail/string_view.hpp b/include/boost/core/detail/string_view.hpp index dccc759fc..a14494b46 100644 --- a/include/boost/core/detail/string_view.hpp +++ b/include/boost/core/detail/string_view.hpp @@ -9,7 +9,9 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW import boost.core; +#endif #else @@ -22,30 +24,27 @@ import boost.core; #include #include #include - -#ifndef BOOST_USE_MODULES #include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) -# include +# include #endif #if !defined(BOOST_NO_CXX20_HDR_CONCEPTS) // std::common_reference_with -# include +# include #endif #if !defined(BOOST_NO_CXX20_HDR_FORMAT) -# include // std::formatter -#endif +# include // std::formatter #endif namespace boost From 14a8749f51e8bfb8680557bc674a5be0291c2e93 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:30:52 +0100 Subject: [PATCH 45/69] lwt fixes --- include/boost/core/lightweight_test.hpp | 27 +++++++++++++------------ modules/boost_core.cppm | 2 ++ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index d8403d42f..d51e1d70e 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -26,6 +26,12 @@ #include #include +// IDE's like Visual Studio perform better if output goes to std::cout or +// some other stream, so allow user to configure output stream: +#ifndef BOOST_LIGHTWEIGHT_TEST_OSTREAM +# define BOOST_LIGHTWEIGHT_TEST_OSTREAM std::cerr +#endif + #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) # ifndef BOOST_IN_MODULE_PURVIEW import std; // required by macros @@ -35,20 +41,15 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -// IDE's like Visual Studio perform better if output goes to std::cout or -// some other stream, so allow user to configure output stream: -#ifndef BOOST_LIGHTWEIGHT_TEST_OSTREAM -# define BOOST_LIGHTWEIGHT_TEST_OSTREAM std::cerr -#endif namespace boost { diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index b4e3f35c0..038aed892 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -7,6 +7,8 @@ module; #include #include #include +#include +#include #include #if defined(_MSC_VER) #include From 8058ab5dc07b2c388091b8557901f75cccc037bf Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:32:12 +0100 Subject: [PATCH 46/69] boost_core cleanup --- modules/boost_core.cppm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 038aed892..5b0410848 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -1,19 +1,18 @@ module; #include // must be the 1st one to avoid conflicts with import std -#include -#include -#include -#include -#include -#include -#include #include -#include #if defined(_MSC_VER) #include #endif +#include +#include +#include #include +#include +#include +#include +#include export module boost.core; From f8bc508b7b282191f63832c284fc93bdbc97d558 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 13:48:04 +0100 Subject: [PATCH 47/69] ABI breaking --- modules/boost_core.cppm | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 5b0410848..e9410be6a 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -31,7 +31,6 @@ import std; #pragma warning(disable : 5244) #endif -extern "C++" { #include #include #include @@ -41,4 +40,3 @@ extern "C++" { #include #include #include -} \ No newline at end of file From f68b9f925df241a6f188c4ebaf71e8e0beee5fa6 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 18:14:27 +0100 Subject: [PATCH 48/69] Whole-lib modularization --- include/boost/core/addressof.hpp | 27 ++++-- include/boost/core/alignof.hpp | 7 +- include/boost/core/alloc_construct.hpp | 29 ++++-- include/boost/core/allocator_access.hpp | 97 ++++++++++--------- include/boost/core/allocator_traits.hpp | 11 ++- include/boost/core/checked_delete.hpp | 19 +++- include/boost/core/cmath.hpp | 74 ++++++++------ include/boost/core/data.hpp | 27 ++++-- include/boost/core/default_allocator.hpp | 24 +++-- include/boost/core/detail/minstd_rand.hpp | 10 ++ include/boost/core/detail/static_assert.hpp | 2 +- include/boost/core/empty_value.hpp | 17 +++- include/boost/core/exchange.hpp | 19 +++- include/boost/core/explicit_operator_bool.hpp | 5 + include/boost/core/fclose_deleter.hpp | 13 ++- include/boost/core/first_scalar.hpp | 15 ++- include/boost/core/functor.hpp | 12 ++- include/boost/core/identity.hpp | 13 ++- include/boost/core/ignore_unused.hpp | 47 +++++---- include/boost/core/invoke_swap.hpp | 17 +++- include/boost/core/launder.hpp | 17 +++- include/boost/core/make_span.hpp | 21 ++-- include/boost/core/max_align.hpp | 16 ++- include/boost/core/memory_resource.hpp | 17 +++- include/boost/core/no_exceptions_support.hpp | 5 + include/boost/core/noinit_adaptor.hpp | 17 +++- include/boost/core/noncopyable.hpp | 13 ++- include/boost/core/null_deleter.hpp | 11 ++- include/boost/core/nvp.hpp | 18 +++- include/boost/core/pointer_in_range.hpp | 14 ++- include/boost/core/pointer_traits.hpp | 19 +++- include/boost/core/quick_exit.hpp | 5 + include/boost/core/ref.hpp | 27 ++++-- include/boost/core/scoped_enum.hpp | 5 + include/boost/core/serialization.hpp | 7 +- include/boost/core/size.hpp | 21 +++- include/boost/core/snprintf.hpp | 5 + include/boost/core/span.hpp | 37 ++++--- include/boost/core/swap.hpp | 12 ++- include/boost/core/typeinfo.hpp | 11 ++- include/boost/core/uncaught_exceptions.hpp | 5 + include/boost/core/underlying_type.hpp | 13 ++- include/boost/core/use_default.hpp | 12 ++- .../boost/core/verbose_terminate_handler.hpp | 20 +++- include/boost/core/yield_primitives.hpp | 5 + modules/boost_core.cppm | 37 ++++++- 46 files changed, 650 insertions(+), 225 deletions(-) diff --git a/include/boost/core/addressof.hpp b/include/boost/core/addressof.hpp index 5473c36a5..b77580175 100644 --- a/include/boost/core/addressof.hpp +++ b/include/boost/core/addressof.hpp @@ -14,6 +14,17 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_ADDRESSOF_HPP #define BOOST_CORE_ADDRESSOF_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + +// RP TODO: BOOST_CORE_HAS_BUILTIN_ADDRESSOF + +#include #include #if defined(BOOST_MSVC_FULL_VER) && BOOST_MSVC_FULL_VER >= 190024215 @@ -33,7 +44,7 @@ Distributed under the Boost Software License, Version 1.0. namespace boost { -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR inline T* addressof(T& o) BOOST_NOEXCEPT { @@ -43,7 +54,7 @@ addressof(T& o) BOOST_NOEXCEPT } /* boost */ #else #include -#include +#include namespace boost { namespace detail { @@ -143,7 +154,7 @@ struct addrof_result { } /* detail */ -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE typename boost::detail::addrof_result::type addressof(T (&o)[N]) BOOST_NOEXCEPT { @@ -152,14 +163,14 @@ addressof(T (&o)[N]) BOOST_NOEXCEPT #endif #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE T (*addressof(T (&o)[N]) BOOST_NOEXCEPT)[N] { return reinterpret_cast(&o); } -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE const T (*addressof(const T (&o)[N]) BOOST_NOEXCEPT)[N] { @@ -250,7 +261,7 @@ addressof(T& o) BOOST_NOEXCEPT } /* detail */ -template +BOOST_CORE_MODULE_EXPORT template constexpr BOOST_FORCEINLINE T* addressof(T& o) BOOST_NOEXCEPT { @@ -265,10 +276,12 @@ addressof(T& o) BOOST_NOEXCEPT !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) namespace boost { -template +BOOST_CORE_MODULE_EXPORT template const T* addressof(const T&&) = delete; } /* boost */ #endif #endif + +#endif diff --git a/include/boost/core/alignof.hpp b/include/boost/core/alignof.hpp index 07ff4447f..712a65b6f 100644 --- a/include/boost/core/alignof.hpp +++ b/include/boost/core/alignof.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_ALIGNOF_HPP_INCLUDED) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_ALIGNOF_HPP_INCLUDED #define BOOST_CORE_ALIGNOF_HPP_INCLUDED @@ -12,7 +17,7 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#include +#include #if !defined(BOOST_NO_CXX11_ALIGNOF) diff --git a/include/boost/core/alloc_construct.hpp b/include/boost/core/alloc_construct.hpp index 075d3cb36..294bd518a 100644 --- a/include/boost/core/alloc_construct.hpp +++ b/include/boost/core/alloc_construct.hpp @@ -8,28 +8,35 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_ALLOC_CONSTRUCT_HPP #define BOOST_CORE_ALLOC_CONSTRUCT_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + /* This functionality is now in . */ #include +#include namespace boost { -template +BOOST_CORE_MODULE_EXPORT template inline void alloc_destroy(A& a, T* p) { boost::allocator_destroy(a, p); } -template +BOOST_CORE_MODULE_EXPORT template inline void alloc_destroy_n(A& a, T* p, std::size_t n) { boost::allocator_destroy_n(a, p, n); } -template +BOOST_CORE_MODULE_EXPORT template inline void alloc_construct(A& a, T* p) { @@ -38,7 +45,7 @@ alloc_construct(A& a, T* p) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -template +BOOST_CORE_MODULE_EXPORT template inline void alloc_construct(A& a, T* p, U&& u, V&&... v) { @@ -46,7 +53,7 @@ alloc_construct(A& a, T* p, U&& u, V&&... v) std::forward(v)...); } #else -template +BOOST_CORE_MODULE_EXPORT template inline void alloc_construct(A& a, T* p, U&& u) { @@ -54,14 +61,14 @@ alloc_construct(A& a, T* p, U&& u) } #endif #else -template +BOOST_CORE_MODULE_EXPORT template inline void alloc_construct(A& a, T* p, const U& u) { boost::allocator_construct(a, p, u); } -template +BOOST_CORE_MODULE_EXPORT template inline void alloc_construct(A& a, T* p, U& u) { @@ -69,21 +76,21 @@ alloc_construct(A& a, T* p, U& u) } #endif -template +BOOST_CORE_MODULE_EXPORT template inline void alloc_construct_n(A& a, T* p, std::size_t n) { boost::allocator_construct_n(a, p, n); } -template +BOOST_CORE_MODULE_EXPORT template inline void alloc_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m) { boost::allocator_construct_n(a, p, n, l, m); } -template +BOOST_CORE_MODULE_EXPORT template inline void alloc_construct_n(A& a, T* p, std::size_t n, I b) { @@ -93,3 +100,5 @@ alloc_construct_n(A& a, T* p, std::size_t n, I b) } /* boost */ #endif + +#endif diff --git a/include/boost/core/allocator_access.hpp b/include/boost/core/allocator_access.hpp index 0f0ed325b..2981323ee 100644 --- a/include/boost/core/allocator_access.hpp +++ b/include/boost/core/allocator_access.hpp @@ -8,15 +8,22 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_ALLOCATOR_ACCESS_HPP #define BOOST_CORE_ALLOCATOR_ACCESS_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include #include -#include -#include +#include +#include #if !defined(BOOST_NO_CXX11_ALLOCATOR) -#include +#include #endif #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -#include +#include #endif #if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 40300) @@ -58,7 +65,7 @@ _STL_DISABLE_DEPRECATED_WARNING namespace boost { -template +BOOST_CORE_MODULE_EXPORT template struct allocator_value_type { typedef typename A::value_type type; }; @@ -83,7 +90,7 @@ struct alloc_ptr +BOOST_CORE_MODULE_EXPORT template struct allocator_pointer { typedef typename detail::alloc_ptr::type type; }; @@ -105,7 +112,7 @@ struct alloc_const_ptr +BOOST_CORE_MODULE_EXPORT template struct allocator_const_pointer { typedef typename detail::alloc_const_ptr::type type; }; @@ -151,7 +158,7 @@ struct alloc_rebind +BOOST_CORE_MODULE_EXPORT template struct allocator_rebind { typedef typename detail::alloc_rebind::type type; }; @@ -173,7 +180,7 @@ struct alloc_void_ptr +BOOST_CORE_MODULE_EXPORT template struct allocator_void_pointer { typedef typename detail::alloc_void_ptr::type type; }; @@ -195,7 +202,7 @@ struct alloc_const_void_ptr +BOOST_CORE_MODULE_EXPORT template struct allocator_const_void_pointer { typedef typename detail::alloc_const_void_ptr::type type; }; @@ -216,7 +223,7 @@ struct alloc_diff_type +BOOST_CORE_MODULE_EXPORT template struct allocator_difference_type { typedef typename detail::alloc_diff_type::type type; }; @@ -244,7 +251,7 @@ struct alloc_size_type +BOOST_CORE_MODULE_EXPORT template struct allocator_size_type { typedef typename detail::alloc_size_type::type type; }; @@ -290,7 +297,7 @@ struct alloc_pocca +BOOST_CORE_MODULE_EXPORT template struct allocator_propagate_on_container_copy_assignment { typedef typename detail::alloc_pocca::type type; }; @@ -311,7 +318,7 @@ struct alloc_pocma +BOOST_CORE_MODULE_EXPORT template struct allocator_propagate_on_container_move_assignment { typedef typename detail::alloc_pocma::type type; }; @@ -331,7 +338,7 @@ struct alloc_pocs +BOOST_CORE_MODULE_EXPORT template struct allocator_propagate_on_container_swap { typedef typename detail::alloc_pocs::type type; }; @@ -363,19 +370,19 @@ struct alloc_equal +BOOST_CORE_MODULE_EXPORT template struct allocator_is_always_equal { typedef typename detail::alloc_equal::type type; }; -template +BOOST_CORE_MODULE_EXPORT template inline typename allocator_pointer::type allocator_allocate(A& a, typename allocator_size_type::type n) { return a.allocate(n); } -template +BOOST_CORE_MODULE_EXPORT template inline void allocator_deallocate(A& a, typename allocator_pointer::type p, typename allocator_size_type::type n) @@ -416,7 +423,7 @@ class alloc_has_allocate { } /* detail */ -template +BOOST_CORE_MODULE_EXPORT template inline typename std::enable_if::value, typename allocator_pointer::type>::type allocator_allocate(A& a, typename allocator_size_type::type n, @@ -425,7 +432,7 @@ allocator_allocate(A& a, typename allocator_size_type::type n, return a.allocate(n, h); } -template +BOOST_CORE_MODULE_EXPORT template inline typename std::enable_if::value, typename allocator_pointer::type>::type allocator_allocate(A& a, typename allocator_size_type::type n, @@ -521,7 +528,7 @@ allocator_construct(A&, T* p, V& v) } #endif #else -template +BOOST_CORE_MODULE_EXPORT template inline typename std::enable_if::value>::type allocator_construct(A& a, T* p, Args&&... args) @@ -529,7 +536,7 @@ allocator_construct(A& a, T* p, Args&&... args) a.construct(p, std::forward(args)...); } -template +BOOST_CORE_MODULE_EXPORT template inline typename std::enable_if::value>::type allocator_construct(A&, T* p, Args&&... args) @@ -568,14 +575,14 @@ class alloc_has_destroy { } /* detail */ -template +BOOST_CORE_MODULE_EXPORT template inline typename detail::alloc_if::value>::type allocator_destroy(A& a, T* p) { a.destroy(p); } -template +BOOST_CORE_MODULE_EXPORT template inline typename detail::alloc_if::value>::type allocator_destroy(A&, T* p) { @@ -628,7 +635,7 @@ class alloc_has_max_size { } /* detail */ -template +BOOST_CORE_MODULE_EXPORT template inline typename detail::alloc_if::value, typename allocator_size_type::type>::type allocator_max_size(const A& a) BOOST_NOEXCEPT @@ -636,7 +643,7 @@ allocator_max_size(const A& a) BOOST_NOEXCEPT return a.max_size(); } -template +BOOST_CORE_MODULE_EXPORT template inline typename detail::alloc_if::value, typename allocator_size_type::type>::type allocator_max_size(const A&) BOOST_NOEXCEPT @@ -686,21 +693,21 @@ class alloc_has_soccc { } /* detail */ -template +BOOST_CORE_MODULE_EXPORT template inline typename detail::alloc_if::value, A>::type allocator_select_on_container_copy_construction(const A& a) { return a.select_on_container_copy_construction(); } -template +BOOST_CORE_MODULE_EXPORT template inline typename detail::alloc_if::value, A>::type allocator_select_on_container_copy_construction(const A& a) { return a; } -template +BOOST_CORE_MODULE_EXPORT template inline void allocator_destroy_n(A& a, T* p, std::size_t n) { @@ -736,7 +743,7 @@ class alloc_destroyer { } /* detail */ -template +BOOST_CORE_MODULE_EXPORT template inline void allocator_construct_n(A& a, T* p, std::size_t n) { @@ -747,7 +754,7 @@ allocator_construct_n(A& a, T* p, std::size_t n) d.size() = 0; } -template +BOOST_CORE_MODULE_EXPORT template inline void allocator_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m) { @@ -758,7 +765,7 @@ allocator_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m) d.size() = 0; } -template +BOOST_CORE_MODULE_EXPORT template inline void allocator_construct_n(A& a, T* p, std::size_t n, I b) { @@ -770,46 +777,46 @@ allocator_construct_n(A& a, T* p, std::size_t n, I b) } #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) -template +BOOST_CORE_MODULE_EXPORT template using allocator_value_type_t = typename allocator_value_type::type; -template +BOOST_CORE_MODULE_EXPORT template using allocator_pointer_t = typename allocator_pointer::type; -template +BOOST_CORE_MODULE_EXPORT template using allocator_const_pointer_t = typename allocator_const_pointer::type; -template +BOOST_CORE_MODULE_EXPORT template using allocator_void_pointer_t = typename allocator_void_pointer::type; -template +BOOST_CORE_MODULE_EXPORT template using allocator_const_void_pointer_t = typename allocator_const_void_pointer::type; -template +BOOST_CORE_MODULE_EXPORT template using allocator_difference_type_t = typename allocator_difference_type::type; -template +BOOST_CORE_MODULE_EXPORT template using allocator_size_type_t = typename allocator_size_type::type; -template +BOOST_CORE_MODULE_EXPORT template using allocator_propagate_on_container_copy_assignment_t = typename allocator_propagate_on_container_copy_assignment::type; -template +BOOST_CORE_MODULE_EXPORT template using allocator_propagate_on_container_move_assignment_t = typename allocator_propagate_on_container_move_assignment::type; -template +BOOST_CORE_MODULE_EXPORT template using allocator_propagate_on_container_swap_t = typename allocator_propagate_on_container_swap::type; -template +BOOST_CORE_MODULE_EXPORT template using allocator_is_always_equal_t = typename allocator_is_always_equal::type; -template +BOOST_CORE_MODULE_EXPORT template using allocator_rebind_t = typename allocator_rebind::type; #endif @@ -832,3 +839,5 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP #endif #endif + +#endif diff --git a/include/boost/core/allocator_traits.hpp b/include/boost/core/allocator_traits.hpp index bf8749d8c..f30e5ea3c 100644 --- a/include/boost/core/allocator_traits.hpp +++ b/include/boost/core/allocator_traits.hpp @@ -8,11 +8,18 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_ALLOCATOR_TRAITS_HPP #define BOOST_CORE_ALLOCATOR_TRAITS_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include namespace boost { -template +BOOST_CORE_MODULE_EXPORT template struct allocator_traits { typedef A allocator_type; @@ -110,3 +117,5 @@ struct allocator_traits { } /* boost */ #endif + +#endif diff --git a/include/boost/core/checked_delete.hpp b/include/boost/core/checked_delete.hpp index 67f3c7428..732909143 100644 --- a/include/boost/core/checked_delete.hpp +++ b/include/boost/core/checked_delete.hpp @@ -7,6 +7,15 @@ # pragma once #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + +#include #include // @@ -28,7 +37,7 @@ namespace boost // verify that types are complete for increased safety -template inline void checked_delete(T * x) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT template inline void checked_delete(T * x) BOOST_NOEXCEPT { #if defined(__cpp_static_assert) && __cpp_static_assert >= 200410L @@ -44,7 +53,7 @@ template inline void checked_delete(T * x) BOOST_NOEXCEPT delete x; } -template inline void checked_array_delete(T * x) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT template inline void checked_array_delete(T * x) BOOST_NOEXCEPT { #if defined(__cpp_static_assert) && __cpp_static_assert >= 200410L @@ -89,9 +98,11 @@ template struct checked_array_deleter } // namespace checked_deleters -using checked_deleters::checked_deleter; -using checked_deleters::checked_array_deleter; +BOOST_CORE_MODULE_EXPORT using checked_deleters::checked_deleter; +BOOST_CORE_MODULE_EXPORT using checked_deleters::checked_array_deleter; } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_CHECKED_DELETE_HPP diff --git a/include/boost/core/cmath.hpp b/include/boost/core/cmath.hpp index 9cfe26e1f..4717d6dc6 100644 --- a/include/boost/core/cmath.hpp +++ b/include/boost/core/cmath.hpp @@ -16,14 +16,21 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include +#include #if defined(BOOST_CORE_USE_GENERIC_CMATH) || (!defined(_MSC_VER) && !defined(FP_SUBNORMAL)) #include #include -#include -#include +#include +#include namespace boost { @@ -32,35 +39,35 @@ namespace core // fpclassify return values -int const fp_zero = 0; -int const fp_subnormal = 1; -int const fp_normal = 2; -int const fp_infinite = 3; -int const fp_nan = 4; +BOOST_CORE_MODULE_EXPORT int const fp_zero = 0; +BOOST_CORE_MODULE_EXPORT int const fp_subnormal = 1; +BOOST_CORE_MODULE_EXPORT int const fp_normal = 2; +BOOST_CORE_MODULE_EXPORT int const fp_infinite = 3; +BOOST_CORE_MODULE_EXPORT int const fp_nan = 4; // Classification functions -template bool isfinite( T x ) +BOOST_CORE_MODULE_EXPORT template bool isfinite( T x ) { return x <= (std::numeric_limits::max)() && x >= -(std::numeric_limits::max)(); } -template bool isinf( T x ) +BOOST_CORE_MODULE_EXPORT template bool isinf( T x ) { return x > (std::numeric_limits::max)() || x < -(std::numeric_limits::max)(); } -template bool isnan( T x ) +BOOST_CORE_MODULE_EXPORT template bool isnan( T x ) { return !isfinite( x ) && !isinf( x ); } -template bool isnormal( T x ) +BOOST_CORE_MODULE_EXPORT template bool isnormal( T x ) { return isfinite( x ) && ( x >= (std::numeric_limits::min)() || x <= -(std::numeric_limits::min)() ); } -template int fpclassify( T x ) +BOOST_CORE_MODULE_EXPORT template int fpclassify( T x ) { if( x == 0 ) return fp_zero; @@ -77,7 +84,7 @@ template int fpclassify( T x ) // Sign manipulation functions -inline bool signbit( float x ) +BOOST_CORE_MODULE_EXPORT inline bool signbit( float x ) { boost::int32_t y; @@ -88,7 +95,7 @@ inline bool signbit( float x ) return y < 0; } -inline bool signbit( double x ) +BOOST_CORE_MODULE_EXPORT inline bool signbit( double x ) { boost::int64_t y; @@ -99,12 +106,12 @@ inline bool signbit( double x ) return y < 0; } -inline bool signbit( long double x ) +BOOST_CORE_MODULE_EXPORT inline bool signbit( long double x ) { return signbit( static_cast( x ) ); } -template T copysign( T x, T y ) +BOOST_CORE_MODULE_EXPORT template T copysign( T x, T y ) { return signbit( x ) == signbit( y )? x: -x; } @@ -115,6 +122,11 @@ template T copysign( T x, T y ) #else // defined(BOOST_CORE_USE_GENERIC_CMATH) #if defined(_MSC_VER) && _MSC_VER < 1800 +// This MSVC version shouldn't support modules. +// Guard the include, just in case. +# ifdef BOOST_USE_MODULES +# error "Your compiler is not supported with BOOST_USE_MODULES" +# endif # include #endif @@ -235,25 +247,25 @@ inline int fpclassify( long double x ) #else -using std::isfinite; -using std::isnan; -using std::isinf; -using std::isnormal; -using std::fpclassify; +BOOST_CORE_MODULE_EXPORT using std::isfinite; +BOOST_CORE_MODULE_EXPORT using std::isnan; +BOOST_CORE_MODULE_EXPORT using std::isinf; +BOOST_CORE_MODULE_EXPORT using std::isnormal; +BOOST_CORE_MODULE_EXPORT using std::fpclassify; -int const fp_zero = FP_ZERO; -int const fp_subnormal = FP_SUBNORMAL; -int const fp_normal = FP_NORMAL; -int const fp_infinite = FP_INFINITE; -int const fp_nan = FP_NAN; +BOOST_CORE_MODULE_EXPORT int const fp_zero = FP_ZERO; +BOOST_CORE_MODULE_EXPORT int const fp_subnormal = FP_SUBNORMAL; +BOOST_CORE_MODULE_EXPORT int const fp_normal = FP_NORMAL; +BOOST_CORE_MODULE_EXPORT int const fp_infinite = FP_INFINITE; +BOOST_CORE_MODULE_EXPORT int const fp_nan = FP_NAN; -using std::signbit; +BOOST_CORE_MODULE_EXPORT using std::signbit; // std::copysign doesn't exist in libstdc++ under -std=c++03 #if !defined(__GNUC__) -template T copysign( T x, T y ) +BOOST_CORE_MODULE_EXPORT template T copysign( T x, T y ) { return std::copysign( x, y ); } @@ -282,7 +294,7 @@ inline long double copysign_impl( long double x, long double y ) } // namespace detail -template T copysign( T x, T y ) +BOOST_CORE_MODULE_EXPORT template T copysign( T x, T y ) { return boost::core::detail::copysign_impl( x, y ); } @@ -295,4 +307,6 @@ template T copysign( T x, T y ) #endif // defined(BOOST_CORE_USE_GENERIC_CMATH) +#endif + #endif // #ifndef BOOST_CORE_CMATH_HPP_INCLUDED diff --git a/include/boost/core/data.hpp b/include/boost/core/data.hpp index 03ac5228f..52c1c0223 100644 --- a/include/boost/core/data.hpp +++ b/include/boost/core/data.hpp @@ -8,46 +8,55 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_DATA_HPP #define BOOST_CORE_DATA_HPP -#include +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + +#include +#include // Note: MSVC doesn't define __cpp_lib_nonmember_container_access but supports the feature even in C++14 mode #if (defined(__cpp_lib_nonmember_container_access) && (__cpp_lib_nonmember_container_access >= 201411l)) || \ (defined(_MSC_VER) && (_MSC_VER >= 1900)) namespace boost { -using std::data; +BOOST_CORE_MODULE_EXPORT using std::data; } /* boost */ #else // (defined(__cpp_lib_nonmember_container_access) ... -#include -#include +#include +#include namespace boost { template -inline constexpr auto +BOOST_CORE_MODULE_EXPORT inline constexpr auto data(C& c) noexcept(noexcept(c.data())) -> decltype(c.data()) { return c.data(); } template -inline constexpr auto +BOOST_CORE_MODULE_EXPORT inline constexpr auto data(const C& c) noexcept(noexcept(c.data())) -> decltype(c.data()) { return c.data(); } template -inline constexpr T* +BOOST_CORE_MODULE_EXPORT inline constexpr T* data(T(&a)[N]) noexcept { return a; } template -inline constexpr const T* +BOOST_CORE_MODULE_EXPORT inline constexpr const T* data(std::initializer_list l) noexcept { return l.begin(); @@ -58,3 +67,5 @@ data(std::initializer_list l) noexcept #endif // (defined(__cpp_lib_nonmember_container_access) ... #endif + +#endif diff --git a/include/boost/core/default_allocator.hpp b/include/boost/core/default_allocator.hpp index 6640473f0..4fe64ccd3 100644 --- a/include/boost/core/default_allocator.hpp +++ b/include/boost/core/default_allocator.hpp @@ -8,13 +8,23 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_DEFAULT_ALLOCATOR_HPP #define BOOST_CORE_DEFAULT_ALLOCATOR_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + +#include #include -#include -#include +#include +#include namespace boost { -#if defined(BOOST_NO_EXCEPTIONS) +// Avoid throw_exception from being attached to Boost.Core in module builds +#if defined(BOOST_NO_EXCEPTIONS) && !defined(BOOST_USE_MODULES) BOOST_NORETURN void throw_exception(const std::exception&); #endif @@ -134,7 +144,7 @@ struct default_allocator { #endif }; -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR inline bool operator==(const default_allocator&, const default_allocator&) BOOST_NOEXCEPT @@ -142,7 +152,7 @@ operator==(const default_allocator&, return true; } -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR inline bool operator!=(const default_allocator&, const default_allocator&) BOOST_NOEXCEPT @@ -152,8 +162,10 @@ operator!=(const default_allocator&, } /* default_ */ -using default_::default_allocator; +BOOST_CORE_MODULE_EXPORT using default_::default_allocator; } /* boost */ #endif + +#endif diff --git a/include/boost/core/detail/minstd_rand.hpp b/include/boost/core/detail/minstd_rand.hpp index bedafb288..611b5c456 100644 --- a/include/boost/core/detail/minstd_rand.hpp +++ b/include/boost/core/detail/minstd_rand.hpp @@ -1,6 +1,14 @@ #ifndef BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED #define BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + // Copyright 2017 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. @@ -55,4 +63,6 @@ class minstd_rand } // namespace detail } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED diff --git a/include/boost/core/detail/static_assert.hpp b/include/boost/core/detail/static_assert.hpp index f62f7671b..ca71b7bae 100644 --- a/include/boost/core/detail/static_assert.hpp +++ b/include/boost/core/detail/static_assert.hpp @@ -12,7 +12,7 @@ #else #include -#include +#include namespace boost { diff --git a/include/boost/core/empty_value.hpp b/include/boost/core/empty_value.hpp index 5eeee51f9..ce6823c76 100644 --- a/include/boost/core/empty_value.hpp +++ b/include/boost/core/empty_value.hpp @@ -8,9 +8,16 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_EMPTY_VALUE_HPP #define BOOST_CORE_EMPTY_VALUE_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -#include +#include #endif #if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 40700) @@ -43,7 +50,7 @@ struct use_empty_value_base { }; }; -struct empty_init_t { }; +BOOST_CORE_MODULE_EXPORT struct empty_init_t { }; namespace empty_ { @@ -190,9 +197,9 @@ class empty_value } /* empty_ */ -using empty_::empty_value; +BOOST_CORE_MODULE_EXPORT using empty_::empty_value; -BOOST_INLINE_CONSTEXPR empty_init_t empty_init = empty_init_t(); +BOOST_CORE_MODULE_EXPORT BOOST_INLINE_CONSTEXPR empty_init_t empty_init = empty_init_t(); } /* boost */ @@ -201,3 +208,5 @@ BOOST_INLINE_CONSTEXPR empty_init_t empty_init = empty_init_t(); #endif #endif + +#endif diff --git a/include/boost/core/exchange.hpp b/include/boost/core/exchange.hpp index bc8a9fcd7..8302e91c0 100644 --- a/include/boost/core/exchange.hpp +++ b/include/boost/core/exchange.hpp @@ -8,16 +8,25 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_EXCHANGE_HPP #define BOOST_CORE_EXCHANGE_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + +#include #include #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #include -#include +#include #endif namespace boost { #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -template +BOOST_CORE_MODULE_EXPORT template inline T exchange(T& t, const U& u) { T v = t; @@ -26,7 +35,7 @@ inline T exchange(T& t, const U& u) } #else #if BOOST_WORKAROUND(BOOST_MSVC, < 1800) -template +BOOST_CORE_MODULE_EXPORT template inline T exchange(T& t, U&& u) { T v = std::move(t); @@ -34,7 +43,7 @@ inline T exchange(T& t, U&& u) return v; } #else -template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR inline T exchange(T& t, U&& u) { T v = std::move(t); @@ -47,3 +56,5 @@ BOOST_CXX14_CONSTEXPR inline T exchange(T& t, U&& u) } /* boost */ #endif + +#endif diff --git a/include/boost/core/explicit_operator_bool.hpp b/include/boost/core/explicit_operator_bool.hpp index d689f114d..2e2449504 100644 --- a/include/boost/core/explicit_operator_bool.hpp +++ b/include/boost/core/explicit_operator_bool.hpp @@ -15,6 +15,11 @@ * C++11. */ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP #define BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP diff --git a/include/boost/core/fclose_deleter.hpp b/include/boost/core/fclose_deleter.hpp index 7a31cb15b..24a71d35f 100644 --- a/include/boost/core/fclose_deleter.hpp +++ b/include/boost/core/fclose_deleter.hpp @@ -17,7 +17,14 @@ #ifndef BOOST_CORE_FCLOSE_DELETER_HPP #define BOOST_CORE_FCLOSE_DELETER_HPP -#include +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include +#include #include #ifdef BOOST_HAS_PRAGMA_ONCE @@ -46,8 +53,10 @@ struct fclose_deleter } // namespace fclose_deleter_ns -using fclose_deleter_ns::fclose_deleter; +BOOST_CORE_MODULE_EXPORT using fclose_deleter_ns::fclose_deleter; } // namespace boost +#endif + #endif // BOOST_CORE_FCLOSE_DELETER_HPP diff --git a/include/boost/core/first_scalar.hpp b/include/boost/core/first_scalar.hpp index 5373542e0..2fd319004 100644 --- a/include/boost/core/first_scalar.hpp +++ b/include/boost/core/first_scalar.hpp @@ -8,8 +8,15 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_FIRST_SCALAR_HPP #define BOOST_CORE_FIRST_SCALAR_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include -#include +#include namespace boost { namespace detail { @@ -26,14 +33,14 @@ struct make_scalar { } /* detail */ -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR inline T* first_scalar(T* p) BOOST_NOEXCEPT { return p; } -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR inline typename detail::make_scalar::type* first_scalar(T (*p)[N]) BOOST_NOEXCEPT { @@ -43,3 +50,5 @@ first_scalar(T (*p)[N]) BOOST_NOEXCEPT } /* boost */ #endif + +#endif diff --git a/include/boost/core/functor.hpp b/include/boost/core/functor.hpp index f3ee11b98..5a8fcbf72 100644 --- a/include/boost/core/functor.hpp +++ b/include/boost/core/functor.hpp @@ -16,6 +16,14 @@ #ifndef BOOST_CORE_FUNCTOR_HPP #define BOOST_CORE_FUNCTOR_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include + namespace boost::core { // Block unintended ADL @@ -34,8 +42,10 @@ struct functor } // namespace functor_ns -using functor_ns::functor; +BOOST_CORE_MODULE_EXPORT using functor_ns::functor; } // namespace boost::core +#endif + #endif // BOOST_CORE_FUNCTOR_HPP diff --git a/include/boost/core/identity.hpp b/include/boost/core/identity.hpp index f27733be5..533396181 100644 --- a/include/boost/core/identity.hpp +++ b/include/boost/core/identity.hpp @@ -8,14 +8,21 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_IDENTITY_HPP #define BOOST_CORE_IDENTITY_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -#include +#include #endif namespace boost { -struct identity { +BOOST_CORE_MODULE_EXPORT struct identity { typedef void is_transparent; #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) @@ -59,3 +66,5 @@ struct identity { } /* boost */ #endif + +#endif diff --git a/include/boost/core/ignore_unused.hpp b/include/boost/core/ignore_unused.hpp index 7c4a99787..f067590aa 100644 --- a/include/boost/core/ignore_unused.hpp +++ b/include/boost/core/ignore_unused.hpp @@ -7,6 +7,15 @@ #ifndef BOOST_CORE_IGNORE_UNUSED_HPP #define BOOST_CORE_IGNORE_UNUSED_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + +#include #include namespace boost { @@ -15,81 +24,81 @@ namespace boost { #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(Ts&& ...) {} #else -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(Ts const& ...) {} #endif -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused() {} #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1&) {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&) {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1&, T2&) {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&) {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1&, T2&, T3&) {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&) {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1&, T2&, T3&, T4&) {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&) {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1&, T2&, T3&, T4&, T5&) {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&, T5 const&) {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused() {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused() {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused() {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused() {} -template +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused() {} @@ -97,4 +106,6 @@ BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused() } // namespace boost +#endif + #endif // BOOST_CORE_IGNORE_UNUSED_HPP diff --git a/include/boost/core/invoke_swap.hpp b/include/boost/core/invoke_swap.hpp index 805628955..988551d2e 100644 --- a/include/boost/core/invoke_swap.hpp +++ b/include/boost/core/invoke_swap.hpp @@ -21,14 +21,21 @@ // to avoid forming an infinite recursion when the arguments are not // swappable. +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include #include #if __cplusplus >= 201103L || defined(BOOST_DINKUMWARE_STDLIB) -#include // for std::swap (C++11) +#include // for std::swap (C++11) #else -#include // for std::swap (C++98) +#include // for std::swap (C++98) #endif -#include // for std::size_t +#include // for std::size_t #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once @@ -76,7 +83,7 @@ inline void invoke_swap_impl(T (& left)[N], T (& right)[N]) namespace boost { namespace core { -template +BOOST_CORE_MODULE_EXPORT template BOOST_GPU_ENABLED inline typename enable_if_c< !::boost_swap_impl::is_const::value >::type invoke_swap(T& left, T& right) @@ -90,4 +97,6 @@ invoke_swap(T& left, T& right) #undef BOOST_CORE_SWAP_NOEXCEPT_IF +#endif + #endif // BOOST_CORE_INVOKE_SWAP_HPP diff --git a/include/boost/core/launder.hpp b/include/boost/core/launder.hpp index 9ec5e7ee9..26fc03789 100644 --- a/include/boost/core/launder.hpp +++ b/include/boost/core/launder.hpp @@ -11,6 +11,13 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include #if defined(__has_builtin) @@ -27,7 +34,7 @@ #elif (BOOST_CXX_VERSION >= 201703L) && !defined(BOOST_CORE_HAS_BUILTIN_LAUNDER) -#include +#include #if defined(__cpp_lib_launder) # define BOOST_CORE_HAS_STD_LAUNDER @@ -42,21 +49,21 @@ namespace core #if defined(BOOST_CORE_HAS_BUILTIN_LAUNDER) -template T* launder( T* p ) +BOOST_CORE_MODULE_EXPORT template T* launder( T* p ) { return __builtin_launder( p ); } #elif defined(BOOST_CORE_HAS_STD_LAUNDER) -template T* launder( T* p ) +BOOST_CORE_MODULE_EXPORT template T* launder( T* p ) { return std::launder( p ); } #else -template T* launder( T* p ) +BOOST_CORE_MODULE_EXPORT template T* launder( T* p ) { return p; } @@ -66,4 +73,6 @@ template T* launder( T* p ) } // namespace core } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_LAUNDER_HPP_INCLUDED diff --git a/include/boost/core/make_span.hpp b/include/boost/core/make_span.hpp index 5f5df5631..957c0b666 100644 --- a/include/boost/core/make_span.hpp +++ b/include/boost/core/make_span.hpp @@ -8,46 +8,53 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_MAKE_SPAN_HPP #define BOOST_CORE_MAKE_SPAN_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include namespace boost { -template +BOOST_CORE_MODULE_EXPORT template inline constexpr span make_span(I* f, std::size_t c) noexcept { return span(f, c); } -template +BOOST_CORE_MODULE_EXPORT template inline constexpr span make_span(I* f, I* l) noexcept { return span(f, l); } -template +BOOST_CORE_MODULE_EXPORT template inline constexpr span make_span(T(&a)[N]) noexcept { return span(a); } -template +BOOST_CORE_MODULE_EXPORT template inline constexpr span make_span(std::array& a) noexcept { return span(a); } -template +BOOST_CORE_MODULE_EXPORT template inline constexpr span make_span(const std::array& a) noexcept { return span(a); } -template +BOOST_CORE_MODULE_EXPORT template inline span::type> make_span(R&& r) { @@ -57,3 +64,5 @@ make_span(R&& r) } /* boost */ #endif + +#endif diff --git a/include/boost/core/max_align.hpp b/include/boost/core/max_align.hpp index a5806d4ba..829d5b0bd 100644 --- a/include/boost/core/max_align.hpp +++ b/include/boost/core/max_align.hpp @@ -11,9 +11,17 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + + #include #include -#include +#include +#include // BOOST_CORE_HAS_FLOAT128 @@ -38,7 +46,7 @@ namespace boost namespace core { -union max_align_t +BOOST_CORE_MODULE_EXPORT union max_align_t { char c; short s; @@ -74,9 +82,11 @@ union max_align_t void (max_align_t::*pmf)(); }; -BOOST_CONSTEXPR_OR_CONST std::size_t max_align = BOOST_CORE_ALIGNOF( max_align_t ); +BOOST_CORE_MODULE_EXPORT BOOST_CONSTEXPR_OR_CONST std::size_t max_align = BOOST_CORE_ALIGNOF( max_align_t ); } // namespace core } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_MAX_ALIGN_HPP_INCLUDED diff --git a/include/boost/core/memory_resource.hpp b/include/boost/core/memory_resource.hpp index 0432f6f96..2298c59c1 100644 --- a/include/boost/core/memory_resource.hpp +++ b/include/boost/core/memory_resource.hpp @@ -11,10 +11,17 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + #include #include #include -#include +#include +#include // Define our own placement new to avoid the inclusion of // (~9K extra lines) at Ion Gaztanhaga's request. @@ -52,7 +59,7 @@ namespace boost namespace core { -class memory_resource +BOOST_CORE_MODULE_EXPORT class memory_resource { public: @@ -92,12 +99,12 @@ class memory_resource virtual bool do_is_equal( memory_resource const & other ) const BOOST_NOEXCEPT = 0; }; -inline bool operator==( memory_resource const& a, memory_resource const& b ) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT inline bool operator==( memory_resource const& a, memory_resource const& b ) BOOST_NOEXCEPT { return &a == &b || a.is_equal( b ); } -inline bool operator!=( memory_resource const& a, memory_resource const& b ) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT inline bool operator!=( memory_resource const& a, memory_resource const& b ) BOOST_NOEXCEPT { return !( a == b ); } @@ -105,4 +112,6 @@ inline bool operator!=( memory_resource const& a, memory_resource const& b ) BOO } // namespace core } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_MEMORY_RESOURCE_HPP_INCLUDED diff --git a/include/boost/core/no_exceptions_support.hpp b/include/boost/core/no_exceptions_support.hpp index 1278e8568..fa5242304 100644 --- a/include/boost/core/no_exceptions_support.hpp +++ b/include/boost/core/no_exceptions_support.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_NO_EXCEPTIONS_SUPPORT_HPP) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_NO_EXCEPTIONS_SUPPORT_HPP #define BOOST_CORE_NO_EXCEPTIONS_SUPPORT_HPP diff --git a/include/boost/core/noinit_adaptor.hpp b/include/boost/core/noinit_adaptor.hpp index 623e3ea4b..b929230c2 100644 --- a/include/boost/core/noinit_adaptor.hpp +++ b/include/boost/core/noinit_adaptor.hpp @@ -8,11 +8,18 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_NOINIT_ADAPTOR_HPP #define BOOST_CORE_NOINIT_ADAPTOR_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include namespace boost { -template +BOOST_CORE_MODULE_EXPORT template struct noinit_adaptor : A { typedef void _default_construct_destroy; @@ -62,7 +69,7 @@ struct noinit_adaptor } }; -template +BOOST_CORE_MODULE_EXPORT template inline bool operator==(const noinit_adaptor& lhs, const noinit_adaptor& rhs) BOOST_NOEXCEPT @@ -70,7 +77,7 @@ operator==(const noinit_adaptor& lhs, return static_cast(lhs) == static_cast(rhs); } -template +BOOST_CORE_MODULE_EXPORT template inline bool operator!=(const noinit_adaptor& lhs, const noinit_adaptor& rhs) BOOST_NOEXCEPT @@ -78,7 +85,7 @@ operator!=(const noinit_adaptor& lhs, return !(lhs == rhs); } -template +BOOST_CORE_MODULE_EXPORT template inline noinit_adaptor noinit_adapt(const A& a) BOOST_NOEXCEPT { @@ -88,3 +95,5 @@ noinit_adapt(const A& a) BOOST_NOEXCEPT } /* boost */ #endif + +#endif diff --git a/include/boost/core/noncopyable.hpp b/include/boost/core/noncopyable.hpp index 4ec2d54fa..a21197c4d 100644 --- a/include/boost/core/noncopyable.hpp +++ b/include/boost/core/noncopyable.hpp @@ -9,6 +9,15 @@ #ifndef BOOST_CORE_NONCOPYABLE_HPP #define BOOST_CORE_NONCOPYABLE_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + +#include #include namespace boost { @@ -56,8 +65,10 @@ namespace noncopyable_ // protection from unintended ADL }; } -typedef noncopyable_::noncopyable noncopyable; +BOOST_CORE_MODULE_EXPORT typedef noncopyable_::noncopyable noncopyable; } // namespace boost +#endif + #endif // BOOST_CORE_NONCOPYABLE_HPP diff --git a/include/boost/core/null_deleter.hpp b/include/boost/core/null_deleter.hpp index 08b6a3d48..13ba7fa53 100644 --- a/include/boost/core/null_deleter.hpp +++ b/include/boost/core/null_deleter.hpp @@ -19,6 +19,13 @@ #ifndef BOOST_CORE_NULL_DELETER_HPP #define BOOST_CORE_NULL_DELETER_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include #ifdef BOOST_HAS_PRAGMA_ONCE @@ -44,8 +51,10 @@ struct null_deleter } // namespace null_deleter_ns -using null_deleter_ns::null_deleter; +BOOST_CORE_MODULE_EXPORT using null_deleter_ns::null_deleter; } // namespace boost +#endif + #endif // BOOST_CORE_NULL_DELETER_HPP diff --git a/include/boost/core/nvp.hpp b/include/boost/core/nvp.hpp index 8826a5929..c233e1b63 100644 --- a/include/boost/core/nvp.hpp +++ b/include/boost/core/nvp.hpp @@ -8,13 +8,20 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_NVP_HPP #define BOOST_CORE_NVP_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include #include namespace boost { namespace serialization { -template +BOOST_CORE_MODULE_EXPORT template class nvp { public: nvp(const char* n, T& v) BOOST_NOEXCEPT @@ -38,7 +45,7 @@ class nvp { T* v_; }; -template +BOOST_CORE_MODULE_EXPORT template inline const nvp make_nvp(const char* n, T& v) BOOST_NOEXCEPT { @@ -47,11 +54,14 @@ make_nvp(const char* n, T& v) BOOST_NOEXCEPT } /* serialization */ -using serialization::nvp; -using serialization::make_nvp; +BOOST_CORE_MODULE_EXPORT using serialization::nvp; +BOOST_CORE_MODULE_EXPORT using serialization::make_nvp; } /* boost */ +#endif // defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +// Export the macro even in builds with modules #define BOOST_NVP(v) boost::make_nvp(BOOST_STRINGIZE(v), v) #endif diff --git a/include/boost/core/pointer_in_range.hpp b/include/boost/core/pointer_in_range.hpp index 4957ff858..74a845146 100644 --- a/include/boost/core/pointer_in_range.hpp +++ b/include/boost/core/pointer_in_range.hpp @@ -9,7 +9,6 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_CORE_POINTER_IN_RANGE_HPP #include -#include #if !defined(BOOST_NO_CXX14_CONSTEXPR) #if defined(BOOST_MSVC) && BOOST_MSVC >= 1925 @@ -25,9 +24,18 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_CORE_NO_CONSTEXPR_POINTER_IN_RANGE #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include +#include + namespace boost { -template +BOOST_CORE_MODULE_EXPORT template inline BOOST_CONSTEXPR bool pointer_in_range(const T* p, const T* b, const T* e) { @@ -46,4 +54,6 @@ pointer_in_range(const T* p, const T* b, const T* e) } /* boost */ +#endif // defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + #endif diff --git a/include/boost/core/pointer_traits.hpp b/include/boost/core/pointer_traits.hpp index 7de7a8e97..3a8271432 100644 --- a/include/boost/core/pointer_traits.hpp +++ b/include/boost/core/pointer_traits.hpp @@ -8,9 +8,16 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_POINTER_TRAITS_HPP #define BOOST_CORE_POINTER_TRAITS_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include #include -#include +#include namespace boost { namespace detail { @@ -209,7 +216,7 @@ struct ptr_traits { }; } /* detail */ -template +BOOST_CORE_MODULE_EXPORT template struct pointer_traits : detail::ptr_traits::type> { }; @@ -231,7 +238,7 @@ struct pointer_traits #endif }; -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR inline T* to_address(T* v) BOOST_NOEXCEPT { @@ -265,14 +272,14 @@ ptr_address(const T& v, long) BOOST_NOEXCEPT } /* detail */ -template +BOOST_CORE_MODULE_EXPORT template inline auto to_address(const T& v) BOOST_NOEXCEPT { return boost::detail::ptr_address(v, 0); } #else -template +BOOST_CORE_MODULE_EXPORT template inline typename pointer_traits::element_type* to_address(const T& v) BOOST_NOEXCEPT { @@ -283,3 +290,5 @@ to_address(const T& v) BOOST_NOEXCEPT } /* boost */ #endif + +#endif diff --git a/include/boost/core/quick_exit.hpp b/include/boost/core/quick_exit.hpp index ff1bda366..48d30a064 100644 --- a/include/boost/core/quick_exit.hpp +++ b/include/boost/core/quick_exit.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_QUICK_EXIT_HPP_INCLUDED) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_QUICK_EXIT_HPP_INCLUDED #define BOOST_CORE_QUICK_EXIT_HPP_INCLUDED diff --git a/include/boost/core/ref.hpp b/include/boost/core/ref.hpp index d29a4d6fb..012735e73 100644 --- a/include/boost/core/ref.hpp +++ b/include/boost/core/ref.hpp @@ -1,6 +1,13 @@ #ifndef BOOST_CORE_REF_HPP #define BOOST_CORE_REF_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include #include #include @@ -78,7 +85,7 @@ struct ref_empty usually allows the function templates to work on references unmodified. */ -template class reference_wrapper +BOOST_CORE_MODULE_EXPORT template class reference_wrapper { public: /** @@ -172,7 +179,7 @@ template class reference_wrapper @return `reference_wrapper(t)` @remark Does not throw. */ -template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST ref( T & t ) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST ref( T & t ) BOOST_NOEXCEPT { #if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 ) @@ -191,7 +198,7 @@ template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST ref( T @return `reference_wrapper(t)` @remark Does not throw. */ -template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST cref( T const & t ) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST cref( T const & t ) BOOST_NOEXCEPT { return reference_wrapper(t); } @@ -215,12 +222,12 @@ template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST c /** @remark Construction from a temporary object is disabled. */ -template void ref(T const&&) BOOST_REF_DELETE; +BOOST_CORE_MODULE_EXPORT template void ref(T const&&) BOOST_REF_DELETE; /** @remark Construction from a temporary object is disabled. */ -template void cref(T const&&) BOOST_REF_DELETE; +BOOST_CORE_MODULE_EXPORT template void cref(T const&&) BOOST_REF_DELETE; #undef BOOST_REF_DELETE @@ -235,7 +242,7 @@ template void cref(T const&&) BOOST_REF_DELETE; The value static constant will be true if the type `T` is a specialization of `reference_wrapper`. */ -template struct is_reference_wrapper +BOOST_CORE_MODULE_EXPORT template struct is_reference_wrapper { BOOST_STATIC_CONSTANT( bool, value = false ); }; @@ -280,7 +287,7 @@ template struct is_reference_wrapper< reference_wrapper const vol The `typedef` type is `T::type` if `T` is a `reference_wrapper`, `T` otherwise. */ -template struct unwrap_reference +BOOST_CORE_MODULE_EXPORT template struct unwrap_reference { typedef T type; }; @@ -322,7 +329,7 @@ template struct unwrap_reference< reference_wrapper const volatil @return `unwrap_reference::type&(t)` @remark Does not throw. */ -template BOOST_FORCEINLINE typename unwrap_reference::type& unwrap_ref( T & t ) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE typename unwrap_reference::type& unwrap_ref( T & t ) BOOST_NOEXCEPT { return t; } @@ -332,7 +339,7 @@ template BOOST_FORCEINLINE typename unwrap_reference::type& unwrap_r /** @cond */ -template BOOST_FORCEINLINE T* get_pointer( reference_wrapper const & r ) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT template BOOST_FORCEINLINE T* get_pointer( reference_wrapper const & r ) BOOST_NOEXCEPT { return r.get_pointer(); } @@ -342,4 +349,6 @@ template BOOST_FORCEINLINE T* get_pointer( reference_wrapper const & } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_REF_HPP diff --git a/include/boost/core/scoped_enum.hpp b/include/boost/core/scoped_enum.hpp index 9267455de..97375f2a5 100644 --- a/include/boost/core/scoped_enum.hpp +++ b/include/boost/core/scoped_enum.hpp @@ -7,6 +7,11 @@ // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_SCOPED_ENUM_HPP) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_SCOPED_ENUM_HPP #define BOOST_CORE_SCOPED_ENUM_HPP diff --git a/include/boost/core/serialization.hpp b/include/boost/core/serialization.hpp index 9c78c5828..f7dc6532c 100644 --- a/include/boost/core/serialization.hpp +++ b/include/boost/core/serialization.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_SERIALIZATION_HPP_INCLUDED) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_SERIALIZATION_HPP_INCLUDED #define BOOST_CORE_SERIALIZATION_HPP_INCLUDED @@ -15,7 +20,7 @@ // without including a Boost.Serialization header #include -#include +#include namespace boost { diff --git a/include/boost/core/size.hpp b/include/boost/core/size.hpp index dd04daa1a..98e052372 100644 --- a/include/boost/core/size.hpp +++ b/include/boost/core/size.hpp @@ -8,31 +8,40 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_SIZE_HPP #define BOOST_CORE_SIZE_HPP -#include +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + +#include +#include // Note: MSVC doesn't define __cpp_lib_nonmember_container_access but supports the feature even in C++14 mode #if (defined(__cpp_lib_nonmember_container_access) && (__cpp_lib_nonmember_container_access >= 201411l)) || \ (defined(_MSC_VER) && (_MSC_VER >= 1900)) namespace boost { -using std::size; +BOOST_CORE_MODULE_EXPORT using std::size; } /* boost */ #else // (defined(__cpp_lib_nonmember_container_access) ... -#include +#include namespace boost { template -inline constexpr auto +BOOST_CORE_MODULE_EXPORT inline constexpr auto size(const C& c) noexcept(noexcept(c.size())) -> decltype(c.size()) { return c.size(); } template -inline constexpr std::size_t +BOOST_CORE_MODULE_EXPORT inline constexpr std::size_t size(T(&)[N]) noexcept { return N; @@ -43,3 +52,5 @@ size(T(&)[N]) noexcept #endif // (defined(__cpp_lib_nonmember_container_access) ... #endif + +#endif diff --git a/include/boost/core/snprintf.hpp b/include/boost/core/snprintf.hpp index 91e252b4c..371342cac 100644 --- a/include/boost/core/snprintf.hpp +++ b/include/boost/core/snprintf.hpp @@ -13,6 +13,11 @@ * as well as \c wchar_t counterparts. */ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_SNPRINTF_HPP_INCLUDED_) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_SNPRINTF_HPP_INCLUDED_ #define BOOST_CORE_SNPRINTF_HPP_INCLUDED_ diff --git a/include/boost/core/span.hpp b/include/boost/core/span.hpp index 01446596b..bcfc57cfc 100644 --- a/include/boost/core/span.hpp +++ b/include/boost/core/span.hpp @@ -8,17 +8,26 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_SPAN_HPP #define BOOST_CORE_SPAN_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + +#include #include #include -#include -#include -#include +#include +#include +#include namespace boost { -constexpr std::size_t dynamic_extent = static_cast(-1); +BOOST_CORE_MODULE_EXPORT constexpr std::size_t dynamic_extent = static_cast(-1); -template +BOOST_CORE_MODULE_EXPORT template class span; namespace detail { @@ -368,27 +377,27 @@ constexpr std::size_t span::extent; #endif #ifdef __cpp_deduction_guides -template +BOOST_CORE_MODULE_EXPORT template span(I*, L) -> span; -template +BOOST_CORE_MODULE_EXPORT template span(T(&)[N]) -> span; -template +BOOST_CORE_MODULE_EXPORT template span(std::array&) -> span; -template +BOOST_CORE_MODULE_EXPORT template span(const std::array&) -> span; -template +BOOST_CORE_MODULE_EXPORT template span(R&&) -> span::type>; -template +BOOST_CORE_MODULE_EXPORT template span(span) -> span; #endif #ifdef __cpp_lib_byte -template +BOOST_CORE_MODULE_EXPORT template inline span::value> as_bytes(span s) noexcept { @@ -397,7 +406,7 @@ as_bytes(span s) noexcept s.size_bytes()); } -template +BOOST_CORE_MODULE_EXPORT template inline typename std::enable_if::value, span::value> >::type as_writable_bytes(span s) noexcept @@ -410,3 +419,5 @@ as_writable_bytes(span s) noexcept } /* boost */ #endif + +#endif diff --git a/include/boost/core/swap.hpp b/include/boost/core/swap.hpp index 4696c4412..88fe3f2a2 100644 --- a/include/boost/core/swap.hpp +++ b/include/boost/core/swap.hpp @@ -14,6 +14,14 @@ // avoid ambiguity when swapping objects of a Boost type that does // not have its own boost::swap overload. +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + + +#include #include #include #include @@ -27,7 +35,7 @@ BOOST_HEADER_DEPRECATED("boost/core/invoke_swap.hpp") namespace boost { - template + BOOST_CORE_MODULE_EXPORT template BOOST_GPU_ENABLED BOOST_DEPRECATED("This function is deprecated, use boost::core::invoke_swap instead.") inline typename enable_if_c< !boost_swap_impl::is_const::value && !boost_swap_impl::is_const::value >::type @@ -37,4 +45,6 @@ namespace boost } } +#endif + #endif // BOOST_CORE_SWAP_HPP diff --git a/include/boost/core/typeinfo.hpp b/include/boost/core/typeinfo.hpp index d33d29ba6..74358f7c8 100644 --- a/include/boost/core/typeinfo.hpp +++ b/include/boost/core/typeinfo.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_TYPEINFO_HPP_INCLUDED) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_TYPEINFO_HPP_INCLUDED #define BOOST_CORE_TYPEINFO_HPP_INCLUDED @@ -20,8 +25,8 @@ #if defined( BOOST_NO_TYPEID ) #include -#include -#include +#include +#include namespace boost { @@ -133,7 +138,7 @@ template struct core_typeid_< T const volatile >: core_typeid_< T > #else #include -#include +#include namespace boost { diff --git a/include/boost/core/uncaught_exceptions.hpp b/include/boost/core/uncaught_exceptions.hpp index 380e81cd0..ad01d8b2a 100644 --- a/include/boost/core/uncaught_exceptions.hpp +++ b/include/boost/core/uncaught_exceptions.hpp @@ -16,6 +16,11 @@ * https://github.com/panaseleus/stack_unwinding/blob/master/boost/exception/uncaught_exception_count.hpp */ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED_) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED_ #define BOOST_CORE_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED_ diff --git a/include/boost/core/underlying_type.hpp b/include/boost/core/underlying_type.hpp index 7ecba313f..9d71981fe 100644 --- a/include/boost/core/underlying_type.hpp +++ b/include/boost/core/underlying_type.hpp @@ -11,11 +11,18 @@ #ifndef BOOST_CORE_UNDERLYING_TYPE_HPP #define BOOST_CORE_UNDERLYING_TYPE_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include #include // GCC 4.7 and later seem to provide std::underlying_type #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) || (defined(BOOST_GCC) && BOOST_GCC >= 40700 && defined(__GXX_EXPERIMENTAL_CXX0X__)) -#include +#include #define BOOST_DETAIL_HAS_STD_UNDERLYING_TYPE #endif @@ -68,7 +75,7 @@ struct underlying_type_impl * to deduce the underlying type of enums. The user is expected to specialize * this trait in this case. */ -template< typename EnumType > +BOOST_CORE_MODULE_EXPORT template< typename EnumType > struct underlying_type : public detail::underlying_type_impl< EnumType > { @@ -76,4 +83,6 @@ struct underlying_type : } // namespace boost +#endif + #endif // BOOST_CORE_UNDERLYING_TYPE_HPP diff --git a/include/boost/core/use_default.hpp b/include/boost/core/use_default.hpp index 9d9be79d8..0686dc52a 100644 --- a/include/boost/core/use_default.hpp +++ b/include/boost/core/use_default.hpp @@ -8,10 +8,20 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_USE_DEFAULT_HPP #define BOOST_CORE_USE_DEFAULT_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include + namespace boost { -struct use_default { }; +BOOST_CORE_MODULE_EXPORT struct use_default { }; } /* boost */ #endif + +#endif diff --git a/include/boost/core/verbose_terminate_handler.hpp b/include/boost/core/verbose_terminate_handler.hpp index b6074703c..c91d9cda9 100644 --- a/include/boost/core/verbose_terminate_handler.hpp +++ b/include/boost/core/verbose_terminate_handler.hpp @@ -11,20 +11,28 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + + +#include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace boost { namespace core { -BOOST_NORETURN inline void verbose_terminate_handler() +BOOST_CORE_MODULE_EXPORT BOOST_NORETURN inline void verbose_terminate_handler() { std::set_terminate( 0 ); @@ -85,4 +93,6 @@ BOOST_NORETURN inline void verbose_terminate_handler() } // namespace core } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_VERBOSE_TERMINATE_HANDLER_HPP_INCLUDED diff --git a/include/boost/core/yield_primitives.hpp b/include/boost/core/yield_primitives.hpp index 899453e5a..de9aea446 100644 --- a/include/boost/core/yield_primitives.hpp +++ b/include/boost/core/yield_primitives.hpp @@ -1,3 +1,8 @@ +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_YIELD_PRIMITIVES_HPP_INCLUDED) +# error "Please #include in your module global fragment" +#endif + #ifndef BOOST_CORE_YIELD_PRIMITIVES_HPP_INCLUDED #define BOOST_CORE_YIELD_PRIMITIVES_HPP_INCLUDED diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index e9410be6a..4fb25a39c 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -1,6 +1,8 @@ module; -#include // must be the 1st one to avoid conflicts with import std +#include // FP_xxx macros. Must be before import std to avoid conflicts +#include // stderr. Must be before import std to avoid conflicts +#include // must be before import std to avoid conflicts #include #if defined(_MSC_VER) #include @@ -40,3 +42,36 @@ import std; #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 +#include +#include +#include +#include +#include +#include +#include +#include +#include From 1d7f35caa6af0438cd7203288a1cdcce988808e3 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 18:20:02 +0100 Subject: [PATCH 49/69] clang fixes --- include/boost/core/checked_delete.hpp | 4 ++-- include/boost/core/default_allocator.hpp | 2 +- include/boost/core/empty_value.hpp | 4 ++-- include/boost/core/fclose_deleter.hpp | 2 +- include/boost/core/functor.hpp | 2 +- include/boost/core/null_deleter.hpp | 2 +- include/boost/core/swap.hpp | 12 +----------- modules/boost_core.cppm | 3 +-- 8 files changed, 10 insertions(+), 21 deletions(-) diff --git a/include/boost/core/checked_delete.hpp b/include/boost/core/checked_delete.hpp index 732909143..df6ebbb78 100644 --- a/include/boost/core/checked_delete.hpp +++ b/include/boost/core/checked_delete.hpp @@ -73,7 +73,7 @@ BOOST_CORE_MODULE_EXPORT template inline void checked_array_delete(T * namespace checked_deleters { -template struct checked_deleter +BOOST_CORE_MODULE_EXPORT template struct checked_deleter { typedef void result_type; typedef T * argument_type; @@ -85,7 +85,7 @@ template struct checked_deleter } }; -template struct checked_array_deleter +BOOST_CORE_MODULE_EXPORT template struct checked_array_deleter { typedef void result_type; typedef T * argument_type; diff --git a/include/boost/core/default_allocator.hpp b/include/boost/core/default_allocator.hpp index 4fe64ccd3..cd3895241 100644 --- a/include/boost/core/default_allocator.hpp +++ b/include/boost/core/default_allocator.hpp @@ -64,7 +64,7 @@ struct add_reference { typedef const void type; }; -template +BOOST_CORE_MODULE_EXPORT template struct default_allocator { typedef T value_type; typedef T* pointer; diff --git a/include/boost/core/empty_value.hpp b/include/boost/core/empty_value.hpp index ce6823c76..26468a950 100644 --- a/include/boost/core/empty_value.hpp +++ b/include/boost/core/empty_value.hpp @@ -54,7 +54,7 @@ BOOST_CORE_MODULE_EXPORT struct empty_init_t { }; namespace empty_ { -template::value> class empty_value { public: @@ -143,7 +143,7 @@ class empty_value_base } /* detail */ #endif -template +BOOST_CORE_MODULE_EXPORT template class empty_value #if defined(BOOST_MSVC) : detail::empty_value_base { diff --git a/include/boost/core/fclose_deleter.hpp b/include/boost/core/fclose_deleter.hpp index 24a71d35f..c463f0d09 100644 --- a/include/boost/core/fclose_deleter.hpp +++ b/include/boost/core/fclose_deleter.hpp @@ -37,7 +37,7 @@ namespace boost { namespace fclose_deleter_ns { //! A function object that closes a file -struct fclose_deleter +BOOST_CORE_MODULE_EXPORT struct fclose_deleter { //! Function object result type typedef void result_type; diff --git a/include/boost/core/functor.hpp b/include/boost/core/functor.hpp index 5a8fcbf72..8ad82fd94 100644 --- a/include/boost/core/functor.hpp +++ b/include/boost/core/functor.hpp @@ -30,7 +30,7 @@ namespace boost::core { namespace functor_ns { //! A function object that invokes a function specified as its template parameter -template< auto Function > +BOOST_CORE_MODULE_EXPORT template< auto Function > struct functor { template< typename... Args > diff --git a/include/boost/core/null_deleter.hpp b/include/boost/core/null_deleter.hpp index 13ba7fa53..f33528b59 100644 --- a/include/boost/core/null_deleter.hpp +++ b/include/boost/core/null_deleter.hpp @@ -38,7 +38,7 @@ namespace boost { namespace null_deleter_ns { //! A function object that does nothing and can be used as an empty deleter for \c shared_ptr -struct null_deleter +BOOST_CORE_MODULE_EXPORT struct null_deleter { //! Function object result type typedef void result_type; diff --git a/include/boost/core/swap.hpp b/include/boost/core/swap.hpp index 88fe3f2a2..4696c4412 100644 --- a/include/boost/core/swap.hpp +++ b/include/boost/core/swap.hpp @@ -14,14 +14,6 @@ // avoid ambiguity when swapping objects of a Boost type that does // not have its own boost::swap overload. -#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) -#ifndef BOOST_IN_MODULE_PURVIEW -import boost.core; -#endif -#else - - -#include #include #include #include @@ -35,7 +27,7 @@ BOOST_HEADER_DEPRECATED("boost/core/invoke_swap.hpp") namespace boost { - BOOST_CORE_MODULE_EXPORT template + template BOOST_GPU_ENABLED BOOST_DEPRECATED("This function is deprecated, use boost::core::invoke_swap instead.") inline typename enable_if_c< !boost_swap_impl::is_const::value && !boost_swap_impl::is_const::value >::type @@ -45,6 +37,4 @@ namespace boost } } -#endif - #endif // BOOST_CORE_SWAP_HPP diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 4fb25a39c..9af0761bf 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -15,6 +15,7 @@ module; #include #include #include +#include export module boost.core; @@ -55,7 +56,6 @@ import std; #include #include #include -#include #include #include #include @@ -67,7 +67,6 @@ import std; #include #include #include -#include #include #include #include From e90df1a313a79797cf24900cd7080c54e093f47b Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 19:04:51 +0100 Subject: [PATCH 50/69] Missing exports --- include/boost/core/demangle.hpp | 12 ++++++------ include/boost/core/detail/minstd_rand.hpp | 10 ---------- include/boost/core/lightweight_test_trait.hpp | 6 +++--- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/include/boost/core/demangle.hpp b/include/boost/core/demangle.hpp index f5416d9e6..646a0ac02 100644 --- a/include/boost/core/demangle.hpp +++ b/include/boost/core/demangle.hpp @@ -69,19 +69,19 @@ BOOST_CORE_MODULE_EXPORT class scoped_demangled_name #if defined( BOOST_CORE_HAS_CXXABI_H ) -inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT { int status = 0; std::size_t size = 0; return abi::__cxa_demangle( name, NULL, &size, &status ); } -inline void demangle_free( char const * name ) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT inline void demangle_free( char const * name ) BOOST_NOEXCEPT { std::free( const_cast< char* >( name ) ); } -inline std::string demangle( char const * name ) +BOOST_CORE_MODULE_EXPORT inline std::string demangle( char const * name ) { scoped_demangled_name demangled_name( name ); char const * p = demangled_name.get(); @@ -92,16 +92,16 @@ inline std::string demangle( char const * name ) #else -inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT { return name; } -inline void demangle_free( char const * ) BOOST_NOEXCEPT +BOOST_CORE_MODULE_EXPORT inline void demangle_free( char const * ) BOOST_NOEXCEPT { } -inline std::string demangle( char const * name ) +BOOST_CORE_MODULE_EXPORT inline std::string demangle( char const * name ) { return name; } diff --git a/include/boost/core/detail/minstd_rand.hpp b/include/boost/core/detail/minstd_rand.hpp index 611b5c456..bedafb288 100644 --- a/include/boost/core/detail/minstd_rand.hpp +++ b/include/boost/core/detail/minstd_rand.hpp @@ -1,14 +1,6 @@ #ifndef BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED #define BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED -#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) - -#ifndef BOOST_IN_MODULE_PURVIEW -import boost.core; -#endif - -#else - // Copyright 2017 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. @@ -63,6 +55,4 @@ class minstd_rand } // namespace detail } // namespace boost -#endif - #endif // #ifndef BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED diff --git a/include/boost/core/lightweight_test_trait.hpp b/include/boost/core/lightweight_test_trait.hpp index 20f1c116e..f0e046c3a 100644 --- a/include/boost/core/lightweight_test_trait.hpp +++ b/include/boost/core/lightweight_test_trait.hpp @@ -39,7 +39,7 @@ namespace boost namespace detail { -template< class T > inline void test_trait_impl( char const * trait, void (*)( T ), +BOOST_CORE_MODULE_EXPORT template< class T > inline void test_trait_impl( char const * trait, void (*)( T ), bool expected, char const * file, int line, char const * function ) { if( T::value == expected ) @@ -59,12 +59,12 @@ template< class T > inline void test_trait_impl( char const * trait, void (*)( T } } -template inline bool test_trait_same_impl_( T ) +BOOST_CORE_MODULE_EXPORT template inline bool test_trait_same_impl_( T ) { return T::value; } -template inline void test_trait_same_impl( char const * types, +BOOST_CORE_MODULE_EXPORT template inline void test_trait_same_impl( char const * types, boost::core::detail::is_same same, char const * file, int line, char const * function ) { if( test_trait_same_impl_( same ) ) From 06eed22fb648cb6db5140969ea6d736587241af2 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 19:04:58 +0100 Subject: [PATCH 51/69] More missing exports --- modules/boost_core.cppm | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 9af0761bf..8cebfafda 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -74,3 +74,4 @@ import std; #include #include #include +#include From 7a8c016a8e67fd3ba0672fcd5cf35f086c975c45 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 19:20:05 +0100 Subject: [PATCH 52/69] Test initial impl --- test/CMakeLists.txt | 8 +++++++ test/addressof_np_test.cpp | 2 +- test/addressof_test.cpp | 2 +- test/addressof_test2.cpp | 2 +- test/alignof_test.cpp | 15 +++++++++++- test/allocator_max_size_test.cpp | 2 +- test/allocator_pmr_test.cpp | 2 +- test/bit_byteswap_test_cx.cpp | 2 +- test/bit_cast_test.cpp | 2 +- test/bit_cast_test_cx.cpp | 3 ++- test/bit_ceil_test.cpp | 2 +- test/bit_countl_test.cpp | 2 +- test/bit_countr_test.cpp | 2 +- test/bit_countr_test_cx.cpp | 2 +- test/bit_endian_test.cpp | 2 +- test/bit_floor_test.cpp | 2 +- test/bit_popcount_test.cpp | 4 ++-- test/bit_rotate_test.cpp | 2 +- test/bit_rotate_test_cx.cpp | 2 +- test/bit_width_test.cpp | 2 +- test/cmath_test.cpp | 4 ++-- test/data_test.cpp | 2 +- test/default_allocator_test.cpp | 4 ++-- test/demangle_test.cpp | 4 ++-- test/demangled_name_test.cpp | 2 +- test/detail_iterator_test.cpp | 13 ++++++++++ test/eif_constructors.cpp | 15 +++++++++++- test/eif_lazy.cpp | 13 ++++++++++ test/eif_member_templates.cpp | 13 ++++++++++ test/eif_partial_specializations.cpp | 13 ++++++++++ test/fclose_deleter_test.cpp | 13 ++++++++++ test/functor_test.cpp | 2 +- test/get_pointer_test.cpp | 2 +- test/has_single_bit_test.cpp | 2 +- test/identity_rvalue_test.cpp | 8 +++---- test/identity_test.cpp | 8 +++---- test/ignore_unused_test.cpp | 1 + test/launder_test.cpp | 2 +- test/lightweight_test_all_eq_test.cpp | 4 ++-- test/lightweight_test_all_with_fail.cpp | 6 ++--- test/lightweight_test_all_with_test.cpp | 6 ++--- test/lightweight_test_bool.cpp | 2 +- test/lightweight_test_test.cpp | 2 +- test/lightweight_test_test3.cpp | 2 +- test/lightweight_test_with_fail.cpp | 2 +- test/lightweight_test_with_test.cpp | 2 +- test/max_align_test.cpp | 15 +++++++++++- test/memory_resource_test.cpp | 4 ++-- test/no_exceptions_support_test.cpp | 2 +- test/noinit_adaptor_test.cpp | 2 +- test/noncopyable_compile_fail.cpp | 2 +- test/serialization_construct_data_test.cpp | 6 ++--- test/serialization_nvp_test.cpp | 4 ++-- test/serialization_split_free_test.cpp | 4 ++-- test/serialization_split_member_test.cpp | 4 ++-- test/size_test.cpp | 2 +- test/snprintf_test.cpp | 4 ++-- test/sp_typeinfo_test.cpp | 2 +- test/span_boost_begin_test.cpp | 2 +- test/span_nonmem_data_size_test.cpp | 2 +- test/sv_common_reference_test.cpp | 6 ++--- test/sv_common_reference_test2.cpp | 5 ++-- test/sv_compare_test.cpp | 4 ++-- test/sv_construct_test.cpp | 8 +++---- test/sv_construct_test_cx.cpp | 2 +- test/sv_contains_test.cpp | 2 +- test/sv_conversion_test.cpp | 6 ++--- test/sv_conversion_test2.cpp | 15 +++++++++++- test/sv_copy_test.cpp | 4 ++-- test/sv_element_access_test.cpp | 2 +- test/sv_ends_with_test.cpp | 4 ++-- test/sv_eq_test.cpp | 6 ++--- test/sv_find_first_not_of_test.cpp | 4 ++-- test/sv_find_first_of_test.cpp | 4 ++-- test/sv_find_last_not_of_test.cpp | 4 ++-- test/sv_find_last_of_test.cpp | 4 ++-- test/sv_find_test.cpp | 2 +- test/sv_format_test.cpp | 4 ++-- test/sv_hash_test.cpp | 15 +++++++++++- test/sv_iteration_test.cpp | 4 ++-- test/sv_lt_test.cpp | 6 ++--- test/sv_modifiers_test.cpp | 2 +- test/sv_rfind_test.cpp | 2 +- test/sv_starts_with_test.cpp | 4 ++-- test/sv_stream_insert_test.cpp | 4 ++-- test/sv_substr_test.cpp | 4 ++-- test/sv_types_test.cpp | 2 +- test/swap/swap_array_of_array_of_class.cpp | 4 ++-- test/swap/swap_array_of_array_of_int.cpp | 4 ++-- test/swap/swap_array_of_class.cpp | 4 ++-- test/swap/swap_array_of_int.cpp | 4 ++-- test/swap/swap_array_of_template.cpp | 4 ++-- test/swap/swap_std_bitset.cpp | 2 +- test/swap/swap_std_dateorder.cpp | 2 +- test/swap/swap_std_string.cpp | 2 +- test/swap/swap_std_typeinfo_ptr.cpp | 2 +- test/swap/swap_std_vector_of_boost.cpp | 2 +- test/swap/swap_std_vector_of_global.cpp | 2 +- test/swap/swap_std_vector_of_other.cpp | 2 +- test/type_name_test.cpp | 28 +++++++++++----------- test/typeinfo_test.cpp | 2 +- test/verbose_terminate_handler_fail.cpp | 2 +- test/visit_each_test.cpp | 2 +- 103 files changed, 301 insertions(+), 160 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a6cdfdcc7..aaa1f4f4b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,6 +2,10 @@ # 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 +if(BOOST_USE_MODULES) +set(CMAKE_CXX_MODULE_STD ON) +endif() + include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) if(HAVE_BOOST_TEST) @@ -24,12 +28,16 @@ set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::config Boost::move Boost::smart boost_test(TYPE run SOURCES fclose_deleter_test.cpp) +# The serialization tests require building Boost libraries not modularized yet, +# which causes errors +if (NOT BOOST_USE_MODULES) set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::serialization) boost_test(TYPE run SOURCES serialization_nvp_test.cpp) boost_test(TYPE run SOURCES serialization_split_free_test.cpp) boost_test(TYPE run SOURCES serialization_split_member_test.cpp) boost_test(TYPE run SOURCES serialization_construct_data_test.cpp) +endif() set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) diff --git a/test/addressof_np_test.cpp b/test/addressof_np_test.cpp index 6e8f70695..bb94b57f5 100644 --- a/test/addressof_np_test.cpp +++ b/test/addressof_np_test.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #if defined( BOOST_NO_CXX11_NULLPTR ) diff --git a/test/addressof_test.cpp b/test/addressof_test.cpp index bf75aca58..ffe494893 100644 --- a/test/addressof_test.cpp +++ b/test/addressof_test.cpp @@ -14,7 +14,7 @@ #pragma warning(push, 3) #endif -#include +#include #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) #pragma warning(pop) diff --git a/test/addressof_test2.cpp b/test/addressof_test2.cpp index 3ad48f431..97e827051 100644 --- a/test/addressof_test2.cpp +++ b/test/addressof_test2.cpp @@ -16,7 +16,7 @@ #pragma warning(push, 3) #endif -#include +#include #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) #pragma warning(pop) diff --git a/test/alignof_test.cpp b/test/alignof_test.cpp index 6468a79db..bc5511511 100644 --- a/test/alignof_test.cpp +++ b/test/alignof_test.cpp @@ -2,11 +2,22 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.TypeTraits and can't be run with C++20 modules yet\n"); +} + +#else + #include #include #include #include -#include +#include template struct struct_of { @@ -96,3 +107,5 @@ int main() return boost::report_errors(); } + +#endif \ No newline at end of file diff --git a/test/allocator_max_size_test.cpp b/test/allocator_max_size_test.cpp index b2837f119..3e337958e 100644 --- a/test/allocator_max_size_test.cpp +++ b/test/allocator_max_size_test.cpp @@ -7,7 +7,7 @@ Distributed under the Boost Software License, Version 1.0. */ #include #include -#include +#include template struct A1 { diff --git a/test/allocator_pmr_test.cpp b/test/allocator_pmr_test.cpp index 96def0343..145a52038 100644 --- a/test/allocator_pmr_test.cpp +++ b/test/allocator_pmr_test.cpp @@ -12,7 +12,7 @@ #include #ifndef BOOST_NO_CXX17_HDR_MEMORY_RESOURCE -#include +#include void pmr_allocator_destroy_compiles(std::pmr::polymorphic_allocator& alloc, int* p) { diff --git a/test/bit_byteswap_test_cx.cpp b/test/bit_byteswap_test_cx.cpp index 384d87b54..351d79fd9 100644 --- a/test/bit_byteswap_test_cx.cpp +++ b/test/bit_byteswap_test_cx.cpp @@ -18,7 +18,7 @@ BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_MSVC is " BOOST_STRINGIZE(BOOS #else #include -#include +#include #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) diff --git a/test/bit_cast_test.cpp b/test/bit_cast_test.cpp index 3d3408ff0..d8d7b07da 100644 --- a/test/bit_cast_test.cpp +++ b/test/bit_cast_test.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include int main() { diff --git a/test/bit_cast_test_cx.cpp b/test/bit_cast_test_cx.cpp index 1f1853507..336f5b450 100644 --- a/test/bit_cast_test_cx.cpp +++ b/test/bit_cast_test_cx.cpp @@ -14,7 +14,8 @@ BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_NO_CXX11_CONSTEXPR is defined" ) -#elif !defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST) +// BOOST_CORE_HAS_BUILTIN_BIT_CAST is not public, but should be defined in every compiler that supports BOOST_USE_MODULES +#elif !defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST) && !defined(BOOST_USE_MODULES) BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_CORE_HAS_BUILTIN_BIT_CAST is not defined" ) diff --git a/test/bit_ceil_test.cpp b/test/bit_ceil_test.cpp index 94cbfc00e..fd9e99649 100644 --- a/test/bit_ceil_test.cpp +++ b/test/bit_ceil_test.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include template void test_bit_ceil( T x ) { diff --git a/test/bit_countl_test.cpp b/test/bit_countl_test.cpp index fe6e3b5b0..7a9c4b33f 100644 --- a/test/bit_countl_test.cpp +++ b/test/bit_countl_test.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include template void test_countl( T x ) { diff --git a/test/bit_countr_test.cpp b/test/bit_countr_test.cpp index ab9bd0639..7dc117a9d 100644 --- a/test/bit_countr_test.cpp +++ b/test/bit_countr_test.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include template void test_countr( T x ) { diff --git a/test/bit_countr_test_cx.cpp b/test/bit_countr_test_cx.cpp index 3548ac5fa..1fa843bef 100644 --- a/test/bit_countr_test_cx.cpp +++ b/test/bit_countr_test_cx.cpp @@ -22,7 +22,7 @@ BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_MSVC is " BOOST_STRINGIZE(BOOS #else #include -#include +#include #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) diff --git a/test/bit_endian_test.cpp b/test/bit_endian_test.cpp index 06f415ea8..d60120a5c 100644 --- a/test/bit_endian_test.cpp +++ b/test/bit_endian_test.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #if defined(_MSC_VER) # pragma warning(disable: 4127) // conditional expression is constant diff --git a/test/bit_floor_test.cpp b/test/bit_floor_test.cpp index 04dc720f0..37961dca2 100644 --- a/test/bit_floor_test.cpp +++ b/test/bit_floor_test.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include template void test_bit_floor( T x ) { diff --git a/test/bit_popcount_test.cpp b/test/bit_popcount_test.cpp index cf8ee870f..7ecfa9435 100644 --- a/test/bit_popcount_test.cpp +++ b/test/bit_popcount_test.cpp @@ -8,8 +8,8 @@ #include #include #include -#include -#include +#include +#include template void test_popcount( T x ) { diff --git a/test/bit_rotate_test.cpp b/test/bit_rotate_test.cpp index d31c5e9f5..19b941179 100644 --- a/test/bit_rotate_test.cpp +++ b/test/bit_rotate_test.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include int const M = 256; diff --git a/test/bit_rotate_test_cx.cpp b/test/bit_rotate_test_cx.cpp index eff6f4bff..b2b741ae4 100644 --- a/test/bit_rotate_test_cx.cpp +++ b/test/bit_rotate_test_cx.cpp @@ -14,7 +14,7 @@ BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_NO_CXX14_CONSTEXPR is defined" #else #include -#include +#include #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) diff --git a/test/bit_width_test.cpp b/test/bit_width_test.cpp index 8f84ac57f..11e7d6660 100644 --- a/test/bit_width_test.cpp +++ b/test/bit_width_test.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include template void test_width( T x ) { diff --git a/test/cmath_test.cpp b/test/cmath_test.cpp index 20b0aab23..a3a6c77d0 100644 --- a/test/cmath_test.cpp +++ b/test/cmath_test.cpp @@ -4,12 +4,12 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include // floating-point macros. Should appear before anything that might import std #include #include #include #include -#include -#include +#include template void test_positive_normal( T x ) { diff --git a/test/data_test.cpp b/test/data_test.cpp index 9849a9e3a..26418cd44 100644 --- a/test/data_test.cpp +++ b/test/data_test.cpp @@ -9,7 +9,7 @@ Distributed under the Boost Software License, Version 1.0. #if !defined(BOOST_NO_CXX11_CONSTEXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) #include #include -#include +#include class range { public: diff --git a/test/default_allocator_test.cpp b/test/default_allocator_test.cpp index 041c52ad9..f3347f2e6 100644 --- a/test/default_allocator_test.cpp +++ b/test/default_allocator_test.cpp @@ -7,8 +7,8 @@ Distributed under the Boost Software License, Version 1.0. */ #include #include -#include -#include +#include +#include class type { public: diff --git a/test/demangle_test.cpp b/test/demangle_test.cpp index 0656ed553..f5f9a0f33 100644 --- a/test/demangle_test.cpp +++ b/test/demangle_test.cpp @@ -10,8 +10,8 @@ // #include -#include -#include +#include +#include template struct Y1 { diff --git a/test/demangled_name_test.cpp b/test/demangled_name_test.cpp index fce328341..4c18283d2 100644 --- a/test/demangled_name_test.cpp +++ b/test/demangled_name_test.cpp @@ -9,7 +9,7 @@ // #include -#include +#include template struct Y1 { diff --git a/test/detail_iterator_test.cpp b/test/detail_iterator_test.cpp index bafb47625..5c2fadd3e 100644 --- a/test/detail_iterator_test.cpp +++ b/test/detail_iterator_test.cpp @@ -8,6 +8,17 @@ // http://www.boost.org/LICENSE_1_0.txt // +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.TypeTraits and can't be run with C++20 modules yet\n"); +} + +#else + #define BOOST_ALLOW_DEPRECATED_HEADERS #include #include @@ -147,3 +158,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/eif_constructors.cpp b/test/eif_constructors.cpp index 0cd3a9740..1013150c6 100644 --- a/test/eif_constructors.cpp +++ b/test/eif_constructors.cpp @@ -10,10 +10,21 @@ // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.TypeTraits and can't be run with C++20 modules yet\n"); +} + +#else + #include #include #include -#include +#include using boost::enable_if; using boost::disable_if; @@ -59,3 +70,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/eif_lazy.cpp b/test/eif_lazy.cpp index fdb37e381..7fdbeaa73 100644 --- a/test/eif_lazy.cpp +++ b/test/eif_lazy.cpp @@ -10,6 +10,17 @@ // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.Utility/enable_if and Boost.TypeTraits and can't be run with C++20 modules yet\n"); +} + +#else + #include #include #include @@ -79,3 +90,5 @@ int main() return boost::report_errors(); } +#endif + diff --git a/test/eif_member_templates.cpp b/test/eif_member_templates.cpp index 545273378..3404ff3f1 100644 --- a/test/eif_member_templates.cpp +++ b/test/eif_member_templates.cpp @@ -10,6 +10,17 @@ // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.TypeTraits and can't be run with C++20 modules yet\n"); +} + +#else + #include #include #include @@ -40,3 +51,5 @@ int main() return boost::report_errors(); } +#endif + diff --git a/test/eif_partial_specializations.cpp b/test/eif_partial_specializations.cpp index 6940eca37..70ecf6a4e 100644 --- a/test/eif_partial_specializations.cpp +++ b/test/eif_partial_specializations.cpp @@ -10,6 +10,17 @@ // Jeremiah Willcock (jewillco at osl.iu.edu) // Andrew Lumsdaine (lums at osl.iu.edu) +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.TypeTraits and can't be run with C++20 modules yet\n"); +} + +#else + #include #include #include @@ -87,3 +98,5 @@ int main() return boost::report_errors(); } +#endif + diff --git a/test/fclose_deleter_test.cpp b/test/fclose_deleter_test.cpp index 436333564..5a594423a 100644 --- a/test/fclose_deleter_test.cpp +++ b/test/fclose_deleter_test.cpp @@ -12,6 +12,17 @@ * This file contains tests for \c boost::fclose_deleter. */ +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.SmartPtr and can't be run with C++20 modules yet\n"); +} + +#else + #include #include #include @@ -71,3 +82,5 @@ int main() std::remove(filename); } + +#endif diff --git a/test/functor_test.cpp b/test/functor_test.cpp index 873e5b0ae..4e12ac033 100644 --- a/test/functor_test.cpp +++ b/test/functor_test.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #if (defined(__cpp_lib_is_invocable) && (__cpp_lib_is_invocable >= 201703l)) || \ (defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (BOOST_CXX_VERSION >= 201703l)) diff --git a/test/get_pointer_test.cpp b/test/get_pointer_test.cpp index 4bccccb6c..a057e9980 100644 --- a/test/get_pointer_test.cpp +++ b/test/get_pointer_test.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include struct X { diff --git a/test/has_single_bit_test.cpp b/test/has_single_bit_test.cpp index 221f8c7ba..1b7c01b06 100644 --- a/test/has_single_bit_test.cpp +++ b/test/has_single_bit_test.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include template void test_single_bit( T x ) { diff --git a/test/identity_rvalue_test.cpp b/test/identity_rvalue_test.cpp index 5cd4e9b81..7afd20572 100644 --- a/test/identity_rvalue_test.cpp +++ b/test/identity_rvalue_test.cpp @@ -9,10 +9,10 @@ Distributed under the Boost Software License, Version 1.0. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #include #include -#include -#include -#include -#include +#include +#include +#include +#include bool test(std::string&&) { diff --git a/test/identity_test.cpp b/test/identity_test.cpp index e82e450ba..2278c8ba4 100644 --- a/test/identity_test.cpp +++ b/test/identity_test.cpp @@ -7,10 +7,10 @@ Distributed under the Boost Software License, Version 1.0. */ #include #include -#include -#include -#include -#include +#include +#include +#include +#include bool test(std::string&) { diff --git a/test/ignore_unused_test.cpp b/test/ignore_unused_test.cpp index 67bdd800d..bd0197344 100644 --- a/test/ignore_unused_test.cpp +++ b/test/ignore_unused_test.cpp @@ -5,6 +5,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #include +#include BOOST_CXX14_CONSTEXPR int test_fun(int a) { diff --git a/test/launder_test.cpp b/test/launder_test.cpp index 98adcfb41..af3499754 100644 --- a/test/launder_test.cpp +++ b/test/launder_test.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include struct X { diff --git a/test/lightweight_test_all_eq_test.cpp b/test/lightweight_test_all_eq_test.cpp index 46254e757..df586bb9f 100644 --- a/test/lightweight_test_all_eq_test.cpp +++ b/test/lightweight_test_all_eq_test.cpp @@ -8,8 +8,8 @@ // http://www.boost.org/LICENSE_1_0.txt // -#include -#include +#include +#include #include int main() diff --git a/test/lightweight_test_all_with_fail.cpp b/test/lightweight_test_all_with_fail.cpp index 9a4a4293d..d81d39647 100644 --- a/test/lightweight_test_all_with_fail.cpp +++ b/test/lightweight_test_all_with_fail.cpp @@ -8,9 +8,9 @@ // http://www.boost.org/LICENSE_1_0.txt // -#include -#include -#include +#include +#include +#include #include int fail_vector() diff --git a/test/lightweight_test_all_with_test.cpp b/test/lightweight_test_all_with_test.cpp index bc078a41d..d976242f8 100644 --- a/test/lightweight_test_all_with_test.cpp +++ b/test/lightweight_test_all_with_test.cpp @@ -8,9 +8,9 @@ // http://www.boost.org/LICENSE_1_0.txt // -#include -#include -#include +#include +#include +#include #include void test_vector() diff --git a/test/lightweight_test_bool.cpp b/test/lightweight_test_bool.cpp index bb178711f..d35e9e89c 100644 --- a/test/lightweight_test_bool.cpp +++ b/test/lightweight_test_bool.cpp @@ -3,7 +3,7 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#include +#include int main() { diff --git a/test/lightweight_test_test.cpp b/test/lightweight_test_test.cpp index 7460af9a4..c3a77c168 100644 --- a/test/lightweight_test_test.cpp +++ b/test/lightweight_test_test.cpp @@ -15,7 +15,7 @@ #endif #include -#include +#include struct X { diff --git a/test/lightweight_test_test3.cpp b/test/lightweight_test_test3.cpp index cda641aa0..e3da6a765 100644 --- a/test/lightweight_test_test3.cpp +++ b/test/lightweight_test_test3.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include // EQ diff --git a/test/lightweight_test_with_fail.cpp b/test/lightweight_test_with_fail.cpp index 4583c2cce..cd9526037 100644 --- a/test/lightweight_test_with_fail.cpp +++ b/test/lightweight_test_with_fail.cpp @@ -7,7 +7,7 @@ // https://www.boost.org/LICENSE_1_0.txt #include -#include +#include template struct with_tolerance diff --git a/test/lightweight_test_with_test.cpp b/test/lightweight_test_with_test.cpp index 461d1e63f..ecc066150 100644 --- a/test/lightweight_test_with_test.cpp +++ b/test/lightweight_test_with_test.cpp @@ -9,7 +9,7 @@ // #include -#include +#include template struct with_tolerance diff --git a/test/max_align_test.cpp b/test/max_align_test.cpp index 45b8e35ff..d66bf452b 100644 --- a/test/max_align_test.cpp +++ b/test/max_align_test.cpp @@ -2,11 +2,22 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.TypeTraits and can't be run with C++20 modules yet\n"); +} + +#else + #include #include #include #include -#include +#include #if defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 40900 # define BOOST_NO_STD_MAX_ALIGN_T @@ -61,3 +72,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/memory_resource_test.cpp b/test/memory_resource_test.cpp index a95d558eb..40aad1b2a 100644 --- a/test/memory_resource_test.cpp +++ b/test/memory_resource_test.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include static bool do_allocate_called; static std::size_t do_allocate_bytes; diff --git a/test/no_exceptions_support_test.cpp b/test/no_exceptions_support_test.cpp index 6cce8ae23..3c83d796b 100644 --- a/test/no_exceptions_support_test.cpp +++ b/test/no_exceptions_support_test.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include void f() { diff --git a/test/noinit_adaptor_test.cpp b/test/noinit_adaptor_test.cpp index 605941f00..e3a271323 100644 --- a/test/noinit_adaptor_test.cpp +++ b/test/noinit_adaptor_test.cpp @@ -8,7 +8,7 @@ Distributed under the Boost Software License, Version 1.0. #include #include #include -#include +#include template class creator diff --git a/test/noncopyable_compile_fail.cpp b/test/noncopyable_compile_fail.cpp index f1f029381..0619acf0b 100644 --- a/test/noncopyable_compile_fail.cpp +++ b/test/noncopyable_compile_fail.cpp @@ -11,7 +11,7 @@ // 2 Jun 99 Initial Version #include -#include +#include // This program demonstrates compiler errors resulting from trying to copy // construct or copy assign a class object derived from class noncopyable. diff --git a/test/serialization_construct_data_test.cpp b/test/serialization_construct_data_test.cpp index ee87e616b..0c09ad46c 100644 --- a/test/serialization_construct_data_test.cpp +++ b/test/serialization_construct_data_test.cpp @@ -9,7 +9,7 @@ #endif #include -#include +#include struct X { @@ -71,8 +71,8 @@ struct Y #include #include #include -#include -#include +#include +#include int main() { diff --git a/test/serialization_nvp_test.cpp b/test/serialization_nvp_test.cpp index 588c9a55f..b7952bb06 100644 --- a/test/serialization_nvp_test.cpp +++ b/test/serialization_nvp_test.cpp @@ -24,8 +24,8 @@ struct X #include #include #include -#include -#include +#include +#include int main() { diff --git a/test/serialization_split_free_test.cpp b/test/serialization_split_free_test.cpp index 9c92ae928..af6251db0 100644 --- a/test/serialization_split_free_test.cpp +++ b/test/serialization_split_free_test.cpp @@ -35,8 +35,8 @@ template void serialize( Ar& ar, X& x, unsigned v ) #include #include #include -#include -#include +#include +#include int main() { diff --git a/test/serialization_split_member_test.cpp b/test/serialization_split_member_test.cpp index 9c1a8b267..7dcc59769 100644 --- a/test/serialization_split_member_test.cpp +++ b/test/serialization_split_member_test.cpp @@ -39,8 +39,8 @@ struct X #include #include #include -#include -#include +#include +#include int main() { diff --git a/test/size_test.cpp b/test/size_test.cpp index 905ca8d5a..7053b702c 100644 --- a/test/size_test.cpp +++ b/test/size_test.cpp @@ -9,7 +9,7 @@ Distributed under the Boost Software License, Version 1.0. #if !defined(BOOST_NO_CXX11_CONSTEXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) #include #include -#include +#include struct range { std::size_t size() const { diff --git a/test/snprintf_test.cpp b/test/snprintf_test.cpp index 48483ba2e..1ea865d0a 100644 --- a/test/snprintf_test.cpp +++ b/test/snprintf_test.cpp @@ -13,8 +13,8 @@ */ #include -#include -#include +#include +#include #include void test_snprintf() diff --git a/test/sp_typeinfo_test.cpp b/test/sp_typeinfo_test.cpp index 95557f6b2..5bd547c6c 100644 --- a/test/sp_typeinfo_test.cpp +++ b/test/sp_typeinfo_test.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include int main() { diff --git a/test/span_boost_begin_test.cpp b/test/span_boost_begin_test.cpp index b7dc1e636..a8c359afa 100644 --- a/test/span_boost_begin_test.cpp +++ b/test/span_boost_begin_test.cpp @@ -8,7 +8,7 @@ Distributed under the Boost Software License, Version 1.0. #include #if !defined(BOOST_NO_CXX11_CONSTEXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) #include -#include +#include namespace boost { namespace begin_ { diff --git a/test/span_nonmem_data_size_test.cpp b/test/span_nonmem_data_size_test.cpp index cc0b23169..e4f0bf65b 100644 --- a/test/span_nonmem_data_size_test.cpp +++ b/test/span_nonmem_data_size_test.cpp @@ -19,7 +19,7 @@ #if !defined(BOOST_NO_CXX11_CONSTEXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) #include -#include +#include // Note: This preprocessor check should be equivalent to those in boost/core/data.hpp and boost/core/size.hpp #if (defined(__cpp_lib_nonmember_container_access) && (__cpp_lib_nonmember_container_access >= 201411l)) || \ diff --git a/test/sv_common_reference_test.cpp b/test/sv_common_reference_test.cpp index 3a0b44440..0738dcedc 100644 --- a/test/sv_common_reference_test.cpp +++ b/test/sv_common_reference_test.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #if defined(BOOST_NO_CXX20_HDR_CONCEPTS) @@ -15,8 +15,8 @@ int main() {} #else -#include -#include +#include +#include using T = std::common_reference_t< boost::core::string_view&&, std::string& >; diff --git a/test/sv_common_reference_test2.cpp b/test/sv_common_reference_test2.cpp index 91e61e095..adb4cd64f 100644 --- a/test/sv_common_reference_test2.cpp +++ b/test/sv_common_reference_test2.cpp @@ -4,8 +4,9 @@ #include #include -#include -#include +#include +#include +#include #if !defined(__cpp_lib_ranges) diff --git a/test/sv_compare_test.cpp b/test/sv_compare_test.cpp index eef12d617..f56326302 100644 --- a/test/sv_compare_test.cpp +++ b/test/sv_compare_test.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include int main() { diff --git a/test/sv_construct_test.cpp b/test/sv_construct_test.cpp index 3da015b26..a55ed0e2a 100644 --- a/test/sv_construct_test.cpp +++ b/test/sv_construct_test.cpp @@ -16,13 +16,13 @@ # endif #endif -#include -#include +#include +#include #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) -# include +# include #endif #if !defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE) -# include +# include #endif template std::reverse_iterator make_reverse_iterator( It it ) diff --git a/test/sv_construct_test_cx.cpp b/test/sv_construct_test_cx.cpp index f490d16ee..f5440cab5 100644 --- a/test/sv_construct_test_cx.cpp +++ b/test/sv_construct_test_cx.cpp @@ -14,7 +14,7 @@ int main() {} #else #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) -# include +# include #endif #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) diff --git a/test/sv_contains_test.cpp b/test/sv_contains_test.cpp index f42f1e428..4378aef70 100644 --- a/test/sv_contains_test.cpp +++ b/test/sv_contains_test.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include int main() { diff --git a/test/sv_conversion_test.cpp b/test/sv_conversion_test.cpp index f9cec64ee..a1d44db8c 100644 --- a/test/sv_conversion_test.cpp +++ b/test/sv_conversion_test.cpp @@ -16,12 +16,12 @@ # endif #endif -#include +#include #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) -# include +# include #endif #if !defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE) -# include +# include #endif boost::core::string_view f( boost::core::string_view const& str ) diff --git a/test/sv_conversion_test2.cpp b/test/sv_conversion_test2.cpp index ee0e196cd..e882ce557 100644 --- a/test/sv_conversion_test2.cpp +++ b/test/sv_conversion_test2.cpp @@ -2,10 +2,21 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.Utility (string_view) and can't be run with C++20 modules yet\n"); +} + +#else + #include #include #include -#include +#include boost::core::string_view f( boost::core::string_view const& str ) { @@ -30,3 +41,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/sv_copy_test.cpp b/test/sv_copy_test.cpp index 75abe8823..9df1df3c3 100644 --- a/test/sv_copy_test.cpp +++ b/test/sv_copy_test.cpp @@ -6,8 +6,8 @@ #include #include -#include -#include +#include +#include int main() { diff --git a/test/sv_element_access_test.cpp b/test/sv_element_access_test.cpp index e4a94f73f..6f3372704 100644 --- a/test/sv_element_access_test.cpp +++ b/test/sv_element_access_test.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include int main() { diff --git a/test/sv_ends_with_test.cpp b/test/sv_ends_with_test.cpp index 86de3daf8..94359e0d6 100644 --- a/test/sv_ends_with_test.cpp +++ b/test/sv_ends_with_test.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include int main() { diff --git a/test/sv_eq_test.cpp b/test/sv_eq_test.cpp index a6d3e29e3..d33bd7dac 100644 --- a/test/sv_eq_test.cpp +++ b/test/sv_eq_test.cpp @@ -16,12 +16,12 @@ # endif #endif -#include +#include #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) -# include +# include #endif #if !defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE) -# include +# include #endif #define TEST_EQ(x, y) \ diff --git a/test/sv_find_first_not_of_test.cpp b/test/sv_find_first_not_of_test.cpp index c94c5be95..6988f021c 100644 --- a/test/sv_find_first_not_of_test.cpp +++ b/test/sv_find_first_not_of_test.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include int main() { diff --git a/test/sv_find_first_of_test.cpp b/test/sv_find_first_of_test.cpp index 59a255f9e..326e9d795 100644 --- a/test/sv_find_first_of_test.cpp +++ b/test/sv_find_first_of_test.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include int main() { diff --git a/test/sv_find_last_not_of_test.cpp b/test/sv_find_last_not_of_test.cpp index 6bdd0175b..a7bb036c5 100644 --- a/test/sv_find_last_not_of_test.cpp +++ b/test/sv_find_last_not_of_test.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include int main() { diff --git a/test/sv_find_last_of_test.cpp b/test/sv_find_last_of_test.cpp index 62482240c..f1399ce4a 100644 --- a/test/sv_find_last_of_test.cpp +++ b/test/sv_find_last_of_test.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include int main() { diff --git a/test/sv_find_test.cpp b/test/sv_find_test.cpp index cdf97ac0f..512a5c348 100644 --- a/test/sv_find_test.cpp +++ b/test/sv_find_test.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include int main() { diff --git a/test/sv_format_test.cpp b/test/sv_format_test.cpp index dc2c045ee..4575abd6a 100644 --- a/test/sv_format_test.cpp +++ b/test/sv_format_test.cpp @@ -14,8 +14,8 @@ int main() {} #else -#include -#include +#include +#include int main() { diff --git a/test/sv_hash_test.cpp b/test/sv_hash_test.cpp index ce05f21bc..9b47f1830 100644 --- a/test/sv_hash_test.cpp +++ b/test/sv_hash_test.cpp @@ -2,11 +2,22 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.ContainerHash and can't be run with C++20 modules yet\n"); +} + +#else + #include #include #include #include -#include +#include template std::size_t hv( T const& t ) { @@ -46,3 +57,5 @@ int main() return boost::report_errors(); } + +#endif diff --git a/test/sv_iteration_test.cpp b/test/sv_iteration_test.cpp index 57078d643..341d59e1e 100644 --- a/test/sv_iteration_test.cpp +++ b/test/sv_iteration_test.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include int main() { diff --git a/test/sv_lt_test.cpp b/test/sv_lt_test.cpp index 4661afd1e..593d5e5c2 100644 --- a/test/sv_lt_test.cpp +++ b/test/sv_lt_test.cpp @@ -16,12 +16,12 @@ # endif #endif -#include +#include #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) -# include +# include #endif #if !defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE) -# include +# include #endif #define TEST_LT(x, y) \ diff --git a/test/sv_modifiers_test.cpp b/test/sv_modifiers_test.cpp index 1a4d2b08f..a88c6330e 100644 --- a/test/sv_modifiers_test.cpp +++ b/test/sv_modifiers_test.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include int main() { diff --git a/test/sv_rfind_test.cpp b/test/sv_rfind_test.cpp index 12ab0cc69..768db7a39 100644 --- a/test/sv_rfind_test.cpp +++ b/test/sv_rfind_test.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include int main() { diff --git a/test/sv_starts_with_test.cpp b/test/sv_starts_with_test.cpp index 8fa886928..93d7d4c37 100644 --- a/test/sv_starts_with_test.cpp +++ b/test/sv_starts_with_test.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include int main() { diff --git a/test/sv_stream_insert_test.cpp b/test/sv_stream_insert_test.cpp index 864c2bd87..75a02da60 100644 --- a/test/sv_stream_insert_test.cpp +++ b/test/sv_stream_insert_test.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include int main() { diff --git a/test/sv_substr_test.cpp b/test/sv_substr_test.cpp index 51cde0ab5..fe416818b 100644 --- a/test/sv_substr_test.cpp +++ b/test/sv_substr_test.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include int main() { diff --git a/test/sv_types_test.cpp b/test/sv_types_test.cpp index d07256612..39e73d34d 100644 --- a/test/sv_types_test.cpp +++ b/test/sv_types_test.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 160000 diff --git a/test/swap/swap_array_of_array_of_class.cpp b/test/swap/swap_array_of_array_of_class.cpp index 5f0a7e6c0..50ac5d33c 100644 --- a/test/swap/swap_array_of_array_of_class.cpp +++ b/test/swap/swap_array_of_array_of_class.cpp @@ -14,8 +14,8 @@ //Put test class in the global namespace #include "./swap_test_class.hpp" -#include //for std::copy and std::equal -#include //for std::size_t +#include //for std::copy and std::equal +#include //for std::size_t #if defined(__clang__) # pragma clang diagnostic ignored "-Wunused-function" diff --git a/test/swap/swap_array_of_array_of_int.cpp b/test/swap/swap_array_of_array_of_int.cpp index 8fe45f96f..15e9a5a29 100644 --- a/test/swap/swap_array_of_array_of_int.cpp +++ b/test/swap/swap_array_of_array_of_int.cpp @@ -11,8 +11,8 @@ #define BOOST_CHECK BOOST_TEST #define BOOST_CHECK_EQUAL BOOST_TEST_EQ -#include //for std::copy and std::equal -#include //for std::size_t +#include //for std::copy and std::equal +#include //for std::size_t int main() { diff --git a/test/swap/swap_array_of_class.cpp b/test/swap/swap_array_of_class.cpp index 52c529dea..e0ab3c45c 100644 --- a/test/swap/swap_array_of_class.cpp +++ b/test/swap/swap_array_of_class.cpp @@ -14,8 +14,8 @@ //Put test class in the global namespace #include "./swap_test_class.hpp" -#include //for std::copy and std::equal -#include //for std::size_t +#include //for std::copy and std::equal +#include //for std::size_t #if defined(__clang__) # pragma clang diagnostic ignored "-Wunused-function" diff --git a/test/swap/swap_array_of_int.cpp b/test/swap/swap_array_of_int.cpp index 9f4775eb3..f50455302 100644 --- a/test/swap/swap_array_of_int.cpp +++ b/test/swap/swap_array_of_int.cpp @@ -11,8 +11,8 @@ #define BOOST_CHECK BOOST_TEST #define BOOST_CHECK_EQUAL BOOST_TEST_EQ -#include //for std::copy and std::equal -#include //for std::size_t +#include //for std::copy and std::equal +#include //for std::size_t int main() diff --git a/test/swap/swap_array_of_template.cpp b/test/swap/swap_array_of_template.cpp index 3921eabe7..f679dd586 100644 --- a/test/swap/swap_array_of_template.cpp +++ b/test/swap/swap_array_of_template.cpp @@ -14,8 +14,8 @@ //Put test class in the global namespace #include "./swap_test_class.hpp" -#include //for std::copy and std::equal -#include //for std::size_t +#include //for std::copy and std::equal +#include //for std::size_t template class swap_test_template diff --git a/test/swap/swap_std_bitset.cpp b/test/swap/swap_std_bitset.cpp index 7b8e5d194..f74dbb6b1 100644 --- a/test/swap/swap_std_bitset.cpp +++ b/test/swap/swap_std_bitset.cpp @@ -13,7 +13,7 @@ #define BOOST_CHECK BOOST_TEST #define BOOST_CHECK_EQUAL BOOST_TEST_EQ -#include +#include int main() { diff --git a/test/swap/swap_std_dateorder.cpp b/test/swap/swap_std_dateorder.cpp index d26729d29..177e64c4d 100644 --- a/test/swap/swap_std_dateorder.cpp +++ b/test/swap/swap_std_dateorder.cpp @@ -13,7 +13,7 @@ #define BOOST_CHECK BOOST_TEST #define BOOST_CHECK_EQUAL BOOST_TEST_EQ -#include +#include int main() { diff --git a/test/swap/swap_std_string.cpp b/test/swap/swap_std_string.cpp index 14c8e7c2f..6978b80b7 100644 --- a/test/swap/swap_std_string.cpp +++ b/test/swap/swap_std_string.cpp @@ -12,7 +12,7 @@ #define BOOST_CHECK BOOST_TEST #define BOOST_CHECK_EQUAL BOOST_TEST_EQ -#include +#include int main() { diff --git a/test/swap/swap_std_typeinfo_ptr.cpp b/test/swap/swap_std_typeinfo_ptr.cpp index b255aa72a..c3fb8d252 100644 --- a/test/swap/swap_std_typeinfo_ptr.cpp +++ b/test/swap/swap_std_typeinfo_ptr.cpp @@ -13,7 +13,7 @@ #define BOOST_CHECK BOOST_TEST #define BOOST_CHECK_EQUAL BOOST_TEST_EQ -#include +#include int main() { diff --git a/test/swap/swap_std_vector_of_boost.cpp b/test/swap/swap_std_vector_of_boost.cpp index f32a168a4..3272385d1 100644 --- a/test/swap/swap_std_vector_of_boost.cpp +++ b/test/swap/swap_std_vector_of_boost.cpp @@ -12,7 +12,7 @@ #define BOOST_CHECK BOOST_TEST #define BOOST_CHECK_EQUAL BOOST_TEST_EQ -#include +#include //Put test class in namespace boost namespace boost diff --git a/test/swap/swap_std_vector_of_global.cpp b/test/swap/swap_std_vector_of_global.cpp index f394b1acb..529a22c78 100644 --- a/test/swap/swap_std_vector_of_global.cpp +++ b/test/swap/swap_std_vector_of_global.cpp @@ -12,7 +12,7 @@ #define BOOST_CHECK BOOST_TEST #define BOOST_CHECK_EQUAL BOOST_TEST_EQ -#include +#include //Put test class in the global namespace #include "./swap_test_class.hpp" diff --git a/test/swap/swap_std_vector_of_other.cpp b/test/swap/swap_std_vector_of_other.cpp index d7d439642..0f778aa97 100644 --- a/test/swap/swap_std_vector_of_other.cpp +++ b/test/swap/swap_std_vector_of_other.cpp @@ -12,7 +12,7 @@ #define BOOST_CHECK BOOST_TEST #define BOOST_CHECK_EQUAL BOOST_TEST_EQ -#include +#include //Put test class in namespace other namespace other diff --git a/test/type_name_test.cpp b/test/type_name_test.cpp index 08cc8727c..f73e10da4 100644 --- a/test/type_name_test.cpp +++ b/test/type_name_test.cpp @@ -5,34 +5,34 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #if !defined(BOOST_NO_CXX11_HDR_UNORDERED_SET) -# include +# include #endif #if !defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) -# include +# include #endif #if !defined(BOOST_NO_CXX11_HDR_ARRAY) -# include +# include #endif #if !defined(BOOST_NO_CXX11_HDR_TUPLE) -# include +# include #endif #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) -# include +# include #endif // diff --git a/test/typeinfo_test.cpp b/test/typeinfo_test.cpp index 3e122bb1c..a52142133 100644 --- a/test/typeinfo_test.cpp +++ b/test/typeinfo_test.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include int main() { diff --git a/test/verbose_terminate_handler_fail.cpp b/test/verbose_terminate_handler_fail.cpp index 31c6bc40f..7b5b0fe1d 100644 --- a/test/verbose_terminate_handler_fail.cpp +++ b/test/verbose_terminate_handler_fail.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG) # include diff --git a/test/visit_each_test.cpp b/test/visit_each_test.cpp index d1fcc3cd2..b8a1ce8ca 100644 --- a/test/visit_each_test.cpp +++ b/test/visit_each_test.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include struct X { From 39a651633b19bb9a337ccf25ffdbd7b254f1b82c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 19:26:55 +0100 Subject: [PATCH 53/69] Missing small headers --- include/boost/get_pointer.hpp | 6 ++++++ include/boost/is_placeholder.hpp | 10 +++++++++- include/boost/non_type.hpp | 9 ++++++++- include/boost/type.hpp | 12 ++++++++++-- include/boost/visit_each.hpp | 13 ++++++++++--- modules/boost_core.cppm | 4 ++++ 6 files changed, 47 insertions(+), 7 deletions(-) diff --git a/include/boost/get_pointer.hpp b/include/boost/get_pointer.hpp index 36e2cd7d0..604ac9d1c 100644 --- a/include/boost/get_pointer.hpp +++ b/include/boost/get_pointer.hpp @@ -2,6 +2,12 @@ // 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) + +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(GET_POINTER_DWA20021219_HPP) +# error "Please #include in your module global fragment" +#endif + #ifndef GET_POINTER_DWA20021219_HPP #define GET_POINTER_DWA20021219_HPP diff --git a/include/boost/is_placeholder.hpp b/include/boost/is_placeholder.hpp index 5f1b544f9..7b0366bb9 100644 --- a/include/boost/is_placeholder.hpp +++ b/include/boost/is_placeholder.hpp @@ -7,6 +7,12 @@ # pragma once #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + // is_placeholder.hpp - TR1 is_placeholder metafunction // @@ -21,11 +27,13 @@ namespace boost { -template< class T > struct is_placeholder +BOOST_CORE_MODULE_EXPORT template< class T > struct is_placeholder { enum _vt { value = 0 }; }; } // namespace boost +#endif + #endif // #ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED diff --git a/include/boost/non_type.hpp b/include/boost/non_type.hpp index 896aed4d3..0f2ff9c40 100644 --- a/include/boost/non_type.hpp +++ b/include/boost/non_type.hpp @@ -11,17 +11,24 @@ #ifndef BOOST_NON_TYPE_HPP_GP_20030417 #define BOOST_NON_TYPE_HPP_GP_20030417 +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + namespace boost { // Just a simple "envelope" for non-type template parameters. Useful // to work around some MSVC deficiencies. - template + BOOST_CORE_MODULE_EXPORT template struct non_type { }; } +#endif #endif // include guard diff --git a/include/boost/type.hpp b/include/boost/type.hpp index ab81c916d..a5b86a725 100644 --- a/include/boost/type.hpp +++ b/include/boost/type.hpp @@ -4,15 +4,23 @@ // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_TYPE_DWA20010120_HPP -# define BOOST_TYPE_DWA20010120_HPP +#define BOOST_TYPE_DWA20010120_HPP + +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else namespace boost { // Just a simple "type envelope". Useful in various contexts, mostly to work // around some MSVC deficiencies. - template + BOOST_CORE_MODULE_EXPORT template struct type {}; } +#endif + #endif // BOOST_TYPE_DWA20010120_HPP diff --git a/include/boost/visit_each.hpp b/include/boost/visit_each.hpp index 6463ca9c2..9f8df1e7d 100644 --- a/include/boost/visit_each.hpp +++ b/include/boost/visit_each.hpp @@ -6,22 +6,29 @@ // http://www.boost.org/LICENSE_1_0.txt) // For more information, see http://www.boost.org/libs/signals - #ifndef BOOST_VISIT_EACH_HPP #define BOOST_VISIT_EACH_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + namespace boost { - template + BOOST_CORE_MODULE_EXPORT template inline void visit_each(Visitor& visitor, const T& t, long) { visitor(t); } - template + BOOST_CORE_MODULE_EXPORT template inline void visit_each(Visitor& visitor, const T& t) { visit_each(visitor, t, 0); } } +#endif + #endif // BOOST_VISIT_EACH_HPP diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 8cebfafda..74e1ab949 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -75,3 +75,7 @@ import std; #include #include #include +#include +#include +#include +#include From bd1c99fffae323b1e79b24c3ab6cf9c7b72f1cd3 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 19:28:04 +0100 Subject: [PATCH 54/69] move header --- modules/boost_core.cppm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index 74e1ab949..eb37bfa30 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -7,6 +7,7 @@ module; #if defined(_MSC_VER) #include #endif +#include #include #include #include @@ -15,7 +16,6 @@ module; #include #include #include -#include export module boost.core; From b0aa468b8c2269ef5336e66fdf8ada369850f829 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 19:35:17 +0100 Subject: [PATCH 55/69] proper get_pointer --- include/boost/get_pointer.hpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/include/boost/get_pointer.hpp b/include/boost/get_pointer.hpp index 604ac9d1c..4ec02da21 100644 --- a/include/boost/get_pointer.hpp +++ b/include/boost/get_pointer.hpp @@ -3,15 +3,17 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Make the header safe to include from libraries supporting modules -#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(GET_POINTER_DWA20021219_HPP) -# error "Please #include in your module global fragment" -#endif - #ifndef GET_POINTER_DWA20021219_HPP #define GET_POINTER_DWA20021219_HPP +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + #include +#include // In order to avoid circular dependencies with Boost.TR1 // we make sure that our include of doesn't try to @@ -23,7 +25,7 @@ namespace boost { // get_pointer(p) extracts a ->* capable pointer from p -template T * get_pointer(T * p) +BOOST_CORE_MODULE_EXPORT template T * get_pointer(T * p) { return p; } @@ -51,7 +53,7 @@ template T * get_pointer(T * p) #define BOOST_CORE_DETAIL_DISABLED_DEPRECATED_WARNINGS #endif -template T * get_pointer(std::auto_ptr const& p) +BOOST_CORE_MODULE_EXPORT template T * get_pointer(std::auto_ptr const& p) { return p.get(); } @@ -65,12 +67,12 @@ template T * get_pointer(std::auto_ptr const& p) #if !defined( BOOST_NO_CXX11_SMART_PTR ) -template T * get_pointer( std::unique_ptr const& p ) +BOOST_CORE_MODULE_EXPORT template T * get_pointer( std::unique_ptr const& p ) { return p.get(); } -template T * get_pointer( std::shared_ptr const& p ) +BOOST_CORE_MODULE_EXPORT template T * get_pointer( std::shared_ptr const& p ) { return p.get(); } @@ -79,4 +81,6 @@ template T * get_pointer( std::shared_ptr const& p ) } // namespace boost +#endif + #endif // GET_POINTER_DWA20021219_HPP From aa457f89fe8cd49e85ac670909d92017dfe31821 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 19:35:39 +0100 Subject: [PATCH 56/69] missing includes --- include/boost/is_placeholder.hpp | 15 ++++++++------- include/boost/non_type.hpp | 1 + include/boost/type.hpp | 2 ++ include/boost/visit_each.hpp | 2 ++ modules/boost_core.cppm | 1 + 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/boost/is_placeholder.hpp b/include/boost/is_placeholder.hpp index 7b0366bb9..c9273a1d9 100644 --- a/include/boost/is_placeholder.hpp +++ b/include/boost/is_placeholder.hpp @@ -7,13 +7,6 @@ # pragma once #endif -#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) -#ifndef BOOST_IN_MODULE_PURVIEW -import boost.core; -#endif -#else - - // is_placeholder.hpp - TR1 is_placeholder metafunction // // Copyright (c) 2006 Peter Dimov @@ -23,6 +16,14 @@ import boost.core; // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif +#else + +#include + namespace boost { diff --git a/include/boost/non_type.hpp b/include/boost/non_type.hpp index 0f2ff9c40..376a435aa 100644 --- a/include/boost/non_type.hpp +++ b/include/boost/non_type.hpp @@ -17,6 +17,7 @@ import boost.core; #endif #else +#include namespace boost { diff --git a/include/boost/type.hpp b/include/boost/type.hpp index a5b86a725..a392d3e3a 100644 --- a/include/boost/type.hpp +++ b/include/boost/type.hpp @@ -12,6 +12,8 @@ import boost.core; #endif #else +#include + namespace boost { // Just a simple "type envelope". Useful in various contexts, mostly to work diff --git a/include/boost/visit_each.hpp b/include/boost/visit_each.hpp index 9f8df1e7d..3e7b4af3a 100644 --- a/include/boost/visit_each.hpp +++ b/include/boost/visit_each.hpp @@ -15,6 +15,8 @@ import boost.core; #endif #else +#include + namespace boost { BOOST_CORE_MODULE_EXPORT template inline void visit_each(Visitor& visitor, const T& t, long) diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index eb37bfa30..f66de291b 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -79,3 +79,4 @@ import std; #include #include #include +#include From f53b4a0cbe94bb94b7c001bb7ede8423bbc39d1b Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 26 Feb 2026 20:10:26 +0100 Subject: [PATCH 57/69] gcc fixes --- include/boost/core/empty_value.hpp | 2 +- test/allocator_size_type_test.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/boost/core/empty_value.hpp b/include/boost/core/empty_value.hpp index 26468a950..99b861ed4 100644 --- a/include/boost/core/empty_value.hpp +++ b/include/boost/core/empty_value.hpp @@ -143,7 +143,7 @@ class empty_value_base } /* detail */ #endif -BOOST_CORE_MODULE_EXPORT template +template class empty_value #if defined(BOOST_MSVC) : detail::empty_value_base { diff --git a/test/allocator_size_type_test.cpp b/test/allocator_size_type_test.cpp index 50301ca74..b09e93bef 100644 --- a/test/allocator_size_type_test.cpp +++ b/test/allocator_size_type_test.cpp @@ -5,6 +5,18 @@ Copyright 2020 Glen Joseph Fernandes Distributed under the Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) */ + +#ifdef BOOST_USE_MODULES + +import std.compat; + +int main() +{ + printf("This test depends on Boost.TypeTraits and can't be run with C++20 modules yet\n"); +} + +#else + #include #include #include @@ -36,3 +48,5 @@ int main() #endif return boost::report_errors(); } + +#endif From 0e0ec8f4bcefc5514fcfb41b73817b57a7f21bdd Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 17:23:08 +0100 Subject: [PATCH 58/69] CI --- .github/workflows/ci.yml | 388 ++++++++++++++++++++++++++++++ tools/install-cmake.sh | 15 ++ tools/setup_boost_with_modules.py | 28 +++ 3 files changed, 431 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 358c5f14a..90e00eef9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -552,6 +552,7 @@ jobs: git submodule update --init tools/boostdep DEPINST_ARGS+=("$LIBRARY") python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" + python libs/core/tools/setup_boost_with_modules.py # Temporary ./bootstrap.sh ./b2 headers if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] @@ -661,6 +662,7 @@ jobs: rmdir /s /q "..\snapshot" git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY% + python libs/core/tools/setup_boost_with_modules.py # Temporary cmd /c bootstrap b2 -d0 headers @@ -728,6 +730,7 @@ jobs: rm -rf "../snapshot" git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" $LIBRARY + python libs/core/tools/setup_boost_with_modules.py # Temporary - name: Use library with add_subdirectory run: | @@ -795,6 +798,7 @@ jobs: rm -rf "../snapshot" git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" $LIBRARY + python libs/core/tools/setup_boost_with_modules.py # Temporary - name: Configure run: | @@ -877,6 +881,7 @@ jobs: rm -rf "../snapshot" git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" $LIBRARY + python libs/core/tools/setup_boost_with_modules.py # Temporary - name: Configure run: | @@ -940,6 +945,7 @@ jobs: rmdir /s /q "..\snapshot" git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY% + python libs/core/tools/setup_boost_with_modules.py # Temporary - name: Use library with add_subdirectory (Debug) shell: cmd @@ -1002,6 +1008,7 @@ jobs: rmdir /s /q "..\snapshot" git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY% + python libs/core/tools/setup_boost_with_modules.py # Temporary - name: Configure shell: cmd @@ -1082,6 +1089,7 @@ jobs: rmdir /s /q "..\snapshot" git submodule update --init tools/boostdep python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY% + python libs/core/tools/setup_boost_with_modules.py # Temporary - name: Configure shell: cmd @@ -1113,3 +1121,383 @@ jobs: run: | cd boost-root/__build__ ctest --output-on-failure --no-tests=error -C Release + + 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/core/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/core/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/core/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/core/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/core/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/core/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..23090ce98 --- /dev/null +++ b/tools/setup_boost_with_modules.py @@ -0,0 +1,28 @@ +#!/usr/bin/python3 + +# This is a temporary workaround to make CIs use the +# "Boost with C++20 modules" proposal, instead of the regular develop branch +# Call it instead of depinst + +from subprocess import run +import os + +def main(): + + submodules = [ + ('tools/cmake', 'https://github.com/anarthal/boost-cmake'), + ('libs/assert', 'https://github.com/anarthal/assert'), + ('libs/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 5a68903dd0a5c9974bd44e75f9319b571fdd6590 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 20:21:30 +0100 Subject: [PATCH 59/69] Fix lightweight_test header status --- include/boost/core/lightweight_test.hpp | 12 ++++++++---- include/boost/core/lightweight_test_trait.hpp | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index d51e1d70e..5ebf49093 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -22,6 +22,11 @@ // http://www.boost.org/LICENSE_1_0.txt // +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_LIGHTWEIGHT_TEST_HPP) && !defined(BOOST_CORE_INTERFACE_UNIT) +# error "Please #include in your module global fragment" +#endif + // Subset of includes required for exported macros #include #include @@ -33,10 +38,9 @@ #endif #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) -# ifndef BOOST_IN_MODULE_PURVIEW - import std; // required by macros - import boost.core; -# endif +// Note that we're guaranteed to not be in a purview here +import std; // required by macros +import boost.core; #else #include diff --git a/include/boost/core/lightweight_test_trait.hpp b/include/boost/core/lightweight_test_trait.hpp index f0e046c3a..c771f7f77 100644 --- a/include/boost/core/lightweight_test_trait.hpp +++ b/include/boost/core/lightweight_test_trait.hpp @@ -20,15 +20,19 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt +// Make the header safe to include from libraries supporting modules +#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP) && !defined(BOOST_CORE_INTERFACE_UNIT) +# error "Please #include in your module global fragment" +#endif + // Subset of includes required for exported macros #include #include #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) -# ifndef BOOST_IN_MODULE_PURVIEW - import std; // required by macros - import boost.core; -# endif +// Note that we're guaranteed to not be in a purview here +import std; // required by macros +import boost.core; #else #include From 2ab425336cded4ecbead45d260aaba93f7f14d3c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 21:13:27 +0100 Subject: [PATCH 60/69] no newline --- include/boost/core/detail/demangle_cxxabi.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/core/detail/demangle_cxxabi.hpp b/include/boost/core/detail/demangle_cxxabi.hpp index 2cc495916..403ec1598 100644 --- a/include/boost/core/detail/demangle_cxxabi.hpp +++ b/include/boost/core/detail/demangle_cxxabi.hpp @@ -37,4 +37,4 @@ #endif -#endif \ No newline at end of file +#endif From fb31ce7f4d2e933ebeadf761eca57e126a34867c Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Mar 2026 21:13:43 +0100 Subject: [PATCH 61/69] Python 2.7 compatibility --- 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 23090ce98..4d2ee48bf 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(): @@ -18,9 +18,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 525dbcf029a9f210d7d3b74c05a9b87cec22e374 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 6 Mar 2026 07:41:14 +0100 Subject: [PATCH 62/69] Update cmake test 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 e2afe7322..4e3a4b1c4 100644 --- a/test/cmake_install_test/CMakeLists.txt +++ b/test/cmake_install_test/CMakeLists.txt @@ -2,7 +2,7 @@ # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required(VERSION 3.5...3.16) +cmake_minimum_required(VERSION 3.5...3.31) project(cmake_install_test LANGUAGES CXX) diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index 045a47658..5c0c84bc7 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.16) +cmake_minimum_required(VERSION 3.5...3.31) project(cmake_subdir_test LANGUAGES CXX) From e78d7b99bc85a87189b4c92ab9ac827b4f3274a7 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 6 Mar 2026 07:49:46 +0100 Subject: [PATCH 63/69] CI cleanup --- .github/workflows/ci.yml | 46 +++++----------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90e00eef9..17369d3ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1123,21 +1123,6 @@ jobs: ctest --output-on-failure --no-tests=error -C Release 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 @@ -1150,7 +1135,7 @@ jobs: 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 }} + apt-get install -y --no-install-recommends wget ninja-build git ca-certificates python3 python-is-python3 g++-15 ./tools/install-cmake.sh - name: Setup Boost @@ -1180,32 +1165,14 @@ jobs: 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 }} \ + -DCMAKE_CXX_COMPILER=g++-15 \ .. 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 @@ -1217,7 +1184,7 @@ jobs: 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 }} + apt-get install -y --no-install-recommends wget ninja-build git ca-certificates python3 python-is-python3 g++-15 ./tools/install-cmake.sh - name: Setup Boost @@ -1247,12 +1214,11 @@ jobs: 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 }} \ + -DCMAKE_CXX_COMPILER=g++-15 \ .. - name: Install @@ -1265,11 +1231,9 @@ jobs: 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 }} \ + -DCMAKE_CXX_COMPILER=g++-15 \ .. cmake --build . ctest --output-on-failure --no-tests=error From 23eda86155f0d1d1a7fb2e2cb8fde82e3ba273be Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 6 Mar 2026 18:15:18 +0100 Subject: [PATCH 64/69] export import std --- include/boost/core/lightweight_test.hpp | 1 - include/boost/core/lightweight_test_trait.hpp | 1 - modules/boost_core.cppm | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index 5ebf49093..fe9f878de 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -39,7 +39,6 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) // Note that we're guaranteed to not be in a purview here -import std; // required by macros import boost.core; #else diff --git a/include/boost/core/lightweight_test_trait.hpp b/include/boost/core/lightweight_test_trait.hpp index c771f7f77..1d4f996d8 100644 --- a/include/boost/core/lightweight_test_trait.hpp +++ b/include/boost/core/lightweight_test_trait.hpp @@ -31,7 +31,6 @@ #if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) // Note that we're guaranteed to not be in a purview here -import std; // required by macros import boost.core; #else diff --git a/modules/boost_core.cppm b/modules/boost_core.cppm index f66de291b..9cd55f17c 100644 --- a/modules/boost_core.cppm +++ b/modules/boost_core.cppm @@ -19,7 +19,7 @@ module; export module boost.core; -import std; +export import std; // re-exporting simplifies consuming lightweight_test #define BOOST_CORE_INTERFACE_UNIT #define BOOST_IN_MODULE_PURVIEW From 50e14cc26837e8d39f6939e52f16f5867bf270b9 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 6 Mar 2026 18:15:27 +0100 Subject: [PATCH 65/69] set CMAKE_C_COMPILER --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17369d3ca..9759e5fcb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1245,13 +1245,13 @@ jobs: 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" + cmake-args: "-DCMAKE_C_COMPILER=clang-21 -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" + cmake-args: "-DCMAKE_C_COMPILER=clang-21 -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" + cmake-args: "-DCMAKE_C_COMPILER=gcc-15 -DCMAKE_CXX_COMPILER=g++-15 -DCMAKE_BUILD_TYPE=Debug" name: CMake test modules ${{ matrix.name }} From fea15590a35f72ab57e4f1bac5bead16de9ba227 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 6 Mar 2026 18:18:00 +0100 Subject: [PATCH 66/69] fix appveyor --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 510bd4136..7e5996336 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -79,6 +79,7 @@ install: - git submodule update --init tools/boostdep - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\core\ - python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" core + - python libs/core/tools/setup_boost_with_modules.py # Temporary - cmd /c bootstrap - b2 -d0 headers From adbdf8800467d4100c338b2be30baf82b368f167 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 6 Mar 2026 20:42:28 +0100 Subject: [PATCH 67/69] -DCMAKE_CXX_MODULE_STD=ON --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9759e5fcb..69482f8b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1166,6 +1166,7 @@ jobs: cmake \ -G Ninja \ -DBOOST_USE_MODULES=ON \ + -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ -DCMAKE_CXX_COMPILER=g++-15 \ .. @@ -1217,6 +1218,7 @@ jobs: -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ -DCMAKE_INSTALL_PREFIX=~/.local \ -DBOOST_USE_MODULES=ON \ + -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ -DCMAKE_CXX_COMPILER=g++-15 \ .. @@ -1349,7 +1351,7 @@ jobs: 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 -DBOOST_USE_MODULES=1 -DCMAKE_CXX_STANDARD=23 -DCMAKE_CXX_MODULE_STD=ON -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. cmake --build . ctest --output-on-failure --no-tests=error @@ -1403,7 +1405,7 @@ jobs: 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 -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DCMAKE_CXX_STANDARD=23 -DCMAKE_CXX_MODULE_STD=ON -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja .. cmake --build . ctest --output-on-failure --no-tests=error From e3ca13501cf5414a8525f95a004db94b3f3df53a Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 7 Mar 2026 13:14:11 +0100 Subject: [PATCH 68/69] Move CMAKE_CXX_MODULE_STD --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69482f8b3..29ad44241 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1218,7 +1218,6 @@ jobs: -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ -DCMAKE_INSTALL_PREFIX=~/.local \ -DBOOST_USE_MODULES=ON \ - -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ -DCMAKE_CXX_COMPILER=g++-15 \ .. @@ -1234,6 +1233,7 @@ jobs: cmake \ -G Ninja \ -DCMAKE_INSTALL_PREFIX=~/.local \ + -DCMAKE_CXX_MODULE_STD=ON \ -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ -DCMAKE_CXX_COMPILER=g++-15 \ .. From 524421078ac97895ef9d73c5e7d4362fb0db5d53 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Sat, 7 Mar 2026 21:53:39 +0100 Subject: [PATCH 69/69] inlines --- include/boost/core/demangle.hpp | 6 +- include/boost/core/detail/minstd_rand.hpp | 6 +- include/boost/core/detail/splitmix64.hpp | 6 +- include/boost/core/fclose_deleter.hpp | 2 +- include/boost/core/lightweight_test.hpp | 8 +-- include/boost/core/memory_resource.hpp | 6 +- include/boost/core/type_name.hpp | 80 +++++++++++------------ include/boost/core/typeinfo.hpp | 10 +-- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/include/boost/core/demangle.hpp b/include/boost/core/demangle.hpp index 646a0ac02..cdefbfa58 100644 --- a/include/boost/core/demangle.hpp +++ b/include/boost/core/demangle.hpp @@ -47,17 +47,17 @@ BOOST_CORE_MODULE_EXPORT class scoped_demangled_name char const * m_p; public: - explicit scoped_demangled_name( char const * name ) BOOST_NOEXCEPT : + inline explicit scoped_demangled_name( char const * name ) BOOST_NOEXCEPT : m_p( demangle_alloc( name ) ) { } - ~scoped_demangled_name() BOOST_NOEXCEPT + inline ~scoped_demangled_name() BOOST_NOEXCEPT { demangle_free( m_p ); } - char const * get() const BOOST_NOEXCEPT + inline char const * get() const BOOST_NOEXCEPT { return m_p; } diff --git a/include/boost/core/detail/minstd_rand.hpp b/include/boost/core/detail/minstd_rand.hpp index bedafb288..0ebccd122 100644 --- a/include/boost/core/detail/minstd_rand.hpp +++ b/include/boost/core/detail/minstd_rand.hpp @@ -28,11 +28,11 @@ class minstd_rand public: - minstd_rand(): x_( 1 ) + inline minstd_rand(): x_( 1 ) { } - explicit minstd_rand( boost::uint_least32_t x ): x_( x % m ) + inline explicit minstd_rand( boost::uint_least32_t x ): x_( x % m ) { if( x_ == 0 ) { @@ -40,7 +40,7 @@ class minstd_rand } } - boost::uint_least32_t operator()() + inline boost::uint_least32_t operator()() { boost::uint_least64_t y = x_; diff --git a/include/boost/core/detail/splitmix64.hpp b/include/boost/core/detail/splitmix64.hpp index cca23e764..0bdf9ff50 100644 --- a/include/boost/core/detail/splitmix64.hpp +++ b/include/boost/core/detail/splitmix64.hpp @@ -34,15 +34,15 @@ class splitmix64 public: - splitmix64(): x_( 0 ) + inline splitmix64(): x_( 0 ) { } - explicit splitmix64( boost::uint64_t seed ): x_( seed ) + inline explicit splitmix64( boost::uint64_t seed ): x_( seed ) { } - boost::uint64_t operator()() + inline boost::uint64_t operator()() { x_ += ( boost::uint64_t(0x9e3779b9u) << 32 ) + 0x7f4a7c15u; diff --git a/include/boost/core/fclose_deleter.hpp b/include/boost/core/fclose_deleter.hpp index c463f0d09..ec597b6a9 100644 --- a/include/boost/core/fclose_deleter.hpp +++ b/include/boost/core/fclose_deleter.hpp @@ -44,7 +44,7 @@ BOOST_CORE_MODULE_EXPORT struct fclose_deleter /*! * Closes the file handle */ - void operator() (std::FILE* p) const BOOST_NOEXCEPT + inline void operator() (std::FILE* p) const BOOST_NOEXCEPT { if (BOOST_LIKELY(!!p)) std::fclose(p); diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index fe9f878de..1a21600d1 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -63,12 +63,12 @@ class test_result { public: - test_result(): report_( false ), errors_( 0 ) + inline test_result(): report_( false ), errors_( 0 ) { core::detail::lwt_unattended(); } - ~test_result() + inline ~test_result() { if( !report_ ) { @@ -77,12 +77,12 @@ class test_result } } - int& errors() + inline int& errors() { return errors_; } - void done() + inline void done() { report_ = true; } diff --git a/include/boost/core/memory_resource.hpp b/include/boost/core/memory_resource.hpp index 2298c59c1..76265c88a 100644 --- a/include/boost/core/memory_resource.hpp +++ b/include/boost/core/memory_resource.hpp @@ -73,7 +73,7 @@ BOOST_CORE_MODULE_EXPORT class memory_resource #endif - BOOST_ATTRIBUTE_NODISCARD void* allocate( std::size_t bytes, std::size_t alignment = max_align ) + BOOST_ATTRIBUTE_NODISCARD inline void* allocate( std::size_t bytes, std::size_t alignment = max_align ) { // https://github.com/boostorg/container/issues/199 // https://cplusplus.github.io/LWG/issue3471 @@ -81,12 +81,12 @@ BOOST_CORE_MODULE_EXPORT class memory_resource return ::operator new( bytes, do_allocate( bytes, alignment ), core::detail::placement_new_tag() ); } - void deallocate( void* p, std::size_t bytes, std::size_t alignment = max_align ) + inline void deallocate( void* p, std::size_t bytes, std::size_t alignment = max_align ) { do_deallocate( p, bytes, alignment ); } - bool is_equal( memory_resource const & other ) const BOOST_NOEXCEPT + inline bool is_equal( memory_resource const & other ) const BOOST_NOEXCEPT { return do_is_equal( other ); } diff --git a/include/boost/core/type_name.hpp b/include/boost/core/type_name.hpp index 75e36b55c..834383cfd 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -241,7 +241,7 @@ template struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "bool" + suffix; } @@ -249,7 +249,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "char" + suffix; } @@ -257,7 +257,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "signed char" + suffix; } @@ -265,7 +265,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "unsigned char" + suffix; } @@ -273,7 +273,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "short" + suffix; } @@ -281,7 +281,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "unsigned short" + suffix; } @@ -289,7 +289,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "int" + suffix; } @@ -297,7 +297,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "unsigned" + suffix; } @@ -305,7 +305,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "long" + suffix; } @@ -313,7 +313,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "unsigned long" + suffix; } @@ -321,7 +321,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "long long" + suffix; } @@ -329,7 +329,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "unsigned long long" + suffix; } @@ -339,7 +339,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "__int128" + suffix; } @@ -347,7 +347,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "unsigned __int128" + suffix; } @@ -359,7 +359,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "wchar_t" + suffix; } @@ -371,7 +371,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "char16_t" + suffix; } @@ -383,7 +383,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "char32_t" + suffix; } @@ -395,7 +395,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "char8_t" + suffix; } @@ -407,7 +407,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::byte" + suffix; } @@ -419,7 +419,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "float" + suffix; } @@ -427,7 +427,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "double" + suffix; } @@ -435,7 +435,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "long double" + suffix; } @@ -445,7 +445,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "void" + suffix; } @@ -457,7 +457,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::nullptr_t" + suffix; } @@ -469,7 +469,7 @@ template<> struct tn_holder template struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return tn_holder::type_name( " const" + suffix ); } @@ -477,7 +477,7 @@ template struct tn_holder template struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return tn_holder::type_name( " volatile" + suffix ); } @@ -485,7 +485,7 @@ template struct tn_holder template struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return tn_holder::type_name( " const volatile" + suffix ); } @@ -495,7 +495,7 @@ template struct tn_holder template struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return tn_holder::type_name( "&" + suffix ); } @@ -505,7 +505,7 @@ template struct tn_holder template struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return tn_holder::type_name( "&&" + suffix ); } @@ -949,7 +949,7 @@ template class L, class Ch> struct tn_hold template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::string" + suffix; } @@ -957,7 +957,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::wstring" + suffix; } @@ -967,7 +967,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::u16string" + suffix; } @@ -979,7 +979,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::u32string" + suffix; } @@ -991,7 +991,7 @@ template<> struct tn_holder template<> struct tn_holder< std::basic_string > { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::u8string" + suffix; } @@ -1013,7 +1013,7 @@ template class L, class Ch> struct tn_holder< L struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::ostream" + suffix; } @@ -1023,7 +1023,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::string_view" + suffix; } @@ -1031,7 +1031,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::wstring_view" + suffix; } @@ -1041,7 +1041,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::u16string_view" + suffix; } @@ -1053,7 +1053,7 @@ template<> struct tn_holder template<> struct tn_holder { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::u32string_view" + suffix; } @@ -1065,7 +1065,7 @@ template<> struct tn_holder template<> struct tn_holder< std::basic_string_view > { - static std::string type_name( std::string const& suffix ) + static inline std::string type_name( std::string const& suffix ) { return "std::u8string_view" + suffix; } diff --git a/include/boost/core/typeinfo.hpp b/include/boost/core/typeinfo.hpp index 74358f7c8..049bd337d 100644 --- a/include/boost/core/typeinfo.hpp +++ b/include/boost/core/typeinfo.hpp @@ -46,11 +46,11 @@ class typeinfo public: - typeinfo( char const * name, void (*lib_id)() ): name_( name ), lib_id_( lib_id ) + inline typeinfo( char const * name, void (*lib_id)() ): name_( name ), lib_id_( lib_id ) { } - bool operator==( typeinfo const& rhs ) const + inline bool operator==( typeinfo const& rhs ) const { #if ( defined(_WIN32) || defined(__CYGWIN__) ) && ( defined(__GNUC__) || defined(__clang__) ) && !defined(BOOST_DISABLE_CURRENT_FUNCTION) @@ -63,12 +63,12 @@ class typeinfo #endif } - bool operator!=( typeinfo const& rhs ) const + inline bool operator!=( typeinfo const& rhs ) const { return !( *this == rhs ); } - bool before( typeinfo const& rhs ) const + inline bool before( typeinfo const& rhs ) const { #if ( defined(_WIN32) || defined(__CYGWIN__) ) && ( defined(__GNUC__) || defined(__clang__) ) && !defined(BOOST_DISABLE_CURRENT_FUNCTION) @@ -81,7 +81,7 @@ class typeinfo #endif } - char const* name() const + inline char const* name() const { return name_; }