From b7d92a4fc70dbe0dec367f6908266837da2a90f8 Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Sun, 8 Mar 2015 18:18:09 +0100 Subject: [PATCH] Fixed warnings of CppCheck's own code (caused by new check #695) --- gui/applicationlist.h | 2 +- gui/checkstatistics.h | 2 +- gui/checkthread.h | 2 +- gui/csvreport.h | 2 +- gui/erroritem.h | 2 +- gui/logview.h | 2 +- gui/platforms.h | 2 +- gui/project.h | 2 +- gui/projectfile.h | 2 +- gui/report.h | 2 +- gui/resultstree.h | 2 +- gui/resultsview.h | 2 +- gui/scratchpad.h | 2 +- gui/statsdialog.h | 2 +- gui/threadhandler.h | 2 +- gui/translationhandler.h | 2 +- gui/txtreport.h | 2 +- gui/xmlreport.h | 2 +- gui/xmlreportv1.h | 2 +- gui/xmlreportv2.h | 2 +- lib/check.h | 2 +- lib/tokenlist.h | 2 +- lib/valueflow.cpp | 8 ++++---- lib/valueflow.h | 2 +- test/testsuite.h | 2 +- 25 files changed, 28 insertions(+), 28 deletions(-) diff --git a/gui/applicationlist.h b/gui/applicationlist.h index c67828bae..7e0f50b2a 100644 --- a/gui/applicationlist.h +++ b/gui/applicationlist.h @@ -33,7 +33,7 @@ class ApplicationList : public QObject { Q_OBJECT public: - ApplicationList(QObject *parent = 0); + explicit ApplicationList(QObject *parent = 0); virtual ~ApplicationList(); /** diff --git a/gui/checkstatistics.h b/gui/checkstatistics.h index b19006476..08adf56e8 100644 --- a/gui/checkstatistics.h +++ b/gui/checkstatistics.h @@ -30,7 +30,7 @@ */ class CheckStatistics : public QObject { public: - CheckStatistics(QObject *parent = NULL); + explicit CheckStatistics(QObject *parent = NULL); /** * @brief Add new checked item to statistics. diff --git a/gui/checkthread.h b/gui/checkthread.h index 6ea260eb1..d4d3fc60b 100644 --- a/gui/checkthread.h +++ b/gui/checkthread.h @@ -36,7 +36,7 @@ class Settings; class CheckThread : public QThread { Q_OBJECT public: - CheckThread(ThreadResult &result); + explicit CheckThread(ThreadResult &result); virtual ~CheckThread(); /** diff --git a/gui/csvreport.h b/gui/csvreport.h index 38f356321..990b4ac73 100644 --- a/gui/csvreport.h +++ b/gui/csvreport.h @@ -35,7 +35,7 @@ */ class CsvReport : public Report { public: - CsvReport(const QString &filename); + explicit CsvReport(const QString &filename); virtual ~CsvReport(); /** diff --git a/gui/erroritem.h b/gui/erroritem.h index 242ba71a8..e3a704ee9 100644 --- a/gui/erroritem.h +++ b/gui/erroritem.h @@ -57,7 +57,7 @@ public: class ErrorItem { public: ErrorItem(); - ErrorItem(const ErrorLine &line); + explicit ErrorItem(const ErrorLine &line); /** * @brief Convert error item to string. diff --git a/gui/logview.h b/gui/logview.h index e37135df1..4d66564a2 100644 --- a/gui/logview.h +++ b/gui/logview.h @@ -32,7 +32,7 @@ class LogView : public QWidget { Q_OBJECT public: - LogView(QWidget *parent = 0); + explicit LogView(QWidget *parent = 0); ~LogView(); /** diff --git a/gui/platforms.h b/gui/platforms.h index 5fb2f7a50..c216c064f 100644 --- a/gui/platforms.h +++ b/gui/platforms.h @@ -44,7 +44,7 @@ class Platforms : public QObject { Q_OBJECT public: - Platforms(QObject *parent = NULL); + explicit Platforms(QObject *parent = NULL); void add(const QString &title, Settings::PlatformType platform); int getCount() const; void init(); diff --git a/gui/project.h b/gui/project.h index 189cd7a90..4a8d7e8ef 100644 --- a/gui/project.h +++ b/gui/project.h @@ -36,7 +36,7 @@ class Project : public QObject { Q_OBJECT public: - Project(QWidget *parent = 0); + explicit Project(QWidget *parent = 0); Project(const QString &filename, QWidget *parent = 0); ~Project(); diff --git a/gui/projectfile.h b/gui/projectfile.h index 49b8cbf5d..f0b0a5e87 100644 --- a/gui/projectfile.h +++ b/gui/projectfile.h @@ -37,7 +37,7 @@ class ProjectFile : public QObject { Q_OBJECT public: - ProjectFile(QObject *parent = 0); + explicit ProjectFile(QObject *parent = 0); ProjectFile(const QString &filename, QObject *parent = 0); /** diff --git a/gui/report.h b/gui/report.h index 8bca37e76..ff0ac80d0 100644 --- a/gui/report.h +++ b/gui/report.h @@ -40,7 +40,7 @@ public: CSV, }; - Report(const QString &filename); + explicit Report(const QString &filename); virtual ~Report(); /** diff --git a/gui/resultstree.h b/gui/resultstree.h index aff136763..7353901c4 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -47,7 +47,7 @@ class QItemSelectionModel; class ResultsTree : public QTreeView { Q_OBJECT public: - ResultsTree(QWidget * parent = 0); + explicit ResultsTree(QWidget * parent = 0); virtual ~ResultsTree(); void Initialize(QSettings *settings, ApplicationList *list); diff --git a/gui/resultsview.h b/gui/resultsview.h index f6dad1e04..068440e04 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -43,7 +43,7 @@ class ResultsView : public QWidget { Q_OBJECT public: - ResultsView(QWidget * parent = 0); + explicit ResultsView(QWidget * parent = 0); void Initialize(QSettings *settings, ApplicationList *list); virtual ~ResultsView(); diff --git a/gui/scratchpad.h b/gui/scratchpad.h index 03e782d49..a1dc7a9ac 100644 --- a/gui/scratchpad.h +++ b/gui/scratchpad.h @@ -33,7 +33,7 @@ class MainWindow; class ScratchPad : public QDialog { Q_OBJECT public: - ScratchPad(MainWindow& mainWindow); + explicit ScratchPad(MainWindow& mainWindow); private slots: /** diff --git a/gui/statsdialog.h b/gui/statsdialog.h index ac3d2b889..7b653c8a0 100644 --- a/gui/statsdialog.h +++ b/gui/statsdialog.h @@ -35,7 +35,7 @@ class CheckStatistics; class StatsDialog : public QDialog { Q_OBJECT public: - StatsDialog(QWidget *parent = 0); + explicit StatsDialog(QWidget *parent = 0); /** * @brief Sets the project to extract statistics from diff --git a/gui/threadhandler.h b/gui/threadhandler.h index 49e40c5bf..09225cc0d 100644 --- a/gui/threadhandler.h +++ b/gui/threadhandler.h @@ -42,7 +42,7 @@ class Settings; class ThreadHandler : public QObject { Q_OBJECT public: - ThreadHandler(QObject *parent = 0); + explicit ThreadHandler(QObject *parent = 0); virtual ~ThreadHandler(); /** diff --git a/gui/translationhandler.h b/gui/translationhandler.h index 2d134f9a1..610c5e99a 100644 --- a/gui/translationhandler.h +++ b/gui/translationhandler.h @@ -61,7 +61,7 @@ struct TranslationInfo { class TranslationHandler : QObject { Q_OBJECT public: - TranslationHandler(QObject *parent = 0); + explicit TranslationHandler(QObject *parent = 0); virtual ~TranslationHandler(); /** diff --git a/gui/txtreport.h b/gui/txtreport.h index 26a52afdb..deba9bb96 100644 --- a/gui/txtreport.h +++ b/gui/txtreport.h @@ -35,7 +35,7 @@ class TxtReport : public Report { Q_OBJECT public: - TxtReport(const QString &filename); + explicit TxtReport(const QString &filename); virtual ~TxtReport(); /** diff --git a/gui/xmlreport.h b/gui/xmlreport.h index 822599deb..15ec80592 100644 --- a/gui/xmlreport.h +++ b/gui/xmlreport.h @@ -35,7 +35,7 @@ class QObject; */ class XmlReport : public Report { public: - XmlReport(const QString &filename); + explicit XmlReport(const QString &filename); /** * @brief Read contents of the report file. diff --git a/gui/xmlreportv1.h b/gui/xmlreportv1.h index 09eaf16eb..f22f092f1 100644 --- a/gui/xmlreportv1.h +++ b/gui/xmlreportv1.h @@ -35,7 +35,7 @@ */ class XmlReportV1 : public XmlReport { public: - XmlReportV1(const QString &filename); + explicit XmlReportV1(const QString &filename); virtual ~XmlReportV1(); /** diff --git a/gui/xmlreportv2.h b/gui/xmlreportv2.h index d39a96b37..57517acdf 100644 --- a/gui/xmlreportv2.h +++ b/gui/xmlreportv2.h @@ -36,7 +36,7 @@ */ class XmlReportV2 : public XmlReport { public: - XmlReportV2(const QString &filename); + explicit XmlReportV2(const QString &filename); virtual ~XmlReportV2(); /** diff --git a/lib/check.h b/lib/check.h index b0e7c9a1a..64c5bc1e9 100644 --- a/lib/check.h +++ b/lib/check.h @@ -129,7 +129,7 @@ private: /** disabled assignment operator and copy constructor */ void operator=(const Check &); - Check(const Check &); + Check(const Check &) = delete; }; /// @} diff --git a/lib/tokenlist.h b/lib/tokenlist.h index 4d4a6cf77..60edcf74e 100644 --- a/lib/tokenlist.h +++ b/lib/tokenlist.h @@ -33,7 +33,7 @@ class Settings; class CPPCHECKLIB TokenList { public: - TokenList(const Settings* settings); + explicit TokenList(const Settings* settings); ~TokenList(); void setSettings(const Settings *settings) { diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 7799c8cdd..bfd0f3952 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1567,7 +1567,7 @@ static void valueFlowForLoopSimplify(Token * const bodyStart, const unsigned int } if (Token::Match(tok2, "%oror%|&&")) { - const std::map programMemory(getProgramMemory(tok2->astTop(), varid, value)); + const std::map programMemory(getProgramMemory(tok2->astTop(), varid, ValueFlow::Value(value))); if ((tok2->str() == "&&" && conditionIsFalse(tok2->astOperand1(), programMemory)) || (tok2->str() == "||" && conditionIsTrue(tok2->astOperand1(), programMemory))) { // Skip second expression.. @@ -1584,8 +1584,8 @@ static void valueFlowForLoopSimplify(Token * const bodyStart, const unsigned int } } - if ((tok2->str() == "&&" && conditionIsFalse(tok2->astOperand1(), getProgramMemory(tok2->astTop(), varid, value))) || - (tok2->str() == "||" && conditionIsTrue(tok2->astOperand1(), getProgramMemory(tok2->astTop(), varid, value)))) + if ((tok2->str() == "&&" && conditionIsFalse(tok2->astOperand1(), getProgramMemory(tok2->astTop(), varid, ValueFlow::Value(value)))) || + (tok2->str() == "||" && conditionIsTrue(tok2->astOperand1(), getProgramMemory(tok2->astTop(), varid, ValueFlow::Value(value))))) break; else if (Token::simpleMatch(tok2, ") {") && Token::findmatch(tok2->link(), "%varid%", tok2, varid)) { @@ -1630,7 +1630,7 @@ static void valueFlowForLoopSimplifyAfter(Token *fortok, unsigned int varid, con endToken = fortok->scope()->classEnd; std::list values; - values.push_back(num); + values.push_back(ValueFlow::Value(num)); valueFlowForward(fortok->linkAt(1)->linkAt(1)->next(), endToken, diff --git a/lib/valueflow.h b/lib/valueflow.h index c8b637a00..53b0e7abb 100644 --- a/lib/valueflow.h +++ b/lib/valueflow.h @@ -30,7 +30,7 @@ class Settings; namespace ValueFlow { class Value { public: - Value(long long val = 0) : intvalue(val), tokvalue(nullptr), varvalue(val), condition(0), varId(0U), conditional(false), inconclusive(false), defaultArg(false) {} + explicit Value(long long val = 0) : intvalue(val), tokvalue(nullptr), varvalue(val), condition(0), varId(0U), conditional(false), inconclusive(false), defaultArg(false) {} Value(const Token *c, long long val) : intvalue(val), tokvalue(nullptr), varvalue(val), condition(c), varId(0U), conditional(false), inconclusive(false), defaultArg(false) {} /** int value */ diff --git a/test/testsuite.h b/test/testsuite.h index 7d8f9d42e..4dc4c5b4c 100644 --- a/test/testsuite.h +++ b/test/testsuite.h @@ -74,7 +74,7 @@ public: void warn(const char msg[]) const; void warnUnsimplified(const std::string& unsimplified, const std::string& simplified); - TestFixture(const std::string &_name); + explicit TestFixture(const std::string &_name); virtual ~TestFixture() { } static std::size_t runTests(const options& args);