From d03d820ebc925b95ff9fc05d452104efdb6200a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sun, 21 Jul 2024 22:45:39 +0200 Subject: [PATCH] cleaned up includes based on include-what-you-use (#6627) --- cli/executor.h | 1 - cli/processexecutor.cpp | 1 + cli/singleexecutor.h | 3 --- cli/threadexecutor.cpp | 2 +- gui/checkthread.cpp | 2 -- gui/codeeditor.cpp | 2 -- gui/codeeditorstyle.cpp | 1 - gui/codeeditstylecontrols.cpp | 2 ++ gui/common.cpp | 1 + gui/cppchecklibrarydata.h | 1 - gui/helpdialog.h | 1 - gui/libraryeditargdialog.cpp | 1 + gui/libraryeditargdialog.h | 1 - gui/newsuppressiondialog.cpp | 2 ++ gui/newsuppressiondialog.h | 1 - gui/projectfiledialog.cpp | 1 + gui/resultstree.cpp | 2 ++ gui/resultsview.h | 2 +- gui/scratchpad.h | 1 - lib/checkcondition.cpp | 1 + lib/checkleakautovar.cpp | 1 - lib/checkleakautovar.h | 1 + lib/checkother.cpp | 1 + lib/checkunusedvar.cpp | 1 + lib/color.cpp | 1 - lib/cppcheck.h | 1 + lib/forwardanalyzer.cpp | 1 + lib/fwdanalysis.cpp | 2 +- lib/preprocessor.h | 1 + lib/settings.h | 1 + lib/token.h | 2 ++ lib/tokenlist.cpp | 1 + lib/valueflow.cpp | 1 + lib/vf_common.h | 2 ++ lib/vf_enumvalue.cpp | 2 +- lib/vf_settokenvalue.cpp | 1 - test/fixture.cpp | 1 + test/fixture.h | 1 - test/helpers.h | 4 ++++ test/testassert.cpp | 2 ++ test/testastutils.cpp | 1 + test/testbufferoverrun.cpp | 1 - test/testcppcheck.cpp | 2 +- test/testleakautovar.cpp | 1 + test/testlibrary.cpp | 1 + test/testnullpointer.cpp | 2 -- test/testpath.cpp | 1 + test/testsimplifytypedef.cpp | 1 + test/testtokenize.cpp | 1 + 49 files changed, 42 insertions(+), 26 deletions(-) diff --git a/cli/executor.h b/cli/executor.h index 74cf3c49c9c..1b6870f9247 100644 --- a/cli/executor.h +++ b/cli/executor.h @@ -24,7 +24,6 @@ #include #include #include -#include class Settings; class ErrorLogger; diff --git a/cli/processexecutor.cpp b/cli/processexecutor.cpp index eaba040ae8f..a85552c7014 100644 --- a/cli/processexecutor.cpp +++ b/cli/processexecutor.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/cli/singleexecutor.h b/cli/singleexecutor.h index b1d9ef5c67f..1a208607066 100644 --- a/cli/singleexecutor.h +++ b/cli/singleexecutor.h @@ -21,10 +21,7 @@ #include "executor.h" -#include #include -#include -#include class ErrorLogger; class Settings; diff --git a/cli/threadexecutor.cpp b/cli/threadexecutor.cpp index 5d4d3a760e6..ca671668e6f 100644 --- a/cli/threadexecutor.cpp +++ b/cli/threadexecutor.cpp @@ -26,7 +26,7 @@ #include "timer.h" #include -#include +#include #include #include #include diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index 40ec77a8c86..4218535986d 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -31,13 +31,11 @@ #include "utils.h" #include -#include #include #include #include #include #include -#include #include #include diff --git a/gui/codeeditor.cpp b/gui/codeeditor.cpp index 0399541bde0..07620ea3cec 100644 --- a/gui/codeeditor.cpp +++ b/gui/codeeditor.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -31,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/gui/codeeditorstyle.cpp b/gui/codeeditorstyle.cpp index e99ce2f65fa..f69ef0adc10 100644 --- a/gui/codeeditorstyle.cpp +++ b/gui/codeeditorstyle.cpp @@ -19,7 +19,6 @@ #include "codeeditorstyle.h" #include -#include #include CodeEditorStyle::CodeEditorStyle( diff --git a/gui/codeeditstylecontrols.cpp b/gui/codeeditstylecontrols.cpp index 8d5c3ec9ca8..0cacb2796bd 100644 --- a/gui/codeeditstylecontrols.cpp +++ b/gui/codeeditstylecontrols.cpp @@ -20,6 +20,8 @@ #include #include +#include +#include #include class QWidget; diff --git a/gui/common.cpp b/gui/common.cpp index abbd5666808..55bdf5dbd14 100644 --- a/gui/common.cpp +++ b/gui/common.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/gui/cppchecklibrarydata.h b/gui/cppchecklibrarydata.h index a442780c3c2..88ac477f28d 100644 --- a/gui/cppchecklibrarydata.h +++ b/gui/cppchecklibrarydata.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/gui/helpdialog.h b/gui/helpdialog.h index 075005fd8f2..fd9c14e418d 100644 --- a/gui/helpdialog.h +++ b/gui/helpdialog.h @@ -21,7 +21,6 @@ #include #include -#include #include #include diff --git a/gui/libraryeditargdialog.cpp b/gui/libraryeditargdialog.cpp index bf971afc450..ac2a2a6357a 100644 --- a/gui/libraryeditargdialog.cpp +++ b/gui/libraryeditargdialog.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include class QWidget; diff --git a/gui/libraryeditargdialog.h b/gui/libraryeditargdialog.h index 190f3d8f644..238dc84a02e 100644 --- a/gui/libraryeditargdialog.h +++ b/gui/libraryeditargdialog.h @@ -24,7 +24,6 @@ #include #include #include -#include class QWidget; namespace Ui { diff --git a/gui/newsuppressiondialog.cpp b/gui/newsuppressiondialog.cpp index 40f5e87f14c..3052f9e5f54 100644 --- a/gui/newsuppressiondialog.cpp +++ b/gui/newsuppressiondialog.cpp @@ -24,10 +24,12 @@ #include "ui_newsuppressiondialog.h" +#include #include #include #include +#include #include class QWidget; diff --git a/gui/newsuppressiondialog.h b/gui/newsuppressiondialog.h index cba4de74272..88ea1fda949 100644 --- a/gui/newsuppressiondialog.h +++ b/gui/newsuppressiondialog.h @@ -23,7 +23,6 @@ #include #include -#include class QWidget; namespace Ui { diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index 0cad08a2151..69babe4007b 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 94fa0e46f7f..c5e2b729966 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -34,6 +34,7 @@ #include "xmlreportv2.h" #include +#include #include #include @@ -53,6 +54,7 @@ #include #include #include +#include #include #include #include diff --git a/gui/resultsview.h b/gui/resultsview.h index d1249b80abf..07cd8b7f341 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -20,7 +20,6 @@ #ifndef RESULTSVIEW_H #define RESULTSVIEW_H -#include "common.h" #include "report.h" #include "showtypes.h" @@ -38,6 +37,7 @@ class QPrinter; class QSettings; class CheckStatistics; class QPoint; +enum class ReportType : std::uint8_t; namespace Ui { class ResultsView; } diff --git a/gui/scratchpad.h b/gui/scratchpad.h index bd75afe93e6..384e2543c94 100644 --- a/gui/scratchpad.h +++ b/gui/scratchpad.h @@ -21,7 +21,6 @@ #include #include -#include class MainWindow; namespace Ui { diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index 2a9db39e69f..deb98ef62d3 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -35,6 +35,7 @@ #include "checkother.h" // comparisonNonZeroExpressionLessThanZero and testIfNonZeroExpressionIsPositive #include +#include #include #include #include diff --git a/lib/checkleakautovar.cpp b/lib/checkleakautovar.cpp index ed41e364e11..f9465163097 100644 --- a/lib/checkleakautovar.cpp +++ b/lib/checkleakautovar.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include diff --git a/lib/checkleakautovar.h b/lib/checkleakautovar.h index 225763572ed..12f60978894 100644 --- a/lib/checkleakautovar.h +++ b/lib/checkleakautovar.h @@ -31,6 +31,7 @@ #include #include #include +#include class ErrorLogger; class Settings; diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 794b84a0c7b..6c8abb1f4b1 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -37,6 +37,7 @@ #include // find_if() #include +#include #include #include #include diff --git a/lib/checkunusedvar.cpp b/lib/checkunusedvar.cpp index ae9e8c8f240..d7290dc2578 100644 --- a/lib/checkunusedvar.cpp +++ b/lib/checkunusedvar.cpp @@ -32,6 +32,7 @@ #include "valueflow.h" #include +#include #include #include #include diff --git a/lib/color.cpp b/lib/color.cpp index 0e9fc91c16b..2a29fb61376 100644 --- a/lib/color.cpp +++ b/lib/color.cpp @@ -18,7 +18,6 @@ #include "color.h" -#include #include #include #include diff --git a/lib/cppcheck.h b/lib/cppcheck.h index 373f3d7731e..fd851af64d9 100644 --- a/lib/cppcheck.h +++ b/lib/cppcheck.h @@ -38,6 +38,7 @@ #include #include #include +#include #include class TokenList; diff --git a/lib/forwardanalyzer.cpp b/lib/forwardanalyzer.cpp index cf46497205c..3b35df6789e 100644 --- a/lib/forwardanalyzer.cpp +++ b/lib/forwardanalyzer.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/fwdanalysis.cpp b/lib/fwdanalysis.cpp index 5a0bf28638d..fe175c2db92 100644 --- a/lib/fwdanalysis.cpp +++ b/lib/fwdanalysis.cpp @@ -27,8 +27,8 @@ #include "vfvalue.h" #include -#include #include +#include static bool isUnchanged(const Token *startToken, const Token *endToken, const std::set &exprVarIds, bool local) { diff --git a/lib/preprocessor.h b/lib/preprocessor.h index e186ce03761..7bb198e3fa5 100644 --- a/lib/preprocessor.h +++ b/lib/preprocessor.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/lib/settings.h b/lib/settings.h index 7fa2918a15f..755ff1b43fe 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -41,6 +41,7 @@ #include #include #include +#include enum class SHOWTIME_MODES : std::uint8_t; namespace ValueFlow { diff --git a/lib/token.h b/lib/token.h index 87ccea46350..646e5183d4b 100644 --- a/lib/token.h +++ b/lib/token.h @@ -28,6 +28,7 @@ #include "utils.h" #include "vfvalue.h" +#include #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include #include diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 970bad3a221..ae129f4c412 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -32,6 +32,7 @@ #include "token.h" #include +#include #include #include #include diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 86e4e360ff2..f36f8b8ec07 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -113,6 +113,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/vf_common.h b/lib/vf_common.h index 1b6e4610b5a..8e9a7a042ae 100644 --- a/lib/vf_common.h +++ b/lib/vf_common.h @@ -25,6 +25,8 @@ #include "symboldatabase.h" #include "vfvalue.h" +#include +#include #include class Token; diff --git a/lib/vf_enumvalue.cpp b/lib/vf_enumvalue.cpp index ba0e177d171..634169aff06 100644 --- a/lib/vf_enumvalue.cpp +++ b/lib/vf_enumvalue.cpp @@ -22,9 +22,9 @@ #include "symboldatabase.h" #include "token.h" #include "valueflow.h" +#include "vfvalue.h" #include -#include #include namespace ValueFlow diff --git a/lib/vf_settokenvalue.cpp b/lib/vf_settokenvalue.cpp index 4bd7bfd8f37..b6c4ac255d8 100644 --- a/lib/vf_settokenvalue.cpp +++ b/lib/vf_settokenvalue.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include diff --git a/test/fixture.cpp b/test/fixture.cpp index a4deb169307..6f79bd70f96 100644 --- a/test/fixture.cpp +++ b/test/fixture.cpp @@ -21,6 +21,7 @@ #include "cppcheck.h" #include "errortypes.h" #include "helpers.h" +#include "library.h" #include "options.h" #include "redirect.h" diff --git a/test/fixture.h b/test/fixture.h index ff16164b65a..a494d2d7408 100644 --- a/test/fixture.h +++ b/test/fixture.h @@ -24,7 +24,6 @@ #include "color.h" #include "config.h" #include "errorlogger.h" -#include "library.h" #include "platform.h" #include "settings.h" #include "standards.h" diff --git a/test/helpers.h b/test/helpers.h index 16ea8817636..6bb4248dcc8 100644 --- a/test/helpers.h +++ b/test/helpers.h @@ -20,6 +20,7 @@ #define helpersH #include "config.h" +#include "library.h" #include "preprocessor.h" #include "settings.h" #include "standards.h" @@ -40,6 +41,9 @@ class ErrorLogger; namespace simplecpp { struct DUI; } +namespace tinyxml2 { + class XMLDocument; +} // TODO: make Tokenizer private class SimpleTokenizer : public Tokenizer { diff --git a/test/testassert.cpp b/test/testassert.cpp index 98e90a0e77a..dea22df00aa 100644 --- a/test/testassert.cpp +++ b/test/testassert.cpp @@ -23,6 +23,8 @@ #include "helpers.h" #include "settings.h" +#include + class TestAssert : public TestFixture { public: TestAssert() : TestFixture("TestAssert") {} diff --git a/test/testastutils.cpp b/test/testastutils.cpp index edf98955de1..f7a55c9c2b6 100644 --- a/test/testastutils.cpp +++ b/test/testastutils.cpp @@ -24,6 +24,7 @@ #include "token.h" #include "tokenlist.h" +#include #include class TestAstUtils : public TestFixture { diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index e1f6f03b26a..9a70e62cded 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -22,7 +22,6 @@ #include "ctu.h" #include "errortypes.h" #include "helpers.h" -#include "standards.h" #include "platform.h" #include "settings.h" #include "fixture.h" diff --git a/test/testcppcheck.cpp b/test/testcppcheck.cpp index 58ae75b8ede..34f07414dd9 100644 --- a/test/testcppcheck.cpp +++ b/test/testcppcheck.cpp @@ -29,7 +29,7 @@ #include #include #include - +#include class TestCppcheck : public TestFixture { public: diff --git a/test/testleakautovar.cpp b/test/testleakautovar.cpp index 286c1a75c24..3c86d7568f8 100644 --- a/test/testleakautovar.cpp +++ b/test/testleakautovar.cpp @@ -22,6 +22,7 @@ #include "settings.h" #include "tokenize.h" +#include #include #include diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp index 0a31a950141..e59086b940b 100644 --- a/test/testlibrary.cpp +++ b/test/testlibrary.cpp @@ -26,6 +26,7 @@ #include "tokenlist.h" #include +#include #include #include #include diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index 6a026119d30..5caf5515f94 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -29,9 +29,7 @@ #include #include -#include #include -#include #include class TestNullPointer : public TestFixture { diff --git a/test/testpath.cpp b/test/testpath.cpp index 5461ebe2b96..7be1f9a2436 100644 --- a/test/testpath.cpp +++ b/test/testpath.cpp @@ -21,6 +21,7 @@ #include "helpers.h" #include "standards.h" +#include #include #include #include diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index 611f9fd36fd..7c1555000f5 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -26,6 +26,7 @@ #include "tokenize.h" #include "tokenlist.h" +#include #include #include #include diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index bd9b2cd358c..93bd2466131 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -28,6 +28,7 @@ #include "tokenize.h" #include "tokenlist.h" +#include #include #include #include