Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Add -Wmissing-variable-declarations to common warnings

Commit
d2cb934d283bcaeb78ce9dec3f9755650db414ba
Author
Martin Hořeňovský ·
Parents
7752229105c8

Files · Download .tar.gz

Changes

 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__)