diff --git a/src/catch2/benchmark/catch_benchmark.hpp b/src/catch2/benchmark/catch_benchmark.hpp index ae351e524b..428a92fd7e 100644 --- a/src/catch2/benchmark/catch_benchmark.hpp +++ b/src/catch2/benchmark/catch_benchmark.hpp @@ -15,7 +15,7 @@ #include #include #include - +#include #include #include #include @@ -36,11 +36,11 @@ namespace Catch { namespace Benchmark { struct Benchmark { Benchmark(std::string&& benchmarkName) - : name(std::move(benchmarkName)) {} + : name(CATCH_MOVE(benchmarkName)) {} template Benchmark(std::string&& benchmarkName , FUN &&func) - : fun(std::move(func)), name(std::move(benchmarkName)) {} + : fun(CATCH_MOVE(func)), name(CATCH_MOVE(benchmarkName)) {} template ExecutionPlan> prepare(const IConfig &cfg, Environment> env) const { diff --git a/src/catch2/benchmark/catch_chronometer.hpp b/src/catch2/benchmark/catch_chronometer.hpp index 10fd5a2753..7ef08cef0d 100644 --- a/src/catch2/benchmark/catch_chronometer.hpp +++ b/src/catch2/benchmark/catch_chronometer.hpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace Catch { namespace Benchmark { @@ -42,7 +43,7 @@ namespace Catch { struct Chronometer { public: template - void measure(Fun&& fun) { measure(std::forward(fun), is_callable()); } + void measure(Fun&& fun) { measure(CATCH_FORWARD(fun), is_callable()); } int runs() const { return repeats; } diff --git a/src/catch2/benchmark/catch_constructor.hpp b/src/catch2/benchmark/catch_constructor.hpp index fe651f1ca1..43b5921241 100644 --- a/src/catch2/benchmark/catch_constructor.hpp +++ b/src/catch2/benchmark/catch_constructor.hpp @@ -10,8 +10,9 @@ #ifndef CATCH_CONSTRUCTOR_HPP_INCLUDED #define CATCH_CONSTRUCTOR_HPP_INCLUDED +#include + #include -#include namespace Catch { namespace Benchmark { @@ -30,7 +31,7 @@ namespace Catch { ObjectStorage(ObjectStorage&& other) { - new(&data) T(std::move(other.stored_object())); + new(&data) T(CATCH_MOVE(other.stored_object())); } ~ObjectStorage() { destruct_on_exit(); } @@ -38,7 +39,7 @@ namespace Catch { template void construct(Args&&... args) { - new (&data) T(std::forward(args)...); + new (&data) T(CATCH_FORWARD(args)...); } template diff --git a/src/catch2/benchmark/catch_optimizer.hpp b/src/catch2/benchmark/catch_optimizer.hpp index 6f03ea0d47..381626dad6 100644 --- a/src/catch2/benchmark/catch_optimizer.hpp +++ b/src/catch2/benchmark/catch_optimizer.hpp @@ -14,8 +14,9 @@ # include // atomic_thread_fence #endif +#include + #include -#include namespace Catch { namespace Benchmark { @@ -57,12 +58,12 @@ namespace Catch { template inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if::value>::type { - deoptimize_value(std::forward(fn) (std::forward(args...))); + deoptimize_value(CATCH_FORWARD(fn) (CATCH_FORWARD(args)...)); } template inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if::value>::type { - std::forward(fn) (std::forward(args...)); + CATCH_FORWARD(fn) (CATCH_FORWARD(args)...); } } // namespace Benchmark } // namespace Catch diff --git a/src/catch2/benchmark/catch_sample_analysis.hpp b/src/catch2/benchmark/catch_sample_analysis.hpp index 579e7af954..6204aaf141 100644 --- a/src/catch2/benchmark/catch_sample_analysis.hpp +++ b/src/catch2/benchmark/catch_sample_analysis.hpp @@ -13,10 +13,10 @@ #include #include #include +#include #include #include -#include #include namespace Catch { @@ -35,7 +35,7 @@ namespace Catch { samples2.reserve(samples.size()); std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); }); return { - std::move(samples2), + CATCH_MOVE(samples2), mean, standard_deviation, outliers, diff --git a/src/catch2/benchmark/detail/catch_analyse.hpp b/src/catch2/benchmark/detail/catch_analyse.hpp index 46382c6295..cf96a3d28b 100644 --- a/src/catch2/benchmark/detail/catch_analyse.hpp +++ b/src/catch2/benchmark/detail/catch_analyse.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -45,7 +46,7 @@ namespace Catch { samples2.reserve(samples.size()); std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](double d) { return Duration(d); }); return { - std::move(samples2), + CATCH_MOVE(samples2), wrap_estimate(analysis.mean), wrap_estimate(analysis.standard_deviation), outliers, @@ -64,7 +65,7 @@ namespace Catch { mean /= i; return { - std::move(samples), + CATCH_MOVE(samples), Estimate{mean, mean, mean, 0.0}, Estimate{Duration(0), Duration(0), Duration(0), 0.0}, OutlierClassification{}, diff --git a/src/catch2/benchmark/detail/catch_benchmark_function.hpp b/src/catch2/benchmark/detail/catch_benchmark_function.hpp index 4e0c55ffcf..ccfdc59d8c 100644 --- a/src/catch2/benchmark/detail/catch_benchmark_function.hpp +++ b/src/catch2/benchmark/detail/catch_benchmark_function.hpp @@ -14,8 +14,8 @@ #include #include #include +#include -#include #include #include @@ -48,7 +48,7 @@ namespace Catch { }; template struct model : public callable { - model(Fun&& fun_) : fun(std::move(fun_)) {} + model(Fun&& fun_) : fun(CATCH_MOVE(fun_)) {} model(Fun const& fun_) : fun(fun_) {} model* clone() const override { return new model(*this); } @@ -78,17 +78,17 @@ namespace Catch { template ::value, int>::type = 0> BenchmarkFunction(Fun&& fun) - : f(new model::type>(std::forward(fun))) {} + : f(new model::type>(CATCH_FORWARD(fun))) {} BenchmarkFunction( BenchmarkFunction&& that ) noexcept: - f( std::move( that.f ) ) {} + f( CATCH_MOVE( that.f ) ) {} BenchmarkFunction(BenchmarkFunction const& that) : f(that.f->clone()) {} BenchmarkFunction& operator=( BenchmarkFunction&& that ) noexcept { - f = std::move( that.f ); + f = CATCH_MOVE( that.f ); return *this; } diff --git a/src/catch2/benchmark/detail/catch_complete_invoke.hpp b/src/catch2/benchmark/detail/catch_complete_invoke.hpp index e5af946513..700885d0a4 100644 --- a/src/catch2/benchmark/detail/catch_complete_invoke.hpp +++ b/src/catch2/benchmark/detail/catch_complete_invoke.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -33,14 +34,14 @@ namespace Catch { struct CompleteInvoker { template static Result invoke(Fun&& fun, Args&&... args) { - return std::forward(fun)(std::forward(args)...); + return CATCH_FORWARD(fun)(CATCH_FORWARD(args)...); } }; template <> struct CompleteInvoker { template static CompleteType_t invoke(Fun&& fun, Args&&... args) { - std::forward(fun)(std::forward(args)...); + CATCH_FORWARD(fun)(CATCH_FORWARD(args)...); return {}; } }; @@ -48,14 +49,14 @@ namespace Catch { // invoke and not return void :( template CompleteType_t> complete_invoke(Fun&& fun, Args&&... args) { - return CompleteInvoker>::invoke(std::forward(fun), std::forward(args)...); + return CompleteInvoker>::invoke(CATCH_FORWARD(fun), CATCH_FORWARD(args)...); } } // namespace Detail template Detail::CompleteType_t> user_code(Fun&& fun) { - return Detail::complete_invoke(std::forward(fun)); + return Detail::complete_invoke(CATCH_FORWARD(fun)); } } // namespace Benchmark } // namespace Catch diff --git a/src/catch2/benchmark/detail/catch_measure.hpp b/src/catch2/benchmark/detail/catch_measure.hpp index 49df259ad4..739e91e589 100644 --- a/src/catch2/benchmark/detail/catch_measure.hpp +++ b/src/catch2/benchmark/detail/catch_measure.hpp @@ -13,8 +13,7 @@ #include #include #include - -#include +#include namespace Catch { namespace Benchmark { @@ -22,10 +21,10 @@ namespace Catch { template TimingOf measure(Fun&& fun, Args&&... args) { auto start = Clock::now(); - auto&& r = Detail::complete_invoke(fun, std::forward(args)...); + auto&& r = Detail::complete_invoke(fun, CATCH_FORWARD(args)...); auto end = Clock::now(); auto delta = end - start; - return { delta, std::forward(r), 1 }; + return { delta, CATCH_FORWARD(r), 1 }; } } // namespace Detail } // namespace Benchmark diff --git a/src/catch2/benchmark/detail/catch_repeat.hpp b/src/catch2/benchmark/detail/catch_repeat.hpp index cc2ea0241a..cbb77e2ff6 100644 --- a/src/catch2/benchmark/detail/catch_repeat.hpp +++ b/src/catch2/benchmark/detail/catch_repeat.hpp @@ -11,7 +11,7 @@ #define CATCH_REPEAT_HPP_INCLUDED #include -#include +#include namespace Catch { namespace Benchmark { @@ -27,7 +27,7 @@ namespace Catch { }; template repeater::type> repeat(Fun&& fun) { - return { std::forward(fun) }; + return { CATCH_FORWARD(fun) }; } } // namespace Detail } // namespace Benchmark diff --git a/src/catch2/benchmark/detail/catch_run_for_at_least.hpp b/src/catch2/benchmark/detail/catch_run_for_at_least.hpp index 4b73ad974e..f9f7ad53ff 100644 --- a/src/catch2/benchmark/detail/catch_run_for_at_least.hpp +++ b/src/catch2/benchmark/detail/catch_run_for_at_least.hpp @@ -16,8 +16,8 @@ #include #include #include +#include -#include #include namespace Catch { @@ -32,7 +32,7 @@ namespace Catch { Detail::ChronometerModel meter; auto&& result = Detail::complete_invoke(fun, Chronometer(meter, iters)); - return { meter.elapsed(), std::move(result), iters }; + return { meter.elapsed(), CATCH_MOVE(result), iters }; } template @@ -52,7 +52,7 @@ namespace Catch { auto&& Timing = measure_one(fun, iters, is_callable()); if (Timing.elapsed >= how_long) { - return { Timing.elapsed, std::move(Timing.result), iters }; + return { Timing.elapsed, CATCH_MOVE(Timing.result), iters }; } iters *= 2; } diff --git a/src/catch2/catch_message.cpp b/src/catch2/catch_message.cpp index 2a35da1d72..2ad4aea37b 100644 --- a/src/catch2/catch_message.cpp +++ b/src/catch2/catch_message.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -25,7 +26,7 @@ namespace Catch { } ScopedMessage::ScopedMessage( ScopedMessage&& old ) noexcept: - m_info( std::move( old.m_info ) ) { + m_info( CATCH_MOVE( old.m_info ) ) { old.m_moved = true; } diff --git a/src/catch2/catch_registry_hub.cpp b/src/catch2/catch_registry_hub.cpp index c183600a22..edf9b2b52e 100644 --- a/src/catch2/catch_registry_hub.cpp +++ b/src/catch2/catch_registry_hub.cpp @@ -19,6 +19,7 @@ #include #include #include +#include namespace Catch { @@ -48,16 +49,16 @@ namespace Catch { public: // IMutableRegistryHub void registerReporter( std::string const& name, IReporterFactoryPtr factory ) override { - m_reporterRegistry.registerReporter( name, std::move(factory) ); + m_reporterRegistry.registerReporter( name, CATCH_MOVE(factory) ); } void registerListener( IReporterFactoryPtr factory ) override { - m_reporterRegistry.registerListener( std::move(factory) ); + m_reporterRegistry.registerListener( CATCH_MOVE(factory) ); } void registerTest( Detail::unique_ptr&& testInfo, Detail::unique_ptr&& invoker ) override { - m_testCaseRegistry.registerTest( std::move(testInfo), std::move(invoker) ); + m_testCaseRegistry.registerTest( CATCH_MOVE(testInfo), CATCH_MOVE(invoker) ); } void registerTranslator( Detail::unique_ptr&& translator ) override { - m_exceptionTranslatorRegistry.registerTranslator( std::move(translator) ); + m_exceptionTranslatorRegistry.registerTranslator( CATCH_MOVE(translator) ); } void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override { m_tagAliasRegistry.add( alias, tag, lineInfo ); diff --git a/src/catch2/catch_section_info.hpp b/src/catch2/catch_section_info.hpp index b80d8b9288..1d206891d0 100644 --- a/src/catch2/catch_section_info.hpp +++ b/src/catch2/catch_section_info.hpp @@ -23,7 +23,7 @@ namespace Catch { // still use the `-c` flag comfortably. SectionInfo( SourceLineInfo const& _lineInfo, std::string _name, const char* const = nullptr ): - name(std::move(_name)), + name(CATCH_MOVE(_name)), lineInfo(_lineInfo) {} diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp index 4419da4c9f..6ce21803b0 100644 --- a/src/catch2/catch_session.cpp +++ b/src/catch2/catch_session.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -57,7 +58,7 @@ namespace Catch { explicit TestGroup(IStreamingReporterPtr&& reporter, Config const* config): m_reporter(reporter.get()), m_config{config}, - m_context{config, std::move(reporter)} { + m_context{config, CATCH_MOVE(reporter)} { auto const& allTestCases = getAllTestCasesSorted(*m_config); m_matches = m_config->testSpec().matchesByFilter(allTestCases, *m_config); @@ -277,7 +278,7 @@ namespace Catch { return 0; } - TestGroup tests { std::move(reporter), m_config.get() }; + TestGroup tests { CATCH_MOVE(reporter), m_config.get() }; auto const totals = tests.execute(); if( m_config->warnAboutNoTests() && totals.error == -1 ) diff --git a/src/catch2/generators/catch_generators.hpp b/src/catch2/generators/catch_generators.hpp index 4ac7300516..13786b77ba 100644 --- a/src/catch2/generators/catch_generators.hpp +++ b/src/catch2/generators/catch_generators.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -55,7 +56,7 @@ namespace Detail { GeneratorWrapper(IGenerator* generator): m_generator(generator) {} GeneratorWrapper(GeneratorPtr generator): - m_generator(std::move(generator)) {} + m_generator(CATCH_MOVE(generator)) {} T const& get() const { return m_generator->get(); @@ -74,7 +75,7 @@ namespace Detail { m_value(value) {} SingleValueGenerator(T&& value): - m_value(std::move(value)) + m_value(CATCH_MOVE(value)) {} T const& get() const override { @@ -108,7 +109,7 @@ namespace Detail { GeneratorWrapper value( T&& value ) { return GeneratorWrapper( Catch::Detail::make_unique>( - std::forward( value ) ) ); + CATCH_FORWARD( value ) ) ); } template GeneratorWrapper values(std::initializer_list values) { @@ -121,35 +122,35 @@ namespace Detail { size_t m_current = 0; void add_generator( GeneratorWrapper&& generator ) { - m_generators.emplace_back( std::move( generator ) ); + m_generators.emplace_back( CATCH_MOVE( generator ) ); } void add_generator( T const& val ) { m_generators.emplace_back( value( val ) ); } void add_generator( T&& val ) { - m_generators.emplace_back( value( std::move( val ) ) ); + m_generators.emplace_back( value( CATCH_MOVE( val ) ) ); } template std::enable_if_t, T>::value> add_generator( U&& val ) { - add_generator( T( std::forward( val ) ) ); + add_generator( T( CATCH_FORWARD( val ) ) ); } template void add_generators( U&& valueOrGenerator ) { - add_generator( std::forward( valueOrGenerator ) ); + add_generator( CATCH_FORWARD( valueOrGenerator ) ); } template void add_generators( U&& valueOrGenerator, Gs&&... moreGenerators ) { - add_generator( std::forward( valueOrGenerator ) ); - add_generators( std::forward( moreGenerators )... ); + add_generator( CATCH_FORWARD( valueOrGenerator ) ); + add_generators( CATCH_FORWARD( moreGenerators )... ); } public: template Generators(Gs &&... moreGenerators) { m_generators.reserve(sizeof...(Gs)); - add_generators(std::forward(moreGenerators)...); + add_generators(CATCH_FORWARD(moreGenerators)...); } T const& get() const override { @@ -181,19 +182,19 @@ namespace Detail { template auto makeGenerators( GeneratorWrapper&& generator, Gs &&... moreGenerators ) -> Generators { - return Generators(std::move(generator), std::forward(moreGenerators)...); + return Generators(CATCH_MOVE(generator), CATCH_FORWARD(moreGenerators)...); } template auto makeGenerators( GeneratorWrapper&& generator ) -> Generators { - return Generators(std::move(generator)); + return Generators(CATCH_MOVE(generator)); } template auto makeGenerators( T&& val, Gs &&... moreGenerators ) -> Generators> { - return makeGenerators( value( std::forward( val ) ), std::forward( moreGenerators )... ); + return makeGenerators( value( CATCH_FORWARD( val ) ), CATCH_FORWARD( moreGenerators )... ); } template auto makeGenerators( as, U&& val, Gs &&... moreGenerators ) -> Generators { - return makeGenerators( value( T( std::forward( val ) ) ), std::forward( moreGenerators )... ); + return makeGenerators( value( T( CATCH_FORWARD( val ) ) ), CATCH_FORWARD( moreGenerators )... ); } auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&; diff --git a/src/catch2/generators/catch_generators_adapters.hpp b/src/catch2/generators/catch_generators_adapters.hpp index 393b070000..c55a396253 100644 --- a/src/catch2/generators/catch_generators_adapters.hpp +++ b/src/catch2/generators/catch_generators_adapters.hpp @@ -10,6 +10,9 @@ #include #include +#include + +#include namespace Catch { namespace Generators { @@ -21,7 +24,7 @@ namespace Generators { size_t m_target; public: TakeGenerator(size_t target, GeneratorWrapper&& generator): - m_generator(std::move(generator)), + m_generator(CATCH_MOVE(generator)), m_target(target) { assert(target != 0 && "Empty generators are not allowed"); @@ -47,7 +50,7 @@ namespace Generators { template GeneratorWrapper take(size_t target, GeneratorWrapper&& generator) { - return GeneratorWrapper(Catch::Detail::make_unique>(target, std::move(generator))); + return GeneratorWrapper(Catch::Detail::make_unique>(target, CATCH_MOVE(generator))); } @@ -58,8 +61,8 @@ namespace Generators { public: template FilterGenerator(P&& pred, GeneratorWrapper&& generator): - m_generator(std::move(generator)), - m_predicate(std::forward

(pred)) + m_generator(CATCH_MOVE(generator)), + m_predicate(CATCH_FORWARD(pred)) { if (!m_predicate(m_generator.get())) { // It might happen that there are no values that pass the @@ -88,7 +91,7 @@ namespace Generators { template GeneratorWrapper filter(Predicate&& pred, GeneratorWrapper&& generator) { - return GeneratorWrapper(Catch::Detail::make_unique>(std::forward(pred), std::move(generator))); + return GeneratorWrapper(Catch::Detail::make_unique>(CATCH_FORWARD(pred), CATCH_MOVE(generator))); } template @@ -103,7 +106,7 @@ namespace Generators { size_t m_repeat_index = 0; public: RepeatGenerator(size_t repeats, GeneratorWrapper&& generator): - m_generator(std::move(generator)), + m_generator(CATCH_MOVE(generator)), m_target_repeats(repeats) { assert(m_target_repeats > 0 && "Repeat generator must repeat at least once"); @@ -144,7 +147,7 @@ namespace Generators { template GeneratorWrapper repeat(size_t repeats, GeneratorWrapper&& generator) { - return GeneratorWrapper(Catch::Detail::make_unique>(repeats, std::move(generator))); + return GeneratorWrapper(Catch::Detail::make_unique>(repeats, CATCH_MOVE(generator))); } template @@ -157,8 +160,8 @@ namespace Generators { public: template MapGenerator(F2&& function, GeneratorWrapper&& generator) : - m_generator(std::move(generator)), - m_function(std::forward(function)), + m_generator(CATCH_MOVE(generator)), + m_function(CATCH_FORWARD(function)), m_cache(m_function(m_generator.get())) {} @@ -177,14 +180,14 @@ namespace Generators { template > GeneratorWrapper map(Func&& function, GeneratorWrapper&& generator) { return GeneratorWrapper( - Catch::Detail::make_unique>(std::forward(function), std::move(generator)) + Catch::Detail::make_unique>(CATCH_FORWARD(function), CATCH_MOVE(generator)) ); } template GeneratorWrapper map(Func&& function, GeneratorWrapper&& generator) { return GeneratorWrapper( - Catch::Detail::make_unique>(std::forward(function), std::move(generator)) + Catch::Detail::make_unique>(CATCH_FORWARD(function), CATCH_MOVE(generator)) ); } @@ -196,7 +199,7 @@ namespace Generators { bool m_used_up = false; public: ChunkGenerator(size_t size, GeneratorWrapper generator) : - m_chunk_size(size), m_generator(std::move(generator)) + m_chunk_size(size), m_generator(CATCH_MOVE(generator)) { m_chunk.reserve(m_chunk_size); if (m_chunk_size != 0) { @@ -227,7 +230,7 @@ namespace Generators { template GeneratorWrapper> chunk(size_t size, GeneratorWrapper&& generator) { return GeneratorWrapper>( - Catch::Detail::make_unique>(size, std::move(generator)) + Catch::Detail::make_unique>(size, CATCH_MOVE(generator)) ); } diff --git a/src/catch2/interfaces/catch_interfaces_reporter.hpp b/src/catch2/interfaces/catch_interfaces_reporter.hpp index aeb78b61ff..f1d93f7e8c 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.hpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.hpp @@ -14,7 +14,7 @@ #include #include #include - +#include #include #include @@ -150,7 +150,7 @@ namespace Catch { } return { info, - std::move(samples2), + CATCH_MOVE(samples2), mean, standardDeviation, outliers, diff --git a/src/catch2/internal/catch_clara.hpp b/src/catch2/internal/catch_clara.hpp index 2da6919a22..13f176485b 100644 --- a/src/catch2/internal/catch_clara.hpp +++ b/src/catch2/internal/catch_clara.hpp @@ -30,11 +30,11 @@ #endif #include +#include #include #include #include -#include #include #include #include @@ -293,7 +293,7 @@ namespace Catch { T temp; auto result = convertInto( source, temp ); if ( result ) - target = std::move( temp ); + target = CATCH_MOVE( temp ); return result; } #endif // CLARA_CONFIG_OPTIONAL_TYPE diff --git a/src/catch2/internal/catch_exception_translator_registry.cpp b/src/catch2/internal/catch_exception_translator_registry.cpp index 08d5d8efbf..acddea6ec9 100644 --- a/src/catch2/internal/catch_exception_translator_registry.cpp +++ b/src/catch2/internal/catch_exception_translator_registry.cpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace Catch { @@ -16,7 +17,7 @@ namespace Catch { } void ExceptionTranslatorRegistry::registerTranslator( Detail::unique_ptr&& translator ) { - m_translators.push_back( std::move( translator ) ); + m_translators.push_back( CATCH_MOVE( translator ) ); } #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) diff --git a/src/catch2/internal/catch_list.cpp b/src/catch2/internal/catch_list.cpp index d7969096e3..20613c7079 100644 --- a/src/catch2/internal/catch_list.cpp +++ b/src/catch2/internal/catch_list.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -43,7 +44,7 @@ namespace Catch { std::vector infos; infos.reserve(tagCounts.size()); for (auto& tagc : tagCounts) { - infos.push_back(std::move(tagc.second)); + infos.push_back(CATCH_MOVE(tagc.second)); } reporter.listTags(infos); diff --git a/src/catch2/internal/catch_reporter_registry.cpp b/src/catch2/internal/catch_reporter_registry.cpp index 372a0e3776..ee92ad7de0 100644 --- a/src/catch2/internal/catch_reporter_registry.cpp +++ b/src/catch2/internal/catch_reporter_registry.cpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace Catch { @@ -43,10 +44,10 @@ namespace Catch { } void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr factory ) { - m_factories.emplace(name, std::move(factory)); + m_factories.emplace(name, CATCH_MOVE(factory)); } void ReporterRegistry::registerListener( IReporterFactoryPtr factory ) { - m_listeners.push_back( std::move(factory) ); + m_listeners.push_back( CATCH_MOVE(factory) ); } IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp index e3a4bd1ebc..b3fb8b11ce 100644 --- a/src/catch2/internal/catch_run_context.cpp +++ b/src/catch2/internal/catch_run_context.cpp @@ -64,7 +64,7 @@ namespace Catch { Catch::Detail::make_unique( nameAndLocation, ctx, ¤tTracker ); tracker = newTracker.get(); - currentTracker.addChild( std::move(newTracker) ); + currentTracker.addChild( CATCH_MOVE(newTracker) ); } if( !tracker->isComplete() ) { @@ -153,7 +153,7 @@ namespace Catch { return m_generator; } void setGenerator( GeneratorBasePtr&& generator ) override { - m_generator = std::move( generator ); + m_generator = CATCH_MOVE( generator ); } }; GeneratorTracker::~GeneratorTracker() = default; @@ -163,7 +163,7 @@ namespace Catch { : m_runInfo(_config->name()), m_context(getCurrentMutableContext()), m_config(_config), - m_reporter(std::move(reporter)), + m_reporter(CATCH_MOVE(reporter)), m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal }, m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ) { diff --git a/src/catch2/internal/catch_run_context.hpp b/src/catch2/internal/catch_run_context.hpp index b2eeb2ee3d..0a20866e1f 100644 --- a/src/catch2/internal/catch_run_context.hpp +++ b/src/catch2/internal/catch_run_context.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include diff --git a/src/catch2/internal/catch_section.cpp b/src/catch2/internal/catch_section.cpp index 6c13c7dd77..3b9d1f8280 100644 --- a/src/catch2/internal/catch_section.cpp +++ b/src/catch2/internal/catch_section.cpp @@ -6,15 +6,16 @@ // SPDX-License-Identifier: BSL-1.0 #include -#include +#include #include +#include #include namespace Catch { Section::Section( SectionInfo&& info ): - m_info( std::move( info ) ), + m_info( CATCH_MOVE( info ) ), m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) { // Non-"included" sections will not use the timing information diff --git a/src/catch2/internal/catch_test_case_registry_impl.cpp b/src/catch2/internal/catch_test_case_registry_impl.cpp index 6ce7a1adb9..318156c405 100644 --- a/src/catch2/internal/catch_test_case_registry_impl.cpp +++ b/src/catch2/internal/catch_test_case_registry_impl.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -119,8 +120,8 @@ namespace { void TestRegistry::registerTest(Detail::unique_ptr testInfo, Detail::unique_ptr testInvoker) { m_handles.emplace_back(testInfo.get(), testInvoker.get()); m_viewed_test_infos.push_back(testInfo.get()); - m_owned_test_infos.push_back(std::move(testInfo)); - m_invokers.push_back(std::move(testInvoker)); + m_owned_test_infos.push_back(CATCH_MOVE(testInfo)); + m_invokers.push_back(CATCH_MOVE(testInvoker)); } std::vector const& TestRegistry::getAllInfos() const { diff --git a/src/catch2/internal/catch_test_case_tracker.cpp b/src/catch2/internal/catch_test_case_tracker.cpp index ada521ca79..a0e883b59b 100644 --- a/src/catch2/internal/catch_test_case_tracker.cpp +++ b/src/catch2/internal/catch_test_case_tracker.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -34,7 +35,7 @@ namespace TestCaseTracking { } void ITracker::addChild( ITrackerPtr&& child ) { - m_children.push_back( std::move(child) ); + m_children.push_back( CATCH_MOVE(child) ); } ITracker* ITracker::findChild( NameAndLocation const& nameAndLocation ) { @@ -207,7 +208,7 @@ namespace TestCaseTracking { auto newSection = Catch::Detail::make_unique( nameAndLocation, ctx, ¤tTracker ); section = newSection.get(); - currentTracker.addChild( std::move( newSection ) ); + currentTracker.addChild( CATCH_MOVE( newSection ) ); } if( !ctx.completedCycle() ) section->tryOpen(); diff --git a/src/catch2/internal/catch_test_registry.cpp b/src/catch2/internal/catch_test_registry.cpp index c0965daafb..d33ba27abe 100644 --- a/src/catch2/internal/catch_test_registry.cpp +++ b/src/catch2/internal/catch_test_registry.cpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace Catch { @@ -42,7 +43,7 @@ namespace Catch { extractClassName( classOrMethod ), nameAndTags, lineInfo), - std::move(invoker) + CATCH_MOVE(invoker) ); } CATCH_CATCH_ALL { // Do not throw when constructing global objects, instead register the exception to be processed later diff --git a/src/catch2/internal/catch_test_spec_parser.cpp b/src/catch2/internal/catch_test_spec_parser.cpp index e9d77e74fc..86b25bfa60 100644 --- a/src/catch2/internal/catch_test_spec_parser.cpp +++ b/src/catch2/internal/catch_test_spec_parser.cpp @@ -9,6 +9,7 @@ #include #include +#include namespace Catch { @@ -35,7 +36,7 @@ namespace Catch { } TestSpec TestSpecParser::testSpec() { addFilter(); - return std::move(m_testSpec); + return CATCH_MOVE(m_testSpec); } bool TestSpecParser::visitChar( char c ) { if( (m_mode != EscapedName) && (c == '\\') ) { @@ -151,7 +152,7 @@ namespace Catch { void TestSpecParser::addFilter() { if( !m_currentFilter.m_required.empty() || !m_currentFilter.m_forbidden.empty() ) { - m_testSpec.m_filters.push_back( std::move(m_currentFilter) ); + m_testSpec.m_filters.push_back( CATCH_MOVE(m_currentFilter) ); m_currentFilter = TestSpec::Filter(); } } diff --git a/src/catch2/matchers/catch_matchers.hpp b/src/catch2/matchers/catch_matchers.hpp index fe8f48c4b7..86f63bee5e 100644 --- a/src/catch2/matchers/catch_matchers.hpp +++ b/src/catch2/matchers/catch_matchers.hpp @@ -9,6 +9,7 @@ #define CATCH_MATCHERS_HPP_INCLUDED #include +#include #include #include @@ -87,11 +88,11 @@ namespace Matchers { friend MatchAllOf operator&& (MatchAllOf&& lhs, MatcherBase const& rhs) { lhs.m_matchers.push_back(&rhs); - return std::move(lhs); + return CATCH_MOVE(lhs); } friend MatchAllOf operator&& (MatcherBase const& lhs, MatchAllOf&& rhs) { rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs); - return std::move(rhs); + return CATCH_MOVE(rhs); } private: @@ -140,11 +141,11 @@ namespace Matchers { friend MatchAnyOf operator|| (MatchAnyOf&& lhs, MatcherBase const& rhs) { lhs.m_matchers.push_back(&rhs); - return std::move(lhs); + return CATCH_MOVE(lhs); } friend MatchAnyOf operator|| (MatcherBase const& lhs, MatchAnyOf&& rhs) { rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs); - return std::move(rhs); + return CATCH_MOVE(rhs); } private: diff --git a/src/catch2/matchers/catch_matchers_container_properties.hpp b/src/catch2/matchers/catch_matchers_container_properties.hpp index 8127399553..082f834f28 100644 --- a/src/catch2/matchers/catch_matchers_container_properties.hpp +++ b/src/catch2/matchers/catch_matchers_container_properties.hpp @@ -10,6 +10,7 @@ #include #include +#include namespace Catch { namespace Matchers { @@ -55,7 +56,7 @@ namespace Catch { Matcher m_matcher; public: explicit SizeMatchesMatcher(Matcher m): - m_matcher(std::move(m)) + m_matcher(CATCH_MOVE(m)) {} template @@ -81,7 +82,7 @@ namespace Catch { template std::enable_if_t::value, SizeMatchesMatcher> SizeIs(Matcher&& m) { - return SizeMatchesMatcher{std::forward(m)}; + return SizeMatchesMatcher{CATCH_FORWARD(m)}; } } // end namespace Matchers diff --git a/src/catch2/matchers/catch_matchers_contains.hpp b/src/catch2/matchers/catch_matchers_contains.hpp index 8841dbda2a..e81ad7c79e 100644 --- a/src/catch2/matchers/catch_matchers_contains.hpp +++ b/src/catch2/matchers/catch_matchers_contains.hpp @@ -9,6 +9,7 @@ #define CATCH_MATCHERS_CONTAINS_HPP_INCLUDED #include +#include #include #include @@ -24,8 +25,8 @@ namespace Catch { public: template ContainsElementMatcher(T2&& target, Equality2&& predicate): - m_desired(std::forward(target)), - m_eq(std::forward(predicate)) + m_desired(CATCH_FORWARD(target)), + m_eq(CATCH_FORWARD(predicate)) {} std::string describe() const override { @@ -52,7 +53,7 @@ namespace Catch { // constructor (and also avoid some perfect forwarding failure // cases) ContainsMatcherMatcher(Matcher matcher): - m_matcher(std::move(matcher)) + m_matcher(CATCH_MOVE(matcher)) {} template @@ -78,14 +79,14 @@ namespace Catch { template std::enable_if_t::value, ContainsElementMatcher>> Contains(T&& elem) { - return { std::forward(elem), std::equal_to<>{} }; + return { CATCH_FORWARD(elem), std::equal_to<>{} }; } //! Creates a matcher that checks whether a range contains element matching a matcher template std::enable_if_t::value, ContainsMatcherMatcher> Contains(Matcher&& matcher) { - return { std::forward(matcher) }; + return { CATCH_FORWARD(matcher) }; } /** @@ -95,7 +96,7 @@ namespace Catch { */ template ContainsElementMatcher Contains(T&& elem, Equality&& eq) { - return { std::forward(elem), std::forward(eq) }; + return { CATCH_FORWARD(elem), CATCH_FORWARD(eq) }; } } diff --git a/src/catch2/matchers/catch_matchers_predicate.hpp b/src/catch2/matchers/catch_matchers_predicate.hpp index 99a01a4edb..5f5cea5901 100644 --- a/src/catch2/matchers/catch_matchers_predicate.hpp +++ b/src/catch2/matchers/catch_matchers_predicate.hpp @@ -10,9 +10,9 @@ #include #include +#include #include -#include namespace Catch { namespace Matchers { @@ -28,7 +28,7 @@ class PredicateMatcher final : public MatcherBase { public: PredicateMatcher(Predicate&& elem, std::string const& descr) - :m_predicate(std::forward(elem)), + :m_predicate(CATCH_FORWARD(elem)), m_description(Detail::finalizeDescription(descr)) {} @@ -50,7 +50,7 @@ class PredicateMatcher final : public MatcherBase { PredicateMatcher Predicate(Pred&& predicate, std::string const& description = "") { static_assert(is_callable::value, "Predicate not callable with argument T"); static_assert(std::is_same>::value, "Predicate does not return bool"); - return PredicateMatcher(std::forward(predicate), description); + return PredicateMatcher(CATCH_FORWARD(predicate), description); } } // namespace Matchers diff --git a/src/catch2/matchers/catch_matchers_quantifiers.hpp b/src/catch2/matchers/catch_matchers_quantifiers.hpp index 09a8c1280e..e0e1a62d70 100644 --- a/src/catch2/matchers/catch_matchers_quantifiers.hpp +++ b/src/catch2/matchers/catch_matchers_quantifiers.hpp @@ -9,8 +9,7 @@ #define CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED #include - -#include +#include namespace Catch { namespace Matchers { @@ -20,7 +19,7 @@ namespace Catch { Matcher m_matcher; public: AllMatchMatcher(Matcher matcher): - m_matcher(std::move(matcher)) + m_matcher(CATCH_MOVE(matcher)) {} std::string describe() const override { @@ -44,7 +43,7 @@ namespace Catch { Matcher m_matcher; public: NoneMatchMatcher(Matcher matcher): - m_matcher(std::move(matcher)) + m_matcher(CATCH_MOVE(matcher)) {} std::string describe() const override { @@ -68,7 +67,7 @@ namespace Catch { Matcher m_matcher; public: AnyMatchMatcher(Matcher matcher): - m_matcher(std::move(matcher)) + m_matcher(CATCH_MOVE(matcher)) {} std::string describe() const override { @@ -89,19 +88,19 @@ namespace Catch { // Creates a matcher that checks whether a range contains element matching a matcher template AllMatchMatcher AllMatch(Matcher&& matcher) { - return { std::forward(matcher) }; + return { CATCH_FORWARD(matcher) }; } // Creates a matcher that checks whether no element in a range matches a matcher. template NoneMatchMatcher NoneMatch(Matcher&& matcher) { - return { std::forward(matcher) }; + return { CATCH_FORWARD(matcher) }; } // Creates a matcher that checks whether any element in a range matches a matcher. template AnyMatchMatcher AnyMatch(Matcher&& matcher) { - return { std::forward(matcher) }; + return { CATCH_FORWARD(matcher) }; } } } diff --git a/src/catch2/matchers/catch_matchers_string.cpp b/src/catch2/matchers/catch_matchers_string.cpp index a81baddd59..ee082d2c06 100644 --- a/src/catch2/matchers/catch_matchers_string.cpp +++ b/src/catch2/matchers/catch_matchers_string.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include @@ -76,7 +77,7 @@ namespace Matchers { - RegexMatcher::RegexMatcher(std::string regex, CaseSensitive caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {} + RegexMatcher::RegexMatcher(std::string regex, CaseSensitive caseSensitivity): m_regex(CATCH_MOVE(regex)), m_caseSensitivity(caseSensitivity) {} bool RegexMatcher::match(std::string const& matchee) const { auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway diff --git a/src/catch2/matchers/catch_matchers_templated.hpp b/src/catch2/matchers/catch_matchers_templated.hpp index 834d0b244d..19cfb528e6 100644 --- a/src/catch2/matchers/catch_matchers_templated.hpp +++ b/src/catch2/matchers/catch_matchers_templated.hpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -145,7 +146,7 @@ namespace Matchers { MatchAllOfGeneric operator && ( MatchAllOfGeneric&& lhs, MatchAllOfGeneric&& rhs) { - return MatchAllOfGeneric{array_cat(std::move(lhs.m_matchers), std::move(rhs.m_matchers))}; + return MatchAllOfGeneric{array_cat(CATCH_MOVE(lhs.m_matchers), CATCH_MOVE(rhs.m_matchers))}; } //! Avoids type nesting for `GenericAllOf && some matcher` case @@ -154,7 +155,7 @@ namespace Matchers { MatchAllOfGeneric> operator && ( MatchAllOfGeneric&& lhs, MatcherRHS const& rhs) { - return MatchAllOfGeneric{array_cat(std::move(lhs.m_matchers), static_cast(&rhs))}; + return MatchAllOfGeneric{array_cat(CATCH_MOVE(lhs.m_matchers), static_cast(&rhs))}; } //! Avoids type nesting for `some matcher && GenericAllOf` case @@ -163,7 +164,7 @@ namespace Matchers { MatchAllOfGeneric> operator && ( MatcherLHS const& lhs, MatchAllOfGeneric&& rhs) { - return MatchAllOfGeneric{array_cat(static_cast(std::addressof(lhs)), std::move(rhs.m_matchers))}; + return MatchAllOfGeneric{array_cat(static_cast(std::addressof(lhs)), CATCH_MOVE(rhs.m_matchers))}; } }; @@ -194,7 +195,7 @@ namespace Matchers { friend MatchAnyOfGeneric operator || ( MatchAnyOfGeneric&& lhs, MatchAnyOfGeneric&& rhs) { - return MatchAnyOfGeneric{array_cat(std::move(lhs.m_matchers), std::move(rhs.m_matchers))}; + return MatchAnyOfGeneric{array_cat(CATCH_MOVE(lhs.m_matchers), CATCH_MOVE(rhs.m_matchers))}; } //! Avoids type nesting for `GenericAnyOf || some matcher` case @@ -203,7 +204,7 @@ namespace Matchers { MatchAnyOfGeneric> operator || ( MatchAnyOfGeneric&& lhs, MatcherRHS const& rhs) { - return MatchAnyOfGeneric{array_cat(std::move(lhs.m_matchers), static_cast(std::addressof(rhs)))}; + return MatchAnyOfGeneric{array_cat(CATCH_MOVE(lhs.m_matchers), static_cast(std::addressof(rhs)))}; } //! Avoids type nesting for `some matcher || GenericAnyOf` case @@ -212,7 +213,7 @@ namespace Matchers { MatchAnyOfGeneric> operator || ( MatcherLHS const& lhs, MatchAnyOfGeneric&& rhs) { - return MatchAnyOfGeneric{array_cat(static_cast(std::addressof(lhs)), std::move(rhs.m_matchers))}; + return MatchAnyOfGeneric{array_cat(static_cast(std::addressof(lhs)), CATCH_MOVE(rhs.m_matchers))}; } }; diff --git a/src/catch2/matchers/internal/catch_matchers_combined_tu.cpp b/src/catch2/matchers/internal/catch_matchers_combined_tu.cpp index f3befb02b4..4fab1b52f8 100644 --- a/src/catch2/matchers/internal/catch_matchers_combined_tu.cpp +++ b/src/catch2/matchers/internal/catch_matchers_combined_tu.cpp @@ -23,6 +23,7 @@ #include #include #include +#include namespace Catch { @@ -31,7 +32,7 @@ namespace Catch { // the Equals matcher (so the header does not mention matchers) void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) { std::string exceptionMessage = Catch::translateActiveException(); - MatchExpr expr( std::move(exceptionMessage), matcher, matcherString ); + MatchExpr expr( CATCH_MOVE(exceptionMessage), matcher, matcherString ); handler.handleExpr( expr ); } diff --git a/src/catch2/matchers/internal/catch_matchers_impl.hpp b/src/catch2/matchers/internal/catch_matchers_impl.hpp index c16cd16b10..2acbec1f30 100644 --- a/src/catch2/matchers/internal/catch_matchers_impl.hpp +++ b/src/catch2/matchers/internal/catch_matchers_impl.hpp @@ -10,6 +10,7 @@ #include #include +#include namespace Catch { @@ -21,7 +22,7 @@ namespace Catch { public: MatchExpr( ArgT && arg, MatcherT const& matcher, StringRef matcherString ) : ITransientExpression{ true, matcher.match( arg ) }, // not forwarding arg here on purpose - m_arg( std::forward(arg) ), + m_arg( CATCH_FORWARD(arg) ), m_matcher( matcher ), m_matcherString( matcherString ) {} @@ -44,7 +45,7 @@ namespace Catch { template auto makeMatchExpr( ArgT && arg, MatcherT const& matcher, StringRef matcherString ) -> MatchExpr { - return MatchExpr( std::forward(arg), matcher, matcherString ); + return MatchExpr( CATCH_FORWARD(arg), matcher, matcherString ); } } // namespace Catch diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp index d2779e34e5..b306800fb6 100644 --- a/src/catch2/reporters/catch_reporter_console.cpp +++ b/src/catch2/reporters/catch_reporter_console.cpp @@ -18,8 +18,8 @@ #include #include #include +#include -#include #include #if defined(_MSC_VER) @@ -285,7 +285,7 @@ class TablePrinter { public: TablePrinter( std::ostream& os, std::vector columnInfos ) : m_os( os ), - m_columnInfos( std::move( columnInfos ) ) {} + m_columnInfos( CATCH_MOVE( columnInfos ) ) {} auto columnInfos() const -> std::vector const& { return m_columnInfos; @@ -592,7 +592,7 @@ void ConsoleReporter::printHeaderString(std::string const& _string, std::size_t struct SummaryColumn { SummaryColumn( std::string _label, Colour::Code _colour ) - : label( std::move( _label ) ), + : label( CATCH_MOVE( _label ) ), colour( _colour ) {} SummaryColumn addRow( std::size_t count ) { ReusableStringStream rss; diff --git a/src/catch2/reporters/catch_reporter_cumulative_base.cpp b/src/catch2/reporters/catch_reporter_cumulative_base.cpp index a83a9ad0ab..a76a85eac2 100644 --- a/src/catch2/reporters/catch_reporter_cumulative_base.cpp +++ b/src/catch2/reporters/catch_reporter_cumulative_base.cpp @@ -54,7 +54,7 @@ namespace Catch { auto newNode = Detail::make_unique( incompleteStats ); node = newNode.get(); - parentNode.childSections.push_back( std::move( newNode ) ); + parentNode.childSections.push_back( CATCH_MOVE( newNode ) ); } else { node = it->get(); } @@ -90,8 +90,8 @@ namespace Catch { TestCaseStats const& testCaseStats ) { auto node = Detail::make_unique( testCaseStats ); assert( m_sectionStack.size() == 0 ); - node->children.push_back( std::move(m_rootSection) ); - m_testCases.push_back( std::move(node) ); + node->children.push_back( CATCH_MOVE(m_rootSection) ); + m_testCases.push_back( CATCH_MOVE(node) ); assert( m_deepestSection ); m_deepestSection->stdOut = testCaseStats.stdOut; @@ -102,7 +102,7 @@ namespace Catch { TestGroupStats const& testGroupStats ) { auto node = Detail::make_unique( testGroupStats ); node->children.swap( m_testCases ); - m_testGroups.push_back( std::move(node) ); + m_testGroups.push_back( CATCH_MOVE(node) ); } void CumulativeReporterBase::testRunEnded( TestRunStats const& testRunStats ) { diff --git a/src/catch2/reporters/catch_reporter_listening.cpp b/src/catch2/reporters/catch_reporter_listening.cpp index 49ab93f776..714a349c54 100644 --- a/src/catch2/reporters/catch_reporter_listening.cpp +++ b/src/catch2/reporters/catch_reporter_listening.cpp @@ -6,18 +6,19 @@ // SPDX-License-Identifier: BSL-1.0 #include +#include #include namespace Catch { void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) { - m_listeners.push_back( std::move( listener ) ); + m_listeners.push_back( CATCH_MOVE( listener ) ); } void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) { assert(!m_reporter && "Listening reporter can wrap only 1 real reporter"); - m_reporter = std::move( reporter ); + m_reporter = CATCH_MOVE( reporter ); m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut; }