From 70e33d455ccc69412663a5b6f35ab5c83d244eb6 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 4 Nov 2026 18:35:43 +0100 Subject: [PATCH 1/2] Works around an Asio warning generated by __attribute__((unused)) in gcc <= 11 --- test/CMakeLists.txt | 6 ++++++ test/Jamfile | 3 +++ 2 files changed, 9 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 071c3bcd..3f3e1744 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -12,6 +12,12 @@ endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Remove a spurious gcc warning in Asio headers target_compile_options(boost_redis_project_options INTERFACE -Wno-maybe-uninitialized) + + # Asio applies __attribute__((unused)) to non-static data members, which + # requires gcc >= 12 (https://github.com/chriskohlhoff/asio/issues/1784) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12) + target_compile_options(boost_redis_project_options INTERFACE -Wno-attributes) + endif() endif() add_library(boost_redis_src STATIC boost_redis.cpp) diff --git a/test/Jamfile b/test/Jamfile index 47a20156..4a1f5ac2 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -36,6 +36,9 @@ local requirements = msvc:"/bigobj" windows:_WIN32_WINNT=0x0601 gcc:-Wno-maybe-uninitialized # spurious gcc warning in Asio + # Asio applies __attribute__((unused)) to non-static data members, which + # which requires gcc >= 12 (https://github.com/chriskohlhoff/asio/issues/1784) + gcc-11:-Wno-attributes [ requires cxx14_constexpr cxx14_generic_lambdas From 2a7898f03f5c144fe5339748f97930a1e8f03eed Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Thu, 5 Nov 2026 15:31:49 +0100 Subject: [PATCH 2/2] Move the flag to CI --- .github/workflows/ci.yml | 5 +++++ test/CMakeLists.txt | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09e7d9e7..a08a348b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,11 +127,14 @@ jobs: matrix: include: # gcc-11 is the default in Ubuntu 22.04, defaults to c++17 + # Asio triggers a warning by applying an __unused__ attribute to a data member, + # supported in gcc >= 12 only - toolset: gcc-11 install: g++-11 container: ubuntu:22.04 cxxstd: '17' build-type: 'Debug' + cxxflags: '-Wno-attributes' server: "redis:8.2.1-alpine" - toolset: gcc-11 @@ -139,6 +142,7 @@ jobs: container: ubuntu:22.04 cxxstd: '20' build-type: 'Debug' + cxxflags: '-Wno-attributes' server: "valkey/valkey:8.1.3-alpine" - toolset: gcc-11 @@ -146,6 +150,7 @@ jobs: container: ubuntu:22.04 cxxstd: '20' build-type: 'Release' + cxxflags: '-Wno-attributes' server: "redis:7.4.5-alpine" - toolset: gcc-12 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3f3e1744..071c3bcd 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -12,12 +12,6 @@ endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Remove a spurious gcc warning in Asio headers target_compile_options(boost_redis_project_options INTERFACE -Wno-maybe-uninitialized) - - # Asio applies __attribute__((unused)) to non-static data members, which - # requires gcc >= 12 (https://github.com/chriskohlhoff/asio/issues/1784) - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12) - target_compile_options(boost_redis_project_options INTERFACE -Wno-attributes) - endif() endif() add_library(boost_redis_src STATIC boost_redis.cpp)