From b25415153cd7f26db179a170a6391d7356bc7c03 Mon Sep 17 00:00:00 2001 From: Ben Deane Date: Wed, 2 Apr 2025 13:23:19 -0600 Subject: [PATCH] :construction_worker: Add clang-20 support Problem: - clang-20 is stable and not yet used to compile this repo. Solution: - Add clang-20 support to CI. --- .github/workflows/unit_tests.yml | 31 +++++++++++++++++++++---------- include/stdx/atomic_bitset.hpp | 2 +- include/stdx/byterator.hpp | 18 +++++++++--------- include/stdx/rollover.hpp | 16 ++++++++-------- 4 files changed, 39 insertions(+), 28 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 15ed63d..858d83d 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -13,9 +13,10 @@ env: DEBIAN_FRONTEND: noninteractive CMAKE_GENERATOR: Ninja DEFAULT_CXX_STANDARD: 20 - DEFAULT_LLVM_VERSION: 19 + DEFAULT_LLVM_VERSION: 20 DEFAULT_GCC_VERSION: 13 - MULL_LLVM_VERSION: 17 + MULL_LLVM_VERSION: 18 + MULL_VERSION: 0.24.0 HYPOTHESIS_PROFILE: default concurrency: @@ -29,7 +30,7 @@ jobs: fail-fast: false matrix: compiler: [clang, gcc] - version: [12, 13, 16, 17, 18, 19] + version: [12, 13, 16, 17, 18, 19, 20] cxx_standard: [17, 20] stdlib: [libstdc++, libc++] build_type: [Debug] @@ -38,6 +39,15 @@ jobs: cc: "clang" cxx: "clang++" cxx_flags: "-stdlib=libstdc++" + - version: 20 + compiler: clang + install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 20 + toolchain_root: "/usr/lib/llvm-20" + - version: 20 + compiler: clang + stdlib: libc++ + install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 20 && sudo apt install -y libc++-20-dev libc++abi-20-dev + cxx_flags: "-stdlib=libc++" - version: 19 compiler: clang install: sudo apt update && sudo apt install -y clang-19 @@ -89,6 +99,8 @@ jobs: cxx: "g++-12" cxx_flags: "" exclude: + - compiler: gcc + version: 20 - compiler: gcc version: 19 - compiler: gcc @@ -255,7 +267,8 @@ jobs: - name: Install build tools run: | - sudo apt update && sudo apt install -y pipx ninja-build clang-tidy-${{env.DEFAULT_LLVM_VERSION}} clang-format-${{env.DEFAULT_LLVM_VERSION}} + wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh ${{env.DEFAULT_LLVM_VERSION}} + sudo apt install -y pipx ninja-build clang-tidy-${{env.DEFAULT_LLVM_VERSION}} clang-format-${{env.DEFAULT_LLVM_VERSION}} - name: Install cmake-format run: | @@ -304,8 +317,8 @@ jobs: - compiler: clang cc: "clang" cxx: "clang++" - install: sudo apt update && sudo apt install -y clang-19 - toolchain_root: "/usr/lib/llvm-19" + install: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 20 + toolchain_root: "/usr/lib/llvm-20" - compiler: gcc cc: "gcc-13" cxx: "g++-13" @@ -452,11 +465,9 @@ jobs: sudo apt update && sudo apt install -y clang-${{env.MULL_LLVM_VERSION}} ninja-build python3-venv python3-pip - name: Install mull - env: - MULL_VERSION: 0.23.0 run: | - wget https://github.com/mull-project/mull/releases/download/${{env.MULL_VERSION}}/Mull-${{env.MULL_LLVM_VERSION}}-${{env.MULL_VERSION}}-LLVM-${{env.MULL_LLVM_VERSION}}.0-ubuntu-24.04.deb - sudo dpkg -i Mull-${{env.MULL_LLVM_VERSION}}-${{env.MULL_VERSION}}-LLVM-${{env.MULL_LLVM_VERSION}}.0-ubuntu-24.04.deb + wget https://github.com/mull-project/mull/releases/download/${{env.MULL_VERSION}}/Mull-${{env.MULL_LLVM_VERSION}}-${{env.MULL_VERSION}}-LLVM-${{env.MULL_LLVM_VERSION}}.1-ubuntu-24.04.deb + sudo dpkg -i Mull-${{env.MULL_LLVM_VERSION}}-${{env.MULL_VERSION}}-LLVM-${{env.MULL_LLVM_VERSION}}.1-ubuntu-24.04.deb - name: Restore CPM cache env: diff --git a/include/stdx/atomic_bitset.hpp b/include/stdx/atomic_bitset.hpp index 4f18a2f..0ae40d8 100644 --- a/include/stdx/atomic_bitset.hpp +++ b/include/stdx/atomic_bitset.hpp @@ -42,7 +42,7 @@ class atomic_bitset { return atomic::load(storage, order) & mask; } - [[nodiscard]] static constexpr auto value_from_string(std::string_view str, + [[nodiscard]] constexpr static auto value_from_string(std::string_view str, std::size_t pos, std::size_t n, char one) -> elem_t { diff --git a/include/stdx/byterator.hpp b/include/stdx/byterator.hpp index 01c9901..28a6f47 100644 --- a/include/stdx/byterator.hpp +++ b/include/stdx/byterator.hpp @@ -34,7 +34,7 @@ template class byterator { using byte_t = std::remove_reference_t>; byte_t *ptr; - [[nodiscard]] constexpr friend auto operator==(byterator const &x, + [[nodiscard]] friend constexpr auto operator==(byterator const &x, byterator const &y) -> bool { return x.ptr == y.ptr; } @@ -42,7 +42,7 @@ template class byterator { template , T>, int> = 0> - [[nodiscard]] constexpr friend auto operator==(byterator const &x, It y) + [[nodiscard]] friend constexpr auto operator==(byterator const &x, It y) -> bool { return static_cast(x.ptr) == static_cast(stdx::to_address(y)); @@ -60,34 +60,34 @@ template class byterator { } template - [[nodiscard]] constexpr friend auto operator==(It y, byterator const &x) + [[nodiscard]] friend constexpr auto operator==(It y, byterator const &x) -> bool { return x == y; } template - [[nodiscard]] constexpr friend auto operator!=(byterator const &x, It y) + [[nodiscard]] friend constexpr auto operator!=(byterator const &x, It y) -> bool { return not(x == y); } template - [[nodiscard]] constexpr friend auto operator!=(It y, byterator const &x) + [[nodiscard]] friend constexpr auto operator!=(It y, byterator const &x) -> bool { return not(x == y); } - [[nodiscard]] constexpr friend auto operator<(byterator const &x, + [[nodiscard]] friend constexpr auto operator<(byterator const &x, byterator const &y) -> bool { return std::less{}(x.ptr, y.ptr); } - [[nodiscard]] constexpr friend auto operator<=(byterator const &x, + [[nodiscard]] friend constexpr auto operator<=(byterator const &x, byterator const &y) -> bool { return std::less_equal{}(x.ptr, y.ptr); } - [[nodiscard]] constexpr friend auto operator>(byterator const &x, + [[nodiscard]] friend constexpr auto operator>(byterator const &x, byterator const &y) -> bool { return std::greater{}(x.ptr, y.ptr); } - [[nodiscard]] constexpr friend auto operator>=(byterator const &x, + [[nodiscard]] friend constexpr auto operator>=(byterator const &x, byterator const &y) -> bool { return std::greater_equal{}(x.ptr, y.ptr); } diff --git a/include/stdx/rollover.hpp b/include/stdx/rollover.hpp index b560d05..69f6d29 100644 --- a/include/stdx/rollover.hpp +++ b/include/stdx/rollover.hpp @@ -66,11 +66,11 @@ template struct rollover_t { } private: - [[nodiscard]] constexpr friend auto operator==(rollover_t lhs, + [[nodiscard]] friend constexpr auto operator==(rollover_t lhs, rollover_t rhs) -> bool { return lhs.value == rhs.value; } - [[nodiscard]] constexpr friend auto operator!=(rollover_t lhs, + [[nodiscard]] friend constexpr auto operator!=(rollover_t lhs, rollover_t rhs) -> bool { return not(lhs == rhs); } @@ -80,37 +80,37 @@ template struct rollover_t { friend constexpr auto operator>(rollover_t, rollover_t) -> bool = delete; friend constexpr auto operator>=(rollover_t, rollover_t) -> bool = delete; - [[nodiscard]] constexpr friend auto cmp_less(rollover_t lhs, rollover_t rhs) + [[nodiscard]] friend constexpr auto cmp_less(rollover_t lhs, rollover_t rhs) -> bool { constexpr auto mid = static_cast(~underlying_t{}) / 2; return static_cast(lhs.value - rhs.value) > mid; } - [[nodiscard]] constexpr friend auto operator+(rollover_t lhs, + [[nodiscard]] friend constexpr auto operator+(rollover_t lhs, rollover_t rhs) -> rollover_t { lhs += rhs; return lhs; } - [[nodiscard]] constexpr friend auto operator-(rollover_t lhs, + [[nodiscard]] friend constexpr auto operator-(rollover_t lhs, rollover_t rhs) -> rollover_t { lhs -= rhs; return lhs; } - [[nodiscard]] constexpr friend auto operator*(rollover_t lhs, + [[nodiscard]] friend constexpr auto operator*(rollover_t lhs, rollover_t rhs) -> rollover_t { lhs *= rhs; return lhs; } - [[nodiscard]] constexpr friend auto operator/(rollover_t lhs, + [[nodiscard]] friend constexpr auto operator/(rollover_t lhs, rollover_t rhs) -> rollover_t { lhs /= rhs; return lhs; } - [[nodiscard]] constexpr friend auto operator%(rollover_t lhs, + [[nodiscard]] friend constexpr auto operator%(rollover_t lhs, rollover_t rhs) -> rollover_t { lhs %= rhs;