diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 358c5f14..29ad4424 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,349 @@ jobs: run: | cd boost-root/__build__ ctest --output-on-failure --no-tests=error -C Release + + posix-cmake-subdir-modules: + + + 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 g++-15 + ./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 \ + -DBOOST_USE_MODULES=ON \ + -DCMAKE_CXX_MODULE_STD=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ + -DCMAKE_CXX_COMPILER=g++-15 \ + .. + cmake --build . + ctest --output-on-failure --no-tests=error + + posix-cmake-install-modules: + + 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 g++-15 + ./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 \ + -DBOOST_INCLUDE_LIBRARIES=$LIBRARY \ + -DCMAKE_INSTALL_PREFIX=~/.local \ + -DBOOST_USE_MODULES=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ + -DCMAKE_CXX_COMPILER=g++-15 \ + .. + + - 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_INSTALL_PREFIX=~/.local \ + -DCMAKE_CXX_MODULE_STD=ON \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444 \ + -DCMAKE_CXX_COMPILER=g++-15 \ + .. + 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_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_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_C_COMPILER=gcc-15 -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_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 + + 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_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 + + 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/CMakeLists.txt b/CMakeLists.txt index 1b2c5abd..cfe1ff34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,17 +3,29 @@ # 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) +if (BOOST_USE_MODULES) + add_library(boost_core STATIC) + 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) -target_include_directories(boost_core INTERFACE include) +else() + add_library(boost_core INTERFACE) + set(__scope INTERFACE) +endif() +add_library(Boost::core ALIAS boost_core) +target_include_directories(boost_core ${__scope} include) target_link_libraries(boost_core - INTERFACE + ${__scope} Boost::assert Boost::config Boost::throw_exception diff --git a/appveyor.yml b/appveyor.yml index 510bd413..7e599633 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 diff --git a/include/boost/core/addressof.hpp b/include/boost/core/addressof.hpp index 5473c36a..b7758017 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 07ff4447..712a65b6 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 075d3cb3..294bd518 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 0f0ed325..2981323e 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 bf8749d8..f30e5ea3 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/bit.hpp b/include/boost/core/bit.hpp index 755ad401..3652a3c7 100644 --- a/include/boost/core/bit.hpp +++ b/include/boost/core/bit.hpp @@ -7,6 +7,14 @@ # pragma once #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + // boost/core/bit.hpp // // A portable version of the C++20 standard header @@ -15,16 +23,17 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #include #include #include -#include -#include -#include +#include +#include +#include #if defined(_MSC_VER) -# include +# include # pragma intrinsic(_BitScanForward) # pragma intrinsic(_BitScanReverse) @@ -69,7 +78,7 @@ namespace core #if defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST) -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR To bit_cast( From const & from ) BOOST_NOEXCEPT { return __builtin_bit_cast( To, from ); @@ -77,7 +86,7 @@ BOOST_CONSTEXPR To bit_cast( From const & from ) BOOST_NOEXCEPT #else -template +BOOST_CORE_MODULE_EXPORT template To bit_cast( From const & from ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( sizeof(To) == sizeof(From) ); @@ -123,7 +132,7 @@ BOOST_CONSTEXPR inline int countl_impl( boost::ulong_long_type x ) BOOST_NOEXCEP } // namespace detail -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -293,7 +302,7 @@ inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT } // namespace detail -template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -320,7 +329,7 @@ BOOST_CXX14_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT #endif // defined(__GNUC__) || defined(__clang__) -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int countl_one( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -362,7 +371,7 @@ BOOST_CONSTEXPR inline int countr_impl( boost::ulong_long_type x ) BOOST_NOEXCEP } // namespace detail -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -518,7 +527,7 @@ inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT } // namespace detail -template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -545,7 +554,7 @@ BOOST_CXX14_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT #endif // defined(__GNUC__) || defined(__clang__) -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int countr_one( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -595,7 +604,7 @@ BOOST_CORE_POPCOUNT_CONSTEXPR inline int popcount_impl( boost::ulong_long_type x #undef BOOST_CORE_POPCOUNT_CONSTEXPR -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -628,7 +637,7 @@ BOOST_CXX14_CONSTEXPR inline int popcount_impl( boost::uint64_t x ) BOOST_NOEXCE } // namespace detail -template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -649,7 +658,7 @@ BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT // rotating -template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T rotl( T x, int s ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -658,7 +667,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_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -669,7 +678,7 @@ BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT // integral powers of 2 -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR bool has_single_bit( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -680,7 +689,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_CORE_MODULE_EXPORT template BOOST_CONSTEXPR int bit_width( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -688,7 +697,7 @@ BOOST_CONSTEXPR int bit_width( T x ) BOOST_NOEXCEPT return std::numeric_limits::digits - boost::core::countl_zero( x ); } -template +BOOST_CORE_MODULE_EXPORT template BOOST_CONSTEXPR T bit_floor( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -742,7 +751,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x ) } // namespace detail -template +BOOST_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T bit_ceil( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer && !std::numeric_limits::is_signed ); @@ -793,14 +802,14 @@ BOOST_CXX14_CONSTEXPR T bit_ceil( T x ) BOOST_NOEXCEPT #if !defined(BOOST_NO_CXX11_SCOPED_ENUMS) -enum class endian +BOOST_CORE_MODULE_EXPORT enum class endian { big, little, native BOOST_CORE_BIT_NATIVE_INITIALIZER }; -typedef endian endian_type; +BOOST_CORE_MODULE_EXPORT typedef endian endian_type; #else @@ -920,7 +929,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_CORE_MODULE_EXPORT template BOOST_CXX14_CONSTEXPR T byteswap( T x ) BOOST_NOEXCEPT { BOOST_CORE_STATIC_ASSERT( std::numeric_limits::is_integer ); @@ -951,4 +960,6 @@ template BOOST_CXX14_CONSTEXPR T byteswap( T x ) BOOST_NOEXCEPT # pragma warning(pop) #endif +#endif + #endif // #ifndef BOOST_CORE_BIT_HPP_INCLUDED diff --git a/include/boost/core/checked_delete.hpp b/include/boost/core/checked_delete.hpp index 67f3c742..df6ebbb7 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 @@ -64,7 +73,7 @@ template inline void checked_array_delete(T * x) BOOST_NOEXCEPT namespace checked_deleters { -template struct checked_deleter +BOOST_CORE_MODULE_EXPORT template struct checked_deleter { typedef void result_type; typedef T * argument_type; @@ -76,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; @@ -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 9cfe26e1..4717d6dc 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 03ac5228..52c1c022 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 6640473f..cd389524 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 @@ -54,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; @@ -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/demangle.hpp b/include/boost/core/demangle.hpp index 63e5f7c3..cdefbfa5 100644 --- a/include/boost/core/demangle.hpp +++ b/include/boost/core/demangle.hpp @@ -10,35 +10,26 @@ // 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 -#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 - +#include #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 -# include -# include -# endif +# include +# include #endif namespace boost @@ -47,26 +38,26 @@ namespace boost namespace core { -inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT; -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; -class scoped_demangled_name +BOOST_CORE_MODULE_EXPORT class scoped_demangled_name { private: 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; } @@ -78,19 +69,19 @@ 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(); @@ -101,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; } @@ -123,4 +114,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/demangle_cxxabi.hpp b/include/boost/core/detail/demangle_cxxabi.hpp new file mode 100644 index 00000000..403ec159 --- /dev/null +++ b/include/boost/core/detail/demangle_cxxabi.hpp @@ -0,0 +1,40 @@ +// 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 + +// 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 diff --git a/include/boost/core/detail/intrin.hpp b/include/boost/core/detail/intrin.hpp new file mode 100644 index 00000000..1b5e83f7 --- /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 diff --git a/include/boost/core/detail/is_same.hpp b/include/boost/core/detail/is_same.hpp index 634d3004..cca43750 100644 --- a/include/boost/core/detail/is_same.hpp +++ b/include/boost/core/detail/is_same.hpp @@ -9,6 +9,15 @@ // 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 #include #if defined(BOOST_HAS_PRAGMA_ONCE) @@ -22,7 +31,7 @@ namespace core namespace detail { -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 ); }; @@ -36,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/lwt_unattended.hpp b/include/boost/core/detail/lwt_unattended.hpp index 96fc5fc5..0d3769f9 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 diff --git a/include/boost/core/detail/minstd_rand.hpp b/include/boost/core/detail/minstd_rand.hpp index bedafb28..0ebccd12 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/modules.hpp b/include/boost/core/detail/modules.hpp new file mode 100644 index 00000000..65018a41 --- /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/sp_thread_pause.hpp b/include/boost/core/detail/sp_thread_pause.hpp index 8971fbd1..a4e327f6 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__) ) diff --git a/include/boost/core/detail/splitmix64.hpp b/include/boost/core/detail/splitmix64.hpp index e91ab0a2..0bdf9ff5 100644 --- a/include/boost/core/detail/splitmix64.hpp +++ b/include/boost/core/detail/splitmix64.hpp @@ -9,6 +9,15 @@ // 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) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + +#include #include namespace boost @@ -16,6 +25,7 @@ namespace boost namespace detail { +BOOST_CORE_MODULE_EXPORT class splitmix64 { private: @@ -24,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; @@ -51,4 +61,6 @@ class splitmix64 } // namespace detail } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_DETAIL_SPLITMIX64_HPP_INCLUDED diff --git a/include/boost/core/detail/static_assert.hpp b/include/boost/core/detail/static_assert.hpp index f62f7671..ca71b7ba 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/detail/string_view.hpp b/include/boost/core/detail/string_view.hpp index b0c256f5..a14494b4 100644 --- a/include/boost/core/detail/string_view.hpp +++ b/include/boost/core/detail/string_view.hpp @@ -7,6 +7,14 @@ # pragma once #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + // boost::core::basic_string_view // // Copyright 2021 Peter Dimov @@ -15,27 +23,28 @@ #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 #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 +# include // std::formatter #endif namespace boost @@ -336,6 +345,7 @@ template BOOST_CXX14_CONSTEXPR std::size_t find_last_not_of( Ch const* } // namespace detail +BOOST_CORE_MODULE_EXPORT template class basic_string_view { private: @@ -1185,6 +1195,7 @@ template class basic_string_view // stream inserter +BOOST_CORE_MODULE_EXPORT template std::basic_ostream& operator<<( std::basic_ostream& os, basic_string_view str ) { Ch const* p = str.data(); @@ -1221,19 +1232,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_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) -typedef basic_string_view u16string_view; +BOOST_CORE_MODULE_EXPORT typedef basic_string_view u16string_view; #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) -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 -typedef basic_string_view u8string_view; +BOOST_CORE_MODULE_EXPORT typedef basic_string_view u8string_view; #endif } // namespace core @@ -1275,4 +1286,6 @@ struct std::formatter, Ch2>: std::formatter #include #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) -#include +#include #endif #if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 40700) @@ -43,11 +50,11 @@ struct use_empty_value_base { }; }; -struct empty_init_t { }; +BOOST_CORE_MODULE_EXPORT struct empty_init_t { }; namespace empty_ { -template::value> class empty_value { public: @@ -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/enable_if.hpp b/include/boost/core/enable_if.hpp index 5dcef1e0..c09f3d71 100644 --- a/include/boost/core/enable_if.hpp +++ b/include/boost/core/enable_if.hpp @@ -14,14 +14,23 @@ #ifndef BOOST_CORE_ENABLE_IF_HPP #define BOOST_CORE_ENABLE_IF_HPP -#include "boost/config.hpp" +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + +#include +#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 #ifndef BOOST_NO_SFINAE -namespace boost +BOOST_CORE_MODULE_EXPORT namespace boost { template struct enable_if_has_type @@ -126,3 +135,5 @@ namespace boost { #endif // BOOST_NO_SFINAE #endif + +#endif diff --git a/include/boost/core/exchange.hpp b/include/boost/core/exchange.hpp index bc8a9fcd..8302e91c 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 d689f114..2e244950 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 7a31cb15..ec597b6a 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 @@ -30,14 +37,14 @@ 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; /*! * 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); @@ -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 5373542e..2fd31900 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 f3ee11b9..8ad82fd9 100644 --- a/include/boost/core/functor.hpp +++ b/include/boost/core/functor.hpp @@ -16,13 +16,21 @@ #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 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 > @@ -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 f27733be..53339618 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 7c4a9978..f067590a 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 80562895..988551d2 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 9ec5e7ee..26fc0378 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/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index f786deb2..1a21600d 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -22,17 +22,14 @@ // http://www.boost.org/LICENSE_1_0.txt // -#include +// 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 -#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: @@ -40,6 +37,23 @@ # define BOOST_LIGHTWEIGHT_TEST_OSTREAM std::cerr #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) +// Note that we're guaranteed to not be in a purview here +import boost.core; +#else + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + namespace boost { namespace detail @@ -49,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_ ) { @@ -63,12 +77,12 @@ class test_result } } - int& errors() + inline int& errors() { return errors_; } - void done() + inline void done() { report_ = true; } @@ -79,6 +93,7 @@ class test_result int errors_; }; +BOOST_CORE_MODULE_EXPORT inline test_result& test_results() { static test_result instance; @@ -90,6 +105,7 @@ inline int& test_errors() return test_results().errors(); } +BOOST_CORE_MODULE_EXPORT inline bool test_impl(char const * expr, char const * file, int line, char const * function, bool v) { if( v ) @@ -107,6 +123,7 @@ inline bool test_impl(char const * expr, char const * file, int line, char const } } +BOOST_CORE_MODULE_EXPORT inline void error_impl(char const * msg, char const * file, int line, char const * function) { BOOST_LIGHTWEIGHT_TEST_OSTREAM @@ -115,6 +132,7 @@ inline void error_impl(char const * msg, char const * file, int line, char const ++test_results().errors(); } +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 @@ -123,6 +141,7 @@ inline void throw_failed_impl(const char* expr, char const * excep, char const * ++test_results().errors(); } +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 @@ -131,6 +150,7 @@ inline void no_throw_failed_impl(const char* expr, const char* file, int line, c ++test_results().errors(); } +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 @@ -219,37 +239,37 @@ inline std::string test_output_impl( char8_t const& v ) // predicates -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; } }; -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; } }; -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; } }; -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; } }; -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; } }; -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; } @@ -294,6 +314,7 @@ inline char const * lwt_predicate_name( lw_test_ge const& ) // +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, @@ -315,6 +336,7 @@ inline bool test_with_impl(BinaryPredicate pred, char const * expr1, char const } } +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 ) { @@ -333,6 +355,7 @@ inline bool test_cstr_eq_impl( char const * expr1, char const * expr2, } } +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 ) { @@ -351,6 +374,7 @@ inline bool test_cstr_ne_impl( char const * expr1, char const * expr2, } } +BOOST_CORE_MODULE_EXPORT template bool test_all_eq_impl(FormattedOutputFunction& output, char const * file, int line, char const * function, @@ -421,6 +445,7 @@ bool test_all_eq_impl(FormattedOutputFunction& output, } } +BOOST_CORE_MODULE_EXPORT template bool test_all_with_impl(FormattedOutputFunction& output, char const * file, int line, char const * function, @@ -504,6 +529,7 @@ bool test_all_with_impl(FormattedOutputFunction& output, } // namespace detail +BOOST_CORE_MODULE_EXPORT inline int report_errors() { boost::detail::test_result& result = boost::detail::test_results(); @@ -529,6 +555,7 @@ inline int report_errors() namespace core { +BOOST_CORE_MODULE_EXPORT inline void lwt_init() { boost::detail::test_results(); @@ -537,6 +564,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)) diff --git a/include/boost/core/lightweight_test_trait.hpp b/include/boost/core/lightweight_test_trait.hpp index eea23717..1d4f996d 100644 --- a/include/boost/core/lightweight_test_trait.hpp +++ b/include/boost/core/lightweight_test_trait.hpp @@ -20,17 +20,29 @@ // 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) +// Note that we're guaranteed to not be in a purview here +import boost.core; +#else + #include #include -#include 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 ) @@ -50,12 +62,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 ) ) @@ -78,6 +90,11 @@ template inline void test_trait_same_impl( char const * type } // namespace detail } // 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_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) ) diff --git a/include/boost/core/make_span.hpp b/include/boost/core/make_span.hpp index 5f5df563..957c0b66 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 a5806d4b..829d5b0b 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 0432f6f9..76265c88 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: @@ -66,7 +73,7 @@ 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 @@ -74,12 +81,12 @@ 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 ); } @@ -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 1278e856..fa524230 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 623e3ea4..b929230c 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 4ec2d54f..a21197c4 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 08b6a3d4..f33528b5 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 @@ -31,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; @@ -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 8826a592..c233e1b6 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 4957ff85..74a84514 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 7de7a8e9..3a827143 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 ff1bda36..48d30a06 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 d29a4d6f..012735e7 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 9267455d..97375f2a 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 9c78c582..f7dc6532 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 dd04daa1..98e05237 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 91e252b4..371342ca 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 01446596..bcfc57cf 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/type_name.hpp b/include/boost/core/type_name.hpp index 81e00c20..834383cf 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -7,24 +7,33 @@ # pragma once #endif +#if defined(BOOST_USE_MODULES) && !defined(BOOST_CORE_INTERFACE_UNIT) + +#ifndef BOOST_IN_MODULE_PURVIEW +import boost.core; +#endif + +#else + // std::string boost::core::type_name() // // Copyright 2021 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) -# include +# include #endif namespace boost @@ -232,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; } @@ -240,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; } @@ -248,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; } @@ -256,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; } @@ -264,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; } @@ -272,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; } @@ -280,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; } @@ -288,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; } @@ -296,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; } @@ -304,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; } @@ -312,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; } @@ -320,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; } @@ -330,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; } @@ -338,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; } @@ -350,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; } @@ -362,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; } @@ -374,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; } @@ -386,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; } @@ -398,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; } @@ -410,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; } @@ -418,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; } @@ -426,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; } @@ -436,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; } @@ -448,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; } @@ -460,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 ); } @@ -468,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 ); } @@ -476,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 ); } @@ -486,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 ); } @@ -496,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 ); } @@ -940,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; } @@ -948,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; } @@ -958,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; } @@ -970,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; } @@ -982,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; } @@ -1004,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; } @@ -1014,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; } @@ -1022,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; } @@ -1032,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; } @@ -1044,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; } @@ -1056,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; } @@ -1175,7 +1184,7 @@ template class L, class T, std::size_t N> struc } // namespace detail -template std::string type_name() +BOOST_CORE_MODULE_EXPORT template std::string type_name() { return core::detail::tn_holder::type_name( "" ); } @@ -1183,4 +1192,6 @@ template std::string type_name() } // namespace core } // namespace boost +#endif + #endif // #ifndef BOOST_CORE_TYPE_NAME_HPP_INCLUDED diff --git a/include/boost/core/typeinfo.hpp b/include/boost/core/typeinfo.hpp index d33d29ba..049bd337 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 { @@ -41,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) @@ -58,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) @@ -76,7 +81,7 @@ class typeinfo #endif } - char const* name() const + inline char const* name() const { return name_; } @@ -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 380e81cd..ad01d8b2 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 7ecba313..9d71981f 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 9d9be79d..0686dc52 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 b6074703..c91d9cda 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 899453e5..de9aea44 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/include/boost/get_pointer.hpp b/include/boost/get_pointer.hpp index 36e2cd7d..4ec02da2 100644 --- a/include/boost/get_pointer.hpp +++ b/include/boost/get_pointer.hpp @@ -2,10 +2,18 @@ // 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 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 @@ -17,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; } @@ -45,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(); } @@ -59,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(); } @@ -73,4 +81,6 @@ template T * get_pointer( std::shared_ptr const& p ) } // namespace boost +#endif + #endif // GET_POINTER_DWA20021219_HPP diff --git a/include/boost/is_placeholder.hpp b/include/boost/is_placeholder.hpp index 5f1b544f..c9273a1d 100644 --- a/include/boost/is_placeholder.hpp +++ b/include/boost/is_placeholder.hpp @@ -7,7 +7,6 @@ # pragma once #endif - // is_placeholder.hpp - TR1 is_placeholder metafunction // // Copyright (c) 2006 Peter Dimov @@ -17,15 +16,25 @@ // 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 { -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 896aed4d..376a435a 100644 --- a/include/boost/non_type.hpp +++ b/include/boost/non_type.hpp @@ -11,17 +11,25 @@ #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 + +#include 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 ab81c916..a392d3e3 100644 --- a/include/boost/type.hpp +++ b/include/boost/type.hpp @@ -4,15 +4,25 @@ // 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 + +#include 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 6463ca9c..3e7b4af3 100644 --- a/include/boost/visit_each.hpp +++ b/include/boost/visit_each.hpp @@ -6,22 +6,31 @@ // 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 + +#include + 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 new file mode 100644 index 00000000..9cd55f17 --- /dev/null +++ b/modules/boost_core.cppm @@ -0,0 +1,82 @@ +module; + +#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 +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include + +export module boost.core; + +export import std; // re-exporting simplifies consuming lightweight_test + +#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 + +#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 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a6cdfdcc..aaa1f4f4 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 6e8f7069..bb94b57f 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 bf75aca5..ffe49489 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 3ad48f43..97e82705 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 6468a79d..bc551151 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 b2837f11..3e337958 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 96def034..145a5203 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/allocator_size_type_test.cpp b/test/allocator_size_type_test.cpp index 50301ca7..b09e93be 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 diff --git a/test/bit_byteswap_test_cx.cpp b/test/bit_byteswap_test_cx.cpp index 384d87b5..351d79fd 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 3d3408ff..d8d7b07d 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 1f185350..336f5b45 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 94cbfc00..fd9e9964 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 fe6e3b5b..7a9c4b33 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 ab9bd063..7dc117a9 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 3548ac5f..1fa843be 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 06f415ea..d60120a5 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 04dc720f..37961dca 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 cf8ee870..7ecfa943 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 d31c5e9f..19b94117 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 eff6f4bf..b2b741ae 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 8f84ac57..11e7d666 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/cmake_install_test/CMakeLists.txt b/test/cmake_install_test/CMakeLists.txt index e2afe732..4e3a4b1c 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 045a4765..5c0c84bc 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) diff --git a/test/cmath_test.cpp b/test/cmath_test.cpp index 20b0aab2..a3a6c77d 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 9849a9e3..26418cd4 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 041c52ad..f3347f2e 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 0656ed55..f5f9a0f3 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 fce32834..4c18283d 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 bafb4762..5c2fadd3 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 0cd3a974..1013150c 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 fdb37e38..7fdbeaa7 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 54527337..3404ff3f 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 6940eca3..70ecf6a4 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 43633356..5a594423 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 873e5b0a..4e12ac03 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 4bccccb6..a057e998 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 221f8c7b..1b7c01b0 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 5cd4e9b8..7afd2057 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 e82e450b..2278c8ba 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 67bdd800..bd019734 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 98adcfb4..af349975 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 46254e75..df586bb9 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 9a4a4293..d81d3964 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 bc078a41..d976242f 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 bb178711..d35e9e89 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 7460af9a..c3a77c16 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 cda641aa..e3da6a76 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 4583c2cc..cd952603 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 461d1e63..ecc06615 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 45b8e35f..d66bf452 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 a95d558e..40aad1b2 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 6cce8ae2..3c83d796 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 605941f0..e3a27132 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 f1f02938..0619acf0 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 ee87e616..0c09ad46 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 588c9a55..b7952bb0 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 9c92ae92..af6251db 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 9c1a8b26..7dcc5976 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 905ca8d5..7053b702 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 48483ba2..1ea865d0 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 95557f6b..5bd547c6 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 b7dc1e63..a8c359af 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 cc0b2316..e4f0bf65 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 3a0b4444..0738dced 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 91e61e09..adb4cd64 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 eef12d61..f5632630 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 3da015b2..a55ed0e2 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 f490d16e..f5440cab 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 f42f1e42..4378aef7 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 f9cec64e..a1d44db8 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 ee0e196c..e882ce55 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 75abe882..9df1df3c 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 e4a94f73..6f337270 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 86de3daf..94359e0d 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 a6d3e29e..d33bd7da 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 c94c5be9..6988f021 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 59a255f9..326e9d79 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 6bdd0175..a7bb036c 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 62482240..f1399ce4 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 cdf97ac0..512a5c34 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 dc2c045e..4575abd6 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 ce05f21b..9b47f183 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 57078d64..341d59e1 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 4661afd1..593d5e5c 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 1a4d2b08..a88c6330 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 12ab0cc6..768db7a3 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 8fa88692..93d7d4c3 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 864c2bd8..75a02da6 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 51cde0ab..fe416818 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 d0725661..39e73d34 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 5f0a7e6c..50ac5d33 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 8fe45f96..15e9a5a2 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 52c529de..e0ab3c45 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 9f4775eb..f5045530 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 3921eabe..f679dd58 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 7b8e5d19..f74dbb6b 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 d26729d2..177e64c4 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 14c8e7c2..6978b80b 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 b255aa72..c3fb8d25 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 f32a168a..3272385d 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 f394b1ac..529a22c7 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 d7d43964..0f778aa9 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 08cc8727..f73e10da 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 3e122bb1..a5214213 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 31c6bc40..7b5b0fe1 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 d1fcc3cd..b8a1ce8c 100644 --- a/test/visit_each_test.cpp +++ b/test/visit_each_test.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include struct X { diff --git a/tools/install-cmake.sh b/tools/install-cmake.sh new file mode 100755 index 00000000..d2fd0bba --- /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 00000000..4d2ee48b --- /dev/null +++ b/tools/setup_boost_with_modules.py @@ -0,0 +1,28 @@ +#!/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 check_call +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) + 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('../..') + + +if __name__ == '__main__': + main()