From a4b2bcb3496c0b8fe86ac0a8935c273a460c3780 Mon Sep 17 00:00:00 2001 From: firewave Date: Sun, 7 Jan 2024 09:58:35 +0100 Subject: [PATCH 1/2] iwyu.xml: treat externals as system includes --- .github/workflows/iwyu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index e796155c544..f52895e6f48 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -63,7 +63,7 @@ jobs: # TODO: switch to Qt 6 after we enabled the Qt mappings again - name: Prepare CMake run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off + cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On - name: Prepare CMake dependencies run: | @@ -140,7 +140,7 @@ jobs: - name: Prepare CMake run: | - cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off + cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DENABLE_CHECK_INTERNAL=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCPPCHK_GLIBCXX_DEBUG=Off -DUSE_MATCHCOMPILER=Off -DEXTERNALS_AS_SYSTEM=On env: CC: clang-17 CXX: clang++-17 From b313dc6facf93f94732db5aad833d056c8010403 Mon Sep 17 00:00:00 2001 From: firewave Date: Sun, 7 Jan 2024 09:58:51 +0100 Subject: [PATCH 2/2] cleaned up includes based on `include-what-you-use` --- cli/cmdlineparser.cpp | 1 + cli/cppcheckexecutor.cpp | 1 + cli/executor.cpp | 2 +- lib/checkleakautovar.cpp | 1 + lib/forwardanalyzer.cpp | 2 ++ lib/programmemory.cpp | 3 +-- lib/symboldatabase.cpp | 2 +- lib/templatesimplifier.cpp | 1 + lib/token.cpp | 1 + lib/xml.h | 2 +- test/testcmdlineparser.cpp | 1 + test/testcppcheck.cpp | 1 + 12 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 82ef08a4179..79cf7e7f525 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include // EXIT_FAILURE #include diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index a9bd31b62d1..40fa87842a0 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -50,6 +50,7 @@ #include #include #include // IWYU pragma: keep +#include #include #include diff --git a/cli/executor.cpp b/cli/executor.cpp index 5282376a7b8..b5e27643d70 100644 --- a/cli/executor.cpp +++ b/cli/executor.cpp @@ -20,10 +20,10 @@ #include "color.h" #include "errorlogger.h" +#include "library.h" #include "settings.h" #include "suppressions.h" -#include #include #include // IWYU pragma: keep #include diff --git a/lib/checkleakautovar.cpp b/lib/checkleakautovar.cpp index d6d86a6f17f..f58e05d66c1 100644 --- a/lib/checkleakautovar.cpp +++ b/lib/checkleakautovar.cpp @@ -32,6 +32,7 @@ #include "symboldatabase.h" #include "token.h" #include "tokenize.h" +#include "tokenlist.h" #include "utils.h" #include "vfvalue.h" diff --git a/lib/forwardanalyzer.cpp b/lib/forwardanalyzer.cpp index 61b9ee517e6..ee391b1a5fa 100644 --- a/lib/forwardanalyzer.cpp +++ b/lib/forwardanalyzer.cpp @@ -26,10 +26,12 @@ #include "settings.h" #include "symboldatabase.h" #include "token.h" +#include "utils.h" #include "valueptr.h" #include "vfvalue.h" #include +#include #include #include #include diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index b6ade0d9834..96b79098aed 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -34,14 +34,13 @@ #include #include #include +#include #include #include #include #include #include -#include - ExprIdToken::ExprIdToken(const Token* tok) : tok(tok), exprid(tok ? tok->exprId() : 0) {} nonneg int ExprIdToken::getExpressionId() const { diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index be63697ec3d..413a7684fee 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -43,11 +43,11 @@ #include #include #include -#include #include // IWYU pragma: keep #include #include #include +#include #include #include //--------------------------------------------------------------------------- diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index b7e0b318b69..d04a79769be 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include static Token *skipRequires(Token *tok) diff --git a/lib/token.cpp b/lib/token.cpp index 8ee4b0194e4..5be97b9b426 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -42,6 +42,7 @@ #include #include // IWYU pragma: keep #include +#include #include #include diff --git a/lib/xml.h b/lib/xml.h index b2c2c34fce0..3620f0d99e6 100644 --- a/lib/xml.h +++ b/lib/xml.h @@ -26,7 +26,7 @@ SUPPRESS_WARNING_CLANG_PUSH("-Wextra-semi-stmt") SUPPRESS_WARNING_CLANG_PUSH("-Wsuggest-override") SUPPRESS_WARNING_CLANG_PUSH("-Wsuggest-destructor-override") -#include +#include // IWYU pragma: export SUPPRESS_WARNING_CLANG_POP SUPPRESS_WARNING_CLANG_POP diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 2cb87695e0f..17ea65f6ca8 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -20,6 +20,7 @@ #include "cmdlineparser.h" #include "config.h" #include "cppcheckexecutor.h" +#include "errorlogger.h" #include "errortypes.h" #include "helpers.h" #include "path.h" diff --git a/test/testcppcheck.cpp b/test/testcppcheck.cpp index 36ca8d59dd5..8bcc1bee18d 100644 --- a/test/testcppcheck.cpp +++ b/test/testcppcheck.cpp @@ -22,6 +22,7 @@ #include "filesettings.h" #include "fixture.h" #include "helpers.h" +#include "settings.h" #include #include