diff --git a/cppcheckpremium-suppressions b/cppcheckpremium-suppressions index 8bc58f52cfe..2be161e5ec0 100644 --- a/cppcheckpremium-suppressions +++ b/cppcheckpremium-suppressions @@ -10,6 +10,8 @@ normalCheckLevelMaxBranches # Cert C++ ########################################################################################################################### +# False positives for (a?b:c)&=true; +premium-cert-exp35-c # False positives for initializations premium-cert-exp45-c # False positives when casting to uintptr @@ -68,7 +70,6 @@ premium-misra-cpp-2023-13.1.2 premium-misra-cpp-2023-13.3.1 premium-misra-cpp-2023-13.3.2 premium-misra-cpp-2023-13.3.3 -premium-misra-cpp-2023-15.0.2 premium-misra-cpp-2023-15.1.2 premium-misra-cpp-2023-15.1.3 premium-misra-cpp-2023-18.1.1 diff --git a/lib/analyzer.h b/lib/analyzer.h index 1b1a3074efd..b0f406bb905 100644 --- a/lib/analyzer.h +++ b/lib/analyzer.h @@ -36,7 +36,7 @@ struct Analyzer { Action() = default; Action(const Action&) = default; - Action& operator=(const Action& rhs) = default; + Action& operator=(const Action& rhs) & = default; template ), diff --git a/lib/importproject.h b/lib/importproject.h index ab029d50d8c..795480613a4 100644 --- a/lib/importproject.h +++ b/lib/importproject.h @@ -74,7 +74,7 @@ class CPPCHECKLIB WARN_UNUSED ImportProject { ImportProject() = default; virtual ~ImportProject() = default; ImportProject(const ImportProject&) = default; - ImportProject& operator=(const ImportProject&) = default; + ImportProject& operator=(const ImportProject&) & = default; void selectOneVsConfig(Platform::Type platform); void selectVsConfigurations(Platform::Type platform, const std::vector &configurations); diff --git a/lib/library.cpp b/lib/library.cpp index 38843731c53..38cead56997 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -153,7 +153,7 @@ Library::Library(const Library& other) : mData(new LibraryData(*other.mData)) {} -Library& Library::operator=(const Library& other) +Library& Library::operator=(const Library& other) & { mData.reset(new LibraryData(*other.mData)); return *this; diff --git a/lib/library.h b/lib/library.h index 7eb5bd33f2b..baf778c476f 100644 --- a/lib/library.h +++ b/lib/library.h @@ -57,7 +57,7 @@ class CPPCHECKLIB Library { ~Library(); Library(const Library& other); - Library& operator=(const Library& other); + Library& operator=(const Library& other) &; enum class ErrorCode : std::uint8_t { OK, diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index daee31baea4..2a8a4dce291 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2252,7 +2252,7 @@ Variable::~Variable() delete mValueType; } -Variable& Variable::operator=(const Variable &var) +Variable& Variable::operator=(const Variable &var) & { if (this == &var) return *this; diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 00868694933..b7cd4c8f7eb 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -236,7 +236,7 @@ class CPPCHECKLIB Variable { ~Variable(); - Variable &operator=(const Variable &var); + Variable &operator=(const Variable &var) &; /** * Get name token. diff --git a/lib/valueptr.h b/lib/valueptr.h index 8058dfe066d..480c4fd319f 100644 --- a/lib/valueptr.h +++ b/lib/valueptr.h @@ -81,7 +81,7 @@ class CPPCHECKLIB ValuePtr { swap(mClone, rhs.mClone); } - ValuePtr& operator=(ValuePtr rhs) { + ValuePtr& operator=(ValuePtr rhs) & { swap(rhs); return *this; }