diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index 731879c4623..54b314f61f8 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -10,6 +10,11 @@ if(USE_BUNDLED_TINYXML2) endif() target_include_directories(cli_objs PRIVATE ${PROJECT_SOURCE_DIR}/externals/simplecpp/) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) + # false positive warning in up to Clang 13 - caused by FD_ZERO macro + set_source_files_properties(threadexecutor.cpp PROPERTIES COMPILE_FLAGS -Wno-reserved-identifier) +endif() + list(APPEND cppcheck_SOURCES ${hdrs} ${mainfile} $ $ $) if(USE_BUNDLED_TINYXML2) list(APPEND cppcheck_SOURCES $) diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index c5235f3577c..cd8cf6b85be 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -66,7 +66,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options_safe(-Wno-shadow-field-in-constructor) add_compile_options_safe(-Wno-covered-switch-default) add_compile_options_safe(-Wno-shorten-64-to-32) - add_compile_options_safe(-Wno-zero-as-null-pointer-constant) + add_compile_options_safe(-Wno-zero-as-null-pointer-constant) # TODO: enable when warnings are fixed in in simplecpp and tinyxml2 add_compile_options_safe(-Wno-format-nonliteral) add_compile_options_safe(-Wno-implicit-int-conversion) add_compile_options_safe(-Wno-double-promotion) @@ -76,12 +76,13 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options_safe(-Wno-implicit-float-conversion) add_compile_options_safe(-Wno-switch-enum) add_compile_options_safe(-Wno-float-conversion) - add_compile_options_safe(-Wno-redundant-parens) # caused by Qt moc code add_compile_options_safe(-Wno-enum-enum-conversion) add_compile_options_safe(-Wno-date-time) - add_compile_options_safe(-Wno-suggest-override) - add_compile_options_safe(-Wno-suggest-destructor-override) add_compile_options_safe(-Wno-conditional-uninitialized) + add_compile_options_safe(-Wno-suggest-override) # TODO: enable when warnings are fixed in in tinyxml2 + add_compile_options_safe(-Wno-suggest-destructor-override) # TODO: enable when warnings are fixed in in tinyxml2 + add_compile_options_safe(-Wno-extra-semi-stmt) # TODO: enable when warnings are fixed in in tinyxml2 + add_compile_options(-Wno-disabled-macro-expansion) # warnings we are not interested in add_compile_options(-Wno-four-char-constants) @@ -89,8 +90,6 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wno-weak-vtables) add_compile_options(-Wno-padded) add_compile_options(-Wno-c++98-compat-pedantic) - add_compile_options(-Wno-disabled-macro-expansion) - add_compile_options(-Wno-reserved-id-macro) add_compile_options_safe(-Wno-return-std-move-in-c++11) if(ENABLE_COVERAGE OR ENABLE_COVERAGE_XML) diff --git a/externals/simplecpp/CMakeLists.txt b/externals/simplecpp/CMakeLists.txt index 8c7df749769..8536a1d6fdc 100644 --- a/externals/simplecpp/CMakeLists.txt +++ b/externals/simplecpp/CMakeLists.txt @@ -2,3 +2,6 @@ file(GLOB hdrs "*.h") file(GLOB srcs "*.cpp") add_library(simplecpp_objs OBJECT ${srcs} ${hdrs}) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + target_compile_options_safe(simplecpp_objs -Wno-zero-as-null-pointer-constant) +endif() diff --git a/externals/tinyxml2/CMakeLists.txt b/externals/tinyxml2/CMakeLists.txt index e599d40fb2b..3488143d8f9 100644 --- a/externals/tinyxml2/CMakeLists.txt +++ b/externals/tinyxml2/CMakeLists.txt @@ -10,5 +10,8 @@ endif() if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_options_safe(tinyxml2_objs -Wno-extra-semi-stmt) target_compile_options_safe(tinyxml2_objs -Wno-implicit-fallthrough) + target_compile_options_safe(tinyxml2_objs -Wno-suggest-override) + target_compile_options_safe(tinyxml2_objs -Wno-suggest-destructor-override) + target_compile_options_safe(tinyxml2_objs -Wno-zero-as-null-pointer-constant) endif() diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index 13d7b877a06..0106d4d76cc 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -44,10 +44,10 @@ if (BUILD_GUI) target_link_libraries(cppcheck-gui ${QT_CHARTS_LIB}) endif() if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0") - # Q_UNUSED() in generated code - target_compile_options(cppcheck-gui PRIVATE -Wno-extra-semi-stmt) - endif() + # Q_UNUSED() in generated code + target_compile_options_safe(cppcheck-gui -Wno-extra-semi-stmt) + # caused by Qt generated moc code + target_compile_options_safe(cppcheck-gui -Wno-redundant-parens) endif() install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications) diff --git a/gui/applicationdialog.h b/gui/applicationdialog.h index e05c2edff44..e6d55018ebf 100644 --- a/gui/applicationdialog.h +++ b/gui/applicationdialog.h @@ -49,7 +49,7 @@ class ApplicationDialog : public QDialog { ApplicationDialog(const QString &title, Application &app, QWidget *parent = nullptr); - virtual ~ApplicationDialog(); + ~ApplicationDialog() override; protected slots: diff --git a/gui/applicationlist.h b/gui/applicationlist.h index 7bf411601fb..108db366725 100644 --- a/gui/applicationlist.h +++ b/gui/applicationlist.h @@ -35,7 +35,7 @@ class ApplicationList : public QObject { public: explicit ApplicationList(QObject *parent = nullptr); - virtual ~ApplicationList(); + ~ApplicationList() override; /** * @brief Load all applications diff --git a/gui/checkthread.h b/gui/checkthread.h index 1a2e339da31..a319b98fe29 100644 --- a/gui/checkthread.h +++ b/gui/checkthread.h @@ -39,7 +39,7 @@ class CheckThread : public QThread { Q_OBJECT public: explicit CheckThread(ThreadResult &result); - virtual ~CheckThread(); + ~CheckThread() override; /** * @brief Set settings for cppcheck diff --git a/gui/codeeditor.h b/gui/codeeditor.h index b35bfd309cc..291e8a7f6c3 100644 --- a/gui/codeeditor.h +++ b/gui/codeeditor.h @@ -80,7 +80,7 @@ class CodeEditor : public QPlainTextEdit { explicit CodeEditor(QWidget *parent); CodeEditor(const CodeEditor &) = delete; CodeEditor &operator=(const CodeEditor &) = delete; - ~CodeEditor(); + ~CodeEditor() override; void lineNumberAreaPaintEvent(QPaintEvent *event); int lineNumberAreaWidth(); diff --git a/gui/codeeditstylecontrols.h b/gui/codeeditstylecontrols.h index 8487e6da870..653a526d744 100644 --- a/gui/codeeditstylecontrols.h +++ b/gui/codeeditstylecontrols.h @@ -31,7 +31,7 @@ class SelectColorButton : public QPushButton { Q_OBJECT public: explicit SelectColorButton(QWidget* parent); - virtual ~SelectColorButton() {} + ~SelectColorButton() override {} void setColor(const QColor& color); const QColor& getColor(); @@ -52,7 +52,7 @@ class SelectFontWeightCombo : public QComboBox { Q_OBJECT public: explicit SelectFontWeightCombo(QWidget* parent); - virtual ~SelectFontWeightCombo() {} + ~SelectFontWeightCombo() override {} void setWeight(const QFont::Weight& weight); const QFont::Weight& getWeight(); diff --git a/gui/codeeditstyledialog.h b/gui/codeeditstyledialog.h index fd02b5220db..f25a171b336 100644 --- a/gui/codeeditstyledialog.h +++ b/gui/codeeditstyledialog.h @@ -33,7 +33,7 @@ class StyleEditDialog : public QDialog { public: explicit StyleEditDialog(const CodeEditorStyle& newStyle, QWidget *parent = nullptr); - virtual ~StyleEditDialog() {} + ~StyleEditDialog() override {} CodeEditorStyle getStyle(); diff --git a/gui/csvreport.h b/gui/csvreport.h index 3779d673a20..3887285618a 100644 --- a/gui/csvreport.h +++ b/gui/csvreport.h @@ -37,7 +37,7 @@ class CsvReport : public Report { public: explicit CsvReport(const QString &filename); - virtual ~CsvReport(); + ~CsvReport() override; /** * @brief Create the report (file). diff --git a/gui/functioncontractdialog.h b/gui/functioncontractdialog.h index 4c34fa6a5df..f67864d0916 100644 --- a/gui/functioncontractdialog.h +++ b/gui/functioncontractdialog.h @@ -30,7 +30,7 @@ class FunctionContractDialog : public QDialog { public: explicit FunctionContractDialog(QWidget *parent, const QString &name, const QString &expects); - ~FunctionContractDialog(); + ~FunctionContractDialog() override; QString getExpects() const; private: Ui::FunctionContractDialog *mUi; diff --git a/gui/helpdialog.h b/gui/helpdialog.h index 4a5e6b09c0c..c4b0dae2ba1 100644 --- a/gui/helpdialog.h +++ b/gui/helpdialog.h @@ -30,9 +30,9 @@ class QHelpEngine; class HelpBrowser : public QTextBrowser { public: - HelpBrowser(QWidget* parent = 0) : QTextBrowser(parent), mHelpEngine(nullptr) {} + HelpBrowser(QWidget* parent = nullptr) : QTextBrowser(parent), mHelpEngine(nullptr) {} void setHelpEngine(QHelpEngine *helpEngine); - QVariant loadResource(int type, const QUrl& name); + QVariant loadResource(int type, const QUrl& name) override; private: QHelpEngine* mHelpEngine; }; @@ -42,7 +42,7 @@ class HelpDialog : public QDialog { public: explicit HelpDialog(QWidget *parent = nullptr); - ~HelpDialog(); + ~HelpDialog() override; private: Ui::HelpDialog *mUi; diff --git a/gui/libraryaddfunctiondialog.h b/gui/libraryaddfunctiondialog.h index 6d431822458..4cf774ce504 100644 --- a/gui/libraryaddfunctiondialog.h +++ b/gui/libraryaddfunctiondialog.h @@ -35,7 +35,7 @@ class LibraryAddFunctionDialog : public QDialog { public: explicit LibraryAddFunctionDialog(QWidget *parent = nullptr); LibraryAddFunctionDialog(const LibraryAddFunctionDialog &) = delete; - ~LibraryAddFunctionDialog(); + ~LibraryAddFunctionDialog() override; LibraryAddFunctionDialog &operator=(const LibraryAddFunctionDialog &) = delete; QString functionName() const; diff --git a/gui/librarydialog.h b/gui/librarydialog.h index 7b0eb358e81..1a5845b3542 100644 --- a/gui/librarydialog.h +++ b/gui/librarydialog.h @@ -35,7 +35,7 @@ class LibraryDialog : public QDialog { public: explicit LibraryDialog(QWidget *parent = nullptr); LibraryDialog(const LibraryDialog &) = delete; - ~LibraryDialog(); + ~LibraryDialog() override; LibraryDialog &operator=(const LibraryDialog &) = delete; private slots: diff --git a/gui/libraryeditargdialog.h b/gui/libraryeditargdialog.h index 6e1ad73fb41..b61713acd53 100644 --- a/gui/libraryeditargdialog.h +++ b/gui/libraryeditargdialog.h @@ -33,7 +33,7 @@ class LibraryEditArgDialog : public QDialog { public: LibraryEditArgDialog(QWidget *parent, const CppcheckLibraryData::Function::Arg &arg); LibraryEditArgDialog(const LibraryEditArgDialog &) = delete; - ~LibraryEditArgDialog(); + ~LibraryEditArgDialog() override; LibraryEditArgDialog &operator=(const LibraryEditArgDialog &) = delete; CppcheckLibraryData::Function::Arg getArg() const; diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 0ebc13d5f36..4c5d3ae57e8 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -55,7 +55,7 @@ class MainWindow : public QMainWindow { MainWindow(TranslationHandler* th, QSettings* settings); MainWindow(const MainWindow &) = delete; - virtual ~MainWindow(); + ~MainWindow() override; MainWindow &operator=(const MainWindow &) = delete; /** diff --git a/gui/newsuppressiondialog.h b/gui/newsuppressiondialog.h index d06fcdc98cd..1204525df8c 100644 --- a/gui/newsuppressiondialog.h +++ b/gui/newsuppressiondialog.h @@ -33,7 +33,7 @@ class NewSuppressionDialog : public QDialog { public: explicit NewSuppressionDialog(QWidget *parent = nullptr); NewSuppressionDialog(const NewSuppressionDialog &) = delete; - ~NewSuppressionDialog(); + ~NewSuppressionDialog() override; NewSuppressionDialog &operator=(const NewSuppressionDialog &) = delete; /** diff --git a/gui/printablereport.h b/gui/printablereport.h index 5293f3f8e8f..45d073ac474 100644 --- a/gui/printablereport.h +++ b/gui/printablereport.h @@ -32,7 +32,7 @@ class PrintableReport : public Report { public: PrintableReport(); - virtual ~PrintableReport(); + ~PrintableReport() override; /** * @brief Create the report (file). diff --git a/gui/projectfile.h b/gui/projectfile.h index 8805042aa16..5d14d8e62e8 100644 --- a/gui/projectfile.h +++ b/gui/projectfile.h @@ -46,7 +46,7 @@ class ProjectFile : public QObject { public: explicit ProjectFile(QObject *parent = nullptr); explicit ProjectFile(const QString &filename, QObject *parent = nullptr); - ~ProjectFile() { + ~ProjectFile() override { if (this == mActiveProject) mActiveProject = nullptr; } diff --git a/gui/projectfiledialog.h b/gui/projectfiledialog.h index f0a6c7c5b17..e8aa10970c1 100644 --- a/gui/projectfiledialog.h +++ b/gui/projectfiledialog.h @@ -42,7 +42,7 @@ class ProjectFileDialog : public QDialog { Q_OBJECT public: explicit ProjectFileDialog(ProjectFile *projectFile, QWidget *parent = nullptr); - virtual ~ProjectFileDialog(); + ~ProjectFileDialog() override; private: void loadFromProjectFile(const ProjectFile *projectFile); diff --git a/gui/report.h b/gui/report.h index efb000db06f..1ec336e515b 100644 --- a/gui/report.h +++ b/gui/report.h @@ -40,7 +40,7 @@ class Report : public QObject { }; explicit Report(const QString &filename); - virtual ~Report(); + ~Report() override; /** * @brief Create the report (file). diff --git a/gui/resultstree.h b/gui/resultstree.h index a70f9774c7d..75cc122d072 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -49,7 +49,7 @@ class ResultsTree : public QTreeView { Q_OBJECT public: explicit ResultsTree(QWidget * parent = nullptr); - virtual ~ResultsTree(); + ~ResultsTree() override; void initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler); /** diff --git a/gui/resultsview.h b/gui/resultsview.h index 5d7b4570d7f..6834587f1af 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -46,7 +46,7 @@ class ResultsView : public QWidget { explicit ResultsView(QWidget * parent = nullptr); void initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler); ResultsView(const ResultsView &) = delete; - virtual ~ResultsView(); + ~ResultsView() override; ResultsView &operator=(const ResultsView &) = delete; void setAddedFunctionContracts(const QStringList &addedContracts); @@ -372,7 +372,7 @@ public slots: CheckStatistics *mStatistics; - bool eventFilter(QObject *target, QEvent *event); + bool eventFilter(QObject *target, QEvent *event) override; private slots: /** * @brief Custom context menu for Analysis Log diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h index 9f8549775b5..489f9c52b09 100644 --- a/gui/settingsdialog.h +++ b/gui/settingsdialog.h @@ -44,7 +44,7 @@ class SettingsDialog : public QDialog { TranslationHandler *translator, QWidget *parent = nullptr); SettingsDialog(const SettingsDialog &) = delete; - virtual ~SettingsDialog(); + ~SettingsDialog() override; SettingsDialog &operator=(const SettingsDialog &) = delete; /** diff --git a/gui/test/benchmark/simple/CMakeLists.txt b/gui/test/benchmark/simple/CMakeLists.txt index 6bc1222cc71..933a10a29f2 100644 --- a/gui/test/benchmark/simple/CMakeLists.txt +++ b/gui/test/benchmark/simple/CMakeLists.txt @@ -21,4 +21,13 @@ if (USE_Z3) endif() if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2) target_link_libraries(benchmark-simple ${tinyxml2_LIBRARY}) +endif() + +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) + # false positive in up to CLang 13 - caused by QBENCHMARK macro + set_source_files_properties(benchmarksimple.cpp PROPERTIES COMPILE_FLAGS -Wno-reserved-identifier) + endif() + # caused by Q_UNUSED macro + set_source_files_properties(moc_benchmarksimple.cpp PROPERTIES COMPILE_FLAGS -Wno-extra-semi-stmt) endif() \ No newline at end of file diff --git a/gui/test/cppchecklibrarydata/CMakeLists.txt b/gui/test/cppchecklibrarydata/CMakeLists.txt index 9569e8017a3..2790788b017 100644 --- a/gui/test/cppchecklibrarydata/CMakeLists.txt +++ b/gui/test/cppchecklibrarydata/CMakeLists.txt @@ -7,4 +7,9 @@ add_executable(test-cppchecklibrarydata ${CMAKE_SOURCE_DIR}/gui/cppchecklibrarydata.cpp ) target_include_directories(test-cppchecklibrarydata PRIVATE ${CMAKE_SOURCE_DIR}/gui) -target_link_libraries(test-cppchecklibrarydata ${QT_CORE_LIB} ${QT_TEST_LIB}) \ No newline at end of file +target_link_libraries(test-cppchecklibrarydata ${QT_CORE_LIB} ${QT_TEST_LIB}) + +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Q_UNUSED() in generated code + target_compile_options_safe(test-cppchecklibrarydata -Wno-extra-semi-stmt) +endif() \ No newline at end of file diff --git a/gui/test/filelist/CMakeLists.txt b/gui/test/filelist/CMakeLists.txt index 315e9954c80..781629e05ac 100644 --- a/gui/test/filelist/CMakeLists.txt +++ b/gui/test/filelist/CMakeLists.txt @@ -12,4 +12,9 @@ add_executable(test-filelist ) target_include_directories(test-filelist PRIVATE ${CMAKE_SOURCE_DIR}/gui ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp) target_compile_definitions(test-filelist PRIVATE SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries(test-filelist ${QT_CORE_LIB} ${QT_TEST_LIB}) \ No newline at end of file +target_link_libraries(test-filelist ${QT_CORE_LIB} ${QT_TEST_LIB}) + +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Q_UNUSED() in generated code + target_compile_options_safe(test-filelist -Wno-extra-semi-stmt) +endif() \ No newline at end of file diff --git a/gui/test/projectfile/CMakeLists.txt b/gui/test/projectfile/CMakeLists.txt index 3947aef5142..baba417184c 100644 --- a/gui/test/projectfile/CMakeLists.txt +++ b/gui/test/projectfile/CMakeLists.txt @@ -8,4 +8,9 @@ add_executable(test-projectfile ) target_include_directories(test-projectfile PRIVATE ${CMAKE_SOURCE_DIR}/gui ${CMAKE_SOURCE_DIR}/lib) target_compile_definitions(test-projectfile PRIVATE SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries(test-projectfile ${QT_CORE_LIB} ${QT_TEST_LIB}) \ No newline at end of file +target_link_libraries(test-projectfile ${QT_CORE_LIB} ${QT_TEST_LIB}) + +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Q_UNUSED() in generated code + target_compile_options_safe(test-projectfile -Wno-extra-semi-stmt) +endif() \ No newline at end of file diff --git a/gui/test/translationhandler/CMakeLists.txt b/gui/test/translationhandler/CMakeLists.txt index 0aadbe7028b..77b1e416830 100644 --- a/gui/test/translationhandler/CMakeLists.txt +++ b/gui/test/translationhandler/CMakeLists.txt @@ -8,4 +8,9 @@ add_executable(test-translationhandler ${CMAKE_SOURCE_DIR}/gui/translationhandler.cpp ) target_include_directories(test-translationhandler PRIVATE ${CMAKE_SOURCE_DIR}/gui) -target_link_libraries(test-translationhandler ${QT_CORE_LIB} ${QT_WIDGETS_LIB} ${QT_TEST_LIB}) \ No newline at end of file +target_link_libraries(test-translationhandler ${QT_CORE_LIB} ${QT_WIDGETS_LIB} ${QT_TEST_LIB}) + +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Q_UNUSED() in generated code + target_compile_options_safe(test-projectfile -Wno-extra-semi-stmt) +endif() \ No newline at end of file diff --git a/gui/threadhandler.h b/gui/threadhandler.h index b2c2c6cf78d..95b4591e95b 100644 --- a/gui/threadhandler.h +++ b/gui/threadhandler.h @@ -48,7 +48,7 @@ class ThreadHandler : public QObject { Q_OBJECT public: explicit ThreadHandler(QObject *parent = nullptr); - virtual ~ThreadHandler(); + ~ThreadHandler() override; /** * @brief Set the number of threads to use diff --git a/gui/threadresult.h b/gui/threadresult.h index 8b0fb99037f..79e3557f01b 100644 --- a/gui/threadresult.h +++ b/gui/threadresult.h @@ -41,7 +41,7 @@ class ThreadResult : public QObject, public ErrorLogger { Q_OBJECT public: ThreadResult(); - virtual ~ThreadResult(); + ~ThreadResult() override; /** * @brief Get next unprocessed file diff --git a/gui/translationhandler.h b/gui/translationhandler.h index 4cc4eea6efb..3d2af86aefd 100644 --- a/gui/translationhandler.h +++ b/gui/translationhandler.h @@ -62,7 +62,7 @@ class TranslationHandler : QObject { Q_OBJECT public: explicit TranslationHandler(QObject *parent = nullptr); - virtual ~TranslationHandler(); + ~TranslationHandler() override; /** * @brief Get a list of available translations. diff --git a/gui/txtreport.h b/gui/txtreport.h index 1ced50fad5c..8bb195d433a 100644 --- a/gui/txtreport.h +++ b/gui/txtreport.h @@ -37,7 +37,7 @@ class TxtReport : public Report { public: explicit TxtReport(const QString &filename); - virtual ~TxtReport(); + ~TxtReport() override; /** * @brief Create the report (file). diff --git a/gui/variablecontractsdialog.h b/gui/variablecontractsdialog.h index 2bcfdb748bf..419caaef637 100644 --- a/gui/variablecontractsdialog.h +++ b/gui/variablecontractsdialog.h @@ -30,7 +30,7 @@ class VariableContractsDialog : public QDialog { public: explicit VariableContractsDialog(QWidget *parent, QString var); - ~VariableContractsDialog(); + ~VariableContractsDialog() override; QString getVarname() const; QString getMin() const; diff --git a/gui/xmlreportv2.h b/gui/xmlreportv2.h index ce40825d078..8e9afcf4be9 100644 --- a/gui/xmlreportv2.h +++ b/gui/xmlreportv2.h @@ -38,7 +38,7 @@ class QXmlStreamWriter; class XmlReportV2 : public XmlReport { public: explicit XmlReportV2(const QString &filename); - virtual ~XmlReportV2(); + ~XmlReportV2() override; /** * @brief Create the report (file). diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 0dfc8b9ef62..e5bf7dd7194 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -88,6 +88,7 @@ static bool isVariableCopyNeeded(const Variable &var, Function::Type type) switch (type) { case Function::eOperatorEqual: isOpEqual = true; + break; case Function::eCopyConstructor: case Function::eMoveConstructor: break; diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index a577d7020bf..ed461deb193 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -180,11 +180,11 @@ void ProgramMemory::insert(const ProgramMemory &pm) mValues.insert(p); } -bool evaluateCondition(const std::string& op, - MathLib::bigint r, - const Token* condition, - ProgramMemory& pm, - const Settings* settings) +static bool evaluateCondition(const std::string& op, + MathLib::bigint r, + const Token* condition, + ProgramMemory& pm, + const Settings* settings) { if (!condition) return false; diff --git a/lib/programmemory.h b/lib/programmemory.h index bb1ef98692d..f873f3f0f95 100644 --- a/lib/programmemory.h +++ b/lib/programmemory.h @@ -147,14 +147,14 @@ void execute(const Token* expr, /** * Is condition always false when variable has given value? * \param condition top ast token in condition - * \param programMemory program memory + * \param pm program memory */ bool conditionIsFalse(const Token* condition, ProgramMemory pm, const Settings* settings = nullptr); /** * Is condition always true when variable has given value? * \param condition top ast token in condition - * \param programMemory program memory + * \param pm program memory */ bool conditionIsTrue(const Token* condition, ProgramMemory pm, const Settings* settings = nullptr); diff --git a/lib/token.cpp b/lib/token.cpp index fea57dfa1e2..b6be36318d9 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -2065,6 +2065,7 @@ static void mergeAdjacent(std::list& values) continue; } std::sort(adjValues.begin(), adjValues.end(), [&values](ValueIterator xx, ValueIterator yy) { + (void)values; assert(xx != values.end() && yy != values.end()); return xx->compareValue(*yy, ValueFlow::less{}); }); diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index c1d4261026e..b23993e7482 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -3741,7 +3741,7 @@ struct LifetimeStore { // Don't add the value a second time if (std::find(tok->values().begin(), tok->values().end(), value) != tok->values().end()) continue; - ; + setTokenValue(tok, value, tokenlist->getSettings()); update = true; } diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 100f9a9edab..e6151e96f76 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -14,7 +14,7 @@ add_executable(dmake EXCLUDE_FROM_ALL ${CMAKE_SOURCE_DIR}/cli/filelister.cpp ${srcs_tools} ${CMAKE_SOURCE_DIR}/lib/utils.cpp - ${CMAKE_SOURCE_DIR}/externals/simplecpp/simplecpp.cpp + $ ) target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp) if (WIN32 AND NOT BORLAND) diff --git a/tools/triage/CMakeLists.txt b/tools/triage/CMakeLists.txt index 286b43ec723..32be7cf4d8f 100644 --- a/tools/triage/CMakeLists.txt +++ b/tools/triage/CMakeLists.txt @@ -24,9 +24,9 @@ if (BUILD_GUI AND BUILD_TESTS) target_include_directories(triage PRIVATE ${PROJECT_SOURCE_DIR}/lib/ ${PROJECT_SOURCE_DIR}/gui/) target_link_libraries(triage ${QT_CORE_LIB} ${QT_GUI_LIB} ${QT_WIDGETS_LIB}) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0") - # Q_UNUSED() in generated code - target_compile_options(triage PRIVATE -Wno-extra-semi-stmt) - endif() + # Q_UNUSED() in generated code + target_compile_options_safe(triage -Wno-extra-semi-stmt) + # caused by Qt generated moc code + target_compile_options_safe(triage -Wno-redundant-parens) endif() endif() diff --git a/tools/triage/mainwindow.h b/tools/triage/mainwindow.h index 7f9099864c7..429ed61204d 100644 --- a/tools/triage/mainwindow.h +++ b/tools/triage/mainwindow.h @@ -36,7 +36,7 @@ class MainWindow : public QMainWindow { explicit MainWindow(QWidget *parent = nullptr); MainWindow(const MainWindow &) = delete; MainWindow &operator=(const MainWindow &) = delete; - ~MainWindow(); + ~MainWindow() override; public slots: void loadFile();