diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d2f89882..7fe4791e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -57,11 +57,6 @@ function(spdlog_prepare_test test_target spdlog_lib) endif() add_test(NAME ${test_target} COMMAND ${test_target}) set_tests_properties(${test_target} PROPERTIES RUN_SERIAL ON) - - # Workaround GCC 12 false positive - if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" MATCHES "^12\..*") - target_compile_options(${test_target} PRIVATE "-Wno-maybe-uninitialized") - endif() endfunction() # The compiled library tests diff --git a/tests/includes.h b/tests/includes.h index e6805280..155ae78d 100644 --- a/tests/includes.h +++ b/tests/includes.h @@ -1,6 +1,15 @@ #pragma once + +#if defined (__GNUC__) && __GNUC__ == 12 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12 +#endif #include "catch.hpp" +#if defined (__GNUC__) && __GNUC__ == 12 +# pragma GCC diagnostic pop +#endif + #include "utils.h" #include #include @@ -24,4 +33,4 @@ #include "spdlog/sinks/ostream_sink.h" #include "spdlog/sinks/rotating_file_sink.h" #include "spdlog/sinks/stdout_color_sinks.h" -#include "spdlog/pattern_formatter.h" \ No newline at end of file +#include "spdlog/pattern_formatter.h" diff --git a/tests/main.cpp b/tests/main.cpp index 063e8787..4f0be406 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,2 +1,11 @@ +#if defined (__GNUC__) && __GNUC__ == 12 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // Workaround for GCC 12 +#endif + #define CATCH_CONFIG_MAIN -#include "catch.hpp" \ No newline at end of file +#include "catch.hpp" + +#if defined (__GNUC__) && __GNUC__ == 12 +# pragma GCC diagnostic pop +#endif