diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 1daa54ce203..abba6f32b3f 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -82,7 +82,7 @@ jobs: - name: iwyu_tool run: | PWD=$(pwd) - iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --mapping_file=$PWD/qt5.imp > iwyu.log + iwyu_tool -p cmake.output -j $(nproc) -- -w -Xiwyu --max_line_length=1024 -Xiwyu --comment_style=long -Xiwyu --quoted_includes_first -Xiwyu --update_comments -Xiwyu --mapping_file=$PWD/qt5.imp > iwyu.log - uses: actions/upload-artifact@v3 if: success() || failure() diff --git a/Makefile b/Makefile index f5844225c3b..dfe5082d216 100644 --- a/Makefile +++ b/Makefile @@ -833,7 +833,7 @@ test/testsizeof.o: test/testsizeof.cpp lib/addoninfo.h lib/check.h lib/checksize test/teststl.o: test/teststl.cpp lib/addoninfo.h lib/check.h lib/checkstl.h lib/color.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/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/teststl.cpp -test/teststring.o: test/teststring.cpp externals/simplecpp/simplecpp.h lib/addoninfo.h lib/check.h lib/checkstring.h lib/color.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/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h +test/teststring.o: test/teststring.cpp lib/addoninfo.h lib/check.h lib/checkstring.h lib/color.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/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/teststring.cpp 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/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/summaries.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 diff --git a/cli/cppcheckexecutorsig.cpp b/cli/cppcheckexecutorsig.cpp index c5347d8e5ac..567b6c79cf8 100644 --- a/cli/cppcheckexecutorsig.cpp +++ b/cli/cppcheckexecutorsig.cpp @@ -30,6 +30,7 @@ #include #include #include +//#include // __USE_DYNAMIC_STACK_SIZE #include #include #include @@ -48,7 +49,7 @@ # include #endif - +// TODO: __USE_DYNAMIC_STACK_SIZE is depedent on the features.h include and not a built-in compiler define, so it might be problematic to depedent on it #ifdef __USE_DYNAMIC_STACK_SIZE static const size_t MYSTACKSIZE = 16*1024+32768; // wild guess about a reasonable buffer #else diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index b7ac15602b8..8d54380dbb5 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -23,6 +23,7 @@ #include "common.h" #include "config.h" #include "erroritem.h" +#include "errortypes.h" #include "path.h" #include "projectfile.h" #include "report.h" diff --git a/gui/resultstree.h b/gui/resultstree.h index 53ba0906754..8d855766082 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -20,7 +20,6 @@ #ifndef RESULTSTREE_H #define RESULTSTREE_H -#include "errortypes.h" #include "showtypes.h" #include @@ -40,6 +39,7 @@ class ThreadHandler; class QContextMenuEvent; class QKeyEvent; class QSettings; +enum class Severity; /// @addtogroup GUI /// @{ diff --git a/gui/showtypes.cpp b/gui/showtypes.cpp index d59b708438f..4ece3ae6ab2 100644 --- a/gui/showtypes.cpp +++ b/gui/showtypes.cpp @@ -19,6 +19,7 @@ #include "showtypes.h" #include "common.h" +#include "errortypes.h" #include diff --git a/gui/showtypes.h b/gui/showtypes.h index 3cff501cf3f..96dc45aec3a 100644 --- a/gui/showtypes.h +++ b/gui/showtypes.h @@ -19,10 +19,10 @@ #ifndef SHOWTYPES_H #define SHOWTYPES_H -#include "errortypes.h" - #include +enum class Severity; + /// @addtogroup GUI /// @{ diff --git a/lib/astutils.h b/lib/astutils.h index 111c2a61d86..3677a4ddb68 100644 --- a/lib/astutils.h +++ b/lib/astutils.h @@ -23,6 +23,7 @@ //--------------------------------------------------------------------------- #include +#include #include #include #include diff --git a/lib/checkio.cpp b/lib/checkio.cpp index 583bbc23e0b..55a6c414ab4 100644 --- a/lib/checkio.cpp +++ b/lib/checkio.cpp @@ -19,6 +19,7 @@ //--------------------------------------------------------------------------- #include "checkio.h" +#include "errortypes.h" #include "library.h" #include "mathlib.h" #include "platform.h" diff --git a/lib/checkio.h b/lib/checkio.h index 3e9d15bb972..1293bc0de66 100644 --- a/lib/checkio.h +++ b/lib/checkio.h @@ -23,7 +23,6 @@ #include "check.h" #include "config.h" -#include "errortypes.h" #include "tokenize.h" #include @@ -34,6 +33,7 @@ class Settings; class Token; class Variable; class ErrorLogger; +enum class Severity; /// @addtogroup Checks /// @{ diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index 57aacdd2faa..2459adb0b6c 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -21,6 +21,7 @@ #include "astutils.h" #include "errorlogger.h" +#include "errortypes.h" #include "library.h" #include "mathlib.h" #include "platform.h" diff --git a/lib/checkmemoryleak.h b/lib/checkmemoryleak.h index ef8e0564c66..20309873c14 100644 --- a/lib/checkmemoryleak.h +++ b/lib/checkmemoryleak.h @@ -34,7 +34,6 @@ #include "check.h" #include "config.h" -#include "errortypes.h" #include "tokenize.h" #include @@ -46,6 +45,8 @@ class Settings; class Token; class Variable; class ErrorLogger; +struct CWE; +enum class Severity; /// @addtogroup Core /// @{ diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index e07ffbe866c..093cf69d56b 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/config.h b/lib/config.h index d6ef3c37dc0..3f98796bee7 100644 --- a/lib/config.h +++ b/lib/config.h @@ -159,6 +159,7 @@ static const std::string emptyString; #define USE_WINDOWS_SEH #endif +// TODO: __GLIBC__ is depedent on the features.h include and not a built-in compiler define, so it might be problematic to depedent on it #if !defined(NO_UNIX_BACKTRACE_SUPPORT) && defined(__GNUC__) && defined(__GLIBC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__NetBSD__) && !defined(__SVR4) && !defined(__QNX__) #define USE_UNIX_BACKTRACE_SUPPORT #endif diff --git a/lib/keywords.cpp b/lib/keywords.cpp index 192b5faac81..ab4ab92307d 100644 --- a/lib/keywords.cpp +++ b/lib/keywords.cpp @@ -20,8 +20,6 @@ #include "utils.h" -#include - // see https://en.cppreference.com/w/c/keyword #define C90_KEYWORDS \ diff --git a/lib/library.cpp b/lib/library.cpp index 1bd06904d5a..bcf7dab7de0 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -19,6 +19,7 @@ #include "library.h" #include "astutils.h" +#include "errortypes.h" #include "mathlib.h" #include "path.h" #include "symboldatabase.h" @@ -31,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/library.h b/lib/library.h index e45683a56f6..e27ca384290 100644 --- a/lib/library.h +++ b/lib/library.h @@ -23,7 +23,6 @@ #include "config.h" #include "mathlib.h" -#include "errortypes.h" #include "standards.h" #include @@ -37,6 +36,7 @@ class Token; class Settings; +enum class Severity; namespace tinyxml2 { class XMLDocument; diff --git a/lib/pathanalysis.cpp b/lib/pathanalysis.cpp index 0404dba58c4..b15bffb95d4 100644 --- a/lib/pathanalysis.cpp +++ b/lib/pathanalysis.cpp @@ -26,7 +26,6 @@ #include #include #include -#include const Scope* PathAnalysis::findOuterScope(const Scope * scope) { diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 6dbedeafc61..665baf4ca69 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include //--------------------------------------------------------------------------- diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 8afe804e801..a235527df76 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -36,7 +36,6 @@ #include #include #include -#include #include #include diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 329bdd3bfbb..1aac2d76b6f 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -21,6 +21,7 @@ #include "check.h" #include "errorlogger.h" +#include "errortypes.h" #include "library.h" #include "mathlib.h" #include "platform.h" @@ -50,7 +51,6 @@ #include // IWYU pragma: keep #include #include -#include #include #include #include diff --git a/lib/tokenize.h b/lib/tokenize.h index 07b526ca08c..17ae2f5d3c2 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -22,7 +22,6 @@ //--------------------------------------------------------------------------- #include "config.h" -#include "errortypes.h" #include "tokenlist.h" #include @@ -40,6 +39,7 @@ class TemplateSimplifier; class ErrorLogger; class Preprocessor; class VariableMap; +enum class Severity; namespace simplecpp { class TokenList; diff --git a/lib/utils.h b/lib/utils.h index 73aec4aa172..d5721574abf 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -31,6 +31,7 @@ #include #include #include +#include #include struct SelectMapKeys { diff --git a/test/fixture.h b/test/fixture.h index 07710b49afa..49e7655138a 100644 --- a/test/fixture.h +++ b/test/fixture.h @@ -24,7 +24,6 @@ #include "color.h" #include "config.h" #include "errorlogger.h" -#include "errortypes.h" #include "library.h" #include "platform.h" #include "settings.h" @@ -39,6 +38,8 @@ class options; class Tokenizer; +enum class Certainty; +enum class Severity; class TestFixture : public ErrorLogger { private: diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 3bc957d7cf3..ed7ef85d0f1 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -16,11 +16,13 @@ * along with this program. If not, see . */ +#include "cmdlinelogger.h" #include "cmdlineparser.h" #include "config.h" #include "cppcheckexecutor.h" #include "errortypes.h" #include "helpers.h" +#include "importproject.h" #include "platform.h" #include "redirect.h" #include "settings.h" @@ -33,8 +35,11 @@ #include #include #include +#include #include +#include #include +#include #include class TestCmdlineParser : public TestFixture { diff --git a/test/testprocessexecutor.cpp b/test/testprocessexecutor.cpp index 94fe7ee8d7b..0bcfb447ef9 100644 --- a/test/testprocessexecutor.cpp +++ b/test/testprocessexecutor.cpp @@ -26,7 +26,6 @@ #include "library.h" #include -#include #include #include #include diff --git a/test/testsingleexecutor.cpp b/test/testsingleexecutor.cpp index a5f6a519e22..054e8a5472b 100644 --- a/test/testsingleexecutor.cpp +++ b/test/testsingleexecutor.cpp @@ -27,7 +27,6 @@ #include "timer.h" #include -#include #include #include #include diff --git a/test/teststring.cpp b/test/teststring.cpp index 57cea1b9773..8d443e215b4 100644 --- a/test/teststring.cpp +++ b/test/teststring.cpp @@ -28,8 +28,6 @@ #include #include -#include - class TestString : public TestFixture { public: TestString() : TestFixture("TestString") {} diff --git a/test/testthreadexecutor.cpp b/test/testthreadexecutor.cpp index 49d2160b3a9..c37223b26ce 100644 --- a/test/testthreadexecutor.cpp +++ b/test/testthreadexecutor.cpp @@ -26,7 +26,6 @@ #include "timer.h" #include -#include #include #include #include