diff --git a/.clang-tidy b/.clang-tidy index e1bae2cd2..540d5a7e8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -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, diff --git a/clang-tidy.md b/clang-tidy.md index 2311d2d3a..a2e2dd5db 100644 --- a/clang-tidy.md +++ b/clang-tidy.md @@ -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`
`modernize-loop-convert`
These might change the behavior of code which might not be intended (need to file an upstream issue) diff --git a/cli/executor.cpp b/cli/executor.cpp index 489d9f895..c7955d717 100644 --- a/cli/executor.cpp +++ b/cli/executor.cpp @@ -31,9 +31,6 @@ Executor::Executor(const std::map &files, const Settin : mFiles(files), mSettings(settings), mSuppressions(suppressions), mErrorLogger(errorLogger) {} -Executor::~Executor() -{} - bool Executor::hasToLog(const ErrorMessage &msg) { if (!mSuppressions.isSuppressed(msg)) diff --git a/cli/executor.h b/cli/executor.h index 1b7db25e7..8c67c6cfe 100644 --- a/cli/executor.h +++ b/cli/executor.h @@ -40,7 +40,7 @@ class Suppressions; class Executor { public: Executor(const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger); - virtual ~Executor(); + virtual ~Executor() = default; Executor(const Executor &) = delete; void operator=(const Executor &) = delete; diff --git a/cli/processexecutor.cpp b/cli/processexecutor.cpp index 0bec1734e..566e503eb 100644 --- a/cli/processexecutor.cpp +++ b/cli/processexecutor.cpp @@ -67,9 +67,6 @@ ProcessExecutor::ProcessExecutor(const std::map &files assert(mSettings.jobs > 1); } -ProcessExecutor::~ProcessExecutor() -{} - class PipeWriter : public ErrorLogger { public: enum PipeSignal {REPORT_OUT='1',REPORT_ERROR='2', CHILD_END='5'}; diff --git a/cli/processexecutor.h b/cli/processexecutor.h index 4b51d596a..580c344cf 100644 --- a/cli/processexecutor.h +++ b/cli/processexecutor.h @@ -40,7 +40,6 @@ class ProcessExecutor : public Executor { public: ProcessExecutor(const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger); ProcessExecutor(const ProcessExecutor &) = delete; - ~ProcessExecutor() override; void operator=(const ProcessExecutor &) = delete; unsigned int check() override; diff --git a/cli/singleexecutor.cpp b/cli/singleexecutor.cpp index c3fea886b..c52c984d9 100644 --- a/cli/singleexecutor.cpp +++ b/cli/singleexecutor.cpp @@ -37,9 +37,6 @@ SingleExecutor::SingleExecutor(CppCheck &cppcheck, const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger); SingleExecutor(const SingleExecutor &) = delete; - ~SingleExecutor() override; void operator=(const SingleExecutor &) = delete; unsigned int check() override; diff --git a/cli/threadexecutor.cpp b/cli/threadexecutor.cpp index a6a9e671b..96f35ac40 100644 --- a/cli/threadexecutor.cpp +++ b/cli/threadexecutor.cpp @@ -46,9 +46,6 @@ ThreadExecutor::ThreadExecutor(const std::map &files, assert(mSettings.jobs > 1); } -ThreadExecutor::~ThreadExecutor() -{} - class SyncLogForwarder : public ErrorLogger { public: diff --git a/cli/threadexecutor.h b/cli/threadexecutor.h index 62ad8e0a8..8ebae323b 100644 --- a/cli/threadexecutor.h +++ b/cli/threadexecutor.h @@ -40,7 +40,6 @@ class ThreadExecutor : public Executor { public: ThreadExecutor(const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger); ThreadExecutor(const ThreadExecutor &) = delete; - ~ThreadExecutor() override; void operator=(const ThreadExecutor &) = delete; unsigned int check() override; diff --git a/gui/application.h b/gui/application.h index ee624bf07..a5bbc31a3 100644 --- a/gui/application.h +++ b/gui/application.h @@ -42,7 +42,7 @@ */ class Application { public: - Application() {} + Application() = default; Application(QString name, QString path, QString params); /** diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index b45f30c6e..0a8fbf346 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -86,14 +86,7 @@ static bool executeCommand(std::string exe, std::vector args, std:: CheckThread::CheckThread(ThreadResult &result) : mResult(result), mCppcheck(result, true, executeCommand) -{ - //ctor -} - -CheckThread::~CheckThread() -{ - //dtor -} +{} void CheckThread::check(const Settings &settings) { diff --git a/gui/checkthread.h b/gui/checkthread.h index d74ec2514..65b6f7820 100644 --- a/gui/checkthread.h +++ b/gui/checkthread.h @@ -46,7 +46,6 @@ class CheckThread : public QThread { Q_OBJECT public: explicit CheckThread(ThreadResult &result); - ~CheckThread() override; /** * @brief Set settings for cppcheck diff --git a/gui/codeeditstylecontrols.h b/gui/codeeditstylecontrols.h index 7e87c7b5f..7285598ad 100644 --- a/gui/codeeditstylecontrols.h +++ b/gui/codeeditstylecontrols.h @@ -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(); diff --git a/gui/codeeditstyledialog.h b/gui/codeeditstyledialog.h index 9ef42907b..c4aeffc99 100644 --- a/gui/codeeditstyledialog.h +++ b/gui/codeeditstyledialog.h @@ -42,7 +42,6 @@ class StyleEditDialog : public QDialog { public: explicit StyleEditDialog(const CodeEditorStyle& newStyle, QWidget *parent = nullptr); - ~StyleEditDialog() override {} CodeEditorStyle getStyle(); diff --git a/gui/cppchecklibrarydata.cpp b/gui/cppchecklibrarydata.cpp index 2e7761a65..83fe76622 100644 --- a/gui/cppchecklibrarydata.cpp +++ b/gui/cppchecklibrarydata.cpp @@ -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()); diff --git a/gui/cppchecklibrarydata.h b/gui/cppchecklibrarydata.h index 252d66920..07fc2a811 100644 --- a/gui/cppchecklibrarydata.h +++ b/gui/cppchecklibrarydata.h @@ -30,7 +30,7 @@ class QIODevice; class CppcheckLibraryData { public: - CppcheckLibraryData(); + CppcheckLibraryData() = default; struct Container { QString id; diff --git a/gui/csvreport.cpp b/gui/csvreport.cpp index 36da50bbd..740651cf0 100644 --- a/gui/csvreport.cpp +++ b/gui/csvreport.cpp @@ -30,9 +30,6 @@ CsvReport::CsvReport(const QString &filename) : Report(filename) {} -CsvReport::~CsvReport() -{} - bool CsvReport::create() { if (Report::create()) { diff --git a/gui/csvreport.h b/gui/csvreport.h index a2efdd93b..cfd918fe0 100644 --- a/gui/csvreport.h +++ b/gui/csvreport.h @@ -39,7 +39,6 @@ class ErrorItem; class CsvReport : public Report { public: explicit CsvReport(const QString &filename); - ~CsvReport() override; /** * @brief Create the report (file). diff --git a/gui/printablereport.cpp b/gui/printablereport.cpp index 9bcfff55c..d9272632f 100644 --- a/gui/printablereport.cpp +++ b/gui/printablereport.cpp @@ -27,9 +27,6 @@ PrintableReport::PrintableReport() : Report(QString()) {} -PrintableReport::~PrintableReport() -{} - bool PrintableReport::create() { return true; diff --git a/gui/printablereport.h b/gui/printablereport.h index 29fa008bf..693356a96 100644 --- a/gui/printablereport.h +++ b/gui/printablereport.h @@ -36,7 +36,6 @@ class ErrorItem; class PrintableReport : public Report { public: PrintableReport(); - ~PrintableReport() override; /** * @brief Create the report (file). diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 61f995e6b..d94223dad 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -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) { diff --git a/gui/resultstree.h b/gui/resultstree.h index 5828c0e38..8a8a79642 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -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); /** diff --git a/gui/test/projectfile/testprojectfile.cpp b/gui/test/projectfile/testprojectfile.cpp index cbd98dc86..65531aa0f 100644 --- a/gui/test/projectfile/testprojectfile.cpp +++ b/gui/test/projectfile/testprojectfile.cpp @@ -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; } diff --git a/gui/threadresult.cpp b/gui/threadresult.cpp index 5e1aed89b..52d683414 100644 --- a/gui/threadresult.cpp +++ b/gui/threadresult.cpp @@ -28,11 +28,6 @@ #include #include -ThreadResult::~ThreadResult() -{ - //dtor -} - void ThreadResult::reportOut(const std::string &outmsg, Color /*c*/) { emit log(QString::fromStdString(outmsg)); diff --git a/gui/threadresult.h b/gui/threadresult.h index f08bb9452..4e32a1cbe 100644 --- a/gui/threadresult.h +++ b/gui/threadresult.h @@ -46,7 +46,6 @@ class ThreadResult : public QObject, public ErrorLogger { Q_OBJECT public: ThreadResult() = default; - ~ThreadResult() override; /** * @brief Get next unprocessed file diff --git a/gui/translationhandler.cpp b/gui/translationhandler.cpp index 6b14b6241..2e17148fd 100644 --- a/gui/translationhandler.cpp +++ b/gui/translationhandler.cpp @@ -62,9 +62,6 @@ TranslationHandler::TranslationHandler(QObject *parent) : addTranslation("Swedish", "cppcheck_sv"); } -TranslationHandler::~TranslationHandler() -{} - bool TranslationHandler::setLanguage(const QString &code) { bool failure = false; diff --git a/gui/translationhandler.h b/gui/translationhandler.h index e9ff87220..cd298d6eb 100644 --- a/gui/translationhandler.h +++ b/gui/translationhandler.h @@ -63,7 +63,6 @@ class TranslationHandler : QObject { Q_OBJECT public: explicit TranslationHandler(QObject *parent = nullptr); - ~TranslationHandler() override; /** * @brief Get a list of available translations. diff --git a/gui/txtreport.cpp b/gui/txtreport.cpp index 1be394434..caa3833ef 100644 --- a/gui/txtreport.cpp +++ b/gui/txtreport.cpp @@ -29,9 +29,6 @@ TxtReport::TxtReport(const QString &filename) : Report(filename) {} -TxtReport::~TxtReport() -{} - bool TxtReport::create() { if (Report::create()) { diff --git a/gui/txtreport.h b/gui/txtreport.h index 02395cc44..d3e74f93d 100644 --- a/gui/txtreport.h +++ b/gui/txtreport.h @@ -40,7 +40,6 @@ class TxtReport : public Report { public: explicit TxtReport(const QString &filename); - ~TxtReport() override; /** * @brief Create the report (file). diff --git a/lib/analyzer.h b/lib/analyzer.h index 3c65e0e68..3ceab711b 100644 --- a/lib/analyzer.h +++ b/lib/analyzer.h @@ -184,7 +184,7 @@ struct Analyzer { virtual bool invalid() const { return false; } - virtual ~Analyzer() {} + virtual ~Analyzer() = default; Analyzer(const Analyzer&) = default; protected: Analyzer() = default; diff --git a/lib/check.h b/lib/check.h index 39e347815..8e8e76463 100644 --- a/lib/check.h +++ b/lib/check.h @@ -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(); } diff --git a/lib/ctu.h b/lib/ctu.h index a353ac1d7..7fdd0f093 100644 --- a/lib/ctu.h +++ b/lib/ctu.h @@ -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{}; diff --git a/lib/errorlogger.h b/lib/errorlogger.h index ef8d8a719..4cb1352c2 100644 --- a/lib/errorlogger.h +++ b/lib/errorlogger.h @@ -219,8 +219,8 @@ private: */ class CPPCHECKLIB ErrorLogger { public: - ErrorLogger() {} - virtual ~ErrorLogger() {} + ErrorLogger() = default; + virtual ~ErrorLogger() = default; /** * Information about progress is directed here. diff --git a/lib/infer.h b/lib/infer.h index 21ffcb22c..35d2afb18 100644 --- a/lib/infer.h +++ b/lib/infer.h @@ -33,7 +33,7 @@ template 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; diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index e551790a4..dbd802269 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -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.. diff --git a/lib/templatesimplifier.h b/lib/templatesimplifier.h index 763962ea2..29b78fb84 100644 --- a/lib/templatesimplifier.h +++ b/lib/templatesimplifier.h @@ -48,7 +48,6 @@ class CPPCHECKLIB TemplateSimplifier { public: explicit TemplateSimplifier(Tokenizer &tokenizer); - ~TemplateSimplifier(); std::string dump() const { return mDump; diff --git a/lib/timer.h b/lib/timer.h index 1fe246f41..34a5216d8 100644 --- a/lib/timer.h +++ b/lib/timer.h @@ -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; diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index c6ba15f68..1a280f9d8 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -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 { diff --git a/lib/valueptr.h b/lib/valueptr.h index 0740a72fc..3bb3f71e2 100644 --- a/lib/valueptr.h +++ b/lib/valueptr.h @@ -97,7 +97,6 @@ public: operator bool() const NOEXCEPT { return !!mPtr; } - ~ValuePtr() {} private: std::shared_ptr mPtr; diff --git a/test/fixture.h b/test/fixture.h index f641f09bd..24633132d 100644 --- a/test/fixture.h +++ b/test/fixture.h @@ -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); };