enabled and mitigated `modernize-use-equals-default` clang-tidy warnings / removed unnecessary default destructors (#5335)

This commit is contained in:
Oliver Stöneberg 2023-08-16 17:13:36 +02:00 committed by GitHub
parent 6a263ba026
commit 84a9b3a5f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 18 additions and 80 deletions

View File

@ -45,7 +45,6 @@ Checks: >
-modernize-replace-auto-ptr,
-modernize-return-braced-init-list,
-modernize-use-auto,
-modernize-use-equals-default,
-modernize-use-trailing-return-type,
-performance-avoid-endl,
-performance-inefficient-string-concatenation,

View File

@ -63,7 +63,6 @@ This does not appear to be useful as it is reported on very common code.
It was decided not to apply these.
`modernize-use-equals-default`<br/>
`modernize-loop-convert`<br/>
These might change the behavior of code which might not be intended (need to file an upstream issue)

View File

@ -31,9 +31,6 @@ Executor::Executor(const std::map<std::string, std::size_t> &files, const Settin
: mFiles(files), mSettings(settings), mSuppressions(suppressions), mErrorLogger(errorLogger)
{}
Executor::~Executor()
{}
bool Executor::hasToLog(const ErrorMessage &msg)
{
if (!mSuppressions.isSuppressed(msg))

View File

@ -40,7 +40,7 @@ class Suppressions;
class Executor {
public:
Executor(const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger);
virtual ~Executor();
virtual ~Executor() = default;
Executor(const Executor &) = delete;
void operator=(const Executor &) = delete;

View File

@ -67,9 +67,6 @@ ProcessExecutor::ProcessExecutor(const std::map<std::string, std::size_t> &files
assert(mSettings.jobs > 1);
}
ProcessExecutor::~ProcessExecutor()
{}
class PipeWriter : public ErrorLogger {
public:
enum PipeSignal {REPORT_OUT='1',REPORT_ERROR='2', CHILD_END='5'};

View File

@ -40,7 +40,6 @@ class ProcessExecutor : public Executor {
public:
ProcessExecutor(const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger);
ProcessExecutor(const ProcessExecutor &) = delete;
~ProcessExecutor() override;
void operator=(const ProcessExecutor &) = delete;
unsigned int check() override;

View File

@ -37,9 +37,6 @@ SingleExecutor::SingleExecutor(CppCheck &cppcheck, const std::map<std::string, s
assert(mSettings.jobs == 1);
}
SingleExecutor::~SingleExecutor()
{}
// TODO: markup handling is not performed with multiple jobs
unsigned int SingleExecutor::check()
{

View File

@ -35,7 +35,6 @@ class SingleExecutor : public Executor
public:
SingleExecutor(CppCheck &cppcheck, const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger);
SingleExecutor(const SingleExecutor &) = delete;
~SingleExecutor() override;
void operator=(const SingleExecutor &) = delete;
unsigned int check() override;

View File

@ -46,9 +46,6 @@ ThreadExecutor::ThreadExecutor(const std::map<std::string, std::size_t> &files,
assert(mSettings.jobs > 1);
}
ThreadExecutor::~ThreadExecutor()
{}
class SyncLogForwarder : public ErrorLogger
{
public:

View File

@ -40,7 +40,6 @@ class ThreadExecutor : public Executor {
public:
ThreadExecutor(const std::map<std::string, std::size_t> &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger);
ThreadExecutor(const ThreadExecutor &) = delete;
~ThreadExecutor() override;
void operator=(const ThreadExecutor &) = delete;
unsigned int check() override;

View File

@ -42,7 +42,7 @@
*/
class Application {
public:
Application() {}
Application() = default;
Application(QString name, QString path, QString params);
/**

View File

@ -86,14 +86,7 @@ static bool executeCommand(std::string exe, std::vector<std::string> args, std::
CheckThread::CheckThread(ThreadResult &result) :
mResult(result),
mCppcheck(result, true, executeCommand)
{
//ctor
}
CheckThread::~CheckThread()
{
//dtor
}
{}
void CheckThread::check(const Settings &settings)
{

View File

@ -46,7 +46,6 @@ class CheckThread : public QThread {
Q_OBJECT
public:
explicit CheckThread(ThreadResult &result);
~CheckThread() override;
/**
* @brief Set settings for cppcheck

View File

@ -35,7 +35,6 @@ class SelectColorButton : public QPushButton {
Q_OBJECT
public:
explicit SelectColorButton(QWidget* parent);
~SelectColorButton() override {}
void setColor(const QColor& color);
const QColor& getColor();
@ -57,7 +56,6 @@ class SelectFontWeightCombo : public QComboBox {
Q_OBJECT
public:
explicit SelectFontWeightCombo(QWidget* parent);
~SelectFontWeightCombo() override {}
void setWeight(const QFont::Weight& weight);
const QFont::Weight& getWeight();

View File

@ -42,7 +42,6 @@ class StyleEditDialog : public QDialog {
public:
explicit StyleEditDialog(const CodeEditorStyle& newStyle,
QWidget *parent = nullptr);
~StyleEditDialog() override {}
CodeEditorStyle getStyle();

View File

@ -35,9 +35,6 @@
const unsigned int CppcheckLibraryData::Function::Arg::ANY = ~0U;
const unsigned int CppcheckLibraryData::Function::Arg::VARIADIC = ~1U;
CppcheckLibraryData::CppcheckLibraryData()
{}
static std::string unhandledElement(const QXmlStreamReader &xmlReader)
{
throw std::runtime_error(QObject::tr("line %1: Unhandled element %2").arg(xmlReader.lineNumber()).arg(xmlReader.name().toString()).toStdString());

View File

@ -30,7 +30,7 @@ class QIODevice;
class CppcheckLibraryData {
public:
CppcheckLibraryData();
CppcheckLibraryData() = default;
struct Container {
QString id;

View File

@ -30,9 +30,6 @@ CsvReport::CsvReport(const QString &filename) :
Report(filename)
{}
CsvReport::~CsvReport()
{}
bool CsvReport::create()
{
if (Report::create()) {

View File

@ -39,7 +39,6 @@ class ErrorItem;
class CsvReport : public Report {
public:
explicit CsvReport(const QString &filename);
~CsvReport() override;
/**
* @brief Create the report (file).

View File

@ -27,9 +27,6 @@ PrintableReport::PrintableReport() :
Report(QString())
{}
PrintableReport::~PrintableReport()
{}
bool PrintableReport::create()
{
return true;

View File

@ -36,7 +36,6 @@ class ErrorItem;
class PrintableReport : public Report {
public:
PrintableReport();
~PrintableReport() override;
/**
* @brief Create the report (file).

View File

@ -91,9 +91,6 @@ ResultsTree::ResultsTree(QWidget * parent) :
connect(this, &ResultsTree::doubleClicked, this, &ResultsTree::quickStartApplication);
}
ResultsTree::~ResultsTree()
{}
void ResultsTree::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {

View File

@ -53,7 +53,7 @@ class ResultsTree : public QTreeView {
Q_OBJECT
public:
explicit ResultsTree(QWidget * parent = nullptr);
~ResultsTree() override;
void initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler);
/**

View File

@ -40,8 +40,8 @@ const char Settings::SafeChecks::XmlExternalFunctions[] = "external-functions";
const char Settings::SafeChecks::XmlInternalFunctions[] = "internal-functions";
const char Settings::SafeChecks::XmlExternalVariables[] = "external-variables";
Settings::Settings() : maxCtuDepth(10) {}
cppcheck::Platform::Platform() {}
ImportProject::ImportProject() {}
cppcheck::Platform::Platform() = default;
ImportProject::ImportProject() = default;
bool ImportProject::sourceFileExists(const std::string & /*file*/) {
return true;
}

View File

@ -28,11 +28,6 @@
#include <QFile>
#include <QMutexLocker>
ThreadResult::~ThreadResult()
{
//dtor
}
void ThreadResult::reportOut(const std::string &outmsg, Color /*c*/)
{
emit log(QString::fromStdString(outmsg));

View File

@ -46,7 +46,6 @@ class ThreadResult : public QObject, public ErrorLogger {
Q_OBJECT
public:
ThreadResult() = default;
~ThreadResult() override;
/**
* @brief Get next unprocessed file

View File

@ -62,9 +62,6 @@ TranslationHandler::TranslationHandler(QObject *parent) :
addTranslation("Swedish", "cppcheck_sv");
}
TranslationHandler::~TranslationHandler()
{}
bool TranslationHandler::setLanguage(const QString &code)
{
bool failure = false;

View File

@ -63,7 +63,6 @@ class TranslationHandler : QObject {
Q_OBJECT
public:
explicit TranslationHandler(QObject *parent = nullptr);
~TranslationHandler() override;
/**
* @brief Get a list of available translations.

View File

@ -29,9 +29,6 @@ TxtReport::TxtReport(const QString &filename) :
Report(filename)
{}
TxtReport::~TxtReport()
{}
bool TxtReport::create()
{
if (Report::create()) {

View File

@ -40,7 +40,6 @@ class TxtReport : public Report {
public:
explicit TxtReport(const QString &filename);
~TxtReport() override;
/**
* @brief Create the report (file).

View File

@ -184,7 +184,7 @@ struct Analyzer {
virtual bool invalid() const {
return false;
}
virtual ~Analyzer() {}
virtual ~Analyzer() = default;
Analyzer(const Analyzer&) = default;
protected:
Analyzer() = default;

View File

@ -100,8 +100,8 @@ public:
/** Base class used for whole-program analysis */
class CPPCHECKLIB FileInfo {
public:
FileInfo() {}
virtual ~FileInfo() {}
FileInfo() = default;
virtual ~FileInfo() = default;
virtual std::string toString() const {
return std::string();
}

View File

@ -82,7 +82,7 @@ namespace CTU {
: callId(std::move(callId)), callArgNr(callArgNr), callFunctionName(std::move(callFunctionName)), location(std::move(loc))
{}
CallBase(const Tokenizer *tokenizer, const Token *callToken);
virtual ~CallBase() {}
virtual ~CallBase() = default;
CallBase(const CallBase&) = default;
std::string callId;
int callArgNr{};

View File

@ -219,8 +219,8 @@ private:
*/
class CPPCHECKLIB ErrorLogger {
public:
ErrorLogger() {}
virtual ~ErrorLogger() {}
ErrorLogger() = default;
virtual ~ErrorLogger() = default;
/**
* Information about progress is directed here.

View File

@ -33,7 +33,7 @@ template<class T> class ValuePtr;
struct InferModel {
virtual bool match(const ValueFlow::Value& value) const = 0;
virtual ValueFlow::Value yield(MathLib::bigint value) const = 0;
virtual ~InferModel() {}
virtual ~InferModel() = default;
InferModel(const InferModel&) = default;
protected:
InferModel() = default;

View File

@ -284,9 +284,6 @@ TemplateSimplifier::TemplateSimplifier(Tokenizer &tokenizer)
mErrorLogger(mTokenizer.mErrorLogger)
{}
TemplateSimplifier::~TemplateSimplifier()
{}
void TemplateSimplifier::checkComplicatedSyntaxErrorsInTemplates()
{
// check for more complicated syntax errors when using templates..

View File

@ -48,7 +48,6 @@ class CPPCHECKLIB TemplateSimplifier {
public:
explicit TemplateSimplifier(Tokenizer &tokenizer);
~TemplateSimplifier();
std::string dump() const {
return mDump;

View File

@ -37,7 +37,7 @@ enum class SHOWTIME_MODES {
class CPPCHECKLIB TimerResultsIntf {
public:
virtual ~TimerResultsIntf() {}
virtual ~TimerResultsIntf() = default;
virtual void addResults(const std::string& str, std::clock_t clocks) = 0;
};
@ -54,7 +54,7 @@ struct TimerResultsData {
class CPPCHECKLIB TimerResults : public TimerResultsIntf {
public:
TimerResults() {}
TimerResults() = default;
void showResults(SHOWTIME_MODES mode) const;
void addResults(const std::string& str, std::clock_t clocks) override;

View File

@ -6676,7 +6676,7 @@ struct ConditionHandler {
}
});
}
virtual ~ConditionHandler() {}
virtual ~ConditionHandler() = default;
ConditionHandler(const ConditionHandler&) = default;
protected:
ConditionHandler() = default;
@ -9291,7 +9291,7 @@ struct ValueFlowPass {
virtual void run(const ValueFlowState& state) const = 0;
// Returns true if pass needs C++
virtual bool cpp() const = 0;
virtual ~ValueFlowPass() noexcept {}
virtual ~ValueFlowPass() noexcept = default;
};
struct ValueFlowPassRunner {

View File

@ -97,7 +97,6 @@ public:
operator bool() const NOEXCEPT {
return !!mPtr;
}
~ValuePtr() {}
private:
std::shared_ptr<T> mPtr;

View File

@ -241,7 +241,6 @@ public:
const std::string classname;
explicit TestFixture(const char * const _name);
~TestFixture() override {}
static std::size_t runTests(const options& args);
};