Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorMartin Hořeňovský2017-07-25 15:45:50 +0200
committerMartin Hořeňovský2017-07-25 15:45:50 +0200
commitb6f62af7d1a96482ca5df3c476e30f8fcf35df5a (patch)
tree826054551693f223eb76656f5299b629b8be8346 /include
parent46bf7605f41a97535f63abfb2406ec408573b441 (diff)
downloadcatch3-b6f62af7d1a96482ca5df3c476e30f8fcf35df5a.tar.gz
Address more of PVS studio warnings
Diffstat (limited to 'include')
-rw-r--r--include/internal/catch_list.cpp6
-rw-r--r--include/internal/catch_result_builder.cpp2
-rw-r--r--include/internal/catch_stringdata.h4
-rw-r--r--include/reporters/catch_reporter_bases.hpp2
4 files changed, 7 insertions, 7 deletions
diff --git a/include/internal/catch_list.cpp b/include/internal/catch_list.cpp
index c411115b..de58badb 100644
--- a/include/internal/catch_list.cpp
+++ b/include/internal/catch_list.cpp
@@ -44,7 +44,7 @@ namespace Catch {
if( config.verbosity() >= Verbosity::High ) {
Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl;
std::string description = testCaseInfo.description;
- if( description == "" )
+ if( description.empty() )
description = "(NO DESCRIPTION)";
Catch::cout() << Column( description ).indent(4) << std::endl;
}
@@ -129,10 +129,10 @@ namespace Catch {
Catch::cout() << "Available reporters:\n";
IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
std::size_t maxNameLen = 0;
- for( auto const& factoryKvp : getRegistryHub().getReporterRegistry().getFactories() )
+ for( auto const& factoryKvp : factories )
maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );
- for( auto const& factoryKvp : getRegistryHub().getReporterRegistry().getFactories() ) {
+ for( auto const& factoryKvp : factories ) {
Catch::cout()
<< Column( factoryKvp.first + ":" )
.indent(2)
diff --git a/include/internal/catch_result_builder.cpp b/include/internal/catch_result_builder.cpp
index 09a2f53e..838c43da 100644
--- a/include/internal/catch_result_builder.cpp
+++ b/include/internal/catch_result_builder.cpp
@@ -91,7 +91,7 @@ namespace Catch {
std::string actualMessage = Catch::translateActiveException();
if( !matcher.match( actualMessage ) ) {
data.resultType = ResultWas::ExpressionFailed;
- data.reconstructedExpression = actualMessage;
+ data.reconstructedExpression = std::move(actualMessage);
}
AssertionResult result( m_assertionInfo, data );
handleResult( result );
diff --git a/include/internal/catch_stringdata.h b/include/internal/catch_stringdata.h
index 5ffafad7..aaa9ec8e 100644
--- a/include/internal/catch_stringdata.h
+++ b/include/internal/catch_stringdata.h
@@ -30,12 +30,12 @@ namespace Catch {
void addRef() const noexcept {
if( m_refs > 0 )
- m_refs++;
+ ++m_refs;
}
void release() const noexcept {
unsigned int refs = m_refs;
if( refs > 1 )
- m_refs--;
+ --m_refs;
else if( refs == 1 )
delete[] reinterpret_cast<char const*>( this );
}
diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp
index 85adc18f..45f8bb57 100644
--- a/include/reporters/catch_reporter_bases.hpp
+++ b/include/reporters/catch_reporter_bases.hpp
@@ -181,7 +181,7 @@ namespace Catch {
node = *it;
}
m_sectionStack.push_back( node );
- m_deepestSection = node;
+ m_deepestSection = std::move(node);
}
void assertionStarting(AssertionInfo const&) override {}