diff options
| author | Martin Jeřábek | 2024-03-01 11:15:27 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2024-03-01 21:24:45 +0100 |
| commit | cde35096641d55b4aa0f743bb03e04703fbb5e9c (patch) | |
| tree | 7072371d7a380dcac9142a4ef8e701756e3fbcd2 /src/catch2/internal | |
| parent | 7677c1658eb4417ec60649589610bf4e3d731bc9 (diff) | |
| download | catch3-cde35096641d55b4aa0f743bb03e04703fbb5e9c.tar.gz | |
Fix various useful clang-tidy warnings
* bugprone-branch-clone
* bugprone-copy-constructor-init
* bugprone-empty-catch
* bugprone-sizeof-expression
* bugprone-switch-missing-default-case
* bugprone-unused-local-non-trivial-variable
* clang-analyzer-core.uninitialized.Assign
* clang-analyzer-cplusplus.Move
* clang-analyzer-optin.cplusplus.VirtualCall
* modernize-loop-convert
* modernize-raw-string-literal
* modernize-use-equals-default
* modernize-use-override
* modernize-use-using
* performance-avoid-endl
* performance-inefficient-string-concatenation
* performance-inefficient-vector-operation
* performance-noexcept-move-constructor
* performance-unnecessary-value-param (and improve generator example)
* readability-duplicate-include
* readability-inconsistent-declaration-parameter-name
* readability-non-const-parameter
* readability-redundant-casting
* readability-redundant-member-init
* readability-redundant-smartptr-get
* readability-static-accessed-through-instance
* unused variable in amalgamted tests
Diffstat (limited to 'src/catch2/internal')
| -rw-r--r-- | src/catch2/internal/catch_commandline.cpp | 2 | ||||
| -rw-r--r-- | src/catch2/internal/catch_console_colour.cpp | 12 | ||||
| -rw-r--r-- | src/catch2/internal/catch_enum_values_registry.hpp | 2 | ||||
| -rw-r--r-- | src/catch2/internal/catch_jsonwriter.cpp | 4 | ||||
| -rw-r--r-- | src/catch2/internal/catch_jsonwriter.hpp | 4 | ||||
| -rw-r--r-- | src/catch2/internal/catch_reporter_spec_parser.cpp | 2 | ||||
| -rw-r--r-- | src/catch2/internal/catch_stringref.hpp | 4 |
7 files changed, 15 insertions, 15 deletions
diff --git a/src/catch2/internal/catch_commandline.cpp b/src/catch2/internal/catch_commandline.cpp index c29a801d..212f1774 100644 --- a/src/catch2/internal/catch_commandline.cpp +++ b/src/catch2/internal/catch_commandline.cpp @@ -47,7 +47,7 @@ namespace Catch { line = trim(line); if( !line.empty() && !startsWith( line, '#' ) ) { if( !startsWith( line, '"' ) ) - line = '"' + line + '"'; + line = '"' + CATCH_MOVE(line) + '"'; config.testsOrTags.push_back( line ); config.testsOrTags.emplace_back( "," ); } diff --git a/src/catch2/internal/catch_console_colour.cpp b/src/catch2/internal/catch_console_colour.cpp index e1238816..b19e01ec 100644 --- a/src/catch2/internal/catch_console_colour.cpp +++ b/src/catch2/internal/catch_console_colour.cpp @@ -230,21 +230,21 @@ namespace { namespace Catch { - Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode implSelection, + Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode colourSelection, IStream* stream ) { #if defined( CATCH_CONFIG_COLOUR_WIN32 ) - if ( implSelection == ColourMode::Win32 ) { + if ( colourSelection == ColourMode::Win32 ) { return Detail::make_unique<Win32ColourImpl>( stream ); } #endif - if ( implSelection == ColourMode::ANSI ) { + if ( colourSelection == ColourMode::ANSI ) { return Detail::make_unique<ANSIColourImpl>( stream ); } - if ( implSelection == ColourMode::None ) { + if ( colourSelection == ColourMode::None ) { return Detail::make_unique<NoColourImpl>( stream ); } - if ( implSelection == ColourMode::PlatformDefault) { + if ( colourSelection == ColourMode::PlatformDefault) { #if defined( CATCH_CONFIG_COLOUR_WIN32 ) if ( Win32ColourImpl::useImplementationForStream( *stream ) ) { return Detail::make_unique<Win32ColourImpl>( stream ); @@ -256,7 +256,7 @@ namespace Catch { return Detail::make_unique<NoColourImpl>( stream ); } - CATCH_ERROR( "Could not create colour impl for selection " << static_cast<int>(implSelection) ); + CATCH_ERROR( "Could not create colour impl for selection " << static_cast<int>(colourSelection) ); } bool isColourImplAvailable( ColourMode colourSelection ) { diff --git a/src/catch2/internal/catch_enum_values_registry.hpp b/src/catch2/internal/catch_enum_values_registry.hpp index 999059ae..de994c35 100644 --- a/src/catch2/internal/catch_enum_values_registry.hpp +++ b/src/catch2/internal/catch_enum_values_registry.hpp @@ -24,7 +24,7 @@ namespace Catch { std::vector<Catch::Detail::unique_ptr<EnumInfo>> m_enumInfos; - EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values) override; + EnumInfo const& registerEnum( StringRef enumName, StringRef allValueNames, std::vector<int> const& values) override; }; std::vector<StringRef> parseEnums( StringRef enums ); diff --git a/src/catch2/internal/catch_jsonwriter.cpp b/src/catch2/internal/catch_jsonwriter.cpp index ff65a9d3..1a96e348 100644 --- a/src/catch2/internal/catch_jsonwriter.cpp +++ b/src/catch2/internal/catch_jsonwriter.cpp @@ -31,7 +31,7 @@ namespace Catch { m_os{ os }, m_indent_level{ indent_level } { m_os << '{'; } - JsonObjectWriter::JsonObjectWriter( JsonObjectWriter&& source ): + JsonObjectWriter::JsonObjectWriter( JsonObjectWriter&& source ) noexcept: m_os{ source.m_os }, m_indent_level{ source.m_indent_level }, m_should_comma{ source.m_should_comma }, @@ -62,7 +62,7 @@ namespace Catch { m_os{ os }, m_indent_level{ indent_level } { m_os << '['; } - JsonArrayWriter::JsonArrayWriter( JsonArrayWriter&& source ): + JsonArrayWriter::JsonArrayWriter( JsonArrayWriter&& source ) noexcept: m_os{ source.m_os }, m_indent_level{ source.m_indent_level }, m_should_comma{ source.m_should_comma }, diff --git a/src/catch2/internal/catch_jsonwriter.hpp b/src/catch2/internal/catch_jsonwriter.hpp index 59c044e4..23b56d13 100644 --- a/src/catch2/internal/catch_jsonwriter.hpp +++ b/src/catch2/internal/catch_jsonwriter.hpp @@ -65,7 +65,7 @@ namespace Catch { JsonObjectWriter( std::ostream& os ); JsonObjectWriter( std::ostream& os, std::uint64_t indent_level ); - JsonObjectWriter( JsonObjectWriter&& source ); + JsonObjectWriter( JsonObjectWriter&& source ) noexcept; JsonObjectWriter& operator=( JsonObjectWriter&& source ) = delete; ~JsonObjectWriter(); @@ -84,7 +84,7 @@ namespace Catch { JsonArrayWriter( std::ostream& os ); JsonArrayWriter( std::ostream& os, std::uint64_t indent_level ); - JsonArrayWriter( JsonArrayWriter&& source ); + JsonArrayWriter( JsonArrayWriter&& source ) noexcept; JsonArrayWriter& operator=( JsonArrayWriter&& source ) = delete; ~JsonArrayWriter(); diff --git a/src/catch2/internal/catch_reporter_spec_parser.cpp b/src/catch2/internal/catch_reporter_spec_parser.cpp index 8b88b170..2b08758a 100644 --- a/src/catch2/internal/catch_reporter_spec_parser.cpp +++ b/src/catch2/internal/catch_reporter_spec_parser.cpp @@ -117,7 +117,7 @@ namespace Catch { auto kv = splitKVPair( parts[i] ); auto key = kv.key, value = kv.value; - if ( key.empty() || value.empty() ) { + if ( key.empty() || value.empty() ) { // NOLINT(bugprone-branch-clone) return {}; } else if ( key[0] == 'X' ) { // This is a reporter-specific option, we don't check these diff --git a/src/catch2/internal/catch_stringref.hpp b/src/catch2/internal/catch_stringref.hpp index 4b9212bf..421ce712 100644 --- a/src/catch2/internal/catch_stringref.hpp +++ b/src/catch2/internal/catch_stringref.hpp @@ -97,8 +97,8 @@ namespace Catch { constexpr const_iterator end() const { return m_start + m_size; } - friend std::string& operator += (std::string& lhs, StringRef sr); - friend std::ostream& operator << (std::ostream& os, StringRef sr); + friend std::string& operator += (std::string& lhs, StringRef rhs); + friend std::ostream& operator << (std::ostream& os, StringRef str); friend std::string operator+(StringRef lhs, StringRef rhs); /** |