Silent clang-tidy warnings for static fields
The warnings
- fuchsia-statically-constructed-objects
- cert-err58-cpp
are disabled for the creation of static fields within the
DOCTEST_GLOBAL_NO_WARNINGS macro. This removes these clang-tidy
warnings in user written unit tests at invocation of the
TEST_SUITE and related macros.
diff --git a/doctest/doctest.h b/doctest/doctest.h
index 9d3304f..9172ceb 100644
--- a/doctest/doctest.h
+++ b/doctest/doctest.h
@@ -343,7 +343,8 @@
// clang-format on
#define DOCTEST_GLOBAL_NO_WARNINGS(var) \
- DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wglobal-constructors") static int var DOCTEST_UNUSED
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wglobal-constructors") \
+ static int var DOCTEST_UNUSED // NOLINT(fuchsia-statically-constructed-objects,cert-err58-cpp)
#define DOCTEST_GLOBAL_NO_WARNINGS_END() DOCTEST_CLANG_SUPPRESS_WARNING_POP
// should probably take a look at https://github.com/scottt/debugbreak
diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h
index 8768b6d..ecb8344 100644
--- a/doctest/parts/doctest_fwd.h
+++ b/doctest/parts/doctest_fwd.h
@@ -340,7 +340,8 @@
// clang-format on
#define DOCTEST_GLOBAL_NO_WARNINGS(var) \
- DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wglobal-constructors") static int var DOCTEST_UNUSED
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wglobal-constructors") \
+ static int var DOCTEST_UNUSED // NOLINT(fuchsia-statically-constructed-objects,cert-err58-cpp)
#define DOCTEST_GLOBAL_NO_WARNINGS_END() DOCTEST_CLANG_SUPPRESS_WARNING_POP
// should probably take a look at https://github.com/scottt/debugbreak