From 85709229dd6b4dd9fb2341eecbddce0e1c0715a3 Mon Sep 17 00:00:00 2001 From: levalup Date: Wed, 19 Jun 2024 21:54:21 +0800 Subject: [PATCH 1/5] add gcc multi version test. --- .github/workflows/build-gcc.yml | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/build-gcc.yml diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml new file mode 100644 index 0000000..5273385 --- /dev/null +++ b/.github/workflows/build-gcc.yml @@ -0,0 +1,56 @@ +# build witch multi version gcc to test gcc and C++ standard compatibility + +name: Build x GCC + +on: + push: + branches: [ "master" ] + tags: + - 'r*' + pull_request: + branches: [ "master" ] + +jobs: + build-gcc: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + + matrix: + gcc_compiler: [9, 10, 11, 12] + build_type: [Release] + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set reusable strings + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Install GCC ${{ matrix.gcc_version }} + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt update + sudo apt install gcc-${{ matrix.gcc_version }} g++-${{ matrix.gcc_version }} + sudo update-alternatives --set gcc /usr/bin/gcc-${{ matrix.gcc_version }} + sudo update-alternatives --set g++ /usr/bin/g++-${{ matrix.gcc_version }} + + - name: Configure CMake + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_CXX_COMPILER=g++-${{ matrix.gcc_version }} + -DCMAKE_C_COMPILER=gcc-${{ matrix.gcc_version }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -S ${{ github.workspace }} + + - name: Build + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + + - name: Test + working-directory: ${{ steps.strings.outputs.build-output-dir }} + run: ctest --build-config ${{ matrix.build_type }} From 869f9903c9f84b5538b68220716e2afa1dbd30df Mon Sep 17 00:00:00 2001 From: levalup Date: Wed, 19 Jun 2024 22:02:56 +0800 Subject: [PATCH 2/5] fix var name typo. --- .github/workflows/build-gcc.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml index 5273385..8cbb1fa 100644 --- a/.github/workflows/build-gcc.yml +++ b/.github/workflows/build-gcc.yml @@ -1,6 +1,6 @@ # build witch multi version gcc to test gcc and C++ standard compatibility -name: Build x GCC +name: Build in GCC on: push: @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: - gcc_compiler: [9, 10, 11, 12] + gcc_version: [9, 10, 11, 12] build_type: [Release] steps: From 660456bd62a1cf4ce91278a3223f2837c0c36dc7 Mon Sep 17 00:00:00 2001 From: levalup Date: Wed, 19 Jun 2024 22:14:41 +0800 Subject: [PATCH 3/5] change update-alternatives --set to --install. --- .github/workflows/build-gcc.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-gcc.yml b/.github/workflows/build-gcc.yml index 8cbb1fa..dd5f159 100644 --- a/.github/workflows/build-gcc.yml +++ b/.github/workflows/build-gcc.yml @@ -37,8 +37,7 @@ jobs: sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt update sudo apt install gcc-${{ matrix.gcc_version }} g++-${{ matrix.gcc_version }} - sudo update-alternatives --set gcc /usr/bin/gcc-${{ matrix.gcc_version }} - sudo update-alternatives --set g++ /usr/bin/g++-${{ matrix.gcc_version }} + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc_version }} 60 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc_version }} - name: Configure CMake run: > From 25a3e2e04393b655282af22f2b285fb077ce1617 Mon Sep 17 00:00:00 2001 From: levalup Date: Wed, 19 Jun 2024 22:20:16 +0800 Subject: [PATCH 4/5] remove nodiscard parameter, witch is c++20 feature. --- include/uvcxx/handle.h | 2 +- include/uvcxx/tcp.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/uvcxx/handle.h b/include/uvcxx/handle.h index 7bcabcd..251ae31 100644 --- a/include/uvcxx/handle.h +++ b/include/uvcxx/handle.h @@ -107,7 +107,7 @@ namespace uv { }); } - [[nodiscard("use close(nullptr) instead")]] + [[nodiscard]] uvcxx::promise<> close() { return close_for_promise([&](void (*cb)(raw_t *)) { uv_close(*this, cb); diff --git a/include/uvcxx/tcp.h b/include/uvcxx/tcp.h index 156ab98..83db47d 100644 --- a/include/uvcxx/tcp.h +++ b/include/uvcxx/tcp.h @@ -123,7 +123,7 @@ namespace uv { }); } - [[nodiscard("use close_reset(nullptr) instead")]] + [[nodiscard]] uvcxx::promise<> close_reset() { return close_for_promise([&](void (*cb)(uv_handle_t *)) { uv_tcp_close_reset(*this, cb); From 6948267f5654b3a5af943bf18d1f61d2b25ae5a0 Mon Sep 17 00:00:00 2001 From: levalup Date: Wed, 19 Jun 2024 22:28:11 +0800 Subject: [PATCH 5/5] fix ambiguous call in gcc --- include/uvcxx/cxx/except.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/uvcxx/cxx/except.h b/include/uvcxx/cxx/except.h index ed157cb..48ce74d 100644 --- a/include/uvcxx/cxx/except.h +++ b/include/uvcxx/cxx/except.h @@ -32,11 +32,13 @@ namespace uvcxx { explicit errcode(int errcode, const Args &...args) : supper(Message(errcode, args...)), m_errcode(errcode) {} - template>> + template && std::is_convertible_v>> explicit errcode(I errcode) : self(int(errcode)) {} - template>> + template && std::is_convertible_v>> explicit errcode(I errcode, const Args &...args) : self(int(errcode), args...) {}