From 47c7fd59bbc8b7d2c5529368972d924c1f17fa2e Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Fri, 7 Feb 2025 19:17:59 -0500 Subject: [PATCH 1/7] delegate to std::experimental --- include/beman/scope/scope.hpp | 58 ++++++++++++++++------------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/include/beman/scope/scope.hpp b/include/beman/scope/scope.hpp index 465aebc..844437c 100644 --- a/include/beman/scope/scope.hpp +++ b/include/beman/scope/scope.hpp @@ -3,6 +3,11 @@ #ifndef BEMAN_SCOPE_HPP #define BEMAN_SCOPE_HPP +#include +#include + +#include + namespace beman::scope { // -- 7.6.7 Feature test macro -- @@ -13,22 +18,39 @@ namespace beman::scope { // -- 7.5.1 Header synopsis [scope.syn] -- // // namespace std { + // template // class scope_exit; -// +template +using scope_exit = std::experimental::scope_exit; + // template // class scope_fail; -// +template +using scope_fail = std::experimental::scope_fail; + // template // class scope_success; -// +template +using scope_success = std::experimental::scope_success; + // template // class unique_resource; -// +template +using unique_resource = std::experimental::unique_resource; + // // factory function // template > // unique_resource, decay_t> // make_unique_resource_checked(R&& r, const S& invalid, D&& d) noexcept(see below); + +template > +unique_resource, std::decay_t> +make_unique_resource_checked(R&& r, const S& invalid, D&& d) noexcept(noexcept( + std::experimental::make_unique_resource_checked(std::forward(r), std::forward(invalid), std::forward(d)))) { + return std::experimental::make_unique_resource_checked(std::forward(r), std::forward(invalid), std::forward(d)); +} + // } // namespace std // @@ -59,7 +81,6 @@ namespace beman::scope { // template // scope_guard(EF) -> scope_guard; // - // -- 7.6.1 Class template unique_resource [scope.unique_resource.class] -- // // template @@ -93,33 +114,6 @@ namespace beman::scope { // template // unique_resource(R, D) -> unique_resource; -// TODO: Implement -struct scope_exit { - template - scope_exit(F) {} - ~scope_exit() { - // TODO: Cleanup - } -}; - -// TODO: Implement -struct scope_fail { - template - scope_fail(F) {} - ~scope_fail() { - // TODO: Cleanup - } -}; - -// TODO: Implement -struct scope_success { - template - scope_success(F) {} - ~scope_success() { - // TODO: Cleanup - } -}; - } // namespace beman::scope #endif // BEMAN_SCOPE_HPP From 1fc32ac8f9daa7b40ada163d137a203c8f9e8f39 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Fri, 7 Feb 2025 19:23:18 -0500 Subject: [PATCH 2/7] remove unsupported platforms --- .github/workflows/ci_tests.yml | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 80f895e..2ac2596 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -20,14 +20,6 @@ jobs: platform: "ubuntu-latest" - preset: "gcc-release" platform: "ubuntu-latest" - - preset: "appleclang-debug" - platform: "macos-latest" - - preset: "appleclang-release" - platform: "macos-latest" - - preset: "msvc-debug" - platform: "windows-latest" - - preset: "msvc-release" - platform: "windows-latest" name: "Preset: ${{ matrix.presets.preset }} on ${{ matrix.presets.platform }}" runs-on: ${{ matrix.presets.platform }} steps: @@ -56,13 +48,7 @@ jobs: - description: "Ubuntu LLVM" os: ubuntu-latest toolchain: "cmake/llvm-toolchain.cmake" - - description: "Windows MSVC" - os: windows-latest - toolchain: "cmake/msvc-toolchain.cmake" - - description: "Macos Appleclang" - os: macos-latest - toolchain: "cmake/appleclang-toolchain.cmake" - cpp_version: [17, 20, 23, 26] + cpp_version: [20, 23, 26] cmake_args: - description: "Default" - description: "TSan" @@ -74,7 +60,7 @@ jobs: description: "Ubuntu GCC" os: ubuntu-latest toolchain: "cmake/gnu-toolchain.cmake" - cpp_version: 17 + cpp_version: 20 cmake_args: description: "Werror" args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'" @@ -82,16 +68,10 @@ jobs: description: "Ubuntu GCC" os: ubuntu-latest toolchain: "cmake/gnu-toolchain.cmake" - cpp_version: 17 + cpp_version: 20 cmake_args: description: "Dynamic" args: "-DBUILD_SHARED_LIBS=on" - exclude: - # MSVC does not support thread sanitizer - - platform: - description: "Windows MSVC" - cmake_args: - description: "TSan" name: "Unit: ${{ matrix.platform.description }} ${{ matrix.cpp_version }} ${{ matrix.cmake_args.description }}" runs-on: ${{ matrix.platform.os }} @@ -192,16 +172,10 @@ jobs: version: 14 - class: GNU version: 13 - - class: GNU - version: 12 - class: LLVM version: 20 - class: LLVM version: 19 - - class: LLVM - version: 18 - - class: LLVM - version: 17 name: "Compiler: ${{ matrix.compilers.class }} ${{ matrix.compilers.version }}" steps: - uses: actions/checkout@v4 From e633a7302c0802b4d561372f1a7421c1365e0f96 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Fri, 7 Feb 2025 19:28:48 -0500 Subject: [PATCH 3/7] update preset test --- .github/workflows/ci_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 2ac2596..c6de0e1 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -144,7 +144,7 @@ jobs: ninja --version - name: Configure CMake run: | - cmake -B build -S . -DCMAKE_CXX_STANDARD=17 ${{ matrix.args.arg }} + cmake -B build -S . -DCMAKE_CXX_STANDARD=20 -DCMAKE_TOOLCHAIN_FILE="cmake/gnu-toolchain.cmake" ${{ matrix.args.arg }} env: CMAKE_GENERATOR: "Ninja Multi-Config" - name: Build Release From 8d15baf6559a07c28f37d1cf9af15c583b8b8cba Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Fri, 7 Feb 2025 19:35:26 -0500 Subject: [PATCH 4/7] fix llvm --- .github/workflows/ci_tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index c6de0e1..e4ee77e 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -87,6 +87,9 @@ jobs: uses: TheMrMilchmann/setup-msvc-dev@v3 with: arch: x64 + - name: Setup LLVM + if: matrix.platform.toolchain == 'cmake/llvm-toolchain.cmake' + run: sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" - name: Setup Macos if: startsWith(matrix.platform.os, 'macos') run: sudo chmod -R 777 /opt/ From f39dddf7478e1a4f94f02d0919c5f886bd3a5fee Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Fri, 7 Feb 2025 19:41:16 -0500 Subject: [PATCH 5/7] Specify llvm 19 --- .github/workflows/ci_tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index e4ee77e..f034f06 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -89,7 +89,10 @@ jobs: arch: x64 - name: Setup LLVM if: matrix.platform.toolchain == 'cmake/llvm-toolchain.cmake' - run: sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo bash llvm.sh 19 - name: Setup Macos if: startsWith(matrix.platform.os, 'macos') run: sudo chmod -R 777 /opt/ From 5b3be8a0c32edafe997dbdb46a5b99297cb8bfd9 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Fri, 7 Feb 2025 21:51:30 -0500 Subject: [PATCH 6/7] fix? compiler test --- .github/workflows/ci_tests.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index f034f06..1e44c6d 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -176,12 +176,16 @@ jobs: compilers: - class: GNU version: 14 + toolchain: "cmake/gnu-toolchain.cmake" - class: GNU version: 13 + toolchain: "cmake/gnu-toolchain.cmake" - class: LLVM version: 20 + toolchain: "cmake/llvm-toolchain.cmake" - class: LLVM version: 19 + toolchain: "cmake/llvm-toolchain.cmake" name: "Compiler: ${{ matrix.compilers.class }} ${{ matrix.compilers.version }}" steps: - uses: actions/checkout@v4 @@ -202,8 +206,10 @@ jobs: sudo apt-get install -y $CC sudo apt-get install -y $CXX - $CC --version - $CXX --version + sudo ln -sf "$(which $CC)" /usr/bin/gcc + sudo ln -sf "$(which $CXX)" /usr/bin/g++ + + /usr/bin/g++ --version else wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh @@ -212,18 +218,15 @@ jobs: CC=clang-${{ matrix.compilers.version }} CXX=clang++-${{ matrix.compilers.version }} - $CC --version - $CXX --version - fi + sudo ln -sf "$(which $CC)" /usr/bin/clang + sudo ln -sf "$(which $CXX)" /usr/bin/clang++ - echo "CC=$CC" >> "$GITHUB_OUTPUT" - echo "CXX=$CXX" >> "$GITHUB_OUTPUT" + /usr/bin/clang++ --version + fi - name: Configure CMake run: | - cmake -B build -S . -DCMAKE_CXX_STANDARD=20 + cmake -B build -S . -DCMAKE_CXX_STANDARD=20 -DCMAKE_TOOLCHAIN_FILE="${{ matrix.compilers.toolchain }}" env: - CC: ${{ steps.install-compiler.outputs.CC }} - CXX: ${{ steps.install-compiler.outputs.CXX }} CMAKE_GENERATOR: "Ninja Multi-Config" - name: Build Debug run: | From c606e1e61fa8de24b23c9d575cb7eaeca059da56 Mon Sep 17 00:00:00 2001 From: River <26424577+wusatosi@users.noreply.github.com> Date: Fri, 7 Feb 2025 21:54:33 -0500 Subject: [PATCH 7/7] Fix unit to llvm 19 --- .github/workflows/ci_tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 1e44c6d..93cd0ee 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -93,6 +93,9 @@ jobs: wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo bash llvm.sh 19 + + sudo ln -sf "$(which clang-19)" /usr/bin/clang + sudo ln -sf "$(which clang++-19)" /usr/bin/clang++ - name: Setup Macos if: startsWith(matrix.platform.os, 'macos') run: sudo chmod -R 777 /opt/