fixed `modernize-use-equals-delete` warnings in headers (#4177)

This commit is contained in:
Oliver Stöneberg 2022-06-07 21:25:23 +02:00 committed by GitHub
parent 69834d537b
commit 9367be804e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 25 deletions

View File

@ -69,6 +69,9 @@ public:
instances().remove(this); instances().remove(this);
} }
Check(const Check &) = delete;
Check& operator=(const Check &) = delete;
/** List of registered check classes. This is used by Cppcheck to run checks and generate documentation */ /** List of registered check classes. This is used by Cppcheck to run checks and generate documentation */
static std::list<Check *> &instances(); static std::list<Check *> &instances();
@ -159,9 +162,6 @@ protected:
*/ */
bool wrongData(const Token *tok, const char *str); bool wrongData(const Token *tok, const char *str);
/** disabled assignment operator and copy constructor */
void operator=(const Check &) = delete;
Check(const Check &) = delete;
private: private:
const std::string mName; const std::string mName;
}; };

View File

@ -76,6 +76,9 @@ private:
ArgumentInfo(const Token *arg, const Settings *settings, bool _isCPP); ArgumentInfo(const Token *arg, const Settings *settings, bool _isCPP);
~ArgumentInfo(); ~ArgumentInfo();
ArgumentInfo(const ArgumentInfo &) = delete;
ArgumentInfo& operator= (const ArgumentInfo &) = delete;
bool isArrayOrPointer() const; bool isArrayOrPointer() const;
bool isComplexType() const; bool isComplexType() const;
bool isKnownType() const; bool isKnownType() const;
@ -91,10 +94,6 @@ private:
bool _template; bool _template;
bool address; bool address;
bool isCPP; bool isCPP;
private:
ArgumentInfo(const ArgumentInfo &); // not implemented
ArgumentInfo operator = (const ArgumentInfo &); // not implemented
}; };
void checkFormatString(const Token * const tok, void checkFormatString(const Token * const tok,

View File

@ -69,12 +69,13 @@ class CPPCHECKLIB Timer {
public: public:
Timer(const std::string& str, SHOWTIME_MODES showtimeMode, TimerResultsIntf* timerResults = nullptr); Timer(const std::string& str, SHOWTIME_MODES showtimeMode, TimerResultsIntf* timerResults = nullptr);
~Timer(); ~Timer();
Timer(const Timer&) = delete;
Timer& operator=(const Timer&) = delete;
void stop(); void stop();
private: private:
Timer(const Timer& other); // disallow copying
Timer& operator=(const Timer&); // disallow assignments
const std::string mStr; const std::string mStr;
TimerResultsIntf* mTimerResults; TimerResultsIntf* mTimerResults;
std::clock_t mStart; std::clock_t mStart;

View File

@ -179,11 +179,10 @@ class CPPCHECKLIB Token {
private: private:
TokensFrontBack* mTokensFrontBack; TokensFrontBack* mTokensFrontBack;
// Not implemented..
Token(const Token &);
Token operator=(const Token &);
public: public:
Token(const Token &) = delete;
Token& operator=(const Token &) = delete;
enum Type { enum Type {
eVariable, eType, eFunction, eKeyword, eName, // Names: Variable (varId), Type (typeId, later), Function (FuncId, later), Language keyword, Name (unknown identifier) eVariable, eType, eFunction, eKeyword, eName, // Names: Variable (varId), Type (typeId, later), Function (FuncId, later), Language keyword, Name (unknown identifier)
eNumber, eString, eChar, eBoolean, eLiteral, eEnumerator, // Literals: Number, String, Character, Boolean, User defined literal (C++11), Enumerator eNumber, eString, eChar, eBoolean, eLiteral, eEnumerator, // Literals: Number, String, Character, Boolean, User defined literal (C++11), Enumerator

View File

@ -43,6 +43,9 @@ public:
explicit TokenList(const Settings* settings); explicit TokenList(const Settings* settings);
~TokenList(); ~TokenList();
TokenList(const TokenList &) = delete;
TokenList &operator=(const TokenList &) = delete;
void setSettings(const Settings *settings) { void setSettings(const Settings *settings) {
mSettings = settings; mSettings = settings;
} }
@ -192,13 +195,6 @@ public:
bool isKeyword(const std::string &str) const; bool isKeyword(const std::string &str) const;
private: private:
/** Disable copy constructor, no implementation */
TokenList(const TokenList &);
/** Disable assignment operator, no implementation */
TokenList &operator=(const TokenList &);
void determineCppC(); void determineCppC();
/** Token list */ /** Token list */

View File

@ -38,10 +38,9 @@ public:
const std::string& exe() const; const std::string& exe() const;
private: options() = delete;
options(); options(const options&) = delete;
options(const options& non_copy); options& operator =(const options&) = delete;
const options& operator =(const options& non_assign);
private: private:
std::set<std::string> mWhichTests; std::set<std::string> mWhichTests;