diff --git a/include/podio/LinkCollection.h b/include/podio/LinkCollection.h index 81598e87d..3fccbf5d1 100644 --- a/include/podio/LinkCollection.h +++ b/include/podio/LinkCollection.h @@ -11,14 +11,14 @@ /// Main macro for declaring links. Takes care of registering the necessary /// buffer creation functionality with the CollectionBufferFactory. #define PODIO_DECLARE_LINK(FromT, ToT) \ - const static auto PODIO_PP_CONCAT(REGISTERED_LINK_, __COUNTER__) = \ + const static auto PODIO_PP_CONCAT(REGISTERED_LINK_, __LINE__) = \ podio::detail::registerLinkCollection(podio::LinkCollection::typeName); #if PODIO_ENABLE_SIO && __has_include("podio/detail/LinkSIOBlock.h") #include /// Macro for registering the necessary SIOBlock for a Link with the SIOBlock factory #define PODIO_DECLARE_LINK_SIO(FromT, ToT) \ - const static auto PODIO_PP_CONCAT(LINK_SIO_BLOCK_, __COUNTER__) = podio::LinkSIOBlock{}; + const static auto PODIO_PP_CONCAT(LINK_SIO_BLOCK_, __LINE__) = podio::LinkSIOBlock{}; #endif #endif // PODIO_LINKCOLLECTION_H diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index f3487a16c..6f595b2ec 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -33,11 +33,20 @@ if(NOT Catch2_FOUND) # Reset the flags set(CMAKE_CXX_FLAGS ${CXX_FLAGS_CMAKE_USED}) +else() + # Same hack as above for the system-installed Catch2: mark its include + # directories as SYSTEM to suppress warnings from Catch2 headers + get_target_property(CATCH2_IF_INC_DIRS Catch2::Catch2 INTERFACE_INCLUDE_DIRECTORIES) + set_target_properties(Catch2::Catch2 PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${CATCH2_IF_INC_DIRS}") endif() find_package(Threads REQUIRED) add_executable(unittest_podio unittest.cpp frame.cpp buffer_factory.cpp interface_types.cpp std_interoperability.cpp links.cpp) target_link_libraries(unittest_podio PUBLIC TestDataModel ExtensionDataModel InterfaceExtensionDataModel PRIVATE Catch2::Catch2WithMain Threads::Threads podio::podioRootIO) +# Catch2 TEST_CASE/SECTION macros expand __COUNTER__ at the call site in user +# code, so marking Catch2 headers as system includes is not sufficient to +# suppress this warning, present with Clang 22 +target_compile_options(unittest_podio PRIVATE -Wno-c2y-extensions) if (ENABLE_SIO) target_link_libraries(unittest_podio PRIVATE podio::podioSioIO) endif()