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);
}
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 */
static std::list<Check *> &instances();
@ -159,9 +162,6 @@ protected:
*/
bool wrongData(const Token *tok, const char *str);
/** disabled assignment operator and copy constructor */
void operator=(const Check &) = delete;
Check(const Check &) = delete;
private:
const std::string mName;
};

View File

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

View File

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

View File

@ -179,11 +179,10 @@ class CPPCHECKLIB Token {
private:
TokensFrontBack* mTokensFrontBack;
// Not implemented..
Token(const Token &);
Token operator=(const Token &);
public:
Token(const Token &) = delete;
Token& operator=(const Token &) = delete;
enum Type {
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

View File

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

View File

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