From 6397e29f84de53655904326ef1ca892a509275c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sat, 3 Apr 2021 21:30:50 +0200 Subject: [PATCH] cleaned up includes based on include-what-you-use (#3141) --- Makefile | 4 ++-- gui/aboutdialog.cpp | 6 +++--- gui/applicationdialog.cpp | 9 +++++---- gui/applicationlist.cpp | 4 ++-- gui/checkstatistics.cpp | 4 ++-- gui/checkstatistics.h | 3 +++ gui/checkthread.cpp | 8 ++------ gui/codeeditor.cpp | 5 +++-- gui/codeeditor.h | 1 - gui/codeeditstyledialog.cpp | 5 ++--- gui/codeeditstyledialog.h | 2 +- gui/cppchecklibrarydata.cpp | 1 - gui/cppchecklibrarydata.h | 3 ++- gui/csvreport.cpp | 6 ++---- gui/erroritem.h | 2 +- gui/filelist.cpp | 5 ++--- gui/fileviewdialog.cpp | 3 ++- gui/libraryaddfunctiondialog.cpp | 1 - gui/librarydialog.cpp | 1 - gui/librarydialog.h | 1 - gui/main.cpp | 1 - gui/mainwindow.cpp | 7 ++++--- gui/mainwindow.h | 6 +++--- gui/platforms.h | 3 ++- gui/printablereport.cpp | 3 ++- gui/projectfile.cpp | 8 +++----- gui/projectfile.h | 4 +++- gui/projectfiledialog.cpp | 10 ++-------- gui/projectfiledialog.h | 2 +- gui/report.cpp | 2 -- gui/resultstree.cpp | 10 ++++------ gui/resultstree.h | 5 ++--- gui/resultsview.cpp | 7 ++----- gui/resultsview.h | 1 - gui/scratchpad.cpp | 1 - gui/settingsdialog.cpp | 6 ++---- gui/showtypes.cpp | 8 ++++++-- gui/showtypes.h | 4 ++-- gui/statsdialog.cpp | 6 ++++-- gui/threadhandler.cpp | 6 +++--- gui/threadresult.cpp | 8 ++------ gui/translationhandler.cpp | 5 +++-- gui/translationhandler.h | 3 ++- gui/txtreport.cpp | 3 ++- gui/xmlreport.cpp | 5 ++--- gui/xmlreportv2.cpp | 6 ++---- gui/xmlreportv2.h | 6 +++--- lib/astutils.h | 2 -- lib/check.cpp | 1 + lib/check64bit.cpp | 1 - lib/checkautovariables.cpp | 2 -- lib/checkbool.cpp | 2 -- lib/checkboost.cpp | 2 -- lib/checkbufferoverrun.h | 1 - lib/checkclass.h | 4 ---- lib/checkcondition.cpp | 3 --- lib/checkexceptionsafety.cpp | 1 - lib/checkfunctions.cpp | 3 --- lib/checkleakautovar.cpp | 2 -- lib/checkmemoryleak.cpp | 2 -- lib/checknullpointer.cpp | 1 - lib/checkother.cpp | 2 +- lib/checkother.h | 1 - lib/checkpostfixoperator.cpp | 2 -- lib/checksizeof.cpp | 1 - lib/checkstl.cpp | 2 -- lib/checkstring.cpp | 1 - lib/checktype.cpp | 4 ---- lib/checkuninitvar.cpp | 2 -- lib/checkunusedfunctions.cpp | 1 - lib/clangimport.cpp | 1 + lib/cppcheck.h | 1 - lib/errorlogger.cpp | 1 - lib/errorlogger.h | 1 - lib/exprengine.cpp | 1 + lib/exprengine.h | 1 - lib/forwardanalyzer.h | 1 - lib/importproject.cpp | 1 - lib/path.cpp | 2 -- lib/preprocessor.cpp | 1 - lib/programmemory.cpp | 1 - lib/programmemory.h | 1 - lib/reverseanalyzer.cpp | 2 -- lib/symboldatabase.cpp | 1 - lib/symboldatabase.h | 1 + lib/tokenize.cpp | 1 - lib/utils.cpp | 1 + lib/utils.h | 1 - oss-fuzz/translate.cpp | 2 +- test/options.cpp | 2 -- test/testbufferoverrun.cpp | 2 -- test/testclass.cpp | 1 - test/testcmdlineparser.cpp | 1 - test/testexprengine.cpp | 1 - test/testfilelister.cpp | 1 - test/testlibrary.cpp | 1 - test/testmemleak.cpp | 1 - test/testsamples.cpp | 3 --- test/testsimplifytokens.cpp | 1 - test/testsuppressions.cpp | 1 - test/testsymboldatabase.cpp | 2 -- test/testthreadexecutor.cpp | 2 -- test/testunusedfunctions.cpp | 1 - test/testvalueflow.cpp | 1 - tools/dmake.cpp | 1 - tools/triage/mainwindow.h | 4 ++-- 106 files changed, 104 insertions(+), 197 deletions(-) diff --git a/Makefile b/Makefile index 6af57a37c..aecab7833 100644 --- a/Makefile +++ b/Makefile @@ -541,7 +541,7 @@ $(libcppdir)/preprocessor.o: lib/preprocessor.cpp externals/simplecpp/simplecpp. $(libcppdir)/programmemory.o: lib/programmemory.cpp lib/astutils.h lib/config.h lib/errortypes.h lib/library.h lib/mathlib.h lib/programmemory.h lib/standards.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/utils.h lib/valueflow.h $(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/programmemory.o $(libcppdir)/programmemory.cpp -$(libcppdir)/reverseanalyzer.o: lib/reverseanalyzer.cpp lib/analyzer.h lib/astutils.h lib/config.h lib/errortypes.h lib/forwardanalyzer.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/reverseanalyzer.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/utils.h lib/valueflow.h lib/valueptr.h +$(libcppdir)/reverseanalyzer.o: lib/reverseanalyzer.cpp lib/analyzer.h lib/astutils.h lib/config.h lib/errortypes.h lib/forwardanalyzer.h lib/library.h lib/mathlib.h lib/reverseanalyzer.h lib/standards.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/utils.h lib/valueflow.h lib/valueptr.h $(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/reverseanalyzer.o $(libcppdir)/reverseanalyzer.cpp $(libcppdir)/settings.o: lib/settings.cpp lib/astutils.h lib/config.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/summaries.h lib/suppressions.h lib/timer.h lib/utils.h lib/valueflow.h @@ -625,7 +625,7 @@ test/testcharvar.o: test/testcharvar.cpp lib/astutils.h lib/check.h lib/checkoth test/testclangimport.o: test/testclangimport.cpp lib/astutils.h lib/clangimport.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testclangimport.o test/testclangimport.cpp -test/testclass.o: test/testclass.cpp externals/tinyxml2/tinyxml2.h lib/astutils.h lib/check.h lib/checkclass.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h +test/testclass.o: test/testclass.cpp externals/tinyxml2/tinyxml2.h lib/astutils.h lib/check.h lib/checkclass.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h test/testsuite.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o test/testclass.o test/testclass.cpp test/testcmdlineparser.o: test/testcmdlineparser.cpp cli/cmdlineparser.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h test/redirect.h test/testsuite.h diff --git a/gui/aboutdialog.cpp b/gui/aboutdialog.cpp index 3c321c4ac..ba3e1a218 100644 --- a/gui/aboutdialog.cpp +++ b/gui/aboutdialog.cpp @@ -16,11 +16,11 @@ * along with this program. If not, see . */ -#include -#include -#include #include "aboutdialog.h" +#include +#include + AboutDialog::AboutDialog(const QString &version, const QString &extraVersion, QWidget *parent) : QDialog(parent) { diff --git a/gui/applicationdialog.cpp b/gui/applicationdialog.cpp index d5b983dab..df64ad2c8 100644 --- a/gui/applicationdialog.cpp +++ b/gui/applicationdialog.cpp @@ -16,12 +16,13 @@ * along with this program. If not, see . */ -#include -#include -#include +#include "applicationdialog.h" + +#include #include #include -#include "applicationdialog.h" +#include + #include "application.h" #include "common.h" diff --git a/gui/applicationlist.cpp b/gui/applicationlist.cpp index fc8784523..37636a794 100644 --- a/gui/applicationlist.cpp +++ b/gui/applicationlist.cpp @@ -16,13 +16,13 @@ * along with this program. If not, see . */ +#include "applicationlist.h" + #include -#include #include #include #include "common.h" -#include "applicationlist.h" #include "application.h" #include diff --git a/gui/checkstatistics.cpp b/gui/checkstatistics.cpp index 20eb5182d..05b4d7f02 100644 --- a/gui/checkstatistics.cpp +++ b/gui/checkstatistics.cpp @@ -16,10 +16,10 @@ * along with this program. If not, see . */ -#include -#include #include "checkstatistics.h" +#include + CheckStatistics::CheckStatistics(QObject *parent) : QObject(parent) { diff --git a/gui/checkstatistics.h b/gui/checkstatistics.h index c28d897b0..b989318bf 100644 --- a/gui/checkstatistics.h +++ b/gui/checkstatistics.h @@ -20,6 +20,9 @@ #define CHECKSTATISTICS_H #include +#include +#include + #include "showtypes.h" /// @addtogroup GUI diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index aa0c2cc26..4be2e7a8c 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -16,17 +16,13 @@ * along with this program. If not, see . */ -#include -#include +#include "checkthread.h" + #include #include #include -#include -#include -#include #include #include -#include "checkthread.h" #include "erroritem.h" #include "threadresult.h" #include "cppcheck.h" diff --git a/gui/codeeditor.cpp b/gui/codeeditor.cpp index e7d6c6f07..e2b85e36b 100644 --- a/gui/codeeditor.cpp +++ b/gui/codeeditor.cpp @@ -1,6 +1,7 @@ -#include -#include #include "codeeditor.h" + +#include +#include #include "codeeditorstyle.h" diff --git a/gui/codeeditor.h b/gui/codeeditor.h index 479125c0a..fc0a41df6 100644 --- a/gui/codeeditor.h +++ b/gui/codeeditor.h @@ -3,7 +3,6 @@ #include #include -#include #include class CodeEditorStyle; diff --git a/gui/codeeditstyledialog.cpp b/gui/codeeditstyledialog.cpp index f6e36ef57..389a01ba4 100644 --- a/gui/codeeditstyledialog.cpp +++ b/gui/codeeditstyledialog.cpp @@ -16,11 +16,10 @@ * along with this program. If not, see . */ -#include "codeeditor.h" #include "codeeditstyledialog.h" + +#include "codeeditor.h" #include "codeeditstylecontrols.h" -#include -#include #include #include diff --git a/gui/codeeditstyledialog.h b/gui/codeeditstyledialog.h index 329d35cc6..38fd00086 100644 --- a/gui/codeeditstyledialog.h +++ b/gui/codeeditstyledialog.h @@ -20,12 +20,12 @@ #define CODEEDITSTYLEDIALOG_H #include -#include #include "codeeditorstyle.h" class CodeEditor; class SelectColorButton; class SelectFontWeightCombo; +class QPushButton; class StyleEditDialog : public QDialog { Q_OBJECT diff --git a/gui/cppchecklibrarydata.cpp b/gui/cppchecklibrarydata.cpp index d44c79745..06ae32058 100644 --- a/gui/cppchecklibrarydata.cpp +++ b/gui/cppchecklibrarydata.cpp @@ -21,7 +21,6 @@ #include #include -#include #include const unsigned int CppcheckLibraryData::Function::Arg::ANY = ~0U; diff --git a/gui/cppchecklibrarydata.h b/gui/cppchecklibrarydata.h index eb69553b9..2124a4af9 100644 --- a/gui/cppchecklibrarydata.h +++ b/gui/cppchecklibrarydata.h @@ -22,7 +22,8 @@ #include #include #include -#include + +class QIODevice; class CppcheckLibraryData { public: diff --git a/gui/csvreport.cpp b/gui/csvreport.cpp index 1cb1464f8..8c0994065 100644 --- a/gui/csvreport.cpp +++ b/gui/csvreport.cpp @@ -16,13 +16,11 @@ * along with this program. If not, see . */ -#include -#include +#include "csvreport.h" + #include -#include #include "erroritem.h" #include "report.h" -#include "csvreport.h" CsvReport::CsvReport(const QString &filename) : Report(filename) diff --git a/gui/erroritem.h b/gui/erroritem.h index 0ab90938a..05dbe8aec 100644 --- a/gui/erroritem.h +++ b/gui/erroritem.h @@ -20,8 +20,8 @@ #define ERRORITEM_H #include -#include #include +#include #include "errorlogger.h" /// @addtogroup GUI diff --git a/gui/filelist.cpp b/gui/filelist.cpp index de48eef7c..c44278eed 100644 --- a/gui/filelist.cpp +++ b/gui/filelist.cpp @@ -16,10 +16,9 @@ * along with this program. If not, see . */ -#include -#include -#include #include "filelist.h" + +#include #include "pathmatch.h" QStringList FileList::getDefaultFilters() diff --git a/gui/fileviewdialog.cpp b/gui/fileviewdialog.cpp index f5eed0a26..b560332e7 100644 --- a/gui/fileviewdialog.cpp +++ b/gui/fileviewdialog.cpp @@ -16,11 +16,12 @@ * along with this program. If not, see . */ +#include "fileviewdialog.h" + #include #include #include #include -#include "fileviewdialog.h" FileViewDialog::FileViewDialog(const QString &file, const QString &title, diff --git a/gui/libraryaddfunctiondialog.cpp b/gui/libraryaddfunctiondialog.cpp index 9a0284024..16440e0a4 100644 --- a/gui/libraryaddfunctiondialog.cpp +++ b/gui/libraryaddfunctiondialog.cpp @@ -2,7 +2,6 @@ #include "ui_libraryaddfunctiondialog.h" #include -#include LibraryAddFunctionDialog::LibraryAddFunctionDialog(QWidget *parent) : QDialog(parent), diff --git a/gui/librarydialog.cpp b/gui/librarydialog.cpp index 1501cdd05..176aa4998 100644 --- a/gui/librarydialog.cpp +++ b/gui/librarydialog.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include // TODO: get/compare functions from header diff --git a/gui/librarydialog.h b/gui/librarydialog.h index 932b0a9af..3649833d3 100644 --- a/gui/librarydialog.h +++ b/gui/librarydialog.h @@ -20,7 +20,6 @@ #define LIBRARYDIALOG_H #include -#include #include "cppchecklibrarydata.h" diff --git a/gui/main.cpp b/gui/main.cpp index 7162ae3fe..c00eb5e93 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include #include diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 93b325d85..1e00d132d 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -16,18 +16,19 @@ * along with this program. If not, see . */ +#include "mainwindow.h" + #include #include #include #include #include -#include -#include #include #include #include #include -#include "mainwindow.h" +#include +#include #include "cppcheck.h" diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 006a6d720..3fdb97831 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -20,10 +20,7 @@ #define MAINWINDOW_H #include -#include #include -#include -#include #include #include "settings.h" @@ -35,6 +32,9 @@ class TranslationHandler; class ScratchPad; class ProjectFile; class QAction; +class QActionGroup; +class QSettings; +class QTimer; /// @addtogroup GUI /// @{ diff --git a/gui/platforms.h b/gui/platforms.h index 7d5eac38c..42950b1ad 100644 --- a/gui/platforms.h +++ b/gui/platforms.h @@ -22,9 +22,10 @@ #include #include #include -#include #include "settings.h" +class QAction; + /// @addtogroup GUI /// @{ diff --git a/gui/printablereport.cpp b/gui/printablereport.cpp index 942d8fc0e..72f136a86 100644 --- a/gui/printablereport.cpp +++ b/gui/printablereport.cpp @@ -16,8 +16,9 @@ * along with this program. If not, see . */ -#include "erroritem.h" #include "printablereport.h" + +#include "erroritem.h" #include PrintableReport::PrintableReport() : diff --git a/gui/projectfile.cpp b/gui/projectfile.cpp index 01b068c7e..53ccb92fc 100644 --- a/gui/projectfile.cpp +++ b/gui/projectfile.cpp @@ -16,13 +16,11 @@ * along with this program. If not, see . */ -#include -#include -#include -#include +#include "projectfile.h" + #include #include -#include "projectfile.h" +#include #include "common.h" #include "importproject.h" diff --git a/gui/projectfile.h b/gui/projectfile.h index ffa2b006d..cd56f9557 100644 --- a/gui/projectfile.h +++ b/gui/projectfile.h @@ -23,12 +23,14 @@ #include #include #include -#include #include "suppressions.h" #include +class QXmlStreamReader; +class QXmlStreamWriter; + /// @addtogroup GUI /// @{ diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index b3a02fd72..6c5e138ac 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -16,20 +16,14 @@ * along with this program. If not, see . */ -#include -#include -#include -#include +#include "projectfiledialog.h" + #include #include -#include #include #include -#include -#include #include "common.h" #include "newsuppressiondialog.h" -#include "projectfiledialog.h" #include "checkthread.h" #include "projectfile.h" #include "library.h" diff --git a/gui/projectfiledialog.h b/gui/projectfiledialog.h index d7ad84d24..9cf72c741 100644 --- a/gui/projectfiledialog.h +++ b/gui/projectfiledialog.h @@ -22,13 +22,13 @@ #include #include #include -#include #include "suppressions.h" #include "ui_projectfiledialog.h" class QWidget; +class QCheckBox; /// @addtogroup GUI /// @{ diff --git a/gui/report.cpp b/gui/report.cpp index e5e7490e6..12d9f9ad8 100644 --- a/gui/report.cpp +++ b/gui/report.cpp @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -#include -#include #include "report.h" Report::Report(const QString &filename) : diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index d3ee28f35..fe997a775 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -16,11 +16,10 @@ * along with this program. If not, see . */ +#include "resultstree.h" + #include -#include #include -#include -#include #include #include #include @@ -35,12 +34,11 @@ #include #include #include -#include -#include +#include +#include #include "common.h" #include "erroritem.h" #include "applicationlist.h" -#include "resultstree.h" #include "report.h" #include "application.h" #include "projectfile.h" diff --git a/gui/resultstree.h b/gui/resultstree.h index f35169a42..74334955f 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -22,9 +22,6 @@ #include #include -#include -#include -#include #include "errortypes.h" #include "showtypes.h" @@ -36,6 +33,8 @@ class QModelIndex; class QWidget; class QItemSelectionModel; class ThreadHandler; +class QContextMenuEvent; +class QSettings; /// @addtogroup GUI /// @{ diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index e724c14f4..cfb4ad3c7 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -16,12 +16,11 @@ * along with this program. If not, see . */ +#include "resultsview.h" + #include #include -#include #include -#include -#include #include #include #include @@ -30,7 +29,6 @@ #include #include #include -#include "resultsview.h" #include "common.h" #include "erroritem.h" #include "txtreport.h" @@ -38,7 +36,6 @@ #include "xmlreportv2.h" #include "csvreport.h" #include "printablereport.h" -#include "applicationlist.h" #include "checkstatistics.h" #include "path.h" #include "codeeditorstyle.h" diff --git a/gui/resultsview.h b/gui/resultsview.h index 0308dac8f..fa1048b42 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -21,7 +21,6 @@ #define RESULTSVIEW_H -#include #include "report.h" #include "showtypes.h" #include "ui_resultsview.h" diff --git a/gui/scratchpad.cpp b/gui/scratchpad.cpp index 7d1dc15f2..5b57b9d22 100644 --- a/gui/scratchpad.cpp +++ b/gui/scratchpad.cpp @@ -18,7 +18,6 @@ #include "scratchpad.h" #include "mainwindow.h" -#include ScratchPad::ScratchPad(MainWindow& mainWindow) : QDialog(&mainWindow) diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index 1d1857314..dae0a6bd0 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -16,16 +16,14 @@ * along with this program. If not, see . */ +#include "settingsdialog.h" -#include #include #include -#include -#include #include #include #include -#include "settingsdialog.h" +#include #include "applicationdialog.h" #include "applicationlist.h" #include "translationhandler.h" diff --git a/gui/showtypes.cpp b/gui/showtypes.cpp index b2ccbeddb..66524fbcf 100644 --- a/gui/showtypes.cpp +++ b/gui/showtypes.cpp @@ -16,10 +16,14 @@ * along with this program. If not, see . */ -#include -#include "common.h" #include "showtypes.h" +#include "common.h" + +#include +#include +#include + ShowTypes::ShowTypes() { load(); diff --git a/gui/showtypes.h b/gui/showtypes.h index 48f497961..f8a1541bb 100644 --- a/gui/showtypes.h +++ b/gui/showtypes.h @@ -19,10 +19,10 @@ #ifndef SHOWTYPES_H #define SHOWTYPES_H -#include "errortypes.h" - #include +#include "errortypes.h" + /// @addtogroup GUI /// @{ diff --git a/gui/statsdialog.cpp b/gui/statsdialog.cpp index 6126febcd..7b01b6e85 100644 --- a/gui/statsdialog.cpp +++ b/gui/statsdialog.cpp @@ -15,17 +15,19 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + +#include "statsdialog.h" + #include #include #include #include #include #include -#include #include #include + #include "projectfile.h" -#include "statsdialog.h" #include "checkstatistics.h" #include "common.h" diff --git a/gui/threadhandler.cpp b/gui/threadhandler.cpp index 08d902dff..e473cf486 100644 --- a/gui/threadhandler.cpp +++ b/gui/threadhandler.cpp @@ -16,14 +16,14 @@ * along with this program. If not, see . */ -#include +#include "threadhandler.h" + #include -#include #include +#include #include "common.h" #include "settings.h" #include "checkthread.h" -#include "threadhandler.h" #include "resultsview.h" ThreadHandler::ThreadHandler(QObject *parent) : diff --git a/gui/threadresult.cpp b/gui/threadresult.cpp index 7705f0e48..6cd441bf9 100644 --- a/gui/threadresult.cpp +++ b/gui/threadresult.cpp @@ -16,16 +16,12 @@ * along with this program. If not, see . */ +#include "threadresult.h" + #include -#include -#include -#include -#include -#include #include "common.h" #include "erroritem.h" #include "errorlogger.h" -#include "threadresult.h" ThreadResult::ThreadResult() : QObject(), ErrorLogger(), mMaxProgress(0), mProgress(0), mFilesChecked(0), mTotalFiles(0) { diff --git a/gui/translationhandler.cpp b/gui/translationhandler.cpp index d12fb7057..b8e963743 100644 --- a/gui/translationhandler.cpp +++ b/gui/translationhandler.cpp @@ -16,13 +16,14 @@ * along with this program. If not, see . */ +#include "translationhandler.h" + #include #include -#include #include #include #include -#include "translationhandler.h" +#include #include "common.h" diff --git a/gui/translationhandler.h b/gui/translationhandler.h index 01a910642..b89876701 100644 --- a/gui/translationhandler.h +++ b/gui/translationhandler.h @@ -20,10 +20,11 @@ #define TRANSLATIONHANDLER_H #include -#include #include #include +class QTranslator; + /// @addtogroup GUI /// @{ diff --git a/gui/txtreport.cpp b/gui/txtreport.cpp index 8058b9ea5..cd86f117a 100644 --- a/gui/txtreport.cpp +++ b/gui/txtreport.cpp @@ -16,9 +16,10 @@ * along with this program. If not, see . */ +#include "txtreport.h" + #include #include "erroritem.h" -#include "txtreport.h" TxtReport::TxtReport(const QString &filename) : Report(filename) diff --git a/gui/xmlreport.cpp b/gui/xmlreport.cpp index 4e22b8424..d1e171ffe 100644 --- a/gui/xmlreport.cpp +++ b/gui/xmlreport.cpp @@ -16,12 +16,11 @@ * along with this program. If not, see . */ -#include -#include +#include "xmlreport.h" + #include #include #include "report.h" -#include "xmlreport.h" static const char ResultElementName[] = "results"; static const char VersionAttribute[] = "version"; diff --git a/gui/xmlreportv2.cpp b/gui/xmlreportv2.cpp index 709ee2176..37dd8c0d9 100644 --- a/gui/xmlreportv2.cpp +++ b/gui/xmlreportv2.cpp @@ -16,16 +16,14 @@ * along with this program. If not, see . */ -#include -#include -#include +#include "xmlreportv2.h" + #include #include #include #include "report.h" #include "erroritem.h" #include "xmlreport.h" -#include "xmlreportv2.h" #include "cppcheck.h" static const QString ResultElementName = "results"; diff --git a/gui/xmlreportv2.h b/gui/xmlreportv2.h index 7e4f82d8f..54061475d 100644 --- a/gui/xmlreportv2.h +++ b/gui/xmlreportv2.h @@ -19,12 +19,12 @@ #ifndef XML_REPORTV2_H #define XML_REPORTV2_H -#include #include -#include -#include #include "xmlreport.h" +class QXmlStreamReader; +class QXmlStreamWriter; + /// @addtogroup GUI /// @{ diff --git a/lib/astutils.h b/lib/astutils.h index f228e6ec9..6c1be1eea 100644 --- a/lib/astutils.h +++ b/lib/astutils.h @@ -28,12 +28,10 @@ #include #include "errortypes.h" -#include "mathlib.h" #include "utils.h" class Function; class Library; -class Scope; class Settings; class Token; class Variable; diff --git a/lib/check.cpp b/lib/check.cpp index e76abf7a3..d53758d1f 100644 --- a/lib/check.cpp +++ b/lib/check.cpp @@ -24,6 +24,7 @@ #include "settings.h" #include "tokenize.h" +#include #include //--------------------------------------------------------------------------- diff --git a/lib/check64bit.cpp b/lib/check64bit.cpp index 876df682e..73d858b86 100644 --- a/lib/check64bit.cpp +++ b/lib/check64bit.cpp @@ -27,7 +27,6 @@ #include "token.h" #include "tokenize.h" -#include //--------------------------------------------------------------------------- diff --git a/lib/checkautovariables.cpp b/lib/checkautovariables.cpp index 7cb873153..cae4f4b33 100644 --- a/lib/checkautovariables.cpp +++ b/lib/checkautovariables.cpp @@ -30,9 +30,7 @@ #include "tokenize.h" #include "valueflow.h" -#include #include -#include //--------------------------------------------------------------------------- diff --git a/lib/checkbool.cpp b/lib/checkbool.cpp index 8fde9af41..d075c893a 100644 --- a/lib/checkbool.cpp +++ b/lib/checkbool.cpp @@ -21,13 +21,11 @@ #include "checkbool.h" #include "astutils.h" -#include "mathlib.h" #include "settings.h" #include "symboldatabase.h" #include "token.h" #include "tokenize.h" -#include #include //--------------------------------------------------------------------------- diff --git a/lib/checkboost.cpp b/lib/checkboost.cpp index 1d344f235..3b04e6b63 100644 --- a/lib/checkboost.cpp +++ b/lib/checkboost.cpp @@ -21,8 +21,6 @@ #include "symboldatabase.h" #include "token.h" -#include - // Register this check class (by creating a static instance of it) namespace { CheckBoost instance; diff --git a/lib/checkbufferoverrun.h b/lib/checkbufferoverrun.h index 21583a495..cbcf86d11 100644 --- a/lib/checkbufferoverrun.h +++ b/lib/checkbufferoverrun.h @@ -29,7 +29,6 @@ #include "symboldatabase.h" #include "valueflow.h" -#include #include #include #include diff --git a/lib/checkclass.h b/lib/checkclass.h index 05ad1ac4a..390fa723a 100644 --- a/lib/checkclass.h +++ b/lib/checkclass.h @@ -33,12 +33,8 @@ #include class ErrorLogger; -class Function; -class Scope; class Settings; -class SymbolDatabase; class Token; -class Type; /// @addtogroup Checks /// @{ diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index 7e14f806d..0581fbf19 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -30,12 +30,9 @@ #include "valueflow.h" #include -#include #include #include -#include #include -#include #include // CWE ids used diff --git a/lib/checkexceptionsafety.cpp b/lib/checkexceptionsafety.cpp index f146b96b9..c9dd3afb6 100644 --- a/lib/checkexceptionsafety.cpp +++ b/lib/checkexceptionsafety.cpp @@ -22,7 +22,6 @@ #include "settings.h" #include "symboldatabase.h" -#include #include #include diff --git a/lib/checkfunctions.cpp b/lib/checkfunctions.cpp index b98247d07..709c263c1 100644 --- a/lib/checkfunctions.cpp +++ b/lib/checkfunctions.cpp @@ -30,10 +30,7 @@ #include "tokenize.h" #include "valueflow.h" -#include -#include #include -#include #include //--------------------------------------------------------------------------- diff --git a/lib/checkleakautovar.cpp b/lib/checkleakautovar.cpp index f6edfc8ac..6562772b5 100644 --- a/lib/checkleakautovar.cpp +++ b/lib/checkleakautovar.cpp @@ -32,10 +32,8 @@ #include "token.h" #include "tokenize.h" -#include #include #include -#include #include //--------------------------------------------------------------------------- diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index cf5e36e35..0943c9c9d 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -29,8 +29,6 @@ #include "utils.h" #include -#include -#include //--------------------------------------------------------------------------- diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index c77e73c52..b236bed2d 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -31,7 +31,6 @@ #include #include -#include #include //--------------------------------------------------------------------------- diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 18d5d24e3..60de62655 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -36,8 +36,8 @@ #include // find_if() #include #include -#include #include +#include //--------------------------------------------------------------------------- // Register this check class (by creating a static instance of it) diff --git a/lib/checkother.h b/lib/checkother.h index fbf55c779..827cd176b 100644 --- a/lib/checkother.h +++ b/lib/checkother.h @@ -27,7 +27,6 @@ #include "errortypes.h" #include "utils.h" -#include #include #include diff --git a/lib/checkpostfixoperator.cpp b/lib/checkpostfixoperator.cpp index 56a5d951a..fa5fffabc 100644 --- a/lib/checkpostfixoperator.cpp +++ b/lib/checkpostfixoperator.cpp @@ -27,8 +27,6 @@ #include "symboldatabase.h" #include "token.h" -#include - //--------------------------------------------------------------------------- diff --git a/lib/checksizeof.cpp b/lib/checksizeof.cpp index b97051c41..a4ecea599 100644 --- a/lib/checksizeof.cpp +++ b/lib/checksizeof.cpp @@ -25,7 +25,6 @@ #include "token.h" #include "tokenize.h" -#include //--------------------------------------------------------------------------- // Register this check class (by creating a static instance of it) diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index da93903d1..bf95b49a9 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -33,14 +33,12 @@ #include "valueflow.h" #include -#include #include #include #include #include #include #include -#include #include // Register this check class (by creating a static instance of it) diff --git a/lib/checkstring.cpp b/lib/checkstring.cpp index 5f3090ad0..d4a0853f9 100644 --- a/lib/checkstring.cpp +++ b/lib/checkstring.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include //--------------------------------------------------------------------------- diff --git a/lib/checktype.cpp b/lib/checktype.cpp index dc4c0e23c..0cb337861 100644 --- a/lib/checktype.cpp +++ b/lib/checktype.cpp @@ -20,7 +20,6 @@ //--------------------------------------------------------------------------- #include "checktype.h" -#include "astutils.h" #include "mathlib.h" #include "platform.h" #include "settings.h" @@ -29,10 +28,7 @@ #include "tokenize.h" #include -#include #include -#include -#include //--------------------------------------------------------------------------- // Register this check class (by creating a static instance of it) diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index d03fee97f..06a9d4bc3 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -32,10 +32,8 @@ #include "valueflow.h" #include -#include #include #include -#include #include diff --git a/lib/checkunusedfunctions.cpp b/lib/checkunusedfunctions.cpp index c3626d551..9468bac00 100644 --- a/lib/checkunusedfunctions.cpp +++ b/lib/checkunusedfunctions.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include //--------------------------------------------------------------------------- diff --git a/lib/clangimport.cpp b/lib/clangimport.cpp index 9544300d3..315af9998 100644 --- a/lib/clangimport.cpp +++ b/lib/clangimport.cpp @@ -28,6 +28,7 @@ #include #include #include +#include static const std::string AccessSpecDecl = "AccessSpecDecl"; static const std::string ArraySubscriptExpr = "ArraySubscriptExpr"; diff --git a/lib/cppcheck.h b/lib/cppcheck.h index 50ef5434c..ee3375494 100644 --- a/lib/cppcheck.h +++ b/lib/cppcheck.h @@ -28,7 +28,6 @@ #include "importproject.h" #include "settings.h" -#include #include #include #include diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index 3788b9238..ee6bccf76 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -32,7 +32,6 @@ #include #include #include -#include // std::hash InternalError::InternalError(const Token *tok, const std::string &errorMsg, Type type) : token(tok), errorMessage(errorMsg), type(type) diff --git a/lib/errorlogger.h b/lib/errorlogger.h index b75208d8b..7bf6e64e4 100644 --- a/lib/errorlogger.h +++ b/lib/errorlogger.h @@ -25,7 +25,6 @@ #include "errortypes.h" #include "suppressions.h" -#include #include #include #include diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp index 942a1edd3..09d02fa7d 100644 --- a/lib/exprengine.cpp +++ b/lib/exprengine.cpp @@ -138,6 +138,7 @@ #include "symboldatabase.h" #include "tokenize.h" +#include #include #include #include diff --git a/lib/exprengine.h b/lib/exprengine.h index cea879249..a01ea157f 100644 --- a/lib/exprengine.h +++ b/lib/exprengine.h @@ -29,7 +29,6 @@ #include #include #include -#include class ErrorLogger; class Tokenizer; diff --git a/lib/forwardanalyzer.h b/lib/forwardanalyzer.h index 87828696e..3238cfa0c 100644 --- a/lib/forwardanalyzer.h +++ b/lib/forwardanalyzer.h @@ -20,7 +20,6 @@ #define forwardanalyzerH #include "analyzer.h" -#include class Settings; class Token; diff --git a/lib/importproject.cpp b/lib/importproject.cpp index 4b0b2ed14..e2c525de0 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -31,7 +31,6 @@ #include #include #include -#include ImportProject::ImportProject() diff --git a/lib/path.cpp b/lib/path.cpp index 4d06a66d5..d37c8f2dd 100644 --- a/lib/path.cpp +++ b/lib/path.cpp @@ -25,9 +25,7 @@ #include #include #include -#include #include -#include #ifndef _WIN32 #include diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 2a2330499..030794ef2 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -28,7 +28,6 @@ #include #include -#include #include // back_inserter #include diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index c2696f5f0..d9ac4a496 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -7,7 +7,6 @@ #include "valueflow.h" #include #include -#include #include #include diff --git a/lib/programmemory.h b/lib/programmemory.h index 761012f28..ece9a4399 100644 --- a/lib/programmemory.h +++ b/lib/programmemory.h @@ -1,7 +1,6 @@ #ifndef GUARD_PROGRAMMEMORY_H #define GUARD_PROGRAMMEMORY_H -#include "config.h" #include "utils.h" #include "valueflow.h" // needed for alias #include "mathlib.h" diff --git a/lib/reverseanalyzer.cpp b/lib/reverseanalyzer.cpp index f11333c15..dd8c8c1be 100644 --- a/lib/reverseanalyzer.cpp +++ b/lib/reverseanalyzer.cpp @@ -3,13 +3,11 @@ #include "astutils.h" #include "errortypes.h" #include "forwardanalyzer.h" -#include "settings.h" #include "symboldatabase.h" #include "token.h" #include "valueptr.h" #include -#include struct ReverseTraversal { ReverseTraversal(const ValuePtr& analyzer, const Settings* settings) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 042a694e9..41498ae58 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -33,7 +33,6 @@ #include #include -#include #include #include #include diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index b1ccea4ee..6a20da32c 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -27,6 +27,7 @@ #include "token.h" #include "utils.h" +#include #include #include #include diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index b92675486..94cabaad9 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/utils.cpp b/lib/utils.cpp index 1791f830d..9df998005 100644 --- a/lib/utils.cpp +++ b/lib/utils.cpp @@ -20,6 +20,7 @@ #include #include +#include int caseInsensitiveStringCompare(const std::string &lhs, const std::string &rhs) diff --git a/lib/utils.h b/lib/utils.h index 525623aa1..8b697f505 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -23,7 +23,6 @@ #include "config.h" -#include #include #include #include diff --git a/oss-fuzz/translate.cpp b/oss-fuzz/translate.cpp index 379dd5c1b..ef8a7b1b3 100644 --- a/oss-fuzz/translate.cpp +++ b/oss-fuzz/translate.cpp @@ -1,6 +1,6 @@ -#include #include +#include #include "type2.h" diff --git a/test/options.cpp b/test/options.cpp index 74fb30b8b..08452bd8b 100644 --- a/test/options.cpp +++ b/test/options.cpp @@ -16,8 +16,6 @@ #include "options.h" -#include - options::options(int argc, const char* const argv[]) :mWhichTests(argv + 1, argv + argc) ,mQuiet(mWhichTests.count("-q") != 0) diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 698c89689..2d81e62b8 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -27,9 +27,7 @@ #include "tokenize.h" #include -#include #include -#include #include diff --git a/test/testclass.cpp b/test/testclass.cpp index 1b3cfff4a..96c2b7506 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -19,7 +19,6 @@ #include #include "checkclass.h" -#include "ctu.h" #include "library.h" #include "settings.h" #include "testsuite.h" diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index bba0578b7..20750d4dc 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include diff --git a/test/testexprengine.cpp b/test/testexprengine.cpp index 33fe56278..f23671a3d 100644 --- a/test/testexprengine.cpp +++ b/test/testexprengine.cpp @@ -25,7 +25,6 @@ #include "tokenize.h" #include "testsuite.h" -#include #include class TestExprEngine : public TestFixture { diff --git a/test/testfilelister.cpp b/test/testfilelister.cpp index 124c92512..25c1a206d 100644 --- a/test/testfilelister.cpp +++ b/test/testfilelister.cpp @@ -20,7 +20,6 @@ #include "pathmatch.h" #include "testsuite.h" -#include #include #include #include diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp index 5c8d478a7..feb73df39 100644 --- a/test/testlibrary.cpp +++ b/test/testlibrary.cpp @@ -26,7 +26,6 @@ #include #include -#include #include #include diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index a4ebc6c0a..ab92b6505 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -24,7 +24,6 @@ #include "tokenize.h" #include -#include #include diff --git a/test/testsamples.cpp b/test/testsamples.cpp index d064eb9d1..cceb6d4cf 100644 --- a/test/testsamples.cpp +++ b/test/testsamples.cpp @@ -27,12 +27,9 @@ #include "testsuite.h" #include -#include -#include #include #include #include -#include #include #include #include diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index fb5480c93..390b631fc 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -23,7 +23,6 @@ #include "tokenize.h" #include "tokenlist.h" -#include #include diff --git a/test/testsuppressions.cpp b/test/testsuppressions.cpp index 7913395ad..f9757bac0 100644 --- a/test/testsuppressions.cpp +++ b/test/testsuppressions.cpp @@ -23,7 +23,6 @@ #include "testsuite.h" #include "threadexecutor.h" -#include #include #include #include diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index da5c389f6..fd3286e97 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -27,8 +27,6 @@ #include "tokenize.h" #include "tokenlist.h" -#include -#include #include #include #include diff --git a/test/testthreadexecutor.cpp b/test/testthreadexecutor.cpp index 3b4a8449a..5aa00e24c 100644 --- a/test/testthreadexecutor.cpp +++ b/test/testthreadexecutor.cpp @@ -20,9 +20,7 @@ #include "testsuite.h" #include "threadexecutor.h" -#include #include -#include #include #include diff --git a/test/testunusedfunctions.cpp b/test/testunusedfunctions.cpp index 53eb72b3a..a90e95b09 100644 --- a/test/testunusedfunctions.cpp +++ b/test/testunusedfunctions.cpp @@ -22,7 +22,6 @@ #include "testsuite.h" #include "tokenize.h" -#include #include class TestUnusedFunctions : public TestFixture { diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 2147193a9..ec4949350 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/tools/dmake.cpp b/tools/dmake.cpp index e541d4242..988553d70 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include "../cli/filelister.h" #include "../lib/pathmatch.h" diff --git a/tools/triage/mainwindow.h b/tools/triage/mainwindow.h index 406e857c7..09592832c 100644 --- a/tools/triage/mainwindow.h +++ b/tools/triage/mainwindow.h @@ -2,11 +2,11 @@ #define MAINWINDOW_H #include -#include #include -#include #include +class QListWidgetItem; +class QTextStream; namespace Ui { class MainWindow; }