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 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 >>