From 02fa7f5b40bf09c898584d259d54021f04b0f252 Mon Sep 17 00:00:00 2001 From: firewave Date: Wed, 14 Feb 2024 06:08:25 +0100 Subject: [PATCH] cleaned up includes based on include-what-you-use --- Makefile | 8 ++++---- cli/signalhandler.h | 2 ++ gui/checkthread.h | 2 ++ gui/mainwindow.cpp | 1 + gui/mainwindow.h | 3 ++- gui/projectfiledialog.cpp | 1 + gui/resultstree.cpp | 3 +++ gui/test/projectfile/testprojectfile.cpp | 2 ++ gui/threadresult.cpp | 1 - gui/xmlreportv2.cpp | 3 +++ lib/checkbufferoverrun.cpp | 1 + lib/checkunusedfunctions.cpp | 4 ---- lib/clangimport.cpp | 1 + lib/cppcheck.h | 1 + lib/errorlogger.cpp | 1 + lib/settings.cpp | 5 +++-- lib/settings.h | 3 +++ test/fixture.h | 2 ++ test/signal/test-signalhandler.cpp | 1 + test/signal/test-stacktrace.cpp | 2 ++ test/testcmdlineparser.cpp | 1 - test/testerrorlogger.cpp | 1 + test/testimportproject.cpp | 1 + test/testpath.cpp | 2 ++ test/testpathmatch.cpp | 1 + test/testprocessexecutor.cpp | 3 +-- test/testsettings.cpp | 3 +++ test/testsimplifytypedef.cpp | 1 + test/testsingleexecutor.cpp | 3 +-- test/testsuppressions.cpp | 2 -- test/testsymboldatabase.cpp | 3 --- test/testthreadexecutor.cpp | 2 +- test/testtoken.cpp | 1 + test/testunusedvar.cpp | 1 + test/testvarid.cpp | 1 + 35 files changed, 50 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 41177cbc9bd4..314bf5c4e66e 100644 --- a/Makefile +++ b/Makefile @@ -805,7 +805,7 @@ test/testpostfixoperator.o: test/testpostfixoperator.cpp lib/addoninfo.h lib/che test/testpreprocessor.o: test/testpreprocessor.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testpreprocessor.cpp -test/testprocessexecutor.o: test/testprocessexecutor.cpp cli/executor.h cli/processexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/checkunusedfunctions.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h test/redirect.h +test/testprocessexecutor.o: test/testprocessexecutor.cpp cli/executor.h cli/processexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h test/redirect.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testprocessexecutor.cpp test/testsettings.o: test/testsettings.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h @@ -823,7 +823,7 @@ test/testsimplifytypedef.o: test/testsimplifytypedef.cpp lib/addoninfo.h lib/che test/testsimplifyusing.o: test/testsimplifyusing.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsimplifyusing.cpp -test/testsingleexecutor.o: test/testsingleexecutor.cpp cli/executor.h cli/singleexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/checkunusedfunctions.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h test/redirect.h +test/testsingleexecutor.o: test/testsingleexecutor.cpp cli/executor.h cli/singleexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h test/redirect.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsingleexecutor.cpp test/testsizeof.o: test/testsizeof.cpp lib/addoninfo.h lib/check.h lib/checksizeof.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h @@ -838,13 +838,13 @@ test/teststring.o: test/teststring.cpp lib/addoninfo.h lib/check.h lib/checkstri test/testsummaries.o: test/testsummaries.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/summaries.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsummaries.cpp -test/testsuppressions.o: test/testsuppressions.cpp cli/cppcheckexecutor.h cli/executor.h cli/processexecutor.h cli/singleexecutor.h cli/threadexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/checkunusedfunctions.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h +test/testsuppressions.o: test/testsuppressions.cpp cli/cppcheckexecutor.h cli/executor.h cli/processexecutor.h cli/singleexecutor.h cli/threadexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsuppressions.cpp test/testsymboldatabase.o: test/testsymboldatabase.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsymboldatabase.cpp -test/testthreadexecutor.o: test/testthreadexecutor.cpp cli/executor.h cli/threadexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/checkunusedfunctions.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h test/redirect.h +test/testthreadexecutor.o: test/testthreadexecutor.cpp cli/executor.h cli/threadexecutor.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/tokenize.h lib/tokenlist.h lib/utils.h test/fixture.h test/helpers.h test/redirect.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testthreadexecutor.cpp test/testtimer.o: test/testtimer.cpp lib/addoninfo.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.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/fixture.h diff --git a/cli/signalhandler.h b/cli/signalhandler.h index b900de6991c8..334b60145912 100644 --- a/cli/signalhandler.h +++ b/cli/signalhandler.h @@ -23,6 +23,8 @@ #if defined(USE_UNIX_SIGNAL_HANDLING) +#include + /** * @param f Output file */ diff --git a/gui/checkthread.h b/gui/checkthread.h index 0cea2d73549a..2b415bef6c51 100644 --- a/gui/checkthread.h +++ b/gui/checkthread.h @@ -24,6 +24,8 @@ #include "suppressions.h" #include +#include +#include #include #include diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index b23a8aeebae1..b42a81a232c4 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -39,6 +39,7 @@ #include "report.h" #include "resultsview.h" #include "scratchpad.h" +#include "settings.h" #include "showtypes.h" #include "statsdialog.h" #include "settingsdialog.h" diff --git a/gui/mainwindow.h b/gui/mainwindow.h index b0f059218cfb..5214b690ddca 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -20,12 +20,12 @@ #define MAINWINDOW_H #include "library.h" -#include "settings.h" #include "platforms.h" #include #include #include +#include #include #include @@ -43,6 +43,7 @@ class ImportProject; class QCloseEvent; class QNetworkAccessManager; class QNetworkReply; +class Settings; namespace Ui { class MainWindow; } diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp index b7c69861cfd6..47ef75e317f9 100644 --- a/gui/projectfiledialog.cpp +++ b/gui/projectfiledialog.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 747f06cd6dd8..56c90f3a8a1a 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -23,6 +23,7 @@ #include "common.h" #include "config.h" #include "erroritem.h" +#include "errorlogger.h" #include "errortypes.h" #include "path.h" #include "projectfile.h" @@ -32,6 +33,8 @@ #include "threadhandler.h" #include "xmlreportv2.h" +#include + #include #include #include diff --git a/gui/test/projectfile/testprojectfile.cpp b/gui/test/projectfile/testprojectfile.cpp index 505a6e8937c1..8dee64092067 100644 --- a/gui/test/projectfile/testprojectfile.cpp +++ b/gui/test/projectfile/testprojectfile.cpp @@ -26,6 +26,8 @@ #include +#include +#include #include #include #include diff --git a/gui/threadresult.cpp b/gui/threadresult.cpp index 8f5989b885a7..1dbec569eb61 100644 --- a/gui/threadresult.cpp +++ b/gui/threadresult.cpp @@ -27,7 +27,6 @@ #include #include -#include void ThreadResult::reportOut(const std::string &outmsg, Color /*c*/) { diff --git a/gui/xmlreportv2.cpp b/gui/xmlreportv2.cpp index 3bb5190e1837..583e865d678c 100644 --- a/gui/xmlreportv2.cpp +++ b/gui/xmlreportv2.cpp @@ -21,8 +21,11 @@ #include "cppcheck.h" #include "erroritem.h" #include "report.h" +#include "settings.h" #include "xmlreport.h" +#include + #include #include #include diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 0dbb06562ffc..2e6111b8d01b 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -40,6 +40,7 @@ #include #include // std::accumulate #include +#include #include "xml.h" diff --git a/lib/checkunusedfunctions.cpp b/lib/checkunusedfunctions.cpp index 63ed6b78ac53..292652fb019f 100644 --- a/lib/checkunusedfunctions.cpp +++ b/lib/checkunusedfunctions.cpp @@ -43,10 +43,6 @@ #include "xml.h" -namespace CTU { - class FileInfo; -} - //--------------------------------------------------------------------------- static const CWE CWE561(561U); // Dead Code diff --git a/lib/clangimport.cpp b/lib/clangimport.cpp index b23e448b8932..aa46a1ff2591 100644 --- a/lib/clangimport.cpp +++ b/lib/clangimport.cpp @@ -21,6 +21,7 @@ #include "errortypes.h" #include "mathlib.h" #include "settings.h" +#include "standards.h" #include "symboldatabase.h" #include "token.h" #include "tokenize.h" diff --git a/lib/cppcheck.h b/lib/cppcheck.h index f8f2627d1af6..64c5e0b3164f 100644 --- a/lib/cppcheck.h +++ b/lib/cppcheck.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index a81dee2146ea..f2c5f74c19b3 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -21,6 +21,7 @@ #include "color.h" #include "cppcheck.h" #include "path.h" +#include "settings.h" #include "suppressions.h" #include "token.h" #include "tokenlist.h" diff --git a/lib/settings.cpp b/lib/settings.cpp index e0402de3f85c..738202483d17 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -21,8 +21,9 @@ #include "summaries.h" #include "vfvalue.h" -#include -#include +#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep #include "json.h" diff --git a/lib/settings.h b/lib/settings.h index 825a4b7f73e8..aad106fed507 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -33,12 +33,15 @@ #include #include #include +#include #include +#include #include #include #include #include #include +#include enum class SHOWTIME_MODES; namespace ValueFlow { diff --git a/test/fixture.h b/test/fixture.h index e4eb34395adb..d2ec804f41d6 100644 --- a/test/fixture.h +++ b/test/fixture.h @@ -30,10 +30,12 @@ #include "standards.h" #include +#include #include #include #include #include +#include #include class options; diff --git a/test/signal/test-signalhandler.cpp b/test/signal/test-signalhandler.cpp index 4be872564d19..023137c2a918 100644 --- a/test/signal/test-signalhandler.cpp +++ b/test/signal/test-signalhandler.cpp @@ -23,6 +23,7 @@ #include #include +#include #include // static functions are omitted from trace diff --git a/test/signal/test-stacktrace.cpp b/test/signal/test-stacktrace.cpp index 8cace95fb9e4..dd9a68485c07 100644 --- a/test/signal/test-stacktrace.cpp +++ b/test/signal/test-stacktrace.cpp @@ -21,6 +21,8 @@ #ifdef USE_UNIX_BACKTRACE_SUPPORT #include "stacktrace.h" +#include + // static functions are omitted from trace /*static*/ void my_func_2() diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 1df0a2ca761f..a552b6525565 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -33,7 +33,6 @@ #include "timer.h" #include "utils.h" -#include #include #include #include diff --git a/test/testerrorlogger.cpp b/test/testerrorlogger.cpp index b49b634448db..49fc814ffa01 100644 --- a/test/testerrorlogger.cpp +++ b/test/testerrorlogger.cpp @@ -24,6 +24,7 @@ #include #include +#include #include "xml.h" diff --git a/test/testimportproject.cpp b/test/testimportproject.cpp index 049e399a561b..d8d65af4f10e 100644 --- a/test/testimportproject.cpp +++ b/test/testimportproject.cpp @@ -26,6 +26,7 @@ #include #include // IWYU pragma: keep #include +#include #include class TestImporter : public ImportProject { diff --git a/test/testpath.cpp b/test/testpath.cpp index 61b49ef5f502..7e563ee57dfa 100644 --- a/test/testpath.cpp +++ b/test/testpath.cpp @@ -19,7 +19,9 @@ #include "path.h" #include "fixture.h" #include "helpers.h" +#include "standards.h" +#include #include #include diff --git a/test/testpathmatch.cpp b/test/testpathmatch.cpp index 4aa580b478e1..615cb2b1246a 100644 --- a/test/testpathmatch.cpp +++ b/test/testpathmatch.cpp @@ -20,6 +20,7 @@ #include "fixture.h" #include +#include #include diff --git a/test/testprocessexecutor.cpp b/test/testprocessexecutor.cpp index 808f9ec49ff2..1331ee037ab7 100644 --- a/test/testprocessexecutor.cpp +++ b/test/testprocessexecutor.cpp @@ -16,16 +16,15 @@ * along with this program. If not, see . */ -#include "checkunusedfunctions.h" #include "processexecutor.h" #include "redirect.h" #include "settings.h" #include "filesettings.h" #include "fixture.h" #include "helpers.h" +#include "suppressions.h" #include "timer.h" -#include #include #include #include diff --git a/test/testsettings.cpp b/test/testsettings.cpp index 1a2d27a16678..803e49dcb541 100644 --- a/test/testsettings.cpp +++ b/test/testsettings.cpp @@ -21,6 +21,9 @@ #include "settings.h" #include "fixture.h" #include "helpers.h" +#include "suppressions.h" + + class TestSettings : public TestFixture { public: diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index 3fecfb6e3cde..37c76de4eaac 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -22,6 +22,7 @@ #include "platform.h" #include "settings.h" #include "fixture.h" +#include "standards.h" #include "token.h" #include "tokenize.h" #include "tokenlist.h" diff --git a/test/testsingleexecutor.cpp b/test/testsingleexecutor.cpp index 8062fed5ea1c..b858a98cfe9c 100644 --- a/test/testsingleexecutor.cpp +++ b/test/testsingleexecutor.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ -#include "checkunusedfunctions.h" #include "cppcheck.h" #include "filesettings.h" #include "fixture.h" @@ -24,9 +23,9 @@ #include "redirect.h" #include "settings.h" #include "singleexecutor.h" +#include "suppressions.h" #include "timer.h" -#include #include #include #include diff --git a/test/testsuppressions.cpp b/test/testsuppressions.cpp index 0f80af45e4e4..927d6938d693 100644 --- a/test/testsuppressions.cpp +++ b/test/testsuppressions.cpp @@ -16,7 +16,6 @@ * along with this program. If not, see . */ -#include "checkunusedfunctions.h" #include "config.h" #include "cppcheck.h" #include "cppcheckexecutor.h" @@ -30,7 +29,6 @@ #include "threadexecutor.h" #include "singleexecutor.h" -#include #include #include #include diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index b3e0818d8e56..4bdf44796dff 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -19,7 +19,6 @@ #include "errortypes.h" #include "fixture.h" #include "helpers.h" -#include "library.h" #include "platform.h" #include "settings.h" #include "sourcelocation.h" @@ -34,12 +33,10 @@ #include #include #include -#include #include #include #include #include -#include #include class TestSymbolDatabase; diff --git a/test/testthreadexecutor.cpp b/test/testthreadexecutor.cpp index 9bed9009bfc7..0216fb1ef203 100644 --- a/test/testthreadexecutor.cpp +++ b/test/testthreadexecutor.cpp @@ -16,12 +16,12 @@ * along with this program. If not, see . */ -#include "checkunusedfunctions.h" #include "redirect.h" #include "settings.h" #include "filesettings.h" #include "fixture.h" #include "helpers.h" +#include "suppressions.h" #include "threadexecutor.h" #include "timer.h" diff --git a/test/testtoken.cpp b/test/testtoken.cpp index a93a8dda529d..1a75ccc30842 100644 --- a/test/testtoken.cpp +++ b/test/testtoken.cpp @@ -20,6 +20,7 @@ #include "errortypes.h" #include "fixture.h" #include "helpers.h" +#include "standards.h" #include "token.h" #include "tokenize.h" #include "tokenlist.h" diff --git a/test/testunusedvar.cpp b/test/testunusedvar.cpp index 5bd59e6f5dc9..9f81ec5cf56f 100644 --- a/test/testunusedvar.cpp +++ b/test/testunusedvar.cpp @@ -22,6 +22,7 @@ #include "preprocessor.h" #include "settings.h" #include "fixture.h" +#include "standards.h" #include "tokenize.h" #include diff --git a/test/testvarid.cpp b/test/testvarid.cpp index 1fc5a500dbea..9da4a4a53aba 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -27,6 +27,7 @@ #include // IWYU pragma: keep #include +#include class TestVarID : public TestFixture { public: