diff --git a/CMake/CatchMiscFunctions.cmake b/CMake/CatchMiscFunctions.cmake index 92530434..2271cf27 100644 --- a/CMake/CatchMiscFunctions.cmake +++ b/CMake/CatchMiscFunctions.cmake @@ -64,6 +64,7 @@ function(add_warnings_to_targets targets) "-Wmissing-braces" "-Wmissing-declarations" "-Wmissing-noreturn" + "-Wmissing-variable-declarations" "-Wnull-dereference" "-Wold-style-cast" "-Woverloaded-virtual" diff --git a/src/catch2/internal/catch_main.cpp b/src/catch2/internal/catch_main.cpp index f523bbfa..a0126c23 100644 --- a/src/catch2/internal/catch_main.cpp +++ b/src/catch2/internal/catch_main.cpp @@ -14,7 +14,7 @@ namespace Catch { CATCH_INTERNAL_START_WARNINGS_SUPPRESSION CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS - LeakDetector leakDetector; + static LeakDetector leakDetector; CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION } diff --git a/tests/ExtraTests/X02-DisabledMacros.cpp b/tests/ExtraTests/X02-DisabledMacros.cpp index aea3b1a3..37d35e11 100644 --- a/tests/ExtraTests/X02-DisabledMacros.cpp +++ b/tests/ExtraTests/X02-DisabledMacros.cpp @@ -33,7 +33,7 @@ struct foo { #pragma clang diagnostic ignored "-Wglobal-constructors" #endif // Construct foo, but `foo::print` should not be run -foo f; +static foo f; #if defined(__clang__)