From 887463855bbd71a2fda779669d120c674a68f664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Tue, 26 Jul 2022 11:10:03 +0200 Subject: [PATCH] mitigated most clang-tidy warnings in headers (#4175) --- gui/csvreport.h | 8 ++++---- gui/printablereport.h | 8 ++++---- gui/scratchpad.h | 2 +- gui/txtreport.h | 8 ++++---- gui/xmlreportv2.h | 12 ++++++------ lib/errortypes.h | 4 ++-- lib/library.h | 2 +- lib/mathlib.h | 4 ++-- lib/symboldatabase.h | 4 ++-- lib/templatesimplifier.h | 2 +- lib/valueflow.h | 4 ++-- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/gui/csvreport.h b/gui/csvreport.h index 74c31d320..a2efdd93b 100644 --- a/gui/csvreport.h +++ b/gui/csvreport.h @@ -45,23 +45,23 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool create() override; + bool create() override; /** * @brief Write report header. */ - virtual void writeHeader() override; + void writeHeader() override; /** * @brief Write report footer. */ - virtual void writeFooter() override; + void writeFooter() override; /** * @brief Write error to report. * @param error Error data. */ - virtual void writeError(const ErrorItem &error) override; + void writeError(const ErrorItem &error) override; private: diff --git a/gui/printablereport.h b/gui/printablereport.h index bce8a1fda..aaf806338 100644 --- a/gui/printablereport.h +++ b/gui/printablereport.h @@ -40,23 +40,23 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool create() override; + bool create() override; /** * @brief Write report header. */ - virtual void writeHeader() override; + void writeHeader() override; /** * @brief Write report footer. */ - virtual void writeFooter() override; + void writeFooter() override; /** * @brief Write error to report. * @param error Error data. */ - virtual void writeError(const ErrorItem &error) override; + void writeError(const ErrorItem &error) override; /** * @brief Returns the formatted report. diff --git a/gui/scratchpad.h b/gui/scratchpad.h index a8bb17f75..9929a7732 100644 --- a/gui/scratchpad.h +++ b/gui/scratchpad.h @@ -37,7 +37,7 @@ class ScratchPad : public QDialog { Q_OBJECT public: explicit ScratchPad(MainWindow& mainWindow); - ~ScratchPad(); + ~ScratchPad() override; /** * @brief Translate dialog diff --git a/gui/txtreport.h b/gui/txtreport.h index 82b5f39f2..2e8ce7249 100644 --- a/gui/txtreport.h +++ b/gui/txtreport.h @@ -46,23 +46,23 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool create() override; + bool create() override; /** * @brief Write report header. */ - virtual void writeHeader() override; + void writeHeader() override; /** * @brief Write report footer. */ - virtual void writeFooter() override; + void writeFooter() override; /** * @brief Write error to report. * @param error Error data. */ - virtual void writeError(const ErrorItem &error) override; + void writeError(const ErrorItem &error) override; private: diff --git a/gui/xmlreportv2.h b/gui/xmlreportv2.h index 604c1c1ad..c875f30a4 100644 --- a/gui/xmlreportv2.h +++ b/gui/xmlreportv2.h @@ -45,33 +45,33 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool create() override; + bool create() override; /** * @brief Open existing report file. */ - virtual bool open() override; + bool open() override; /** * @brief Write report header. */ - virtual void writeHeader() override; + void writeHeader() override; /** * @brief Write report footer. */ - virtual void writeFooter() override; + void writeFooter() override; /** * @brief Write error to report. * @param error Error data. */ - virtual void writeError(const ErrorItem &error) override; + void writeError(const ErrorItem &error) override; /** * @brief Read contents of the report file. */ - virtual QList read() override; + QList read() override; protected: /** diff --git a/lib/errortypes.h b/lib/errortypes.h index d8d41ace5..d5512dd28 100644 --- a/lib/errortypes.h +++ b/lib/errortypes.h @@ -122,8 +122,8 @@ struct CWE { unsigned short id; }; -typedef std::pair ErrorPathItem; -typedef std::list ErrorPath; +using ErrorPathItem = std::pair; +using ErrorPath = std::list; /// @} //--------------------------------------------------------------------------- diff --git a/lib/library.h b/lib/library.h index 01032613d..4c8e1d36b 100644 --- a/lib/library.h +++ b/lib/library.h @@ -478,7 +478,7 @@ public: std::vector defines; // to provide some library defines struct SmartPointer { - std::string name = ""; + std::string name; bool unique = false; }; diff --git a/lib/mathlib.h b/lib/mathlib.h index 74c45c5a3..d072170a7 100644 --- a/lib/mathlib.h +++ b/lib/mathlib.h @@ -66,8 +66,8 @@ public: value shiftRight(const value &v) const; }; - typedef long long bigint; - typedef unsigned long long biguint; + using bigint = long long; + using biguint = unsigned long long; static const int bigint_bits; static bigint toLongNumber(const std::string & str); diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 82df2c294..abef43245 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -1490,8 +1490,8 @@ private: Function *findFunctionInScope(const Token *func, const Scope *ns, const std::string & path, nonneg int path_length); const Type *findVariableTypeInBase(const Scope *scope, const Token *typeTok) const; - typedef std::map MemberIdMap; - typedef std::map VarIdMap; + using MemberIdMap = std::map; + using VarIdMap = std::map; void fixVarId(VarIdMap & varIds, const Token * vartok, Token * membertok, const Variable * membervar); diff --git a/lib/templatesimplifier.h b/lib/templatesimplifier.h index f48bc308d..87f15b197 100644 --- a/lib/templatesimplifier.h +++ b/lib/templatesimplifier.h @@ -242,7 +242,7 @@ public: bool isSameFamily(const TemplateSimplifier::TokenAndName &decl) const { // Make sure a family flag is set and matches. // This works because at most only one flag will be set. - return ((mFlags & fFamilyMask) & (decl.mFlags & fFamilyMask)) != 0; + return ((mFlags & fFamilyMask) && (decl.mFlags & fFamilyMask)); } }; diff --git a/lib/valueflow.h b/lib/valueflow.h index af922035c..928bc783b 100644 --- a/lib/valueflow.h +++ b/lib/valueflow.h @@ -83,8 +83,8 @@ namespace ValueFlow { }; class CPPCHECKLIB Value { public: - typedef std::pair ErrorPathItem; - typedef std::list ErrorPath; + using ErrorPathItem = std::pair; + using ErrorPath = std::list; enum class Bound { Upper, Lower, Point }; explicit Value(long long val = 0, Bound b = Bound::Point)