Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package doctest for openSUSE:Factory checked in at 2021-03-24 16:13:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/doctest (Old) and /work/SRC/openSUSE:Factory/.doctest.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "doctest" Wed Mar 24 16:13:49 2021 rev:6 rq:880591 version:2.4.6 Changes: -------- --- /work/SRC/openSUSE:Factory/doctest/doctest.changes 2021-03-02 12:45:35.616362619 +0100 +++ /work/SRC/openSUSE:Factory/.doctest.new.2401/doctest.changes 2021-03-24 16:13:49.431993875 +0100 @@ -1,0 +2,16 @@ +Mon Mar 22 15:28:53 UTC 2021 - Martin Hauke <[email protected]> + +- Update to version 2.4.6 + Fixed bugs: + * REQUIRE does not compile when operator== in different + namespace #443 + * Using templated operator== inside TEST_CASE changes deduced + types of forwarding references #399 + Closed issues: + * CMake doesn't link package #483 + * Get list of registered test-case names #479 + * Can't compile with glibc master (future 2.34): SIGSTKSZ is + no longer a constant #473 + * INFO does not compile when used like a function call #469 + +------------------------------------------------------------------- Old: ---- doctest-2.4.5.tar.gz New: ---- doctest-2.4.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ doctest.spec ++++++ --- /var/tmp/diff_new_pack.FukPKs/_old 2021-03-24 16:13:49.879994346 +0100 +++ /var/tmp/diff_new_pack.FukPKs/_new 2021-03-24 16:13:49.883994350 +0100 @@ -17,7 +17,7 @@ Name: doctest -Version: 2.4.5 +Version: 2.4.6 Release: 0 Summary: Single-header testing framework License: MIT ++++++ doctest-2.4.5.tar.gz -> doctest-2.4.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/CHANGELOG.md new/doctest-2.4.6/CHANGELOG.md --- old/doctest-2.4.5/CHANGELOG.md 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/CHANGELOG.md 2021-03-22 13:05:04.000000000 +0100 @@ -1,19 +1,48 @@ # Change Log +## [2.4.6](https://github.com/onqtam/doctest/tree/2.4.6) (2021-03-22) +[Full Changelog](https://github.com/onqtam/doctest/compare/2.4.5...2.4.6) + +**Fixed bugs:** + +- REQUIRE does not compile when operator== in different namespace [\#443](https://github.com/onqtam/doctest/issues/443) +- Using templated operator== inside TEST\_CASE changes deduced types of forwarding references [\#399](https://github.com/onqtam/doctest/issues/399) + +**Closed issues:** + +- CMake doesn't link package [\#483](https://github.com/onqtam/doctest/issues/483) +- Assertions are slow when running on Windows with a debugger attached [\#481](https://github.com/onqtam/doctest/issues/481) +- Get list of registered test-case names [\#479](https://github.com/onqtam/doctest/issues/479) +- Can't compile with glibc master \(future 2.34\): SIGSTKSZ is no longer a constant [\#473](https://github.com/onqtam/doctest/issues/473) +- How to use Doctest with Github Actions [\#472](https://github.com/onqtam/doctest/issues/472) +- Link error \(multiple definition...\) in simple project [\#470](https://github.com/onqtam/doctest/issues/470) +- INFO does not compile when used like a function call [\#469](https://github.com/onqtam/doctest/issues/469) +- std::uncaught\_exceptions is only available if compiling for macOS 10.12 or above [\#466](https://github.com/onqtam/doctest/issues/466) +- Compile failure with WinRT on 2.4.5 [\#465](https://github.com/onqtam/doctest/issues/465) + +**Merged pull requests:** + +- Improve speed with attached debugger \(Windows\) [\#482](https://github.com/onqtam/doctest/pull/482) ([pgroke](https://github.com/pgroke)) +- Convert to bool by casting, rather than double negation [\#480](https://github.com/onqtam/doctest/pull/480) ([kitegi](https://github.com/kitegi)) +- Fix compile error when targeting macOS version earlier and macOS 10.12 [\#478](https://github.com/onqtam/doctest/pull/478) ([SamWindell](https://github.com/SamWindell)) +- Fix MSVC linter warning about uninitialized TestSuite variables [\#471](https://github.com/onqtam/doctest/pull/471) ([Reedbeta](https://github.com/Reedbeta)) +- REQUIRE does not compile when operator== in different namespace \#443 . [\#468](https://github.com/onqtam/doctest/pull/468) ([navinp0304](https://github.com/navinp0304)) +- Automatically add TEST\_SUITE labels to discovered tests [\#464](https://github.com/onqtam/doctest/pull/464) ([shivupa](https://github.com/shivupa)) + ## [2.4.5](https://github.com/onqtam/doctest/tree/2.4.5) (2021-02-02) [Full Changelog](https://github.com/onqtam/doctest/compare/2.4.4...2.4.5) **Closed issues:** -- Use of std::atomic can slow down multithreaded tests [\#452](https://github.com/onqtam/doctest/issues/452) -- compilation issue in MSVC when defining DOCTEST_THREAD_LOCAL to static [\#458](https://github.com/onqtam/doctest/issues/458) -- nvcc compiler warning; doctest.h(4138): warning : expression has no effect [\#454](https://github.com/onqtam/doctest/issues/454) - Stack buffer overflow in `String` constructor [\#460](https://github.com/onqtam/doctest/issues/460) - Surpress warnings from clang-tidy [\#459](https://github.com/onqtam/doctest/issues/459) +- compilation issue in MSVC when defining DOCTEST\_THREAD\_LOCAL to static [\#458](https://github.com/onqtam/doctest/issues/458) +- nvcc compiler warning; doctest.h\(4138\): warning : expression has no effect [\#454](https://github.com/onqtam/doctest/issues/454) +- Use of std::atomic can slow down multithreaded tests [\#452](https://github.com/onqtam/doctest/issues/452) **Merged pull requests:** -- Fix compilation on case-sensitive filesystems [\#463](https://github.com/onqtam/doctest/pull/463) ([jhasse](https://github.com/onqtam/jhasse)) +- Fix compilation on case-sensitive filesystems [\#463](https://github.com/onqtam/doctest/pull/463) ([jhasse](https://github.com/jhasse)) - Use function-like macros for prefixless macro names [\#462](https://github.com/onqtam/doctest/pull/462) ([tbleher](https://github.com/tbleher)) - Implement a multi lane atomic for assertion counts [\#453](https://github.com/onqtam/doctest/pull/453) ([martinus](https://github.com/martinus)) @@ -22,16 +51,13 @@ **Closed issues:** -- Issue with GitHub Security Scanning: gmtime [\#423](https://github.com/onqtam/doctest/issues/423) +- 2.4.2: build fails [\#450](https://github.com/onqtam/doctest/issues/450) - combine the same tests for different build configurations from multiple shared objects without having symbol clashes [\#436](https://github.com/onqtam/doctest/issues/436) +- Issue with GitHub Security Scanning: gmtime [\#423](https://github.com/onqtam/doctest/issues/423) ## [2.4.3](https://github.com/onqtam/doctest/tree/2.4.3) (2020-12-16) [Full Changelog](https://github.com/onqtam/doctest/compare/2.4.2...2.4.3) -**Closed issues:** - -- 2.4.2: build fails [\#450](https://github.com/onqtam/doctest/issues/450) - ## [2.4.2](https://github.com/onqtam/doctest/tree/2.4.2) (2020-12-15) [Full Changelog](https://github.com/onqtam/doctest/compare/2.4.1...2.4.2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/README.md new/doctest-2.4.6/README.md --- old/doctest-2.4.5/README.md 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/README.md 2021-03-22 13:05:04.000000000 +0100 @@ -45,7 +45,6 @@ [](https://en.wikipedia.org/wiki/C%2B%2B#Standardization) [](https://opensource.org/licenses/MIT) -[](https://github.com/onqtam/doctest/releases) [](https://raw.githubusercontent.com/onqtam/doctest/master/doctest/doctest.h) [](https://bestpractices.coreinfrastructure.org/projects/503) [](https://lgtm.com/projects/g/onqtam/doctest/context:cpp) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/doctest/doctest.h new/doctest-2.4.6/doctest/doctest.h --- old/doctest-2.4.5/doctest/doctest.h 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/doctest/doctest.h 2021-03-22 13:05:04.000000000 +0100 @@ -48,8 +48,8 @@ #define DOCTEST_VERSION_MAJOR 2 #define DOCTEST_VERSION_MINOR 4 -#define DOCTEST_VERSION_PATCH 5 -#define DOCTEST_VERSION_STR "2.4.5" +#define DOCTEST_VERSION_PATCH 6 +#define DOCTEST_VERSION_STR "2.4.6" #define DOCTEST_VERSION \ (DOCTEST_VERSION_MAJOR * 10000 + DOCTEST_VERSION_MINOR * 100 + DOCTEST_VERSION_PATCH) @@ -781,6 +781,29 @@ template<class T> struct remove_reference<T&> { typedef T type; }; template<class T> struct remove_reference<T&&> { typedef T type; }; + template<typename T, typename U = T&&> U declval(int); + + template<typename T> T declval(long); + + template<typename T> auto declval() DOCTEST_NOEXCEPT -> decltype(declval<T>(0)) ; + + template<class T> struct is_lvalue_reference { const static bool value=false; }; + template<class T> struct is_lvalue_reference<T&> { const static bool value=true; }; + + template <class T> + inline T&& forward(typename remove_reference<T>::type& t) DOCTEST_NOEXCEPT + { + return static_cast<T&&>(t); + } + + template <class T> + inline T&& forward(typename remove_reference<T>::type&& t) DOCTEST_NOEXCEPT + { + static_assert(!is_lvalue_reference<T>::value, + "Can not forward an rvalue as an lvalue."); + return static_cast<T&&>(t); + } + template<class T> struct remove_const { typedef T type; }; template<class T> struct remove_const<const T> { typedef T type; }; #ifdef DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS @@ -1048,10 +1071,20 @@ return toString(lhs) + op + toString(rhs); } +#if DOCTEST_CLANG && DOCTEST_CLANG < DOCTEST_COMPILER(3, 6, 0) +DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wunused-comparison") +#endif + +// This will check if there is any way it could find a operator like member or friend and uses it. +// If not it doesn't find the operator or if the operator at global scope is defined after +// this template, the template won't be instantiated due to SFINAE. Once the template is not +// instantiated it can look for global operator using normal conversions. +#define SFINAE_OP(ret,op) decltype(doctest::detail::declval<L>() op doctest::detail::declval<R>(),static_cast<ret>(0)) + #define DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(op, op_str, op_macro) \ template <typename R> \ - DOCTEST_NOINLINE Result operator op(const DOCTEST_REF_WRAP(R) rhs) { \ - bool res = op_macro(lhs, rhs); \ + DOCTEST_NOINLINE SFINAE_OP(Result,op) operator op(R&& rhs) { \ + bool res = op_macro(doctest::detail::forward<L>(lhs), doctest::detail::forward<R>(rhs)); \ if(m_at & assertType::is_false) \ res = !res; \ if(!res || doctest::getContextOptions()->success) \ @@ -1179,12 +1212,16 @@ L lhs; assertType::Enum m_at; - explicit Expression_lhs(L in, assertType::Enum at) - : lhs(in) + explicit Expression_lhs(L&& in, assertType::Enum at) + : lhs(doctest::detail::forward<L>(in)) , m_at(at) {} DOCTEST_NOINLINE operator Result() { - bool res = !!lhs; +// this is needed only foc MSVC 2015: +// https://ci.appveyor.com/project/onqtam/doctest/builds/38181202 +DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4800) // 'int': forcing value to bool + bool res = static_cast<bool>(lhs); +DOCTEST_MSVC_SUPPRESS_WARNING_POP if(m_at & assertType::is_false) //!OCLINT bitwise operator in conditional res = !res; @@ -1193,6 +1230,10 @@ return Result(res); } + /* This is required for user-defined conversions from Expression_lhs to L */ + //operator L() const { return lhs; } + operator L() const { return lhs; } + // clang-format off DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(==, " == ", DOCTEST_CMP_EQ) //!OCLINT bitwise operator in conditional DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(!=, " != ", DOCTEST_CMP_NE) //!OCLINT bitwise operator in conditional @@ -1233,6 +1274,10 @@ #endif // DOCTEST_CONFIG_NO_COMPARISON_WARNING_SUPPRESSION +#if DOCTEST_CLANG && DOCTEST_CLANG < DOCTEST_COMPILER(3, 6, 0) +DOCTEST_CLANG_SUPPRESS_WARNING_POP +#endif + struct DOCTEST_INTERFACE ExpressionDecomposer { assertType::Enum m_at; @@ -1244,8 +1289,8 @@ // https://github.com/catchorg/Catch2/issues/870 // https://github.com/catchorg/Catch2/issues/565 template <typename L> - Expression_lhs<const DOCTEST_REF_WRAP(L)> operator<<(const DOCTEST_REF_WRAP(L) operand) { - return Expression_lhs<const DOCTEST_REF_WRAP(L)>(operand, m_at); + Expression_lhs<L> operator<<(L &&operand) { + return Expression_lhs<L>(doctest::detail::forward<L>(operand), m_at); } }; @@ -1534,7 +1579,7 @@ template <typename L> class ContextScope : public ContextScopeBase { - const L &lambda_; + const L lambda_; public: explicit ContextScope(const L &lambda) : lambda_(lambda) {} @@ -1933,10 +1978,12 @@ 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; \ @@ -1991,17 +2038,15 @@ // for logging #define DOCTEST_INFO(...) \ DOCTEST_INFO_IMPL(DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_), DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_), \ - DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_), __VA_ARGS__) + __VA_ARGS__) -#define DOCTEST_INFO_IMPL(lambda_name, mb_name, s_name, ...) \ - DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4626) \ - auto lambda_name = [&](std::ostream* s_name) { \ +#define DOCTEST_INFO_IMPL(mb_name, s_name, ...) \ + auto DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_) = doctest::detail::MakeContextScope( \ + [&](std::ostream* s_name) { \ doctest::detail::MessageBuilder mb_name(__FILE__, __LINE__, doctest::assertType::is_warn); \ mb_name.m_stream = s_name; \ mb_name * __VA_ARGS__; \ - }; \ - DOCTEST_MSVC_SUPPRESS_WARNING_POP \ - auto DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_) = doctest::detail::MakeContextScope(lambda_name) + }) #define DOCTEST_CAPTURE(x) DOCTEST_INFO(#x " := ", x) @@ -2857,6 +2902,10 @@ #define DOCTEST_OPTIONS_PREFIX_DISPLAY "" #endif +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +#define DOCTEST_CONFIG_NO_MULTI_LANE_ATOMICS +#endif + namespace doctest { bool is_running_in_test = false; @@ -3017,21 +3066,21 @@ "guarantee one atomic takes exactly one cache line"); public: - T operator++() noexcept { return fetch_add(1) + 1; } + T operator++() DOCTEST_NOEXCEPT { return fetch_add(1) + 1; } - T operator++(int) noexcept { return fetch_add(1); } + T operator++(int) DOCTEST_NOEXCEPT { return fetch_add(1); } - T fetch_add(T arg, std::memory_order order = std::memory_order_seq_cst) noexcept { + T fetch_add(T arg, std::memory_order order = std::memory_order_seq_cst) DOCTEST_NOEXCEPT { return myAtomic().fetch_add(arg, order); } - T fetch_sub(T arg, std::memory_order order = std::memory_order_seq_cst) noexcept { + T fetch_sub(T arg, std::memory_order order = std::memory_order_seq_cst) DOCTEST_NOEXCEPT { return myAtomic().fetch_sub(arg, order); } - operator T() const noexcept { return load(); } + operator T() const DOCTEST_NOEXCEPT { return load(); } - T load(std::memory_order order = std::memory_order_seq_cst) const noexcept { + T load(std::memory_order order = std::memory_order_seq_cst) const DOCTEST_NOEXCEPT { auto result = T(); for(auto const& c : m_atomics) { result += c.atomic.load(order); @@ -3039,12 +3088,12 @@ return result; } - T operator=(T desired) noexcept { + T operator=(T desired) DOCTEST_NOEXCEPT { store(desired); return desired; } - void store(T desired, std::memory_order order = std::memory_order_seq_cst) noexcept { + void store(T desired, std::memory_order order = std::memory_order_seq_cst) DOCTEST_NOEXCEPT { // first value becomes desired", all others become 0. for(auto& c : m_atomics) { c.atomic.store(desired, order); @@ -3065,7 +3114,7 @@ // assigned in a round-robin fashion. // 3. This tlsLaneIdx is stored in the thread local data, so it is directly available with // little overhead. - std::atomic<T>& myAtomic() noexcept { + std::atomic<T>& myAtomic() DOCTEST_NOEXCEPT { static std::atomic<size_t> laneCounter; DOCTEST_THREAD_LOCAL size_t tlsLaneIdx = laneCounter++ % DOCTEST_MULTI_LANE_ATOMICS_THREAD_LANES; @@ -3577,7 +3626,7 @@ 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 @@ -3731,7 +3780,7 @@ g_cs->subcasesPassed.insert(g_cs->subcasesStack); g_cs->subcasesStack.pop_back(); -#if defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411L +#if defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411L && (!defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) if(std::uncaught_exceptions() > 0 #else if(std::uncaught_exception() @@ -3839,6 +3888,12 @@ return file_cmp < 0; return m_template_id < other.m_template_id; } + + // all the registered tests + std::set<TestCase>& getRegisteredTests() { + static std::set<TestCase> data; + return data; + } } // namespace detail namespace { using namespace detail; @@ -3870,12 +3925,6 @@ return suiteOrderComparator(lhs, rhs); } - // all the registered tests - std::set<TestCase>& getRegisteredTests() { - static std::set<TestCase> data; - return data; - } - #ifdef DOCTEST_CONFIG_COLORS_WINDOWS HANDLE g_stdoutHandle; WORD g_origFgAttrs; @@ -4104,7 +4153,7 @@ // ContextScope has been destroyed (base class destructors run after derived class destructors). // Instead, ContextScope calls this method directly from its destructor. void ContextScopeBase::destroy() { -#if defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411L +#if defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411L && (!defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) if(std::uncaught_exceptions() > 0) { #else if(std::uncaught_exception()) { @@ -4126,7 +4175,9 @@ #if !defined(DOCTEST_CONFIG_POSIX_SIGNALS) && !defined(DOCTEST_CONFIG_WINDOWS_SEH) struct FatalConditionHandler { - void reset() {} + static void reset() {} + static void allocateAltStackMem() {} + static void freeAltStackMem() {} }; #else // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH @@ -4179,6 +4230,9 @@ std::exit(EXIT_FAILURE); } + static void allocateAltStackMem() {} + static void freeAltStackMem() {} + FatalConditionHandler() { isSet = true; // 32k seems enough for doctest to handle stack overflow, @@ -4196,7 +4250,7 @@ // - std::terminate is called FROM THE TEST RUNNER THREAD // - an exception is thrown from a destructor FROM THE TEST RUNNER THREAD original_terminate_handler = std::get_terminate(); - std::set_terminate([]() noexcept { + std::set_terminate([]() DOCTEST_NOEXCEPT { reportFatal("Terminate handler called"); if(isDebuggerActive() && !g_cs->no_breaks) DOCTEST_BREAK_INTO_DEBUGGER(); @@ -4207,7 +4261,7 @@ // - std::terminate is called FROM A DIFFERENT THREAD // - an exception is thrown from a destructor FROM A DIFFERENT THREAD // - an uncaught exception is thrown FROM A DIFFERENT THREAD - prev_sigabrt_handler = std::signal(SIGABRT, [](int signal) noexcept { + prev_sigabrt_handler = std::signal(SIGABRT, [](int signal) DOCTEST_NOEXCEPT { if(signal == SIGABRT) { reportFatal("SIGABRT - Abort (abnormal termination) signal"); if(isDebuggerActive() && !g_cs->no_breaks) @@ -4296,7 +4350,8 @@ static bool isSet; static struct sigaction oldSigActions[DOCTEST_COUNTOF(signalDefs)]; static stack_t oldSigStack; - static char altStackMem[4 * SIGSTKSZ]; + static size_t altStackSize; + static char* altStackMem; static void handleSignal(int sig) { const char* name = "<unknown signal>"; @@ -4312,11 +4367,19 @@ raise(sig); } + static void allocateAltStackMem() { + altStackMem = new char[altStackSize]; + } + + static void freeAltStackMem() { + delete[] altStackMem; + } + FatalConditionHandler() { isSet = true; stack_t sigStack; sigStack.ss_sp = altStackMem; - sigStack.ss_size = sizeof(altStackMem); + sigStack.ss_size = altStackSize; sigStack.ss_flags = 0; sigaltstack(&sigStack, &oldSigStack); struct sigaction sa = {}; @@ -4341,10 +4404,11 @@ } }; - bool FatalConditionHandler::isSet = false; + bool FatalConditionHandler::isSet = false; struct sigaction FatalConditionHandler::oldSigActions[DOCTEST_COUNTOF(signalDefs)] = {}; - stack_t FatalConditionHandler::oldSigStack = {}; - char FatalConditionHandler::altStackMem[] = {}; + stack_t FatalConditionHandler::oldSigStack = {}; + size_t FatalConditionHandler::altStackSize = 4 * SIGSTKSZ; + char* FatalConditionHandler::altStackMem = nullptr; #endif // DOCTEST_PLATFORM_WINDOWS #endif // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH @@ -5902,8 +5966,10 @@ bool with_col = g_no_colors; \ g_no_colors = false; \ ConsoleReporter::func(arg); \ - DOCTEST_OUTPUT_DEBUG_STRING(oss.str().c_str()); \ - oss.str(""); \ + if(oss.tellp() != std::streampos{}) { \ + DOCTEST_OUTPUT_DEBUG_STRING(oss.str().c_str()); \ + oss.str(""); \ + } \ g_no_colors = with_col; \ } @@ -6090,7 +6156,7 @@ #define DOCTEST_PARSE_AS_BOOL_OR_FLAG(name, sname, var, default) \ if(parseIntOption(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX name "=", option_bool, intRes) || \ parseIntOption(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX sname "=", option_bool, intRes)) \ - p->var = !!intRes; \ + p->var = static_cast<bool>(intRes); \ else if(parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX name) || \ parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX sname)) \ p->var = true; \ @@ -6235,7 +6301,11 @@ p->cout = &fstr; } + FatalConditionHandler::allocateAltStackMem(); + auto cleanup_and_return = [&]() { + FatalConditionHandler::freeAltStackMem(); + if(fstr.is_open()) fstr.close(); @@ -6409,10 +6479,13 @@ #ifndef DOCTEST_CONFIG_NO_EXCEPTIONS try { #endif // DOCTEST_CONFIG_NO_EXCEPTIONS +// MSVC 2015 diagnoses fatalConditionHandler as unused (because reset() is a static method) +DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4101) // unreferenced local variable FatalConditionHandler fatalConditionHandler; // Handle signals // execute the test tc.m_test(); fatalConditionHandler.reset(); +DOCTEST_MSVC_SUPPRESS_WARNING_POP #ifndef DOCTEST_CONFIG_NO_EXCEPTIONS } catch(const TestFailureException&) { p->failure_flags |= TestCaseFailureReason::AssertFailure; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/doctest/parts/doctest.cpp new/doctest-2.4.6/doctest/parts/doctest.cpp --- old/doctest-2.4.5/doctest/parts/doctest.cpp 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/doctest/parts/doctest.cpp 2021-03-22 13:05:04.000000000 +0100 @@ -188,6 +188,10 @@ #define DOCTEST_OPTIONS_PREFIX_DISPLAY "" #endif +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +#define DOCTEST_CONFIG_NO_MULTI_LANE_ATOMICS +#endif + namespace doctest { bool is_running_in_test = false; @@ -348,21 +352,21 @@ "guarantee one atomic takes exactly one cache line"); public: - T operator++() noexcept { return fetch_add(1) + 1; } + T operator++() DOCTEST_NOEXCEPT { return fetch_add(1) + 1; } - T operator++(int) noexcept { return fetch_add(1); } + T operator++(int) DOCTEST_NOEXCEPT { return fetch_add(1); } - T fetch_add(T arg, std::memory_order order = std::memory_order_seq_cst) noexcept { + T fetch_add(T arg, std::memory_order order = std::memory_order_seq_cst) DOCTEST_NOEXCEPT { return myAtomic().fetch_add(arg, order); } - T fetch_sub(T arg, std::memory_order order = std::memory_order_seq_cst) noexcept { + T fetch_sub(T arg, std::memory_order order = std::memory_order_seq_cst) DOCTEST_NOEXCEPT { return myAtomic().fetch_sub(arg, order); } - operator T() const noexcept { return load(); } + operator T() const DOCTEST_NOEXCEPT { return load(); } - T load(std::memory_order order = std::memory_order_seq_cst) const noexcept { + T load(std::memory_order order = std::memory_order_seq_cst) const DOCTEST_NOEXCEPT { auto result = T(); for(auto const& c : m_atomics) { result += c.atomic.load(order); @@ -370,12 +374,12 @@ return result; } - T operator=(T desired) noexcept { + T operator=(T desired) DOCTEST_NOEXCEPT { store(desired); return desired; } - void store(T desired, std::memory_order order = std::memory_order_seq_cst) noexcept { + void store(T desired, std::memory_order order = std::memory_order_seq_cst) DOCTEST_NOEXCEPT { // first value becomes desired", all others become 0. for(auto& c : m_atomics) { c.atomic.store(desired, order); @@ -396,7 +400,7 @@ // assigned in a round-robin fashion. // 3. This tlsLaneIdx is stored in the thread local data, so it is directly available with // little overhead. - std::atomic<T>& myAtomic() noexcept { + std::atomic<T>& myAtomic() DOCTEST_NOEXCEPT { static std::atomic<size_t> laneCounter; DOCTEST_THREAD_LOCAL size_t tlsLaneIdx = laneCounter++ % DOCTEST_MULTI_LANE_ATOMICS_THREAD_LANES; @@ -908,7 +912,7 @@ 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 @@ -1062,7 +1066,7 @@ g_cs->subcasesPassed.insert(g_cs->subcasesStack); g_cs->subcasesStack.pop_back(); -#if defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411L +#if defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411L && (!defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) if(std::uncaught_exceptions() > 0 #else if(std::uncaught_exception() @@ -1170,6 +1174,12 @@ return file_cmp < 0; return m_template_id < other.m_template_id; } + + // all the registered tests + std::set<TestCase>& getRegisteredTests() { + static std::set<TestCase> data; + return data; + } } // namespace detail namespace { using namespace detail; @@ -1201,12 +1211,6 @@ return suiteOrderComparator(lhs, rhs); } - // all the registered tests - std::set<TestCase>& getRegisteredTests() { - static std::set<TestCase> data; - return data; - } - #ifdef DOCTEST_CONFIG_COLORS_WINDOWS HANDLE g_stdoutHandle; WORD g_origFgAttrs; @@ -1435,7 +1439,7 @@ // ContextScope has been destroyed (base class destructors run after derived class destructors). // Instead, ContextScope calls this method directly from its destructor. void ContextScopeBase::destroy() { -#if defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411L +#if defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411L && (!defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) if(std::uncaught_exceptions() > 0) { #else if(std::uncaught_exception()) { @@ -1457,7 +1461,9 @@ #if !defined(DOCTEST_CONFIG_POSIX_SIGNALS) && !defined(DOCTEST_CONFIG_WINDOWS_SEH) struct FatalConditionHandler { - void reset() {} + static void reset() {} + static void allocateAltStackMem() {} + static void freeAltStackMem() {} }; #else // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH @@ -1510,6 +1516,9 @@ std::exit(EXIT_FAILURE); } + static void allocateAltStackMem() {} + static void freeAltStackMem() {} + FatalConditionHandler() { isSet = true; // 32k seems enough for doctest to handle stack overflow, @@ -1527,7 +1536,7 @@ // - std::terminate is called FROM THE TEST RUNNER THREAD // - an exception is thrown from a destructor FROM THE TEST RUNNER THREAD original_terminate_handler = std::get_terminate(); - std::set_terminate([]() noexcept { + std::set_terminate([]() DOCTEST_NOEXCEPT { reportFatal("Terminate handler called"); if(isDebuggerActive() && !g_cs->no_breaks) DOCTEST_BREAK_INTO_DEBUGGER(); @@ -1538,7 +1547,7 @@ // - std::terminate is called FROM A DIFFERENT THREAD // - an exception is thrown from a destructor FROM A DIFFERENT THREAD // - an uncaught exception is thrown FROM A DIFFERENT THREAD - prev_sigabrt_handler = std::signal(SIGABRT, [](int signal) noexcept { + prev_sigabrt_handler = std::signal(SIGABRT, [](int signal) DOCTEST_NOEXCEPT { if(signal == SIGABRT) { reportFatal("SIGABRT - Abort (abnormal termination) signal"); if(isDebuggerActive() && !g_cs->no_breaks) @@ -1627,7 +1636,8 @@ static bool isSet; static struct sigaction oldSigActions[DOCTEST_COUNTOF(signalDefs)]; static stack_t oldSigStack; - static char altStackMem[4 * SIGSTKSZ]; + static size_t altStackSize; + static char* altStackMem; static void handleSignal(int sig) { const char* name = "<unknown signal>"; @@ -1643,11 +1653,19 @@ raise(sig); } + static void allocateAltStackMem() { + altStackMem = new char[altStackSize]; + } + + static void freeAltStackMem() { + delete[] altStackMem; + } + FatalConditionHandler() { isSet = true; stack_t sigStack; sigStack.ss_sp = altStackMem; - sigStack.ss_size = sizeof(altStackMem); + sigStack.ss_size = altStackSize; sigStack.ss_flags = 0; sigaltstack(&sigStack, &oldSigStack); struct sigaction sa = {}; @@ -1672,10 +1690,11 @@ } }; - bool FatalConditionHandler::isSet = false; + bool FatalConditionHandler::isSet = false; struct sigaction FatalConditionHandler::oldSigActions[DOCTEST_COUNTOF(signalDefs)] = {}; - stack_t FatalConditionHandler::oldSigStack = {}; - char FatalConditionHandler::altStackMem[] = {}; + stack_t FatalConditionHandler::oldSigStack = {}; + size_t FatalConditionHandler::altStackSize = 4 * SIGSTKSZ; + char* FatalConditionHandler::altStackMem = nullptr; #endif // DOCTEST_PLATFORM_WINDOWS #endif // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH @@ -3233,8 +3252,10 @@ bool with_col = g_no_colors; \ g_no_colors = false; \ ConsoleReporter::func(arg); \ - DOCTEST_OUTPUT_DEBUG_STRING(oss.str().c_str()); \ - oss.str(""); \ + if(oss.tellp() != std::streampos{}) { \ + DOCTEST_OUTPUT_DEBUG_STRING(oss.str().c_str()); \ + oss.str(""); \ + } \ g_no_colors = with_col; \ } @@ -3421,7 +3442,7 @@ #define DOCTEST_PARSE_AS_BOOL_OR_FLAG(name, sname, var, default) \ if(parseIntOption(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX name "=", option_bool, intRes) || \ parseIntOption(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX sname "=", option_bool, intRes)) \ - p->var = !!intRes; \ + p->var = static_cast<bool>(intRes); \ else if(parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX name) || \ parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX sname)) \ p->var = true; \ @@ -3566,7 +3587,11 @@ p->cout = &fstr; } + FatalConditionHandler::allocateAltStackMem(); + auto cleanup_and_return = [&]() { + FatalConditionHandler::freeAltStackMem(); + if(fstr.is_open()) fstr.close(); @@ -3740,10 +3765,13 @@ #ifndef DOCTEST_CONFIG_NO_EXCEPTIONS try { #endif // DOCTEST_CONFIG_NO_EXCEPTIONS +// MSVC 2015 diagnoses fatalConditionHandler as unused (because reset() is a static method) +DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4101) // unreferenced local variable FatalConditionHandler fatalConditionHandler; // Handle signals // execute the test tc.m_test(); fatalConditionHandler.reset(); +DOCTEST_MSVC_SUPPRESS_WARNING_POP #ifndef DOCTEST_CONFIG_NO_EXCEPTIONS } catch(const TestFailureException&) { p->failure_flags |= TestCaseFailureReason::AssertFailure; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/doctest/parts/doctest_fwd.h new/doctest-2.4.6/doctest/parts/doctest_fwd.h --- old/doctest-2.4.5/doctest/parts/doctest_fwd.h 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/doctest/parts/doctest_fwd.h 2021-03-22 13:05:04.000000000 +0100 @@ -45,8 +45,8 @@ #define DOCTEST_VERSION_MAJOR 2 #define DOCTEST_VERSION_MINOR 4 -#define DOCTEST_VERSION_PATCH 5 -#define DOCTEST_VERSION_STR "2.4.5" +#define DOCTEST_VERSION_PATCH 6 +#define DOCTEST_VERSION_STR "2.4.6" #define DOCTEST_VERSION \ (DOCTEST_VERSION_MAJOR * 10000 + DOCTEST_VERSION_MINOR * 100 + DOCTEST_VERSION_PATCH) @@ -778,6 +778,29 @@ template<class T> struct remove_reference<T&> { typedef T type; }; template<class T> struct remove_reference<T&&> { typedef T type; }; + template<typename T, typename U = T&&> U declval(int); + + template<typename T> T declval(long); + + template<typename T> auto declval() DOCTEST_NOEXCEPT -> decltype(declval<T>(0)) ; + + template<class T> struct is_lvalue_reference { const static bool value=false; }; + template<class T> struct is_lvalue_reference<T&> { const static bool value=true; }; + + template <class T> + inline T&& forward(typename remove_reference<T>::type& t) DOCTEST_NOEXCEPT + { + return static_cast<T&&>(t); + } + + template <class T> + inline T&& forward(typename remove_reference<T>::type&& t) DOCTEST_NOEXCEPT + { + static_assert(!is_lvalue_reference<T>::value, + "Can not forward an rvalue as an lvalue."); + return static_cast<T&&>(t); + } + template<class T> struct remove_const { typedef T type; }; template<class T> struct remove_const<const T> { typedef T type; }; #ifdef DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS @@ -1045,10 +1068,20 @@ return toString(lhs) + op + toString(rhs); } +#if DOCTEST_CLANG && DOCTEST_CLANG < DOCTEST_COMPILER(3, 6, 0) +DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wunused-comparison") +#endif + +// This will check if there is any way it could find a operator like member or friend and uses it. +// If not it doesn't find the operator or if the operator at global scope is defined after +// this template, the template won't be instantiated due to SFINAE. Once the template is not +// instantiated it can look for global operator using normal conversions. +#define SFINAE_OP(ret,op) decltype(doctest::detail::declval<L>() op doctest::detail::declval<R>(),static_cast<ret>(0)) + #define DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(op, op_str, op_macro) \ template <typename R> \ - DOCTEST_NOINLINE Result operator op(const DOCTEST_REF_WRAP(R) rhs) { \ - bool res = op_macro(lhs, rhs); \ + DOCTEST_NOINLINE SFINAE_OP(Result,op) operator op(R&& rhs) { \ + bool res = op_macro(doctest::detail::forward<L>(lhs), doctest::detail::forward<R>(rhs)); \ if(m_at & assertType::is_false) \ res = !res; \ if(!res || doctest::getContextOptions()->success) \ @@ -1176,12 +1209,16 @@ L lhs; assertType::Enum m_at; - explicit Expression_lhs(L in, assertType::Enum at) - : lhs(in) + explicit Expression_lhs(L&& in, assertType::Enum at) + : lhs(doctest::detail::forward<L>(in)) , m_at(at) {} DOCTEST_NOINLINE operator Result() { - bool res = !!lhs; +// this is needed only foc MSVC 2015: +// https://ci.appveyor.com/project/onqtam/doctest/builds/38181202 +DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4800) // 'int': forcing value to bool + bool res = static_cast<bool>(lhs); +DOCTEST_MSVC_SUPPRESS_WARNING_POP if(m_at & assertType::is_false) //!OCLINT bitwise operator in conditional res = !res; @@ -1190,6 +1227,10 @@ return Result(res); } + /* This is required for user-defined conversions from Expression_lhs to L */ + //operator L() const { return lhs; } + operator L() const { return lhs; } + // clang-format off DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(==, " == ", DOCTEST_CMP_EQ) //!OCLINT bitwise operator in conditional DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(!=, " != ", DOCTEST_CMP_NE) //!OCLINT bitwise operator in conditional @@ -1230,6 +1271,10 @@ #endif // DOCTEST_CONFIG_NO_COMPARISON_WARNING_SUPPRESSION +#if DOCTEST_CLANG && DOCTEST_CLANG < DOCTEST_COMPILER(3, 6, 0) +DOCTEST_CLANG_SUPPRESS_WARNING_POP +#endif + struct DOCTEST_INTERFACE ExpressionDecomposer { assertType::Enum m_at; @@ -1241,8 +1286,8 @@ // https://github.com/catchorg/Catch2/issues/870 // https://github.com/catchorg/Catch2/issues/565 template <typename L> - Expression_lhs<const DOCTEST_REF_WRAP(L)> operator<<(const DOCTEST_REF_WRAP(L) operand) { - return Expression_lhs<const DOCTEST_REF_WRAP(L)>(operand, m_at); + Expression_lhs<L> operator<<(L &&operand) { + return Expression_lhs<L>(doctest::detail::forward<L>(operand), m_at); } }; @@ -1531,7 +1576,7 @@ template <typename L> class ContextScope : public ContextScopeBase { - const L &lambda_; + const L lambda_; public: explicit ContextScope(const L &lambda) : lambda_(lambda) {} @@ -1930,10 +1975,12 @@ 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; \ @@ -1988,17 +2035,15 @@ // for logging #define DOCTEST_INFO(...) \ DOCTEST_INFO_IMPL(DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_), DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_), \ - DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_), __VA_ARGS__) + __VA_ARGS__) -#define DOCTEST_INFO_IMPL(lambda_name, mb_name, s_name, ...) \ - DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4626) \ - auto lambda_name = [&](std::ostream* s_name) { \ +#define DOCTEST_INFO_IMPL(mb_name, s_name, ...) \ + auto DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_) = doctest::detail::MakeContextScope( \ + [&](std::ostream* s_name) { \ doctest::detail::MessageBuilder mb_name(__FILE__, __LINE__, doctest::assertType::is_warn); \ mb_name.m_stream = s_name; \ mb_name * __VA_ARGS__; \ - }; \ - DOCTEST_MSVC_SUPPRESS_WARNING_POP \ - auto DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_) = doctest::detail::MakeContextScope(lambda_name) + }) #define DOCTEST_CAPTURE(x) DOCTEST_INFO(#x " := ", x) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/CMakeLists.txt new/doctest-2.4.6/examples/all_features/CMakeLists.txt --- old/doctest-2.4.5/examples/all_features/CMakeLists.txt 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/CMakeLists.txt 2021-03-22 13:05:04.000000000 +0100 @@ -22,6 +22,15 @@ ${files_with_output} concurrency.cpp ../../scripts/coverage_maxout.cpp + namespace1.cpp + namespace2.cpp + namespace3.cpp + namespace4.cpp + namespace5.cpp + namespace6.cpp + namespace7.cpp + namespace8.cpp + namespace9.cpp ) # add the executable @@ -49,6 +58,16 @@ doctest_add_test(NO_OUTPUT NAME concurrency.cpp ${common_args} -sf=*concurrency.cpp -d) # duration: there is no output anyway endif() +doctest_add_test(NO_OUTPUT NAME namespace1.cpp ${common_args} -sf=*namespace1.cpp ) +doctest_add_test(NO_OUTPUT NAME namespace2.cpp ${common_args} -sf=*namespace2.cpp ) +doctest_add_test(NO_OUTPUT NAME namespace3.cpp ${common_args} -sf=*namespace3.cpp ) +doctest_add_test(NO_OUTPUT NAME namespace4.cpp ${common_args} -sf=*namespace4.cpp ) +doctest_add_test(NO_OUTPUT NAME namespace5.cpp ${common_args} -sf=*namespace5.cpp ) +doctest_add_test(NO_OUTPUT NAME namespace6.cpp ${common_args} -sf=*namespace6.cpp ) +doctest_add_test(NO_OUTPUT NAME namespace7.cpp ${common_args} -sf=*namespace7.cpp ) +doctest_add_test(NO_OUTPUT NAME namespace8.cpp ${common_args} -sf=*namespace8.cpp ) +doctest_add_test(NO_OUTPUT NAME namespace9.cpp ${common_args} -sf=*namespace9.cpp ) + # add this separately since the file has a non-straightforward path doctest_add_test(NAME coverage_maxout.cpp ${common_args} -sf=*coverage_maxout.cpp) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/namespace1.cpp new/doctest-2.4.6/examples/all_features/namespace1.cpp --- old/doctest-2.4.5/examples/all_features/namespace1.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/namespace1.cpp 2021-03-22 13:05:04.000000000 +0100 @@ -0,0 +1,27 @@ +#include <doctest/doctest.h> + +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN +#include <cstdint> +#include <sstream> +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END + +namespace user1 { +struct label +{ + label() + : i(0) {} + int i; +}; +} // namespace user1 + +DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations") +DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-prototypes") + +bool operator==(const user1::label& lhs, const user1::label& rhs) { return lhs.i == rhs.i; } + + +TEST_CASE("namespace 1 global operator") { + user1::label a; + user1::label b; + CHECK(a == b); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/namespace2.cpp new/doctest-2.4.6/examples/all_features/namespace2.cpp --- old/doctest-2.4.5/examples/all_features/namespace2.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/namespace2.cpp 2021-03-22 13:05:04.000000000 +0100 @@ -0,0 +1,24 @@ +#include <doctest/doctest.h> + +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN +#include <cstdint> +#include <sstream> +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END + +namespace user2 { +struct label +{ + label() + : i(0) {} + int i; + friend bool operator==(const user2::label& lhs, const user2::label& rhs) { + return lhs.i == rhs.i; + } +}; +} // namespace user2 + +TEST_CASE("namespace 2 friend operator") { + user2::label a; + user2::label b; + REQUIRE(a == b); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/namespace3.cpp new/doctest-2.4.6/examples/all_features/namespace3.cpp --- old/doctest-2.4.5/examples/all_features/namespace3.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/namespace3.cpp 2021-03-22 13:05:04.000000000 +0100 @@ -0,0 +1,22 @@ +#include <doctest/doctest.h> + +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN +#include <cstdint> +#include <sstream> +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END + +namespace user3 { +struct label +{ + label() + : i(0) {} + int i; + bool operator==(const user3::label& rhs) const { return i == rhs.i; } +}; +} // namespace user3 + +TEST_CASE("namespace 3 member operator") { + user3::label a; + user3::label b; + REQUIRE(a == b); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/namespace4.cpp new/doctest-2.4.6/examples/all_features/namespace4.cpp --- old/doctest-2.4.5/examples/all_features/namespace4.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/namespace4.cpp 2021-03-22 13:05:04.000000000 +0100 @@ -0,0 +1,37 @@ +#include <doctest/doctest.h> + +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN +#include <cstdint> +#include <sstream> +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END + +namespace user4 { +struct label +{ + label() + : i(0) {} + int i; + bool operator==(const user4::label& rhs) const { return i == rhs.i; } +}; +} // namespace user4 + +namespace user5 { +struct label +{ + label() + : i(0) {} + int i; + bool operator==(const user5::label& rhs) const { return i == rhs.i; } +}; +} // namespace user5 + +TEST_CASE("namespace 4 member vs member") { + user4::label a4; + user4::label b4; + + user5::label a5; + user5::label b5; + + REQUIRE(a4 == b4); + REQUIRE(a5 == b5); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/namespace5.cpp new/doctest-2.4.6/examples/all_features/namespace5.cpp --- old/doctest-2.4.5/examples/all_features/namespace5.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/namespace5.cpp 2021-03-22 13:05:04.000000000 +0100 @@ -0,0 +1,39 @@ +#include <doctest/doctest.h> + +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN +#include <cstdint> +#include <sstream> +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END + +namespace user6 { +struct label +{ + label() + : i(0) {} + int i; + bool operator==(const user6::label& rhs) const { return i == rhs.i; } +}; +} // namespace user6 + +namespace user7 { +struct label +{ + label() + : i(0) {} + int i; + friend bool operator==(const user7::label& lhs, const user7::label& rhs) { + return lhs.i == rhs.i; + } +}; +} // namespace user7 + +TEST_CASE("namespace 5 member vs friend") { + user6::label a6; + user6::label b6; + + user7::label a7; + user7::label b7; + + REQUIRE(a6 == b6); + REQUIRE(a7 == b7); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/namespace6.cpp new/doctest-2.4.6/examples/all_features/namespace6.cpp --- old/doctest-2.4.5/examples/all_features/namespace6.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/namespace6.cpp 2021-03-22 13:05:04.000000000 +0100 @@ -0,0 +1,41 @@ +#include <doctest/doctest.h> + +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN +#include <cstdint> +#include <sstream> +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END + +namespace user6 { +struct label +{ + label() + : i(0) {} + int i; + friend bool operator==(const user6::label& lhs, const user6::label& rhs) { + return lhs.i == rhs.i; + } +}; +} // namespace user6 + +namespace user7 { +struct label +{ + label() + : i(0) {} + int i; + friend bool operator==(const user7::label& lhs, const user7::label& rhs) { + return lhs.i == rhs.i; + } +}; +} // namespace user7 + +TEST_CASE("namespace 6 friend vs friend") { + user6::label a6; + user6::label b6; + + user7::label a7; + user7::label b7; + + REQUIRE(a6 == b6); + REQUIRE(a7 == b7); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/namespace7.cpp new/doctest-2.4.6/examples/all_features/namespace7.cpp --- old/doctest-2.4.5/examples/all_features/namespace7.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/namespace7.cpp 2021-03-22 13:05:04.000000000 +0100 @@ -0,0 +1,41 @@ +#include <doctest/doctest.h> + +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN +#include <cstdint> +#include <sstream> +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END + +namespace user6 { +struct label +{ + label() + : i(0) {} + int i; + bool operator==(const user6::label& rhs) const { return i == rhs.i; } +}; +} // namespace user6 + +namespace user7 { +struct label +{ + label() + : i(0) {} + int i; +}; +} // namespace user7 + +DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations") +DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-prototypes") + +bool operator==(const user7::label& lhs, const user7::label& rhs) { return lhs.i == rhs.i; } + +TEST_CASE("namespace 7 member vs global") { + user6::label a6; + user6::label b6; + + user7::label a7; + user7::label b7; + + REQUIRE(a6 == b6); + REQUIRE(a7 == b7); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/namespace8.cpp new/doctest-2.4.6/examples/all_features/namespace8.cpp --- old/doctest-2.4.5/examples/all_features/namespace8.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/namespace8.cpp 2021-03-22 13:05:04.000000000 +0100 @@ -0,0 +1,45 @@ +#include <doctest/doctest.h> + +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN +#include <cstdint> +#include <sstream> +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END + +namespace user6 { +struct label +{ + label() + : i(0) {} + int i; + friend bool operator==(const user6::label& lhs, const user6::label& rhs) { + return lhs.i == rhs.i; + } +}; +} // namespace user6 + +namespace user8 { +struct label +{ + label() + : i(0) {} + int i; +}; +} // namespace user8 + + +DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations") +DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-prototypes") + +bool operator==(const user8::label& lhs, const user8::label& rhs) { return lhs.i == rhs.i; } + + +TEST_CASE("namespace 8 friend vs global") { + user6::label a6; + user6::label b6; + + user8::label a8; + user8::label b8; + + REQUIRE(a6 == b6); + REQUIRE(a8 == b8); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/namespace9.cpp new/doctest-2.4.6/examples/all_features/namespace9.cpp --- old/doctest-2.4.5/examples/all_features/namespace9.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/namespace9.cpp 2021-03-22 13:05:04.000000000 +0100 @@ -0,0 +1,44 @@ +#include <doctest/doctest.h> + +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN +#include <cstdint> +#include <sstream> +DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END + +namespace user9a { +struct label +{ + label() + : i(0) {} + int i; +}; +} // namespace user9a + +DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations") +DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-prototypes") +bool operator==(const user9a::label& lhs, const user9a::label& rhs) { return lhs.i == rhs.i; } + +namespace user9b { +struct label +{ + label() + : i(0) {} + int i; +}; +} // namespace user9b + +DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations") +DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-prototypes") + +bool operator==(const user9b::label& lhs, const user9b::label& rhs) { return lhs.i == rhs.i; } + +TEST_CASE("namespace 9 both global") { + user9a::label a1; + user9a::label a2; + + user9b::label b1; + user9b::label b2; + + REQUIRE(a1 == a2); + REQUIRE(b1 == b2); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/test_output/filter_2.txt new/doctest-2.4.6/examples/all_features/test_output/filter_2.txt --- old/doctest-2.4.5/examples/all_features/test_output/filter_2.txt 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/test_output/filter_2.txt 2021-03-22 13:05:04.000000000 +0100 @@ -1,6 +1,6 @@ [doctest] run with "--help" for options =============================================================================== -[doctest] test cases: 0 | 0 passed | 0 failed | 81 skipped +[doctest] test cases: 0 | 0 passed | 0 failed | 90 skipped [doctest] assertions: 0 | 0 passed | 0 failed | [doctest] Status: SUCCESS! Program code. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/test_output/filter_2_xml.txt new/doctest-2.4.6/examples/all_features/test_output/filter_2_xml.txt --- old/doctest-2.4.5/examples/all_features/test_output/filter_2_xml.txt 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/test_output/filter_2_xml.txt 2021-03-22 13:05:04.000000000 +0100 @@ -75,6 +75,15 @@ <TestCase name="multiple types<>" filename="templated_test_cases.cpp" line="0" skipped="true"/> <TestCase name="multiple types<>" filename="templated_test_cases.cpp" line="0" skipped="true"/> <TestCase name="multiple types<>" filename="templated_test_cases.cpp" line="0" skipped="true"/> + <TestCase name="namespace 1 global operator" filename="namespace1.cpp" line="0" skipped="true"/> + <TestCase name="namespace 2 friend operator" filename="namespace2.cpp" line="0" skipped="true"/> + <TestCase name="namespace 3 member operator" filename="namespace3.cpp" line="0" skipped="true"/> + <TestCase name="namespace 4 member vs member" filename="namespace4.cpp" line="0" skipped="true"/> + <TestCase name="namespace 5 member vs friend" filename="namespace5.cpp" line="0" skipped="true"/> + <TestCase name="namespace 6 friend vs friend" filename="namespace6.cpp" line="0" skipped="true"/> + <TestCase name="namespace 7 member vs global" filename="namespace7.cpp" line="0" skipped="true"/> + <TestCase name="namespace 8 friend vs global" filename="namespace8.cpp" line="0" skipped="true"/> + <TestCase name="namespace 9 both global" filename="namespace9.cpp" line="0" skipped="true"/> <TestCase name="normal macros" filename="assertion_macros.cpp" line="0" skipped="true"/> </TestSuite> <TestSuite name="ts1"> @@ -119,6 +128,6 @@ <TestCase name="will end from an unknown exception" filename="coverage_maxout.cpp" line="0" skipped="true"/> </TestSuite> <OverallResultsAsserts successes="0" failures="0"/> - <OverallResultsTestCases successes="0" failures="0" skipped="81"/> + <OverallResultsTestCases successes="0" failures="0" skipped="90"/> </doctest> Program code. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/test_output/version.txt new/doctest-2.4.6/examples/all_features/test_output/version.txt --- old/doctest-2.4.5/examples/all_features/test_output/version.txt 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/test_output/version.txt 2021-03-22 13:05:04.000000000 +0100 @@ -1 +1 @@ -[doctest] doctest version is "2.4.5" +[doctest] doctest version is "2.4.6" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/examples/all_features/test_output/version_xml.txt new/doctest-2.4.6/examples/all_features/test_output/version_xml.txt --- old/doctest-2.4.5/examples/all_features/test_output/version_xml.txt 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/examples/all_features/test_output/version_xml.txt 2021-03-22 13:05:04.000000000 +0100 @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> -<doctest binary="all_features" version="2.4.5"> +<doctest binary="all_features" version="2.4.6"> <Options order_by="file" rand_seed="324" first="0" last="4294967295" abort_after="0" subcase_filter_levels="2147483647" case_sensitive="false" no_throw="false" no_skip="false"/> </doctest> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/meson.build new/doctest-2.4.6/meson.build --- old/doctest-2.4.5/meson.build 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/meson.build 2021-03-22 13:05:04.000000000 +0100 @@ -1,2 +1,2 @@ -project('doctest', ['cpp'], version: '2.4.5', meson_version:'>=0.50') +project('doctest', ['cpp'], version: '2.4.6', meson_version:'>=0.50') doctest_dep = declare_dependency(include_directories: include_directories('doctest')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/scripts/cmake/common.cmake new/doctest-2.4.6/scripts/cmake/common.cmake --- old/doctest-2.4.5/scripts/cmake/common.cmake 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/scripts/cmake/common.cmake 2021-03-22 13:05:04.000000000 +0100 @@ -138,6 +138,10 @@ add_compiler_flags(-Wnoexcept) endif() + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + add_compiler_flags(-Wno-missing-field-initializers) + endif() + # no way to silence it in the expression decomposition macros: _Pragma() in macros doesn't work for the c++ front-end of g++ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55578 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69543 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/scripts/cmake/doctest.cmake new/doctest-2.4.6/scripts/cmake/doctest.cmake --- old/doctest-2.4.5/scripts/cmake/doctest.cmake 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/scripts/cmake/doctest.cmake 2021-03-22 13:05:04.000000000 +0100 @@ -32,6 +32,7 @@ [TEST_PREFIX prefix] [TEST_SUFFIX suffix] [PROPERTIES name1 value1...] + [ADD_LABELS value] [TEST_LIST var] [JUNIT_OUTPUT_DIR dir] ) @@ -85,6 +86,9 @@ Specifies additional properties to be set on all tests discovered by this invocation of ``doctest_discover_tests``. + ``ADD_LABELS value`` + Specifies if the test labels should be set automatically. + ``TEST_LIST var`` Make the list of tests available in the variable ``var``, rather than the default ``<target>_TESTS``. This can be useful when the same test @@ -106,7 +110,7 @@ "" "" "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;JUNIT_OUTPUT_DIR" - "TEST_SPEC;EXTRA_ARGS;PROPERTIES" + "TEST_SPEC;EXTRA_ARGS;PROPERTIES;ADD_LABELS" ${ARGN} ) @@ -139,6 +143,7 @@ -D "TEST_SPEC=${_TEST_SPEC}" -D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}" -D "TEST_PROPERTIES=${_PROPERTIES}" + -D "TEST_ADD_LABELS=${_ADD_LABELS}" -D "TEST_PREFIX=${_TEST_PREFIX}" -D "TEST_SUFFIX=${_TEST_SUFFIX}" -D "TEST_LIST=${_TEST_LIST}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/scripts/cmake/doctestAddTests.cmake new/doctest-2.4.6/scripts/cmake/doctestAddTests.cmake --- old/doctest-2.4.5/scripts/cmake/doctestAddTests.cmake 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/scripts/cmake/doctestAddTests.cmake 2021-03-22 13:05:04.000000000 +0100 @@ -6,6 +6,7 @@ set(spec ${TEST_SPEC}) set(extra_args ${TEST_EXTRA_ARGS}) set(properties ${TEST_PROPERTIES}) +set(add_labels ${TEST_ADD_LABELS}) set(junit_output_dir "${TEST_JUNIT_OUTPUT_DIR}") set(script) set(suite) @@ -55,6 +56,31 @@ continue() endif() set(test ${line}) + set(labels "") + if(${add_labels} EQUAL 1) + # get test suite that test belongs to + execute_process( + COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" --test-case=${test} --list-test-suites + OUTPUT_VARIABLE labeloutput + RESULT_VARIABLE labelresult + ) + if(NOT ${labelresult} EQUAL 0) + message(FATAL_ERROR + "Error running test executable '${TEST_EXECUTABLE}':\n" + " Result: ${labelresult}\n" + " Output: ${labeloutput}\n" + ) + endif() + + string(REPLACE "\n" ";" labeloutput "${labeloutput}") + foreach(labelline ${labeloutput}) + if("${labelline}" STREQUAL "===============================================================================" OR "${labelline}" MATCHES [==[^\[doctest\] ]==]) + continue() + endif() + list(APPEND labels ${labelline}) + endforeach() + endif() + if(NOT "${junit_output_dir}" STREQUAL "") # turn testname into a valid filename by replacing all special characters with "-" string(REGEX REPLACE "[/\\:\"|<>]" "-" test_filename "${test}") @@ -77,8 +103,10 @@ "${prefix}${test}${suffix}" PROPERTIES WORKING_DIRECTORY "${TEST_WORKING_DIR}" + LABELS ${labels} ${properties} ) + unset(labels) list(APPEND tests "${prefix}${test}${suffix}") endforeach() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doctest-2.4.5/scripts/version.txt new/doctest-2.4.6/scripts/version.txt --- old/doctest-2.4.5/scripts/version.txt 2021-02-02 15:59:16.000000000 +0100 +++ new/doctest-2.4.6/scripts/version.txt 2021-03-22 13:05:04.000000000 +0100 @@ -1 +1 @@ -2.4.5 \ No newline at end of file +2.4.6 \ No newline at end of file
