From d2cb934d283bcaeb78ce9dec3f9755650db414ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Mon, 2 May 2022 12:51:46 +0200 Subject: [PATCH] Add -Wmissing-variable-declarations to common warnings --- CMake/CatchMiscFunctions.cmake | 1 + src/catch2/internal/catch_main.cpp | 2 +- tests/ExtraTests/X02-DisabledMacros.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) 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__)