This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 5586eb3694d4c5b95125dd350a4e5cea6280cbd6
Author: Andrew Stitcher <[email protected]>
AuthorDate: Wed Sep 16 21:07:10 2026 -0400

    PROTON-2972: Stop recent clang++ warning about __COUNTER__
    
    This is used in Catch2 tests to create unique names.
---
 c/tests/CMakeLists.txt | 8 ++++++++
 cpp/tests.cmake        | 9 +++++++++
 2 files changed, 17 insertions(+)

diff --git a/c/tests/CMakeLists.txt b/c/tests/CMakeLists.txt
index 85eee84cc..5183f42c7 100644
--- a/c/tests/CMakeLists.txt
+++ b/c/tests/CMakeLists.txt
@@ -37,12 +37,20 @@ endif()
 
 if (CMAKE_CXX_COMPILER)
 
+  # Suppress Clang warning about __COUNTER__ used by Catch2 which is now in 
C++26
+  include(CheckCXXCompilerFlag)
+  check_cxx_compiler_flag("-Wno-c2y-extensions" HAS_WNO_C2Y_EXTENSIONS)
+  if(HAS_WNO_C2Y_EXTENSIONS)
+    set(SUPPRESS_COUNTER_WARNING "-Wno-c2y-extensions")
+  endif()
+
   add_library(test_main OBJECT test_main.cpp)
   set_target_properties(test_main PROPERTIES
     COMPILE_FLAGS "${CXX_WARNING_FLAGS}")
 
   macro(add_c_test exe)
     add_executable(${exe} $<TARGET_OBJECTS:test_main> pn_test.cpp ${ARGN})
+    target_compile_options(${exe} PRIVATE ${SUPPRESS_COUNTER_WARNING})
     set_target_properties(${exe} PROPERTIES
       COMPILE_FLAGS "${CXX_WARNING_FLAGS}"
       LINK_FLAGS "${CATCH_UNDEFINED}")
diff --git a/cpp/tests.cmake b/cpp/tests.cmake
index c13faee42..b29753b3a 100644
--- a/cpp/tests.cmake
+++ b/cpp/tests.cmake
@@ -92,11 +92,20 @@ endif()
 # See c/tests/ for more interesting examples.
 # Eventually all the C++ tests will migrate to Catch2.
 
+# Suppress Clang warning about __COUNTER__ used by Catch2 which is now in C++26
+include(CheckCXXCompilerFlag)
+check_cxx_compiler_flag("-Wno-c2y-extensions" HAS_WNO_C2Y_EXTENSIONS)
+if(HAS_WNO_C2Y_EXTENSIONS)
+  set(SUPPRESS_COUNTER_WARNING "-Wno-c2y-extensions")
+endif()
+
 include_directories(${PROJECT_SOURCE_DIR}/tests/include)
 add_executable(cpp-test src/cpp-test.cpp src/url_test.cpp)
+target_compile_options(cpp-test PRIVATE ${SUPPRESS_COUNTER_WARNING})
 target_link_libraries(cpp-test qpid-proton-cpp ${PLATFORM_LIBS})
 # tests that require access to pn_ functions in qpid-proton-core
 add_executable(cpp-core-test src/cpp-test.cpp src/object_test.cpp)
+target_compile_options(cpp-core-test PRIVATE ${SUPPRESS_COUNTER_WARNING})
 target_link_libraries(cpp-core-test qpid-proton-cpp qpid-proton-core 
${PLATFORM_LIBS})
 
 macro(add_catch_test tag)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to