From df1c1a11fc342cfb0c33280469c80302b4f43b5b Mon Sep 17 00:00:00 2001 From: Mikael Lindemann Date: Thu, 14 Nov 2024 08:20:38 +0000 Subject: [PATCH 1/2] Use aligned array instead of std::aligned_storage. --- include/rigtorp/MPMCQueue.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/rigtorp/MPMCQueue.h b/include/rigtorp/MPMCQueue.h index a31e826..31b34b0 100644 --- a/include/rigtorp/MPMCQueue.h +++ b/include/rigtorp/MPMCQueue.h @@ -22,6 +22,7 @@ SOFTWARE. #pragma once +#include #include #include #include // offsetof @@ -81,6 +82,11 @@ template struct AlignedAllocator { } }; #endif +#if defined(__cpp_lib_byte) && !defined(__APPLE__) +using Byte = std::byte; +#else +using Byte = unsigned char; +#endif template struct Slot { ~Slot() noexcept { @@ -105,7 +111,7 @@ template struct Slot { // Align to avoid false sharing between adjacent slots alignas(hardwareInterferenceSize) std::atomic turn = {0}; - typename std::aligned_storage::type storage; + alignas(T) std::array storage; }; template >> From b3c4ac3b05f2577ef818c60f1e29dd3954473141 Mon Sep 17 00:00:00 2001 From: Mikael Lindemann Date: Thu, 14 Nov 2024 08:20:52 +0000 Subject: [PATCH 2/2] CI: Run with C++ 23 --- .github/workflows/ccpp.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 32cf3af..4695b8d 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -9,14 +9,14 @@ jobs: strategy: matrix: config: [Debug, Release] - standard: [11, 17] + standard: [11, 17, 23] steps: - uses: actions/checkout@v1 - name: Build & Test run: | cmake -E remove_directory build - cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DCMAKE_CXX_FLAGS="-Werror -fsanitize=address,undefined" + cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DCMAKE_CXX_FLAGS="-Werror -fsanitize=address,undefined -Wno-interference-size" cmake --build build cd build ctest --output-on-failure @@ -27,7 +27,7 @@ jobs: strategy: matrix: config: [Debug, Release] - standard: [11, 17] + standard: [11, 17, 23] steps: - uses: actions/checkout@v1 @@ -45,7 +45,7 @@ jobs: strategy: matrix: config: [Debug, Release] - standard: [11, 17] + standard: [11, 17, 23] steps: - uses: actions/checkout@v1