Skip to content

Commit

Permalink
Initialize TestSuite variables (#471)
Browse files Browse the repository at this point in the history
- Fixes an MSVC Intellisense linter warning
  • Loading branch information
Reedbeta committed Mar 21, 2021
1 parent 2492389 commit 2c93c1a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions doctest/doctest.h
Original file line number Diff line number Diff line change
Expand Up @@ -1933,10 +1933,12 @@ int registerReporter(const char* name, int priority, bool isReporter) {
static DOCTEST_NOINLINE doctest::detail::TestSuite& getCurrentTestSuite() { \
DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4640) \
DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wexit-time-destructors") \
static doctest::detail::TestSuite data; \
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wmissing-field-initializers") \
static doctest::detail::TestSuite data{}; \
static bool inited = false; \
DOCTEST_MSVC_SUPPRESS_WARNING_POP \
DOCTEST_CLANG_SUPPRESS_WARNING_POP \
DOCTEST_GCC_SUPPRESS_WARNING_POP \
if(!inited) { \
data* decorators; \
inited = true; \
Expand Down Expand Up @@ -3575,7 +3577,7 @@ int registerReporter(const char*, int, IReporter*) { return 0; }
namespace doctest_detail_test_suite_ns {
// holds the current test suite
doctest::detail::TestSuite& getCurrentTestSuite() {
static doctest::detail::TestSuite data;
static doctest::detail::TestSuite data{};
return data;
}
} // namespace doctest_detail_test_suite_ns
Expand Down
2 changes: 1 addition & 1 deletion doctest/parts/doctest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ int registerReporter(const char*, int, IReporter*) { return 0; }
namespace doctest_detail_test_suite_ns {
// holds the current test suite
doctest::detail::TestSuite& getCurrentTestSuite() {
static doctest::detail::TestSuite data;
static doctest::detail::TestSuite data{};
return data;
}
} // namespace doctest_detail_test_suite_ns
Expand Down
4 changes: 3 additions & 1 deletion doctest/parts/doctest_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1930,10 +1930,12 @@ int registerReporter(const char* name, int priority, bool isReporter) {
static DOCTEST_NOINLINE doctest::detail::TestSuite& getCurrentTestSuite() { \
DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4640) \
DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wexit-time-destructors") \
static doctest::detail::TestSuite data; \
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wmissing-field-initializers") \
static doctest::detail::TestSuite data{}; \
static bool inited = false; \
DOCTEST_MSVC_SUPPRESS_WARNING_POP \
DOCTEST_CLANG_SUPPRESS_WARNING_POP \
DOCTEST_GCC_SUPPRESS_WARNING_POP \
if(!inited) { \
data* decorators; \
inited = true; \
Expand Down

0 comments on commit 2c93c1a

Please sign in to comment.