From 639d7354555ab22d15252cd1c3a763c72b3430fc Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 17 Oct 2025 20:55:30 +0200 Subject: [PATCH] cleaned up includes based on include-what-you-use --- cli/cppcheckexecutor.cpp | 1 + gui/threadresult.cpp | 4 ---- lib/astutils.cpp | 1 - lib/checkother.cpp | 1 + lib/checkunusedvar.cpp | 1 + lib/checkunusedvar.h | 3 --- lib/cppcheck.cpp | 2 -- lib/cppcheck.h | 1 - lib/importproject.cpp | 1 - lib/pathmatch.cpp | 1 + lib/preprocessor.cpp | 1 + lib/preprocessor.h | 1 - lib/programmemory.cpp | 2 +- lib/smallvector.h | 2 +- lib/symboldatabase.cpp | 1 + lib/token.h | 1 + lib/tokenize.cpp | 2 +- lib/tokenlist.h | 2 +- lib/utils.cpp | 1 - test/fixture.h | 3 +-- test/testclangimport.cpp | 1 + test/testcppcheck.cpp | 1 - test/testexecutor.cpp | 1 + test/testincompletestatement.cpp | 1 + test/testlibrary.cpp | 1 - test/testother.cpp | 1 + test/testprogrammemory.cpp | 3 +++ test/testregex.cpp | 1 + test/teststring.cpp | 1 + test/testsuppressions.cpp | 1 + test/testuninitvar.cpp | 1 + test/testunusedprivfunc.cpp | 1 + test/testunusedvar.cpp | 1 + 33 files changed, 25 insertions(+), 22 deletions(-) diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index 5457621a0c5..4b9809556b8 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -33,6 +33,7 @@ #include "errortypes.h" #include "filesettings.h" #include "json.h" +#include "path.h" #include "settings.h" #include "singleexecutor.h" #include "suppressions.h" diff --git a/gui/threadresult.cpp b/gui/threadresult.cpp index 8cbd5bd6d88..ea858c92e4a 100644 --- a/gui/threadresult.cpp +++ b/gui/threadresult.cpp @@ -23,11 +23,7 @@ #include "errorlogger.h" #include "errortypes.h" #include "importproject.h" -#include "path.h" -#include -#include -#include #include #include diff --git a/lib/astutils.cpp b/lib/astutils.cpp index 8c9b81f1e8d..421ab3fc996 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -37,7 +37,6 @@ #include "checkclass.h" #include -#include #include #include #include diff --git a/lib/checkother.cpp b/lib/checkother.cpp index f52b7cf8ba0..871b5905db8 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -36,6 +36,7 @@ #include "vfvalue.h" #include // find_if() +#include #include #include #include diff --git a/lib/checkunusedvar.cpp b/lib/checkunusedvar.cpp index 30e6fe45b16..887b1451da7 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/checkunusedvar.h b/lib/checkunusedvar.h index d85bbf54dd2..5ab79514cf9 100644 --- a/lib/checkunusedvar.h +++ b/lib/checkunusedvar.h @@ -24,7 +24,6 @@ #include "check.h" #include "config.h" -#include #include #include @@ -34,8 +33,6 @@ class Settings; class Token; class Type; class Variables; -class Variable; -class Function; class Tokenizer; /// @addtogroup Checks diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index fe3a29f4083..2048d6f8098 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -74,8 +74,6 @@ #include -class SymbolDatabase; - static constexpr char Version[] = CPPCHECK_VERSION_STRING; static constexpr char ExtraVersion[] = ""; diff --git a/lib/cppcheck.h b/lib/cppcheck.h index 18135efbc6c..9108ac28430 100644 --- a/lib/cppcheck.h +++ b/lib/cppcheck.h @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/lib/importproject.cpp b/lib/importproject.cpp index df77691453a..2891466d0f0 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/pathmatch.cpp b/lib/pathmatch.cpp index 19db03b87d1..b7d78f048df 100644 --- a/lib/pathmatch.cpp +++ b/lib/pathmatch.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index f7ccc9c0dc5..a701d29a962 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include diff --git a/lib/preprocessor.h b/lib/preprocessor.h index c1c034e2904..ddb43266454 100644 --- a/lib/preprocessor.h +++ b/lib/preprocessor.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index 6bf3a6aa22f..55419879055 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/lib/smallvector.h b/lib/smallvector.h index 41f4798184e..6665ef5f8dd 100644 --- a/lib/smallvector.h +++ b/lib/smallvector.h @@ -24,7 +24,7 @@ static constexpr std::size_t DefaultSmallVectorSize = 3; #ifdef HAVE_BOOST -#include +#include // IWYU pragma: export template using SmallVector = boost::container::small_vector; diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 2b35a90c0ed..646ca5a0380 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/token.h b/lib/token.h index 066f0b14c66..32f1c21209b 100644 --- a/lib/token.h +++ b/lib/token.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 8edeaa4ac1f..d45a7f0f351 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/lib/tokenlist.h b/lib/tokenlist.h index 76db5bb2a89..b528ebc7889 100644 --- a/lib/tokenlist.h +++ b/lib/tokenlist.h @@ -25,7 +25,7 @@ #include "standards.h" #include -#include +#include #include #include #include diff --git a/lib/utils.cpp b/lib/utils.cpp index a7c82d49048..b840fc3194b 100644 --- a/lib/utils.cpp +++ b/lib/utils.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include diff --git a/test/fixture.h b/test/fixture.h index ee46934bc29..5983ae66a3a 100644 --- a/test/fixture.h +++ b/test/fixture.h @@ -24,6 +24,7 @@ #include "color.h" #include "config.h" #include "errorlogger.h" +#include "errortypes.h" #include "platform.h" #include "settings.h" #include "standards.h" @@ -41,8 +42,6 @@ class options; class Tokenizer; -enum class Certainty : std::uint8_t; -enum class Severity : std::uint8_t; class TestFixture : public ErrorLogger { private: diff --git a/test/testclangimport.cpp b/test/testclangimport.cpp index 89f2c7b907a..c67767db0ba 100644 --- a/test/testclangimport.cpp +++ b/test/testclangimport.cpp @@ -16,6 +16,7 @@ #include "clangimport.h" #include "fixture.h" +#include "mathlib.h" #include "platform.h" #include "settings.h" #include "standards.h" diff --git a/test/testcppcheck.cpp b/test/testcppcheck.cpp index c4b818b79b9..05c0a18081a 100644 --- a/test/testcppcheck.cpp +++ b/test/testcppcheck.cpp @@ -31,7 +31,6 @@ #include "suppressions.h" #include -#include #include #include #include diff --git a/test/testexecutor.cpp b/test/testexecutor.cpp index 4f952a4004d..9e495640523 100644 --- a/test/testexecutor.cpp +++ b/test/testexecutor.cpp @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +#include "config.h" #include "errorlogger.h" #include "errortypes.h" #include "executor.h" diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index e2efce8dacd..7a1fbdb2dab 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -22,6 +22,7 @@ #include "settings.h" #include "fixture.h" +#include #include class TestIncompleteStatement : public TestFixture { diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp index 44b1b6660a7..5ea3a2e7120 100644 --- a/test/testlibrary.cpp +++ b/test/testlibrary.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/test/testother.cpp b/test/testother.cpp index 3f2af3c0f9a..a8c298c9a43 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -25,6 +25,7 @@ #include "standards.h" #include +#include #include static std::string unionZeroInitMessage(int lno, int cno, const std::string &varName, const std::string &largestMemberName) diff --git a/test/testprogrammemory.cpp b/test/testprogrammemory.cpp index 13a5f8e639a..1dc1cb1d909 100644 --- a/test/testprogrammemory.cpp +++ b/test/testprogrammemory.cpp @@ -21,8 +21,11 @@ #include "helpers.h" #include "token.h" #include "programmemory.h" +#include "utils.h" #include "vfvalue.h" +#include + class TestProgramMemory : public TestFixture { public: TestProgramMemory() : TestFixture("TestProgramMemory") {} diff --git a/test/testregex.cpp b/test/testregex.cpp index 3809b19796e..5003d31c0f3 100644 --- a/test/testregex.cpp +++ b/test/testregex.cpp @@ -22,6 +22,7 @@ #include "regex.h" #include +#include #include #include diff --git a/test/teststring.cpp b/test/teststring.cpp index 3969e48aec2..051aa870788 100644 --- a/test/teststring.cpp +++ b/test/teststring.cpp @@ -23,6 +23,7 @@ #include "settings.h" #include "fixture.h" +#include #include class TestString : public TestFixture { diff --git a/test/testsuppressions.cpp b/test/testsuppressions.cpp index 1db32939440..7100d98b37e 100644 --- a/test/testsuppressions.cpp +++ b/test/testsuppressions.cpp @@ -30,6 +30,7 @@ #include "suppressions.h" #include "threadexecutor.h" +#include #include #include #include diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index cf96efe22da..6f18005b2a1 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -23,6 +23,7 @@ #include "helpers.h" #include "settings.h" +#include #include #include diff --git a/test/testunusedprivfunc.cpp b/test/testunusedprivfunc.cpp index 530624f89fa..8afbf6ff6e5 100644 --- a/test/testunusedprivfunc.cpp +++ b/test/testunusedprivfunc.cpp @@ -23,6 +23,7 @@ #include "settings.h" #include "fixture.h" +#include #include class TestUnusedPrivateFunction : public TestFixture { diff --git a/test/testunusedvar.cpp b/test/testunusedvar.cpp index adc72c7f6ec..231e64e1fde 100644 --- a/test/testunusedvar.cpp +++ b/test/testunusedvar.cpp @@ -23,6 +23,7 @@ #include "preprocessor.h" #include "settings.h" +#include #include #include