diff options
author | offa <bm-dev@yandex.com> | 2022-09-30 14:20:15 +0300 |
---|---|---|
committer | offa <bm-dev@yandex.com> | 2022-09-30 14:20:15 +0300 |
commit | 29b24f9e725b168114e338c47b089598d842093e (patch) | |
tree | 71cc4dedcf7c28be09572a72b9aeb69e0d69a9ea | |
parent | b8fdc9bf5d4aa490b6f62720d11a482b86c1d66e (diff) |
Use pragams instead of compile options
-rw-r--r-- | tests/CMakeLists.txt | 5 | ||||
-rw-r--r-- | tests/includes.h | 11 | ||||
-rw-r--r-- | tests/main.cpp | 11 |
3 files changed, 20 insertions, 7 deletions
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 <chrono> #include <cstdio> @@ -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 |