diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d2e2202..fe98e2cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,10 @@ if(CMAKE_VERSION VERSION_GREATER 3.18 AND CMAKE_GENERATOR MATCHES "Visual Studio endif() +if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.28.0" AND BUILD_MODULE) + add_subdirectory(module) +endif() + if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") add_subdirectory(test) diff --git a/include/boost/core/addressof.hpp b/include/boost/core/addressof.hpp index 5473c36a..0a0f63d1 100644 --- a/include/boost/core/addressof.hpp +++ b/include/boost/core/addressof.hpp @@ -16,6 +16,8 @@ Distributed under the Boost Software License, Version 1.0. #include +#include + #if defined(BOOST_MSVC_FULL_VER) && BOOST_MSVC_FULL_VER >= 190024215 #define BOOST_CORE_HAS_BUILTIN_ADDRESSOF #elif defined(BOOST_GCC) && BOOST_GCC >= 70000 @@ -33,6 +35,8 @@ Distributed under the Boost Software License, Version 1.0. namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CONSTEXPR inline T* addressof(T& o) BOOST_NOEXCEPT @@ -40,6 +44,8 @@ addressof(T& o) BOOST_NOEXCEPT return __builtin_addressof(o); } +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #else #include @@ -121,6 +127,8 @@ struct addrof { defined(BOOST_NO_CXX11_DECLTYPE) #define BOOST_CORE_NO_CONSTEXPR_ADDRESSOF +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_FORCEINLINE T* addressof(T& o) BOOST_NOEXCEPT @@ -133,6 +141,8 @@ addressof(T& o) BOOST_NOEXCEPT #endif } +BOOST_CORE_END_MODULE_EXPORT + #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) namespace detail { @@ -143,15 +153,24 @@ struct addrof_result { } /* detail */ + +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_FORCEINLINE typename boost::detail::addrof_result::type addressof(T (&o)[N]) BOOST_NOEXCEPT { return &o; } + +BOOST_CORE_END_MODULE_EXPORT + #endif #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) + +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_FORCEINLINE T (*addressof(T (&o)[N]) BOOST_NOEXCEPT)[N] @@ -165,6 +184,9 @@ const T (*addressof(const T (&o)[N]) BOOST_NOEXCEPT)[N] { return reinterpret_cast(&o); } + +BOOST_CORE_END_MODULE_EXPORT + #endif #else namespace detail { @@ -250,12 +272,17 @@ addressof(T& o) BOOST_NOEXCEPT } /* detail */ +BOOST_CORE_BEGIN_MODULE_EXPORT + template constexpr BOOST_FORCEINLINE T* addressof(T& o) BOOST_NOEXCEPT { return boost::detail::addressof(o); } + +BOOST_CORE_END_MODULE_EXPORT + #endif } /* boost */ @@ -265,9 +292,13 @@ addressof(T& o) BOOST_NOEXCEPT !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + template const T* addressof(const T&&) = delete; +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/alloc_construct.hpp b/include/boost/core/alloc_construct.hpp index 075d3cb3..d62b7b23 100644 --- a/include/boost/core/alloc_construct.hpp +++ b/include/boost/core/alloc_construct.hpp @@ -13,6 +13,10 @@ This functionality is now in . */ #include +#include + +BOOST_CORE_BEGIN_MODULE_EXPORT + namespace boost { template @@ -92,4 +96,6 @@ alloc_construct_n(A& a, T* p, std::size_t n, I b) } /* boost */ +BOOST_CORE_END_MODULE_EXPORT + #endif diff --git a/include/boost/core/allocator_access.hpp b/include/boost/core/allocator_access.hpp index 0f0ed325..81720cd8 100644 --- a/include/boost/core/allocator_access.hpp +++ b/include/boost/core/allocator_access.hpp @@ -9,6 +9,9 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_CORE_ALLOCATOR_ACCESS_HPP #include + +#include + #include #include #include @@ -58,11 +61,15 @@ _STL_DISABLE_DEPRECATED_WARNING namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + template struct allocator_value_type { typedef typename A::value_type type; }; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { template @@ -83,11 +90,15 @@ struct alloc_ptr struct allocator_pointer { typedef typename detail::alloc_ptr::type type; }; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { template @@ -105,11 +116,15 @@ struct alloc_const_ptr struct allocator_const_pointer { typedef typename detail::alloc_const_ptr::type type; }; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { template @@ -151,11 +166,15 @@ struct alloc_rebind struct allocator_rebind { typedef typename detail::alloc_rebind::type type; }; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { template @@ -173,11 +192,15 @@ struct alloc_void_ptr struct allocator_void_pointer { typedef typename detail::alloc_void_ptr::type type; }; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { template @@ -195,11 +218,15 @@ struct alloc_const_void_ptr struct allocator_const_void_pointer { typedef typename detail::alloc_const_void_ptr::type type; }; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { template @@ -216,11 +243,15 @@ struct alloc_diff_type struct allocator_difference_type { typedef typename detail::alloc_diff_type::type type; }; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { #if defined(BOOST_NO_CXX11_ALLOCATOR) @@ -244,11 +275,15 @@ struct alloc_size_type struct allocator_size_type { typedef typename detail::alloc_size_type::type type; }; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { #if defined(BOOST_NO_CXX11_ALLOCATOR) @@ -290,11 +325,15 @@ struct alloc_pocca struct allocator_propagate_on_container_copy_assignment { typedef typename detail::alloc_pocca::type type; }; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { template @@ -311,11 +350,15 @@ struct alloc_pocma struct allocator_propagate_on_container_move_assignment { typedef typename detail::alloc_pocma::type type; }; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { template @@ -331,11 +374,15 @@ struct alloc_pocs struct allocator_propagate_on_container_swap { typedef typename detail::alloc_pocs::type type; }; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { #if !defined(BOOST_NO_CXX11_ALLOCATOR) @@ -363,6 +410,8 @@ struct alloc_equal struct allocator_is_always_equal { typedef typename detail::alloc_equal::type type; @@ -383,7 +432,12 @@ allocator_deallocate(A& a, typename allocator_pointer::type p, a.deallocate(p, n); } +BOOST_CORE_END_MODULE_EXPORT + #if defined(BOOST_NO_CXX11_ALLOCATOR) + +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline typename allocator_pointer::type allocator_allocate(A& a, typename allocator_size_type::type n, @@ -391,6 +445,9 @@ allocator_allocate(A& a, typename allocator_size_type::type n, { return a.allocate(n, h); } + +BOOST_CORE_END_MODULE_EXPORT + #else namespace detail { @@ -416,6 +473,8 @@ class alloc_has_allocate { } /* detail */ +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline typename std::enable_if::value, typename allocator_pointer::type>::type @@ -433,6 +492,9 @@ allocator_allocate(A& a, typename allocator_size_type::type n, { return a.allocate(n); } + +BOOST_CORE_END_MODULE_EXPORT + #endif namespace detail { @@ -474,6 +536,8 @@ struct alloc_if { } /* detail */ +BOOST_CORE_BEGIN_MODULE_EXPORT + #if defined(BOOST_NO_CXX11_ALLOCATOR) template inline typename detail::alloc_if::value>::type @@ -538,6 +602,8 @@ allocator_construct(A&, T* p, Args&&... args) } #endif +BOOST_CORE_END_MODULE_EXPORT + namespace detail { #if defined(BOOST_NO_CXX11_ALLOCATOR) @@ -568,6 +634,8 @@ class alloc_has_destroy { } /* detail */ +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline typename detail::alloc_if::value>::type allocator_destroy(A& a, T* p) @@ -583,6 +651,8 @@ allocator_destroy(A&, T* p) (void)p; } +BOOST_CORE_END_MODULE_EXPORT + namespace detail { #if defined(BOOST_NO_CXX11_ALLOCATOR) @@ -628,6 +698,8 @@ class alloc_has_max_size { } /* detail */ +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline typename detail::alloc_if::value, typename allocator_size_type::type>::type @@ -646,6 +718,8 @@ allocator_max_size(const A&) BOOST_NOEXCEPT sizeof(typename allocator_value_type::type); } +BOOST_CORE_END_MODULE_EXPORT + namespace detail { #if defined(BOOST_NO_CXX11_ALLOCATOR) @@ -686,6 +760,8 @@ class alloc_has_soccc { } /* detail */ +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline typename detail::alloc_if::value, A>::type allocator_select_on_container_copy_construction(const A& a) @@ -709,6 +785,8 @@ allocator_destroy_n(A& a, T* p, std::size_t n) } } +BOOST_CORE_END_MODULE_EXPORT + namespace detail { template @@ -736,6 +814,8 @@ class alloc_destroyer { } /* detail */ +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline void allocator_construct_n(A& a, T* p, std::size_t n) @@ -813,6 +893,8 @@ template using allocator_rebind_t = typename allocator_rebind::type; #endif +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #if defined(__clang__) && defined(__has_warning) diff --git a/include/boost/core/allocator_traits.hpp b/include/boost/core/allocator_traits.hpp index bf8749d8..6576f60b 100644 --- a/include/boost/core/allocator_traits.hpp +++ b/include/boost/core/allocator_traits.hpp @@ -10,8 +10,12 @@ Distributed under the Boost Software License, Version 1.0. #include +#include + namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + template struct allocator_traits { typedef A allocator_type; @@ -107,6 +111,8 @@ struct allocator_traits { } }; +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/bit.hpp b/include/boost/core/bit.hpp index cebc8787..41f7fbd5 100644 --- a/include/boost/core/bit.hpp +++ b/include/boost/core/bit.hpp @@ -16,6 +16,9 @@ // https://www.boost.org/LICENSE_1_0.txt #include + +#include + #include #include #include @@ -65,6 +68,8 @@ namespace boost namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + // bit_cast #if defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST) @@ -89,6 +94,8 @@ To bit_cast( From const & from ) BOOST_NOEXCEPT #endif +BOOST_CORE_END_MODULE_EXPORT + // countl #if defined(__GNUC__) || defined(__clang__) @@ -123,6 +130,8 @@ BOOST_CONSTEXPR inline int countl_impl( boost::ulong_long_type x ) BOOST_NOEXCEP } // namespace detail +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT { @@ -131,6 +140,8 @@ BOOST_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT return boost::core::detail::countl_impl( x ); } +BOOST_CORE_END_MODULE_EXPORT + #else // defined(__GNUC__) || defined(__clang__) namespace detail @@ -293,6 +304,8 @@ inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT } // namespace detail +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CXX14_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT { @@ -318,8 +331,12 @@ BOOST_CXX14_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT } } +BOOST_CORE_END_MODULE_EXPORT + #endif // defined(__GNUC__) || defined(__clang__) +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CONSTEXPR int countl_one( T x ) BOOST_NOEXCEPT { @@ -328,6 +345,8 @@ BOOST_CONSTEXPR int countl_one( T x ) BOOST_NOEXCEPT return boost::core::countl_zero( static_cast( ~x ) ); } +BOOST_CORE_END_MODULE_EXPORT + // countr #if defined(__GNUC__) || defined(__clang__) @@ -362,6 +381,8 @@ BOOST_CONSTEXPR inline int countr_impl( boost::ulong_long_type x ) BOOST_NOEXCEP } // namespace detail +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT { @@ -370,6 +391,8 @@ BOOST_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT return boost::core::detail::countr_impl( x ); } +BOOST_CORE_END_MODULE_EXPORT + #else // defined(__GNUC__) || defined(__clang__) namespace detail @@ -518,6 +541,9 @@ inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT } // namespace detail + +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CXX14_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT { @@ -543,8 +569,12 @@ BOOST_CXX14_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT } } +BOOST_CORE_END_MODULE_EXPORT + #endif // defined(__GNUC__) || defined(__clang__) +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CONSTEXPR int countr_one( T x ) BOOST_NOEXCEPT { @@ -553,6 +583,8 @@ BOOST_CONSTEXPR int countr_one( T x ) BOOST_NOEXCEPT return boost::core::countr_zero( static_cast( ~x ) ); } +BOOST_CORE_END_MODULE_EXPORT + // popcount #if defined(__GNUC__) || defined(__clang__) @@ -595,6 +627,8 @@ BOOST_CORE_POPCOUNT_CONSTEXPR inline int popcount_impl( boost::ulong_long_type x #undef BOOST_CORE_POPCOUNT_CONSTEXPR +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT { @@ -603,6 +637,8 @@ BOOST_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT return boost::core::detail::popcount_impl( x ); } +BOOST_CORE_END_MODULE_EXPORT + #else // defined(__GNUC__) || defined(__clang__) namespace detail @@ -628,6 +664,8 @@ BOOST_CXX14_CONSTEXPR inline int popcount_impl( boost::uint64_t x ) BOOST_NOEXCE } // namespace detail +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT { @@ -645,10 +683,14 @@ BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT } } +BOOST_CORE_END_MODULE_EXPORT + #endif // defined(__GNUC__) || defined(__clang__) // rotating +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CXX14_CONSTEXPR T rotl( T x, int s ) BOOST_NOEXCEPT { @@ -696,6 +738,8 @@ BOOST_CONSTEXPR T bit_floor( T x ) BOOST_NOEXCEPT return x == 0? T(0): static_cast( T(1) << ( boost::core::bit_width( x ) - 1 ) ); } +BOOST_CORE_END_MODULE_EXPORT + namespace detail { @@ -742,6 +786,8 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x ) } // namespace detail +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CXX14_CONSTEXPR T bit_ceil( T x ) BOOST_NOEXCEPT { @@ -820,6 +866,8 @@ typedef endian::type endian_type; #endif +BOOST_CORE_END_MODULE_EXPORT + #undef BOOST_CORE_BIT_NATIVE_INITIALIZER // byteswap @@ -920,6 +968,8 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t byteswap_impl( boost::uint64_t x ) } // namespace detail +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CXX14_CONSTEXPR T byteswap( T x ) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT( std::numeric_limits::is_integer ); @@ -944,6 +994,8 @@ template BOOST_CXX14_CONSTEXPR T byteswap( T x ) BOOST_NOEXCEPT } } +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/checked_delete.hpp b/include/boost/core/checked_delete.hpp index 67f3c742..e50b777a 100644 --- a/include/boost/core/checked_delete.hpp +++ b/include/boost/core/checked_delete.hpp @@ -9,6 +9,8 @@ #include +#include + // // boost/checked_delete.hpp // @@ -23,6 +25,8 @@ // See http://www.boost.org/libs/core/doc/html/core/checked_delete.html for documentation. // +BOOST_CORE_BEGIN_MODULE_EXPORT + namespace boost { @@ -94,4 +98,6 @@ using checked_deleters::checked_array_deleter; } // namespace boost +BOOST_CORE_END_MODULE_EXPORT + #endif // #ifndef BOOST_CORE_CHECKED_DELETE_HPP diff --git a/include/boost/core/cmath.hpp b/include/boost/core/cmath.hpp index a18c81b5..a423922a 100644 --- a/include/boost/core/cmath.hpp +++ b/include/boost/core/cmath.hpp @@ -18,6 +18,8 @@ #include +#include + #if defined(BOOST_CORE_USE_GENERIC_CMATH) || (!defined(_MSC_VER) && !defined(FP_SUBNORMAL)) #include @@ -25,6 +27,8 @@ #include #include +BOOST_CORE_BEGIN_MODULE_EXPORT + namespace boost { namespace core @@ -112,6 +116,8 @@ template T copysign( T x, T y ) } // namespace core } // namespace boost +BOOST_CORE_END_MODULE_EXPORT + #else // defined(BOOST_CORE_USE_GENERIC_CMATH) #if defined(_MSC_VER) && _MSC_VER < 1800 @@ -124,6 +130,8 @@ namespace core { #if defined(_MSC_VER) && _MSC_VER < 1800 +BOOST_CORE_BEGIN_MODULE_EXPORT + template T copysign( T x, T y ) { return static_cast( _copysign( static_cast( x ), static_cast( y ) ) ); @@ -233,8 +241,12 @@ inline int fpclassify( long double x ) return boost::core::fpclassify( static_cast( x ) ); } +BOOST_CORE_END_MODULE_EXPORT + #else +BOOST_CORE_BEGIN_MODULE_EXPORT + using std::isfinite; using std::isnan; using std::isinf; @@ -249,15 +261,21 @@ int const fp_nan = FP_NAN; using std::signbit; +BOOST_CORE_END_MODULE_EXPORT + // std::copysign doesn't exist in libstdc++ under -std=c++03 #if !defined(__GNUC__) +BOOST_CORE_BEGIN_MODULE_EXPORT + template T copysign( T x, T y ) { return std::copysign( x, y ); } +BOOST_CORE_END_MODULE_EXPORT + #else namespace detail @@ -282,11 +300,15 @@ inline long double copysign_impl( long double x, long double y ) } // namespace detail +BOOST_CORE_BEGIN_MODULE_EXPORT + template T copysign( T x, T y ) { return boost::core::detail::copysign_impl( x, y ); } +BOOST_CORE_END_MODULE_EXPORT + #endif // !defined(__GNUC__) #endif // #if defined(_MSC_VER) && _MSC_VER < 1800 diff --git a/include/boost/core/data.hpp b/include/boost/core/data.hpp index 44cf426e..b19fdd41 100644 --- a/include/boost/core/data.hpp +++ b/include/boost/core/data.hpp @@ -11,8 +11,12 @@ Distributed under the Boost Software License, Version 1.0. #include #include +#include + namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline constexpr auto data(C& c) noexcept(noexcept(c.data())) -> decltype(c.data()) @@ -41,6 +45,8 @@ data(std::initializer_list l) noexcept return l.begin(); } +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/default_allocator.hpp b/include/boost/core/default_allocator.hpp index 91d3bbcb..fb22f0de 100644 --- a/include/boost/core/default_allocator.hpp +++ b/include/boost/core/default_allocator.hpp @@ -9,10 +9,15 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_CORE_DEFAULT_ALLOCATOR_HPP #include + +#include + #include namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + #if defined(BOOST_NO_EXCEPTIONS) BOOST_NORETURN void throw_exception(const std::exception&); #endif @@ -153,6 +158,8 @@ operator!=(const default_allocator&, using default_::default_allocator; +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/demangle.hpp b/include/boost/core/demangle.hpp index dc714d80..14379482 100644 --- a/include/boost/core/demangle.hpp +++ b/include/boost/core/demangle.hpp @@ -11,6 +11,9 @@ // http://www.boost.org/LICENSE_1_0.txt #include + +#include + #include #if defined(BOOST_HAS_PRAGMA_ONCE) @@ -47,6 +50,8 @@ namespace boost namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT; inline void demangle_free( char const * name ) BOOST_NOEXCEPT; @@ -117,6 +122,8 @@ inline std::string demangle( char const * name ) #endif +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/detail/is_same.hpp b/include/boost/core/detail/is_same.hpp index 634d3004..e24a92d8 100644 --- a/include/boost/core/detail/is_same.hpp +++ b/include/boost/core/detail/is_same.hpp @@ -11,6 +11,8 @@ #include +#include + #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -22,6 +24,8 @@ namespace core namespace detail { +BOOST_CORE_BEGIN_MODULE_EXPORT + template< class T1, class T2 > struct is_same { BOOST_STATIC_CONSTANT( bool, value = false ); @@ -32,6 +36,8 @@ template< class T > struct is_same< T, T > BOOST_STATIC_CONSTANT( bool, value = true ); }; +BOOST_CORE_END_MODULE_EXPORT + } // namespace detail } // namespace core } // namespace boost diff --git a/include/boost/core/detail/module_macro.hpp b/include/boost/core/detail/module_macro.hpp new file mode 100644 index 00000000..b071560a --- /dev/null +++ b/include/boost/core/detail/module_macro.hpp @@ -0,0 +1,19 @@ +/* +Copyright 2025 Antony Polukhin + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_CORE_DETAIL_MODULE_MACRO_HPP +#define BOOST_CORE_DETAIL_MODULE_MACRO_HPP + +#ifndef BOOST_CORE_BEGIN_MODULE_EXPORT +#define BOOST_CORE_BEGIN_MODULE_EXPORT +#endif + +#ifndef BOOST_CORE_END_MODULE_EXPORT +#define BOOST_CORE_END_MODULE_EXPORT +#endif + +#endif diff --git a/include/boost/core/empty_value.hpp b/include/boost/core/empty_value.hpp index 5eeee51f..0d5286d1 100644 --- a/include/boost/core/empty_value.hpp +++ b/include/boost/core/empty_value.hpp @@ -9,6 +9,9 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_CORE_EMPTY_VALUE_HPP #include + +#include + #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #include #endif @@ -32,6 +35,8 @@ Distributed under the Boost Software License, Version 1.0. namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + template struct use_empty_value_base { enum { @@ -45,8 +50,12 @@ struct use_empty_value_base { struct empty_init_t { }; +BOOST_CORE_END_MODULE_EXPORT + namespace empty_ { +BOOST_CORE_BEGIN_MODULE_EXPORT + template::value> class empty_value { @@ -94,6 +103,8 @@ class empty_value { T value_; }; +BOOST_CORE_END_MODULE_EXPORT + #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) #if defined(BOOST_MSVC) /* @@ -136,6 +147,8 @@ class empty_value_base } /* detail */ #endif +BOOST_CORE_BEGIN_MODULE_EXPORT + template class empty_value #if defined(BOOST_MSVC) @@ -188,12 +201,18 @@ class empty_value }; #endif +BOOST_CORE_END_MODULE_EXPORT + } /* empty_ */ +BOOST_CORE_BEGIN_MODULE_EXPORT + using empty_::empty_value; BOOST_INLINE_CONSTEXPR empty_init_t empty_init = empty_init_t(); +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #if defined(_MSC_VER) diff --git a/include/boost/core/enable_if.hpp b/include/boost/core/enable_if.hpp index 5dcef1e0..bd63df24 100644 --- a/include/boost/core/enable_if.hpp +++ b/include/boost/core/enable_if.hpp @@ -16,6 +16,8 @@ #include "boost/config.hpp" +#include + // Even the definition of enable_if causes problems on some compilers, // so it's macroed out for all compilers that do not support SFINAE @@ -23,6 +25,9 @@ namespace boost { + +BOOST_CORE_BEGIN_MODULE_EXPORT + template struct enable_if_has_type { @@ -74,6 +79,8 @@ namespace boost template struct lazy_disable_if : public lazy_disable_if_c {}; +BOOST_CORE_END_MODULE_EXPORT + } // namespace boost #else @@ -82,6 +89,8 @@ namespace boost { namespace detail { typedef void enable_if_default_T; } +BOOST_CORE_BEGIN_MODULE_EXPORT + template struct enable_if_does_not_work_on_this_compiler; @@ -121,6 +130,8 @@ namespace boost { struct lazy_disable_if : enable_if_does_not_work_on_this_compiler { }; +BOOST_CORE_END_MODULE_EXPORT + } // namespace boost #endif // BOOST_NO_SFINAE diff --git a/include/boost/core/exchange.hpp b/include/boost/core/exchange.hpp index bc8a9fcd..dbda33f7 100644 --- a/include/boost/core/exchange.hpp +++ b/include/boost/core/exchange.hpp @@ -9,6 +9,9 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_CORE_EXCHANGE_HPP #include + +#include + #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #include #include @@ -16,6 +19,8 @@ Distributed under the Boost Software License, Version 1.0. namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template inline T exchange(T& t, const U& u) @@ -44,6 +49,8 @@ BOOST_CXX14_CONSTEXPR inline T exchange(T& t, U&& u) #endif #endif +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/fclose_deleter.hpp b/include/boost/core/fclose_deleter.hpp index 7a31cb15..61949b3b 100644 --- a/include/boost/core/fclose_deleter.hpp +++ b/include/boost/core/fclose_deleter.hpp @@ -20,12 +20,16 @@ #include #include +#include + #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once #endif namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + // Block unintended ADL namespace fclose_deleter_ns { @@ -48,6 +52,8 @@ struct fclose_deleter using fclose_deleter_ns::fclose_deleter; +BOOST_CORE_END_MODULE_EXPORT + } // namespace boost #endif // BOOST_CORE_FCLOSE_DELETER_HPP diff --git a/include/boost/core/first_scalar.hpp b/include/boost/core/first_scalar.hpp index 5373542e..b6ff015b 100644 --- a/include/boost/core/first_scalar.hpp +++ b/include/boost/core/first_scalar.hpp @@ -11,6 +11,8 @@ Distributed under the Boost Software License, Version 1.0. #include #include +#include + namespace boost { namespace detail { @@ -26,6 +28,8 @@ struct make_scalar { } /* detail */ +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_CONSTEXPR inline T* first_scalar(T* p) BOOST_NOEXCEPT @@ -40,6 +44,8 @@ first_scalar(T (*p)[N]) BOOST_NOEXCEPT return boost::first_scalar(&(*p)[0]); } +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/functor.hpp b/include/boost/core/functor.hpp index f3ee11b9..c8f81e9e 100644 --- a/include/boost/core/functor.hpp +++ b/include/boost/core/functor.hpp @@ -16,8 +16,12 @@ #ifndef BOOST_CORE_FUNCTOR_HPP #define BOOST_CORE_FUNCTOR_HPP +#include + namespace boost::core { +BOOST_CORE_BEGIN_MODULE_EXPORT + // Block unintended ADL namespace functor_ns { @@ -36,6 +40,8 @@ struct functor using functor_ns::functor; +BOOST_CORE_END_MODULE_EXPORT + } // namespace boost::core #endif // BOOST_CORE_FUNCTOR_HPP diff --git a/include/boost/core/identity.hpp b/include/boost/core/identity.hpp index f27733be..dbff7c8d 100644 --- a/include/boost/core/identity.hpp +++ b/include/boost/core/identity.hpp @@ -9,12 +9,17 @@ Distributed under the Boost Software License, Version 1.0. #define BOOST_CORE_IDENTITY_HPP #include + +#include + #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #include #endif namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + struct identity { typedef void is_transparent; @@ -56,6 +61,8 @@ struct identity { #endif }; +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/ignore_unused.hpp b/include/boost/core/ignore_unused.hpp index 7c4a9978..9959c9a6 100644 --- a/include/boost/core/ignore_unused.hpp +++ b/include/boost/core/ignore_unused.hpp @@ -9,8 +9,12 @@ #include +#include + namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) @@ -95,6 +99,8 @@ BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused() #endif +BOOST_CORE_END_MODULE_EXPORT + } // namespace boost #endif // BOOST_CORE_IGNORE_UNUSED_HPP diff --git a/include/boost/core/invoke_swap.hpp b/include/boost/core/invoke_swap.hpp index 80562895..6af703a4 100644 --- a/include/boost/core/invoke_swap.hpp +++ b/include/boost/core/invoke_swap.hpp @@ -23,6 +23,9 @@ #include #include + +#include + #if __cplusplus >= 201103L || defined(BOOST_DINKUMWARE_STDLIB) #include // for std::swap (C++11) #else @@ -76,6 +79,8 @@ inline void invoke_swap_impl(T (& left)[N], T (& right)[N]) namespace boost { namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_GPU_ENABLED inline typename enable_if_c< !::boost_swap_impl::is_const::value >::type @@ -85,6 +90,8 @@ invoke_swap(T& left, T& right) ::boost_swap_impl::invoke_swap_impl(left, right); } +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/is_same.hpp b/include/boost/core/is_same.hpp index 111cbd18..ae48fafc 100644 --- a/include/boost/core/is_same.hpp +++ b/include/boost/core/is_same.hpp @@ -12,6 +12,8 @@ #include #include +#include + #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -26,8 +28,12 @@ namespace boost namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + using boost::core::detail::is_same; +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/launder.hpp b/include/boost/core/launder.hpp index 9ec5e7ee..323c73e4 100644 --- a/include/boost/core/launder.hpp +++ b/include/boost/core/launder.hpp @@ -13,6 +13,8 @@ #include +#include + #if defined(__has_builtin) # if __has_builtin(__builtin_launder) # define BOOST_CORE_HAS_BUILTIN_LAUNDER @@ -40,6 +42,8 @@ namespace boost namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + #if defined(BOOST_CORE_HAS_BUILTIN_LAUNDER) template T* launder( T* p ) @@ -63,6 +67,8 @@ template T* launder( T* p ) #endif +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/make_span.hpp b/include/boost/core/make_span.hpp index 5f5df563..16e2fd48 100644 --- a/include/boost/core/make_span.hpp +++ b/include/boost/core/make_span.hpp @@ -10,8 +10,12 @@ Distributed under the Boost Software License, Version 1.0. #include +#include + namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline constexpr span make_span(I* f, std::size_t c) noexcept @@ -54,6 +58,8 @@ make_span(R&& r) return span::type>(std::forward(r)); } +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/max_align.hpp b/include/boost/core/max_align.hpp index a5806d4b..756c32e8 100644 --- a/include/boost/core/max_align.hpp +++ b/include/boost/core/max_align.hpp @@ -15,6 +15,8 @@ #include #include +#include + // BOOST_CORE_HAS_FLOAT128 #if defined(BOOST_HAS_FLOAT128) @@ -38,6 +40,8 @@ namespace boost namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + union max_align_t { char c; @@ -76,6 +80,8 @@ union max_align_t BOOST_CONSTEXPR_OR_CONST std::size_t max_align = BOOST_CORE_ALIGNOF( max_align_t ); +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/memory_resource.hpp b/include/boost/core/memory_resource.hpp index 0432f6f9..4dc677b8 100644 --- a/include/boost/core/memory_resource.hpp +++ b/include/boost/core/memory_resource.hpp @@ -16,6 +16,8 @@ #include #include +#include + // Define our own placement new to avoid the inclusion of // (~9K extra lines) at Ion Gaztanhaga's request. // @@ -52,6 +54,8 @@ namespace boost namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + class memory_resource { public: @@ -102,6 +106,8 @@ inline bool operator!=( memory_resource const& a, memory_resource const& b ) BOO return !( a == b ); } +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/noinit_adaptor.hpp b/include/boost/core/noinit_adaptor.hpp index 623e3ea4..e099526d 100644 --- a/include/boost/core/noinit_adaptor.hpp +++ b/include/boost/core/noinit_adaptor.hpp @@ -10,8 +10,12 @@ Distributed under the Boost Software License, Version 1.0. #include +#include + namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + template struct noinit_adaptor : A { @@ -85,6 +89,8 @@ noinit_adapt(const A& a) BOOST_NOEXCEPT return noinit_adaptor(a); } +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/noncopyable.hpp b/include/boost/core/noncopyable.hpp index 4ec2d54f..f1eb38cd 100644 --- a/include/boost/core/noncopyable.hpp +++ b/include/boost/core/noncopyable.hpp @@ -11,8 +11,12 @@ #include +#include + namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + // Private copy constructor and copy assignment ensure classes derived from // class noncopyable cannot be copied. @@ -58,6 +62,8 @@ namespace noncopyable_ // protection from unintended ADL typedef noncopyable_::noncopyable noncopyable; +BOOST_CORE_END_MODULE_EXPORT + } // namespace boost #endif // BOOST_CORE_NONCOPYABLE_HPP diff --git a/include/boost/core/null_deleter.hpp b/include/boost/core/null_deleter.hpp index 08b6a3d4..248299e6 100644 --- a/include/boost/core/null_deleter.hpp +++ b/include/boost/core/null_deleter.hpp @@ -21,12 +21,16 @@ #include +#include + #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once #endif namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + // Block unintended ADL namespace null_deleter_ns { @@ -46,6 +50,8 @@ struct null_deleter using null_deleter_ns::null_deleter; +BOOST_CORE_END_MODULE_EXPORT + } // namespace boost #endif // BOOST_CORE_NULL_DELETER_HPP diff --git a/include/boost/core/nvp.hpp b/include/boost/core/nvp.hpp index 8826a592..4dec5235 100644 --- a/include/boost/core/nvp.hpp +++ b/include/boost/core/nvp.hpp @@ -11,6 +11,10 @@ Distributed under the Boost Software License, Version 1.0. #include #include +#include + +BOOST_CORE_BEGIN_MODULE_EXPORT + namespace boost { namespace serialization { @@ -52,6 +56,8 @@ using serialization::make_nvp; } /* boost */ +BOOST_CORE_END_MODULE_EXPORT + #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 4957ff85..c7ca60b4 100644 --- a/include/boost/core/pointer_in_range.hpp +++ b/include/boost/core/pointer_in_range.hpp @@ -11,6 +11,8 @@ Distributed under the Boost Software License, Version 1.0. #include #include +#include + #if !defined(BOOST_NO_CXX14_CONSTEXPR) #if defined(BOOST_MSVC) && BOOST_MSVC >= 1925 #define BOOST_CORE_DETAIL_HAS_IS_CONSTEVAL @@ -27,6 +29,8 @@ Distributed under the Boost Software License, Version 1.0. namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline BOOST_CONSTEXPR bool pointer_in_range(const T* p, const T* b, const T* e) @@ -44,6 +48,8 @@ pointer_in_range(const T* p, const T* b, const T* e) return std::less_equal()(b, p) && std::less()(p, e); } +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/pointer_traits.hpp b/include/boost/core/pointer_traits.hpp index 7de7a8e9..430b094f 100644 --- a/include/boost/core/pointer_traits.hpp +++ b/include/boost/core/pointer_traits.hpp @@ -12,6 +12,8 @@ Distributed under the Boost Software License, Version 1.0. #include #include +#include + namespace boost { namespace detail { @@ -209,6 +211,8 @@ struct ptr_traits { }; } /* detail */ +BOOST_CORE_BEGIN_MODULE_EXPORT + template struct pointer_traits : detail::ptr_traits::type> { }; @@ -238,6 +242,8 @@ to_address(T* v) BOOST_NOEXCEPT return v; } +BOOST_CORE_END_MODULE_EXPORT + #if !defined(BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION) namespace detail { @@ -265,19 +271,30 @@ ptr_address(const T& v, long) BOOST_NOEXCEPT } /* detail */ +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline auto to_address(const T& v) BOOST_NOEXCEPT { return boost::detail::ptr_address(v, 0); } + +BOOST_CORE_END_MODULE_EXPORT + #else + +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline typename pointer_traits::element_type* to_address(const T& v) BOOST_NOEXCEPT { return boost::to_address(v.operator->()); } + +BOOST_CORE_END_MODULE_EXPORT + #endif } /* boost */ diff --git a/include/boost/core/quick_exit.hpp b/include/boost/core/quick_exit.hpp index ff1bda36..53e78fcd 100644 --- a/include/boost/core/quick_exit.hpp +++ b/include/boost/core/quick_exit.hpp @@ -18,6 +18,8 @@ #include #include +#include + #if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) extern "C" _CRTIMP __cdecl __MINGW_NOTHROW void _exit (int) __MINGW_ATTRIB_NORETURN; @@ -33,6 +35,8 @@ extern "C" _Noreturn void quick_exit(int); namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + BOOST_NORETURN inline void quick_exit( int code ) BOOST_NOEXCEPT { #if defined(_MSC_VER) && _MSC_VER < 1900 @@ -54,6 +58,8 @@ BOOST_NORETURN inline void quick_exit( int code ) BOOST_NOEXCEPT #endif } +BOOST_CORE_END_MODULE_EXPORT + } // namespace boost #endif // #ifndef BOOST_CORE_QUICK_EXIT_HPP_INCLUDED diff --git a/include/boost/core/ref.hpp b/include/boost/core/ref.hpp index d29a4d6f..ec6b1eff 100644 --- a/include/boost/core/ref.hpp +++ b/include/boost/core/ref.hpp @@ -6,6 +6,8 @@ #include #include +#include + #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -67,6 +69,8 @@ struct ref_empty } // namespace detail +BOOST_CORE_BEGIN_MODULE_EXPORT + // reference_wrapper /** @@ -340,6 +344,8 @@ template BOOST_FORCEINLINE T* get_pointer( reference_wrapper const & @endcond */ +BOOST_CORE_END_MODULE_EXPORT + } // namespace boost #endif // #ifndef BOOST_CORE_REF_HPP diff --git a/include/boost/core/serialization.hpp b/include/boost/core/serialization.hpp index 9c78c582..fc259ac5 100644 --- a/include/boost/core/serialization.hpp +++ b/include/boost/core/serialization.hpp @@ -17,9 +17,13 @@ #include #include +#include + namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + namespace serialization { @@ -43,14 +47,20 @@ struct core_version_type } // namespace serialization +BOOST_CORE_END_MODULE_EXPORT + namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + // nvp using serialization::nvp; using serialization::make_nvp; +BOOST_CORE_END_MODULE_EXPORT + // split_free namespace detail @@ -76,11 +86,15 @@ template<> struct load_or_save_f } // namespace detail +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline void split_free( A& a, T& t, unsigned int v ) { detail::load_or_save_f< A::is_saving::value >()( a, t, v ); } +BOOST_CORE_END_MODULE_EXPORT + // split_member namespace detail @@ -106,6 +120,8 @@ template struct load_or_save_m } // namespace detail +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline void split_member( A& a, T& t, unsigned int v ) { detail::load_or_save_m< A::is_saving::value >()( a, t, v ); @@ -125,6 +141,8 @@ template void save_construct_data_adl( Ar& ar, T const* t, un save_construct_data( ar, t, serialization::core_version_type( v ) ); } +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/size.hpp b/include/boost/core/size.hpp index 449ccb90..d3261dab 100644 --- a/include/boost/core/size.hpp +++ b/include/boost/core/size.hpp @@ -10,8 +10,12 @@ Distributed under the Boost Software License, Version 1.0. #include +#include + namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + template inline constexpr auto size(const C& c) noexcept(noexcept(c.size())) -> decltype(c.size()) @@ -26,6 +30,8 @@ size(T(&)[N]) noexcept return N; } +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/snprintf.hpp b/include/boost/core/snprintf.hpp index 91e252b4..d795b205 100644 --- a/include/boost/core/snprintf.hpp +++ b/include/boost/core/snprintf.hpp @@ -20,6 +20,8 @@ #include #include +#include + #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once #endif @@ -50,6 +52,8 @@ namespace boost { namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + #if defined(BOOST_CORE_DETAIL_MINGW_SNPRINTF) || defined(BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF) #if defined(BOOST_CORE_DETAIL_MINGW_SNPRINTF) @@ -166,6 +170,8 @@ using ::vswprintf; #endif // defined(BOOST_CORE_DETAIL_MINGW_SNPRINTF) || defined(BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF) +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/span.hpp b/include/boost/core/span.hpp index 3a602c25..adec8be4 100644 --- a/include/boost/core/span.hpp +++ b/include/boost/core/span.hpp @@ -14,13 +14,19 @@ Distributed under the Boost Software License, Version 1.0. #include #include +#include + namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + constexpr std::size_t dynamic_extent = static_cast(-1); template class span; +BOOST_CORE_END_MODULE_EXPORT + namespace detail { template @@ -156,6 +162,8 @@ struct span_bytes { } /* detail */ +BOOST_CORE_BEGIN_MODULE_EXPORT + template class span { public: @@ -401,6 +409,8 @@ as_writable_bytes(span s) noexcept } #endif +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/swap.hpp b/include/boost/core/swap.hpp index 4696c441..10626b09 100644 --- a/include/boost/core/swap.hpp +++ b/include/boost/core/swap.hpp @@ -19,6 +19,8 @@ #include #include +#include + #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once #endif @@ -27,6 +29,9 @@ BOOST_HEADER_DEPRECATED("boost/core/invoke_swap.hpp") namespace boost { + +BOOST_CORE_BEGIN_MODULE_EXPORT + template BOOST_GPU_ENABLED BOOST_DEPRECATED("This function is deprecated, use boost::core::invoke_swap instead.") @@ -35,6 +40,9 @@ namespace boost { boost::core::invoke_swap(left, right); } + +BOOST_CORE_END_MODULE_EXPORT + } #endif // BOOST_CORE_SWAP_HPP diff --git a/include/boost/core/type_name.hpp b/include/boost/core/type_name.hpp index 81e00c20..50511081 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -1175,11 +1176,15 @@ template class L, class T, std::size_t N> struc } // namespace detail +BOOST_CORE_BEGIN_MODULE_EXPORT + template std::string type_name() { return core::detail::tn_holder::type_name( "" ); } +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/typeinfo.hpp b/include/boost/core/typeinfo.hpp index d33d29ba..fb896a39 100644 --- a/include/boost/core/typeinfo.hpp +++ b/include/boost/core/typeinfo.hpp @@ -17,6 +17,8 @@ #include +#include + #if defined( BOOST_NO_TYPEID ) #include @@ -29,6 +31,8 @@ namespace boost namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + class typeinfo { private: @@ -87,6 +91,8 @@ inline char const * demangled_name( core::typeinfo const & ti ) return ti.name(); } +BOOST_CORE_END_MODULE_EXPORT + } // namespace core namespace detail @@ -141,6 +147,8 @@ namespace boost namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + #if defined( BOOST_NO_STD_TYPEINFO ) typedef ::type_info typeinfo; @@ -156,6 +164,8 @@ inline std::string demangled_name( core::typeinfo const & ti ) return core::demangle( ti.name() ); } +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/uncaught_exceptions.hpp b/include/boost/core/uncaught_exceptions.hpp index 380e81cd..5acedb36 100644 --- a/include/boost/core/uncaught_exceptions.hpp +++ b/include/boost/core/uncaught_exceptions.hpp @@ -22,6 +22,8 @@ #include #include +#include + #if defined(BOOST_HAS_PRAGMA_ONCE) #pragma once #endif @@ -121,6 +123,8 @@ namespace boost { namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + //! Returns the number of currently pending exceptions inline unsigned int uncaught_exceptions() BOOST_NOEXCEPT { @@ -143,6 +147,8 @@ inline unsigned int uncaught_exceptions() BOOST_NOEXCEPT #endif } +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/core/underlying_type.hpp b/include/boost/core/underlying_type.hpp index 7ecba313..ea67d10d 100644 --- a/include/boost/core/underlying_type.hpp +++ b/include/boost/core/underlying_type.hpp @@ -13,6 +13,8 @@ #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 @@ -60,6 +62,8 @@ struct underlying_type_impl #define BOOST_NO_UNDERLYING_TYPE #endif +BOOST_CORE_BEGIN_MODULE_EXPORT + /** * Meta-function to get the underlying type of a scoped enum. * @@ -74,6 +78,8 @@ struct underlying_type : { }; +BOOST_CORE_END_MODULE_EXPORT + } // namespace boost #endif // BOOST_CORE_UNDERLYING_TYPE_HPP diff --git a/include/boost/core/use_default.hpp b/include/boost/core/use_default.hpp index 9d9be79d..d4e37f3a 100644 --- a/include/boost/core/use_default.hpp +++ b/include/boost/core/use_default.hpp @@ -8,10 +8,16 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_USE_DEFAULT_HPP #define BOOST_CORE_USE_DEFAULT_HPP +#include + namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT + struct use_default { }; +BOOST_CORE_END_MODULE_EXPORT + } /* boost */ #endif diff --git a/include/boost/core/verbose_terminate_handler.hpp b/include/boost/core/verbose_terminate_handler.hpp index b6074703..8625354c 100644 --- a/include/boost/core/verbose_terminate_handler.hpp +++ b/include/boost/core/verbose_terminate_handler.hpp @@ -12,6 +12,7 @@ // https://www.boost.org/LICENSE_1_0.txt #include +#include #include #include #include @@ -24,6 +25,8 @@ namespace boost namespace core { +BOOST_CORE_BEGIN_MODULE_EXPORT + BOOST_NORETURN inline void verbose_terminate_handler() { std::set_terminate( 0 ); @@ -82,6 +85,8 @@ BOOST_NORETURN inline void verbose_terminate_handler() std::abort(); } +BOOST_CORE_END_MODULE_EXPORT + } // namespace core } // namespace boost diff --git a/include/boost/get_pointer.hpp b/include/boost/get_pointer.hpp index 36e2cd7d..ee65009e 100644 --- a/include/boost/get_pointer.hpp +++ b/include/boost/get_pointer.hpp @@ -7,12 +7,16 @@ #include +#include + // In order to avoid circular dependencies with Boost.TR1 // we make sure that our include of doesn't try to // pull in the TR1 headers: that's why we use this header // rather than including directly: #include // std::auto_ptr +BOOST_CORE_BEGIN_MODULE_EXPORT + namespace boost { // get_pointer(p) extracts a ->* capable pointer from p @@ -73,4 +77,6 @@ template T * get_pointer( std::shared_ptr const& p ) } // namespace boost +BOOST_CORE_END_MODULE_EXPORT + #endif // GET_POINTER_DWA20021219_HPP diff --git a/include/boost/non_type.hpp b/include/boost/non_type.hpp index 896aed4d..44fc48ec 100644 --- a/include/boost/non_type.hpp +++ b/include/boost/non_type.hpp @@ -11,6 +11,9 @@ #ifndef BOOST_NON_TYPE_HPP_GP_20030417 #define BOOST_NON_TYPE_HPP_GP_20030417 +#include + +BOOST_CORE_BEGIN_MODULE_EXPORT namespace boost { @@ -23,5 +26,6 @@ namespace boost { } +BOOST_CORE_END_MODULE_EXPORT #endif // include guard diff --git a/include/boost/type.hpp b/include/boost/type.hpp index ab81c916..16c23620 100644 --- a/include/boost/type.hpp +++ b/include/boost/type.hpp @@ -6,13 +6,18 @@ #ifndef BOOST_TYPE_DWA20010120_HPP # define BOOST_TYPE_DWA20010120_HPP +#include + namespace boost { +BOOST_CORE_BEGIN_MODULE_EXPORT // Just a simple "type envelope". Useful in various contexts, mostly to work // around some MSVC deficiencies. template struct type {}; +BOOST_CORE_END_MODULE_EXPORT + } #endif // BOOST_TYPE_DWA20010120_HPP diff --git a/include/boost/visit_each.hpp b/include/boost/visit_each.hpp index 6463ca9c..637e38ed 100644 --- a/include/boost/visit_each.hpp +++ b/include/boost/visit_each.hpp @@ -10,6 +10,10 @@ #ifndef BOOST_VISIT_EACH_HPP #define BOOST_VISIT_EACH_HPP +#include + +BOOST_CORE_BEGIN_MODULE_EXPORT + namespace boost { template inline void visit_each(Visitor& visitor, const T& t, long) @@ -24,4 +28,6 @@ namespace boost { } } +BOOST_CORE_END_MODULE_EXPORT + #endif // BOOST_VISIT_EACH_HPP diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt new file mode 100644 index 00000000..b3f4d5b9 --- /dev/null +++ b/module/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (c) 2025 Antony Polukhin +# +# Distributed under the Boost Software License, Version 1.0. +# https://www.boost.org/LICENSE_1_0.txt + +cmake_minimum_required(VERSION 3.28) + +function (_add_boost_core_module_impl NAME) + add_library(${NAME}) + target_compile_features(${NAME} PUBLIC cxx_std_20) + target_sources(${NAME} PUBLIC + FILE_SET modules_public TYPE CXX_MODULES FILES + ${CMAKE_CURRENT_LIST_DIR}/core.cppm + ) +endfunction() + +function (add_boost_core_module NAME) + _add_boost_core_module_impl(${NAME}) + target_include_directories(${NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../include) + + _add_boost_core_module_impl(${NAME}_migration) + target_include_directories(${NAME}_migration PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../include) + target_compile_definitions(${NAME}_migration PRIVATE BOOST_CORE_ATTACH_TO_GLOBAL_MODULE) +endfunction() + +add_boost_core_module(boost_core_module) +add_library(Boost::core_module ALIAS boost_core_module) +add_library(Boost::core_module_migration ALIAS boost_core_module_migration) + +if (BUILD_TESTING) + add_executable(boost_core_module_usage usage_sample.cpp) + target_link_libraries(boost_core_module_usage PRIVATE Boost::core_module) + + add_executable(boost_core_module_usage_migration usage_sample.cpp) + target_link_libraries(boost_core_module_usage_migration PRIVATE Boost::core_module_migration) +endif() diff --git a/module/core.cppm b/module/core.cppm new file mode 100644 index 00000000..ee557a99 --- /dev/null +++ b/module/core.cppm @@ -0,0 +1,207 @@ +// Copyright (c) 2025 Antony Polukhin +// +// 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) + +// To compile manually use a command like the folowing: +// clang++ -I ../include -std=c++20 --precompile -x c++-module core.cppm + +#define BOOST_CORE_BEGIN_MODULE_EXPORT export { +#define BOOST_CORE_END_MODULE_EXPORT } + +module; + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include // TODO: modularize + +#if (defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411) +#if defined(__APPLE__) +#include +#endif +#endif + +#ifndef BOOST_CORE_HAS_STD_MODULE +#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 +#endif + +export module Boost.Core; + +#ifdef BOOST_CORE_HAS_STD_MODULE +import std; +#endif + +#ifdef __clang__ +# pragma clang diagnostic ignored "-Winclude-angled-in-module-purview" +#endif + +#ifdef BOOST_CORE_ATTACH_TO_GLOBAL_MODULE +extern "C++" { +#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 +#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 +} +#else +#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 +#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 +#endif diff --git a/module/usage_sample.cpp b/module/usage_sample.cpp new file mode 100644 index 00000000..91a80a6f --- /dev/null +++ b/module/usage_sample.cpp @@ -0,0 +1,14 @@ +//Copyright (c) 2025 Antony Polukhin. + +//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) + +// To compile manually use a command like the folowing: +// clang++ -std=c++20 -fmodule-file=core.pcm core.pcm usage_sample.cpp + +import Boost.Core; + +int main() { + int x = 42; + return *boost::core::launder(boost::addressof(x)) == 42 ? 0 : 1; +}