diff --git a/.drone.star b/.drone.star index 9da936d..cfdae14 100644 --- a/.drone.star +++ b/.drone.star @@ -8,7 +8,7 @@ # As the yaml syntax for Drone CI is rather limited. # # -globalenv={'B2_VARIANT': 'variant=release,debug'} +globalenv={'B2_CI_VERSION': '0', 'B2_VARIANT': 'variant=release,debug'} linuxglobalimage="cppalliance/droneubuntu1604:1" windowsglobalimage="cppalliance/dronevs2019" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index adeceab..bb4ce1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,27 +26,10 @@ jobs: #------------------ # Linux, gcc #------------------ - # Linux, gcc-4.6 - - toolset: gcc-4.6 - cxxstd: "03,0x" - address-model: 32,64 - os: ubuntu-latest - container: ubuntu:16.04 - install: - - g++-4.6-multilib - sources: - - "ppa:ubuntu-toolchain-r/test" - # Linux, gcc-4.7 - - toolset: gcc-4.7 - cxxstd: "03,11" - address-model: 32,64 - os: ubuntu-latest - container: ubuntu:16.04 - install: - - g++-4.7-multilib # Linux, gcc-4.8 - toolset: gcc-4.8 cxxstd: "03,11" + cxxflags: -pipe address-model: 32,64 os: ubuntu-latest container: ubuntu:18.04 @@ -55,6 +38,7 @@ jobs: # Linux, gcc-4.9 - toolset: gcc-4.9 cxxstd: "03,11" + cxxflags: -pipe address-model: 32,64 os: ubuntu-latest container: ubuntu:16.04 @@ -62,6 +46,7 @@ jobs: - g++-4.9-multilib # Linux, gcc-5 - toolset: gcc-5 + cxxflags: -pipe cxxstd: "03,11,14,1z" address-model: 32,64 os: ubuntu-latest @@ -71,6 +56,7 @@ jobs: # Linux, gcc-6 - toolset: gcc-6 cxxstd: "03,11,14,1z" + cxxflags: -pipe address-model: 32,64 os: ubuntu-latest container: ubuntu:18.04 @@ -79,6 +65,7 @@ jobs: # Linux, gcc-7 - toolset: gcc-7 cxxstd: "03,11,14,17" + cxxflags: -pipe address-model: 32,64 os: ubuntu-latest container: ubuntu:18.04 @@ -87,6 +74,7 @@ jobs: # Linux, gcc-8 - toolset: gcc-8 cxxstd: "03,11,14,17,2a" + cxxflags: -pipe address-model: 32,64 os: ubuntu-latest container: ubuntu:18.04 @@ -95,6 +83,7 @@ jobs: # Linux, gcc-9 - toolset: gcc-9 cxxstd: "03,11,14,17,2a" + cxxflags: -pipe address-model: 32,64 os: ubuntu-latest container: ubuntu:20.04 @@ -103,6 +92,7 @@ jobs: # Linux, gcc-10 - toolset: gcc-10 cxxstd: "03,11,14,17,20" + cxxflags: -pipe address-model: 32,64 os: ubuntu-latest container: ubuntu:20.04 @@ -111,6 +101,7 @@ jobs: # Linux, gcc-11 - toolset: gcc-11 cxxstd: "03,11,14,17,20,23" + cxxflags: -pipe address-model: 32,64 os: ubuntu-latest container: ubuntu:22.04 @@ -119,6 +110,7 @@ jobs: # Linux, gcc-12 - toolset: gcc-12 cxxstd: "03,11,14,17,20,23" + cxxflags: -pipe address-model: 32,64 os: ubuntu-latest container: ubuntu:22.04 @@ -126,42 +118,54 @@ jobs: - g++-12-multilib # Linux, gcc-13 - toolset: gcc-13 - cxxstd: "11,14,17,20,2b" + cxxstd: "03,11,14,17,20,2b" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:24.04 install: g++-13-multilib address-model: 32,64 # Linux, gcc-14 - toolset: gcc-14 - cxxstd: "11,14,17,20,2b" + cxxstd: "03,11,14,17,20,2b" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:24.04 install: g++-14-multilib address-model: 32,64 - # Linux, gcc-12 UBSAN + # Linux, gcc-15 + - toolset: gcc-15 + cxxstd: "03,11,14,17,20,23,2c" + cxxflags: -pipe + os: ubuntu-latest + container: ubuntu:25.04 + install: g++-15-multilib + address-model: 32,64 + # Linux, gcc-15, ubsan - name: UBSAN - toolset: gcc-12 + toolset: gcc-15 cxxstd: "03,11,14,17,20,23" + cxxflags: -pipe ubsan: 1 os: ubuntu-latest - container: ubuntu:22.04 - install: - - g++-12 + container: ubuntu:25.04 + install: g++-15 + # Linux, gcc-15, asan + - name: ASAN + toolset: gcc-15 + cxxstd: "03,11,14,17,20,23" + cxxflags: -pipe + asan: 1 + os: ubuntu-latest + container: ubuntu:25.04 + install: g++-15 #------------------ # Linux, clang #------------------ - # Linux, clang-3.5 - - toolset: clang - compiler: clang++-3.5 - cxxstd: "03,11" - os: ubuntu-latest - container: ubuntu:16.04 - install: - - clang-3.5 # Linux, clang-3.6 - toolset: clang compiler: clang++-3.6 cxxstd: "03,11,14" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:16.04 install: @@ -170,6 +174,7 @@ jobs: - toolset: clang compiler: clang++-3.7 cxxstd: "03,11,14" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:16.04 install: @@ -178,6 +183,7 @@ jobs: - toolset: clang compiler: clang++-3.8 cxxstd: "03,11,14" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:16.04 install: @@ -186,6 +192,7 @@ jobs: - toolset: clang compiler: clang++-3.9 cxxstd: "03,11,14" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:18.04 install: @@ -194,6 +201,7 @@ jobs: - toolset: clang compiler: clang++-4.0 cxxstd: "03,11,14" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:18.04 install: @@ -202,6 +210,7 @@ jobs: - toolset: clang compiler: clang++-5.0 cxxstd: "03,11,14,1z" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:18.04 install: @@ -210,6 +219,7 @@ jobs: - toolset: clang compiler: clang++-6.0 cxxstd: "03,11,14,17" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:18.04 install: @@ -218,6 +228,7 @@ jobs: - toolset: clang compiler: clang++-7 cxxstd: "03,11,14,17" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:18.04 install: @@ -227,6 +238,7 @@ jobs: - toolset: clang compiler: clang++-8 cxxstd: "03,11,14,17,2a" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:18.04 install: @@ -237,6 +249,7 @@ jobs: - toolset: clang compiler: clang++-9 cxxstd: "03,11,14,17,2a" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:20.04 install: @@ -245,6 +258,7 @@ jobs: - toolset: clang compiler: clang++-10 cxxstd: "03,11,14,17,20" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:20.04 install: @@ -253,6 +267,7 @@ jobs: - toolset: clang compiler: clang++-11 cxxstd: "03,11,14,17,20" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:22.04 install: @@ -261,6 +276,7 @@ jobs: - toolset: clang compiler: clang++-12 cxxstd: "03,11,14,17,20" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:22.04 install: @@ -269,6 +285,7 @@ jobs: - toolset: clang compiler: clang++-13 cxxstd: "03,11,14,17,20" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:22.04 install: @@ -277,6 +294,7 @@ jobs: - toolset: clang compiler: clang++-14 cxxstd: "03,11,14,17,20" + cxxflags: -pipe os: ubuntu-latest container: ubuntu:22.04 install: @@ -285,12 +303,14 @@ jobs: - toolset: clang compiler: clang++-15 cxxstd: "03,11,14,17,20" + cxxflags: -pipe container: ubuntu:22.04 os: ubuntu-latest install: clang-15 # Linux, clang-16 - toolset: clang compiler: clang++-16 + cxxflags: -pipe cxxstd: "03,11,14,17,20,2b" container: ubuntu:24.04 os: ubuntu-latest @@ -299,6 +319,7 @@ jobs: - toolset: clang compiler: clang++-17 cxxstd: "03,11,14,17,20,2b" + cxxflags: -pipe container: ubuntu:24.04 os: ubuntu-latest install: clang-17 @@ -306,74 +327,104 @@ jobs: - toolset: clang compiler: clang++-18 cxxstd: "03,11,14,17,20,2b" + cxxflags: -pipe container: ubuntu:24.04 os: ubuntu-latest install: clang-18 + # Linux, clang-19 + - toolset: clang + compiler: clang++-19 + cxxstd: "03,11,14,17,20,2b" + cxxflags: -pipe + container: ubuntu:24.04 + os: ubuntu-latest + install: clang-19 + # Linux, clang-20 + - toolset: clang + compiler: clang++-20 + cxxstd: "03,11,14,17,20,23,2c" + cxxflags: -pipe + container: ubuntu:25.04 + os: ubuntu-latest + install: clang-20 # Linux, clang-15 libc++ - toolset: clang compiler: clang++-15 - cxxstd: "03,11,14,17,20,2b" - os: ubuntu-22.04 + cxxstd: "11,14,17,20,2b" + os: ubuntu-latest + container: ubuntu:22.04 install: - clang-15 - libc++-15-dev - libc++abi-15-dev - cxxflags: -stdlib=libc++ + cxxflags: -pipe -stdlib=libc++ linkflags: -stdlib=libc++ # Linux, clang-18 libc++ - toolset: clang compiler: clang++-18 cxxstd: "11,14,17,20,2b" - os: ubuntu-24.04 + os: ubuntu-latest + container: ubuntu:24.04 install: - clang-18 - libc++-18-dev - libc++abi-18-dev - cxxflags: -stdlib=libc++ + cxxflags: -pipe -stdlib=libc++ + linkflags: -stdlib=libc++ + # Linux, clang-20 libc++ + - toolset: clang + compiler: clang++-20 + cxxstd: "11,14,17,20,23,2c" + os: ubuntu-latest + container: ubuntu:25.04 + install: + - clang-20 + - libc++-20-dev + - libc++abi-20-dev + cxxflags: -pipe -stdlib=libc++ linkflags: -stdlib=libc++ - # Linux, clang-14 libc++, ubsan + # Linux, clang-20 libc++, ubsan - name: UBSAN toolset: clang - compiler: clang++-14 - cxxstd: "03,11,14,17,20" - cxxflags: -stdlib=libc++ + compiler: clang++-20 + cxxstd: "11,14,17,20,23,2c" + cxxflags: -pipe -stdlib=libc++ linkflags: -stdlib=libc++ ubsan: 1 - os: ubuntu-22.04 + os: ubuntu-latest + container: ubuntu:25.04 install: - - clang-14 - - libc++-14-dev - - libc++abi-14-dev - # Linux, clang-18 libc++, ubsan - - name: UBSAN + - clang-20 + - libc++-20-dev + - libc++abi-20-dev + # Linux, clang-20 libc++, asan + - name: ASAN toolset: clang - compiler: clang++-18 - cxxstd: "11,14,17,20" - cxxflags: -stdlib=libc++ + compiler: clang++-20 + cxxstd: "11,14,17,20,23,2c" + cxxflags: -pipe -stdlib=libc++ linkflags: -stdlib=libc++ - ubsan: 1 - os: ubuntu-24.04 + asan: 1 + os: ubuntu-latest + container: ubuntu:25.04 install: - - clang-18 - - libc++-18-dev - - libc++abi-18-dev + - clang-20 + - libc++-20-dev + - libc++abi-20-dev #------------------ # MacOS, clang #------------------ - # Macos 12, clang - toolset: clang cxxstd: "11,14,17,20,2b" - os: macos-12 - # Macos 13, clang + os: macos-14 - toolset: clang cxxstd: "11,14,17,20,2b" - os: macos-13 - # Macos 17, clang + os: macos-15 - toolset: clang - cxxstd: "11,14,17,20,2b" - os: macos-14 + cxxstd: "11,14,17,20,23,2c" + os: macos-26 - timeout-minutes: 180 + timeout-minutes: 240 runs-on: ${{matrix.os}} container: ${{matrix.container}} @@ -390,7 +441,9 @@ jobs: echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV if [ -f "/etc/debian_version" ] then - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + for i in $(seq 1 $NET_RETRY_COUNT); do + apt-get update && break || sleep 5 + done if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ] then PYTHON_PACKAGE="python-is-python3" @@ -456,7 +509,9 @@ jobs: done done fi - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + for i in $(seq 1 $NET_RETRY_COUNT); do + apt-get update && break || sleep 5 + done sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} - name: Setup GCC Toolchain @@ -485,6 +540,7 @@ jobs: BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true echo BOOST_BRANCH: $BOOST_BRANCH BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) + echo BUILD_JOBS: $BUILD_JOBS echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV DEPINST_ARGS=() @@ -537,7 +593,7 @@ jobs: rm -rf "../snapshot" git submodule update --init tools/boostdep DEPINST_ARGS+=("$LIBRARY") - python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" + python tools/boostdep/depinst/depinst.py -C "${DEPINST_ARGS[@]}" ./bootstrap.sh ./b2 headers if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] @@ -554,34 +610,57 @@ jobs: if: matrix.cmake_tests == '' run: | cd boost-root - B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}") + B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "debug-symbols=off") + #Build variant if [ -n "${{matrix.build_variant}}" ] then B2_ARGS+=("variant=${{matrix.build_variant}}") else B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") fi + #Threading if [ -n "${{matrix.threading}}" ] then B2_ARGS+=("threading=${{matrix.threading}}") fi + #UBSAN options if [ -n "${{matrix.ubsan}}" ] then - export UBSAN_OPTIONS="print_stacktrace=1" - B2_ARGS+=("undefined-sanitizer=norecover" "linkflags=-fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global") + export UBSAN_OPTIONS="verbosity=1:print_stacktrace=1" + B2_ARGS+=("undefined-sanitizer=norecover" "define=UBSAN=1") fi + #ASAN options + if [ -n "${{matrix.asan}}" ] + then + export ASAN_OPTIONS="verbosity=1:print_stacktrace=1" + B2_ARGS+=("address-sanitizer=norecover" "define=ASAN=1") + fi + #Common UBSAN / ASAN options + if [ -n "${{matrix.asan}}" ] || [ -n "${{matrix.ubsan}}" ] + then + B2_ARGS+=("debug-symbols=on" "visibility=global") + fi + #cxxflags if [ -n "${{matrix.cxxflags}}" ] then B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") fi + #address-model if [ -n "${{matrix.address-model}}" ] then B2_ARGS+=("address-model=${{matrix.address-model}}") fi + #link-flags if [ -n "${{matrix.linkflags}}" ] then B2_ARGS+=("linkflags=${{matrix.linkflags}}") fi + #cxxstd + if [ -n "${{matrix.cxxstd}}" ] + then + B2_ARGS+=("cxxstd=${{matrix.cxxstd}}") + fi + B2_ARGS+=("libs/$LIBRARY/test") ./b2 "${B2_ARGS[@]}" @@ -590,28 +669,26 @@ jobs: fail-fast: false matrix: include: - - toolset: msvc-14.0 - cxxstd: "14" - addrmd: 32,64 - os: windows-2019 - - toolset: msvc-14.2 + #------------------ + #Windows runners are much slower, split 32/64 bit jobs + - toolset: msvc-14.3 cxxstd: "14,17,20,latest" - addrmd: 32,64 - os: windows-2019 + addrmd: 32 + os: windows-2025 - toolset: msvc-14.3 cxxstd: "14,17,20,latest" - addrmd: 32,64 - os: windows-2022 + addrmd: 64 + os: windows-2025 - toolset: clang-win cxxstd: "14,17,latest" addrmd: 64 - os: windows-2022 + os: windows-2025 - toolset: gcc cxxstd: "03,11,14,17,2a" addrmd: 64 - os: windows-2019 + os: windows-2025 - timeout-minutes: 180 + timeout-minutes: 240 runs-on: ${{matrix.os}} steps: @@ -628,6 +705,7 @@ jobs: set BOOST_BRANCH=develop for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master echo BOOST_BRANCH: %BOOST_BRANCH% + echo NUMBER_OF_PROCESSORS: %NUMBER_OF_PROCESSORS% mkdir snapshot cd snapshot echo Downloading library snapshot: https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip @@ -647,7 +725,7 @@ jobs: move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%" rmdir /s /q "..\snapshot" git submodule update --init tools/boostdep - python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY% + python tools/boostdep/depinst/depinst.py -C --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY% cmd /c bootstrap b2 -d0 headers @@ -655,5 +733,369 @@ jobs: shell: cmd run: | cd boost-root - b2 -j %NUMBER_OF_PROCESSORS% libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release embed-manifest-via=linker + b2 -j %NUMBER_OF_PROCESSORS% libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release embed-manifest-via=linker debug-symbols=off + cygwin: + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + include: + - toolset: gcc + cxxflags: -pipe + os: windows-latest + + timeout-minutes: 240 + runs-on: ${{matrix.os}} + container: ${{matrix.container}} + + steps: + - name: Setup environment + uses: cygwin/cygwin-install-action@master + with: + packages: gcc-g++ make python3 git wget curl + - name: Setup Boost + shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' + 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 + BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) + echo BUILD_JOBS: $BUILD_JOBS + echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV + echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV + DEPINST_ARGS=() + GIT_VERSION="$(git --version | sed -e 's/git version //')" + GIT_HAS_JOBS=1 + DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") + mkdir -p snapshot + cd snapshot + echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz" + curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz" + tar -xf "${LIBRARY}-${GITHUB_SHA}.tar.gz" + if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ] + then + echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:" + ls -la + exit 1 + fi + rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz" + cd .. + git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" + cd boost-root + mkdir -p libs + rm -rf "libs/$LIBRARY" + mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY" + rm -rf "../snapshot" + git submodule update --init tools/boostdep + DEPINST_ARGS+=("$LIBRARY") + python tools/boostdep/depinst/depinst.py -C "${DEPINST_ARGS[@]}" + ./bootstrap.sh + ./b2 headers + if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam + if [ -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam + fi + echo " ;" >> ~/user-config.jam + fi + + - name: Run tests + if: matrix.cmake_tests == '' + shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' + run: | + /usr/sbin/cygserver & + sleep 2 + cd boost-root + B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "debug-symbols=off") + #Build variant + if [ -n "${{matrix.build_variant}}" ] + then + B2_ARGS+=("variant=${{matrix.build_variant}}") + else + B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") + fi + #Threading + if [ -n "${{matrix.threading}}" ] + then + B2_ARGS+=("threading=${{matrix.threading}}") + fi + #UBSAN options + if [ -n "${{matrix.ubsan}}" ] + then + export UBSAN_OPTIONS="verbosity=1:print_stacktrace=1" + B2_ARGS+=("undefined-sanitizer=norecover" "define=UBSAN=1") + fi + #ASAN options + if [ -n "${{matrix.asan}}" ] + then + export ASAN_OPTIONS="verbosity=1:print_stacktrace=1" + B2_ARGS+=("address-sanitizer=norecover" "define=ASAN=1") + fi + #Common UBSAN / ASAN options + if [ -n "${{matrix.asan}}" ] || [ -n "${{matrix.ubsan}}" ] + then + B2_ARGS+=("debug-symbols=on" "visibility=global") + fi + #cxxflags + if [ -n "${{matrix.cxxflags}}" ] + then + B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") + fi + #address-model + if [ -n "${{matrix.address-model}}" ] + then + B2_ARGS+=("address-model=${{matrix.address-model}}") + fi + #link-flags + if [ -n "${{matrix.linkflags}}" ] + then + B2_ARGS+=("linkflags=${{matrix.linkflags}}") + fi + #cxxstd + if [ -n "${{matrix.cxxstd}}" ] + then + B2_ARGS+=("cxxstd=${{matrix.cxxstd}}") + fi + B2_ARGS+=("libs/$LIBRARY/test") + ./b2 "${B2_ARGS[@]}" + + bsd: + strategy: + fail-fast: false + matrix: + include: + - toolset: clang + vm: freebsd + cxxflags: -pipe + os: ubuntu-latest + bsd_version: "14.3" + + - toolset: clang + vm: openbsd + cxxflags: -pipe + os: ubuntu-latest + bsd_version: "7.8" + + - toolset: gcc + vm: netbsd + cxxflags: -pipe + os: ubuntu-latest + bsd_version: "10.1" + + timeout-minutes: 240 + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v4 + - name: Test on ${{matrix.vm}} + uses: cross-platform-actions/action@v0.30.0 + with: + operating_system: ${{matrix.vm}} + version: ${{matrix.bsd_version}} + environment_variables: GIT_FETCH_JOBS NET_RETRY_COUNT DEFAULT_BUILD_VARIANT + sync_files: false + shell: bash + run: | + export PATH=/usr/pkg/bin:/sbin:/usr/local/bin:$PATH >> ~/.profile + export PATH=/usr/pkg/bin:/sbin:/usr/local/bin:$PATH + uname -mrs + sysctl hw.model + sysctl hw.ncpu + sysctl hw.physmem + sysctl hw.usermem + pwd + ls -la + set -e + + # Install required packages + echo "Installing packages..." + if [ "${{matrix.vm}}" == "freebsd" ] + then + echo "Executing: sudo pkg git bash python3 curl" + sudo pkg install -y git bash python3 curl + fi + if [ "${{matrix.vm}}" == "openbsd" ] + then + pkg_info -Q python + echo "Executing: sudo pkg_add git bash python%3.11 curl" + sudo pkg_add -v git bash python%3.11 curl + # Check if python3 binary exists + if ! command -v python3 >/dev/null 2>&1; then + echo "python3 not found, creating symlink..." + sudo ln -sf /usr/local/bin/python3.11 /usr/local/bin/python3 + echo "Symlink created: /usr/local/bin/python3 -> /usr/local/bin/python3.11" + else + echo "python3 is already available at: $(which python3)" + fi + fi + if [ "${{matrix.vm}}" == "netbsd" ] + then + echo "Executing: pkgin -y install git-base bash python311 curl ca-certificates mozilla-rootcerts mozilla-rootcerts-openssl" + sudo sh -c ' + export PKG_PATH="http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r | cut -d_ -f1)/All/" + echo "$PKG_PATH" > /usr/pkg/etc/pkgin/repositories.conf + pkgin update + pkgin -V -y install git-base bash python311 curl ca-certificates mozilla-rootcerts mozilla-rootcerts-openssl + ln -s /usr/pkg/bin/python3.11 /usr/pkg/bin/python3 + ' + fi + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + 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 + BUILD_JOBS=$(sysctl -n hw.ncpu) + echo BUILD_JOBS: $BUILD_JOBS + DEPINST_ARGS=() + DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") + mkdir -p snapshot + cd snapshot + echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz" + curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz" + tar -xzf "${LIBRARY}-${GITHUB_SHA}.tar.gz" + if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ] + then + echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:" + ls -la + exit 1 + fi + rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz" + cd .. + git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" + cd boost-root + mkdir -p libs + rm -rf "libs/$LIBRARY" + mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY" + rm -rf "../snapshot" + git submodule update --init tools/boostdep + DEPINST_ARGS+=("$LIBRARY") + python3 --version + python3 tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" + ./bootstrap.sh + ./b2 headers + if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam + if [ -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam + fi + echo " ;" >> ~/user-config.jam + fi + # Run tests + B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "debug-symbols=off") + #Build variant + if [ -n "${{matrix.build_variant}}" ] + then + B2_ARGS+=("variant=${{matrix.build_variant}}") + else + B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") + fi + #Threading + if [ -n "${{matrix.threading}}" ] + then + B2_ARGS+=("threading=${{matrix.threading}}") + fi + #UBSAN options + if [ -n "${{matrix.ubsan}}" ] + then + export UBSAN_OPTIONS="verbosity=1:print_stacktrace=1" + B2_ARGS+=("undefined-sanitizer=norecover" "define=UBSAN=1") + fi + #ASAN options + if [ -n "${{matrix.asan}}" ] + then + export ASAN_OPTIONS="verbosity=1:print_stacktrace=1" + B2_ARGS+=("address-sanitizer=norecover" "define=ASAN=1") + fi + #Common UBSAN / ASAN options + if [ -n "${{matrix.asan}}" ] || [ -n "${{matrix.ubsan}}" ] + then + B2_ARGS+=("debug-symbols=on" "visibility=global") + fi + #cxxflags + if [ -n "${{matrix.cxxflags}}" ] + then + B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") + fi + #address-model + if [ -n "${{matrix.address-model}}" ] + then + B2_ARGS+=("address-model=${{matrix.address-model}}") + fi + #link-flags + if [ -n "${{matrix.linkflags}}" ] + then + B2_ARGS+=("linkflags=${{matrix.linkflags}}") + fi + #cxxstd + if [ -n "${{matrix.cxxstd}}" ] + then + B2_ARGS+=("cxxstd=${{matrix.cxxstd}}") + fi + + B2_ARGS+=("libs/$LIBRARY/test") + ./b2 "${B2_ARGS[@]}" + + B2_ARGS+=("libs/$LIBRARY/test") + ./b2 "${B2_ARGS[@]}" + + + docs: + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + container: cppalliance/boost_superproject_build:24.04-v4 + + timeout-minutes: 240 + runs-on: ${{matrix.os}} + container: ${{matrix.container}} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 3 + + - name: Git safe.directory + run: | + git status || git config --system --add safe.directory "$GITHUB_WORKSPACE" + + - uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + src: + - 'doc/**' + + - if: steps.changes.outputs.src == 'true' + name: Build docs + run: | + set -xe + curl --retry-all-errors --connect-timeout 15 -sSL --retry 5 -o linuxdocs.sh https://raw.githubusercontent.com/boostorg/release-tools/refs/heads/master/build_docs/linuxdocs.sh + chmod 755 linuxdocs.sh + ./linuxdocs.sh --skip-packages diff --git a/doc/move.qbk b/doc/move.qbk index aba2aaf..113da73 100644 --- a/doc/move.qbk +++ b/doc/move.qbk @@ -802,6 +802,30 @@ Special thanks to: [section:release_notes Release Notes] +[section:release_notes_boost_1_90 Boost 1.90 Release] + +* Fixed bugs: + * [@https://github.com/boostorg/move/issues/61 Git Issue #61: ['"launder_cast triggers warning about dropping const and volatile qualifiers"]]. + +[endsect] + +[section:release_notes_boost_1_88 Boost 1.88 Release] + +* Fixed bugs: + * [@https://github.com/boostorg/move/pull/58 Git Pull #58: ['"Avoid -Wdeprecated-variadic-comma-omission with GCC 15 trunk -std=c++26"]]. + +[endsect] + +[section:release_notes_boost_1_87 Boost 1.87 Release] + +* Fixed bugs: + * [@https://github.com/boostorg/move/issues/56 Git Issue #56: ['"Forward declarations of std types cause compilation errors on some platforms"]]. + * [@https://github.com/boostorg/move/issues/57 Git Issue #57: ['" fails to compile under libc++-19"]]. + +[endsect] + +Forward declarations of std types cause compilation errors on some platforms #292 + [section:release_notes_boost_1_85 Boost 1.85 Release] * Fixed bugs: diff --git a/example/movable.hpp b/example/movable.hpp index 3b2518f..0e05394 100644 --- a/example/movable.hpp +++ b/example/movable.hpp @@ -13,8 +13,17 @@ //[movable_definition //header file "movable.hpp" + +//This devinition should only include a single, minimal move header #include -#include + +//Forward declaration of +namespace boost{ + +template +struct has_nothrow_move; + +} //namespace boost{ //A movable class class movable diff --git a/include/boost/move/adl_move_swap.hpp b/include/boost/move/adl_move_swap.hpp index 63ad788..3648ea4 100644 --- a/include/boost/move/adl_move_swap.hpp +++ b/include/boost/move/adl_move_swap.hpp @@ -40,6 +40,8 @@ //In GCC 4.4 stl_move.h was renamed to move.h #include #endif +#elif defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION >= 13000) + #include <__utility/swap.h> //libc++ refactored headers in smaller headers #elif defined(_LIBCPP_VERSION) #include //The initial import of libc++ defines std::swap and still there #elif __cplusplus >= 201103L diff --git a/include/boost/move/core.hpp b/include/boost/move/core.hpp index 33fc393..e5e82ca 100644 --- a/include/boost/move/core.hpp +++ b/include/boost/move/core.hpp @@ -262,12 +262,12 @@ #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\ public:\ - inline TYPE& operator=(TYPE &t)\ + BOOST_MOVE_FORCEINLINE TYPE& operator=(TYPE &t)\ { this->operator=(const_cast(t)); return *this;}\ public:\ - inline operator ::boost::rv&() \ + BOOST_MOVE_FORCEINLINE operator ::boost::rv&() \ { return *BOOST_MOVE_TO_RV_CAST(::boost::rv*, this); }\ - inline operator const ::boost::rv&() const \ + BOOST_MOVE_FORCEINLINE operator const ::boost::rv&() const \ { return *BOOST_MOVE_TO_RV_CAST(const ::boost::rv*, this); }\ private:\ // @@ -447,7 +447,7 @@ #else //!defined(BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG) || defined(BOOST_MOVE_DOXYGEN_INVOKED) - #include + #include namespace boost { namespace move_detail { diff --git a/include/boost/move/detail/iterator_to_raw_pointer.hpp b/include/boost/move/detail/iterator_to_raw_pointer.hpp index 97ee3a6..53b977d 100644 --- a/include/boost/move/detail/iterator_to_raw_pointer.hpp +++ b/include/boost/move/detail/iterator_to_raw_pointer.hpp @@ -27,7 +27,7 @@ namespace movelib { namespace detail { template -inline T* iterator_to_pointer(T* i) +BOOST_MOVE_FORCEINLINE T* iterator_to_pointer(T* i) { return i; } template diff --git a/include/boost/move/detail/launder.hpp b/include/boost/move/detail/launder.hpp index a6236de..ca5d851 100644 --- a/include/boost/move/detail/launder.hpp +++ b/include/boost/move/detail/launder.hpp @@ -44,7 +44,7 @@ BOOST_MOVE_FORCEINLINE T* launder(T* p) template BOOST_MOVE_FORCEINLINE T launder_cast(const volatile void* p) { - return (launder)((T)p); + return (launder)(static_cast(const_cast(p))); } } //namespace move_detail { diff --git a/include/boost/move/detail/meta_utils.hpp b/include/boost/move/detail/meta_utils.hpp index ad5654a..46883a8 100644 --- a/include/boost/move/detail/meta_utils.hpp +++ b/include/boost/move/detail/meta_utils.hpp @@ -17,10 +17,10 @@ #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif -#include + +#include #include //forceinline #include -#include //for std::size_t #include //Small meta-typetraits to support move @@ -202,30 +202,32 @@ struct add_const_lvalue_reference }; ////////////////////////////////////// -// is_lvalue_reference +// identity ////////////////////////////////////// -template -struct is_lvalue_reference +template +struct identity { - static const bool value = false; -}; + typedef T type; + typedef typename add_const_lvalue_reference::type reference; -template -struct is_lvalue_reference -{ - static const bool value = true; -}; + BOOST_MOVE_FORCEINLINE reference operator()(reference t) const + { return t; } + //For transparent types + template + BOOST_MOVE_FORCEINLINE const K & operator()(const K &t) const + { return t; } +}; ////////////////////////////////////// // identity ////////////////////////////////////// -template -struct identity +template <> +struct identity { - typedef T type; - typedef typename add_const_lvalue_reference::type reference; - BOOST_MOVE_FORCEINLINE reference operator()(reference t) const + template + BOOST_MOVE_FORCEINLINE typename add_const_lvalue_reference::type + operator()(typename add_const_lvalue_reference::type t) const { return t; } }; @@ -526,6 +528,10 @@ template< class T > struct add_rvalue_reference { typedef T & type; }; +template< class T, std::size_t N > +struct add_rvalue_reference +{ typedef T (&type)[N]; }; + #endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template< class T > struct remove_rvalue_reference { typedef T type; }; @@ -558,6 +564,4 @@ template< class T > struct remove_rvalue_reference { typedef T type; }; } //namespace move_detail { } //namespace boost { -#include - #endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP diff --git a/include/boost/move/detail/meta_utils_core.hpp b/include/boost/move/detail/meta_utils_core.hpp index 4e11673..fcd04c7 100644 --- a/include/boost/move/detail/meta_utils_core.hpp +++ b/include/boost/move/detail/meta_utils_core.hpp @@ -131,6 +131,21 @@ struct enable_if_same : enable_if, R> {}; template struct disable_if_same : disable_if, R> {}; +////////////////////////////////////// +// is_lvalue_reference +////////////////////////////////////// +template +struct is_lvalue_reference +{ + static const bool value = false; +}; + +template +struct is_lvalue_reference +{ + static const bool value = true; +}; + } //namespace move_detail { } //namespace boost { diff --git a/include/boost/move/detail/nsec_clock.hpp b/include/boost/move/detail/nsec_clock.hpp index 88c0551..62ec2df 100644 --- a/include/boost/move/detail/nsec_clock.hpp +++ b/include/boost/move/detail/nsec_clock.hpp @@ -43,7 +43,7 @@ #include #if defined( BOOST_USE_WINDOWS_H ) -#include +#include #else #if defined (WIN32_PLATFORM_PSPC) diff --git a/include/boost/move/detail/placement_new.hpp b/include/boost/move/detail/placement_new.hpp index 69d3332..11a9fca 100644 --- a/include/boost/move/detail/placement_new.hpp +++ b/include/boost/move/detail/placement_new.hpp @@ -18,6 +18,8 @@ # pragma once #endif +#include + struct boost_move_new_t{}; //avoid including diff --git a/include/boost/move/detail/std_ns_begin.hpp b/include/boost/move/detail/std_ns_begin.hpp index 1d28117..ef9b4b4 100644 --- a/include/boost/move/detail/std_ns_begin.hpp +++ b/include/boost/move/detail/std_ns_begin.hpp @@ -9,6 +9,9 @@ #// #////////////////////////////////////////////////////////////////////////////// # +#ifndef BOOST_CONFIG_HPP +# include +#endif #if defined(_LIBCPP_VERSION) #if defined(__clang__) #define BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH @@ -23,12 +26,15 @@ #elif defined(BOOST_GNU_STDLIB) && defined(_GLIBCXX_BEGIN_NAMESPACE) //GCC >= 4.2 #define BOOST_MOVE_STD_NS_BEG _GLIBCXX_BEGIN_NAMESPACE(std) #define BOOST_MOVE_STD_NS_END _GLIBCXX_END_NAMESPACE +#elif defined(BOOST_DINKUMWARE_STDLIB) + #define BOOST_MOVE_STD_NS_BEG _STD_BEGIN + #define BOOST_MOVE_STD_NS_END _STD_END #else - #if defined(_MSC_VER) && (_MSC_VER >= 1915) - #pragma warning (push) - #pragma warning (disable : 4643) // Forward declaring 'X' in namespace std is not permitted by the C++ Standard - #endif - - #define BOOST_MOVE_STD_NS_BEG namespace std{ + #define BOOST_MOVE_STD_NS_BEG namespace std { #define BOOST_MOVE_STD_NS_END } #endif + +#if defined(_MSC_VER) && (_MSC_VER >= 1915) + #pragma warning (push) + #pragma warning (disable : 4643) // Forward declaring 'X' in namespace std is not permitted by the C++ Standard +#endif diff --git a/include/boost/move/detail/std_ns_end.hpp b/include/boost/move/detail/std_ns_end.hpp index 61af2d7..abc40ed 100644 --- a/include/boost/move/detail/std_ns_end.hpp +++ b/include/boost/move/detail/std_ns_end.hpp @@ -14,3 +14,6 @@ #elif defined(_MSC_VER) && (_MSC_VER >= 1915) #pragma warning (pop) #endif //BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH + +#undef BOOST_MOVE_STD_NS_BEG +#undef BOOST_MOVE_STD_NS_END diff --git a/include/boost/move/detail/unique_ptr_meta_utils.hpp b/include/boost/move/detail/unique_ptr_meta_utils.hpp index 4c6aeb5..27154e0 100644 --- a/include/boost/move/detail/unique_ptr_meta_utils.hpp +++ b/include/boost/move/detail/unique_ptr_meta_utils.hpp @@ -497,7 +497,7 @@ struct is_unary_function_impl { static const bool value = true; }; template -struct is_unary_function_impl +struct is_unary_function_impl { static const bool value = true; }; #else // BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS @@ -519,7 +519,7 @@ struct is_unary_function_impl { static const bool value = true; }; template -struct is_unary_function_impl +struct is_unary_function_impl { static const bool value = true; }; #endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0418f69..d629bd7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -10,7 +10,7 @@ endif() file(GLOB tests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) -set(BOOST_TEST_LINK_LIBRARIES Boost::move Boost::config Boost::container Boost::core Boost::static_assert) +set(BOOST_TEST_LINK_LIBRARIES Boost::move Boost::config Boost::container Boost::core) foreach(test IN LISTS tests) diff --git a/test/move_core.cpp b/test/move_core.cpp new file mode 100644 index 0000000..4e3d15c --- /dev/null +++ b/test/move_core.cpp @@ -0,0 +1,39 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright David Abrahams, Vicente Botet, Ion Gaztanaga 2009. +// (C) Copyright Ion Gaztanaga 2009-2014. +// 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) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#include "../example/movable.hpp" +#include "../example/copymovable.hpp" + +#ifdef BOOST_MOVE_MOVE_UTILITY_CORE_HPP +#error " should not be included for this test. Minimal headers are required." +#endif + +movable produce_movable() +{ return movable(); } + +movable produce_copyable() +{ return movable(); } + +int main() +{ + movable m; + copyable c; + ::boost::movelib::ignore(m); + ::boost::movelib::ignore(c); + + movable m2 = produce_movable(); + movable c2 = produce_copyable(); + + ::boost::movelib::ignore(m2); + ::boost::movelib::ignore(c2); + + return 0; +}