Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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} $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
if(USE_BUNDLED_TINYXML2)
list(APPEND cppcheck_SOURCES $<TARGET_OBJECTS:tinyxml2_objs>)
Expand Down
11 changes: 5 additions & 6 deletions cmake/compileroptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -76,21 +76,20 @@ 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)
add_compile_options(-Wno-c++98-compat)
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)
Expand Down
3 changes: 3 additions & 0 deletions externals/simplecpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
3 changes: 3 additions & 0 deletions externals/tinyxml2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

8 changes: 4 additions & 4 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion gui/applicationdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ApplicationDialog : public QDialog {
ApplicationDialog(const QString &title,
Application &app,
QWidget *parent = nullptr);
virtual ~ApplicationDialog();
~ApplicationDialog() override;

protected slots:

Expand Down
2 changes: 1 addition & 1 deletion gui/applicationlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ApplicationList : public QObject {
public:

explicit ApplicationList(QObject *parent = nullptr);
virtual ~ApplicationList();
~ApplicationList() override;

/**
* @brief Load all applications
Expand Down
2 changes: 1 addition & 1 deletion gui/checkthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CheckThread : public QThread {
Q_OBJECT
public:
explicit CheckThread(ThreadResult &result);
virtual ~CheckThread();
~CheckThread() override;

/**
* @brief Set settings for cppcheck
Expand Down
2 changes: 1 addition & 1 deletion gui/codeeditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions gui/codeeditstylecontrols.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion gui/codeeditstyledialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class StyleEditDialog : public QDialog {
public:
explicit StyleEditDialog(const CodeEditorStyle& newStyle,
QWidget *parent = nullptr);
virtual ~StyleEditDialog() {}
~StyleEditDialog() override {}

CodeEditorStyle getStyle();

Expand Down
2 changes: 1 addition & 1 deletion gui/csvreport.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
class CsvReport : public Report {
public:
explicit CsvReport(const QString &filename);
virtual ~CsvReport();
~CsvReport() override;

/**
* @brief Create the report (file).
Expand Down
2 changes: 1 addition & 1 deletion gui/functioncontractdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions gui/helpdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -42,7 +42,7 @@ class HelpDialog : public QDialog {

public:
explicit HelpDialog(QWidget *parent = nullptr);
~HelpDialog();
~HelpDialog() override;

private:
Ui::HelpDialog *mUi;
Expand Down
2 changes: 1 addition & 1 deletion gui/libraryaddfunctiondialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion gui/librarydialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gui/libraryeditargdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion gui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
2 changes: 1 addition & 1 deletion gui/newsuppressiondialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
2 changes: 1 addition & 1 deletion gui/printablereport.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
class PrintableReport : public Report {
public:
PrintableReport();
virtual ~PrintableReport();
~PrintableReport() override;

/**
* @brief Create the report (file).
Expand Down
2 changes: 1 addition & 1 deletion gui/projectfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion gui/projectfiledialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion gui/report.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Report : public QObject {
};

explicit Report(const QString &filename);
virtual ~Report();
~Report() override;

/**
* @brief Create the report (file).
Expand Down
2 changes: 1 addition & 1 deletion gui/resultstree.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down
4 changes: 2 additions & 2 deletions gui/resultsview.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gui/settingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
9 changes: 9 additions & 0 deletions gui/test/benchmark/simple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
7 changes: 6 additions & 1 deletion gui/test/cppchecklibrarydata/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
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()
7 changes: 6 additions & 1 deletion gui/test/filelist/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
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()
7 changes: 6 additions & 1 deletion gui/test/projectfile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
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()
7 changes: 6 additions & 1 deletion gui/test/translationhandler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
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()
2 changes: 1 addition & 1 deletion gui/threadhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gui/threadresult.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ThreadResult : public QObject, public ErrorLogger {
Q_OBJECT
public:
ThreadResult();
virtual ~ThreadResult();
~ThreadResult() override;

/**
* @brief Get next unprocessed file
Expand Down
2 changes: 1 addition & 1 deletion gui/translationhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion gui/txtreport.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TxtReport : public Report {

public:
explicit TxtReport(const QString &filename);
virtual ~TxtReport();
~TxtReport() override;

/**
* @brief Create the report (file).
Expand Down
Loading