Enable bugprone-unhandled-self-assignment
This check looks for suspicious assignment operators that might not correctly handle self-assignment. In practice it is a bit prone to false-positives, but we have so few assignment operators in general that's not a big deal. Also enable cert-oop54-cpp which is essentially the same check. Tweak its configuration so that it doesn't have more false positives. Suppress these warnings in one place and fix them in another.
This commit is contained in:
parent
68afa17191
commit
dbe7c4ef52
|
@ -51,8 +51,6 @@ readability-*,\
|
|||
-bugprone-narrowing-conversions,\
|
||||
-bugprone-redundant-branch-condition,\
|
||||
-bugprone-signed-char-misuse,\
|
||||
-bugprone-unhandled-self-assignment,\
|
||||
-cert-oop54-cpp,\
|
||||
-cert-str34-c,\
|
||||
-clang-analyzer-core.CallAndMessage,\
|
||||
-clang-analyzer-deadcode.DeadStores,\
|
||||
|
@ -86,9 +84,11 @@ WarningsAsErrors: '*'
|
|||
HeaderFilterRegex: '(src|test|tools).*'
|
||||
FormatStyle: none
|
||||
CheckOptions:
|
||||
- key: readability-uppercase-literal-suffix.NewSuffixes
|
||||
value: 'L;UL;LL;ULL'
|
||||
- key: cata-text-style.EscapeUnicode
|
||||
value: 0
|
||||
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
|
||||
value: true
|
||||
- key: readability-uppercase-literal-suffix.NewSuffixes
|
||||
value: 'L;UL;LL;ULL'
|
||||
|
||||
# vim:tw=0
|
||||
|
|
|
@ -486,6 +486,7 @@ JsonArray::JsonArray( const JsonArray &ja )
|
|||
final_separator = ja.final_separator;
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(bugprone-unhandled-self-assignment,cert-oop54-cpp)
|
||||
JsonArray &JsonArray::operator=( const JsonArray &ja )
|
||||
{
|
||||
jsin = ja.jsin;
|
||||
|
|
|
@ -19,9 +19,11 @@ safe_reference_anchor::safe_reference_anchor( safe_reference_anchor && ) noexcep
|
|||
safe_reference_anchor()
|
||||
{}
|
||||
|
||||
safe_reference_anchor &safe_reference_anchor::operator=( const safe_reference_anchor & )
|
||||
safe_reference_anchor &safe_reference_anchor::operator=( const safe_reference_anchor &other )
|
||||
{
|
||||
impl = std::make_shared<empty>();
|
||||
if( this != &other ) {
|
||||
impl = std::make_shared<empty>();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue