From 4bf5dcd29fcbff562d6a6dba933b1daf2d9df486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sun, 14 Aug 2022 12:44:19 +0200 Subject: [PATCH] cleaned up includes based on include-what-you-use (#4358) * cleaned up includes based on include-what-you-use * testlibrary.cpp: no need for `empyString` optimization --- cli/cmdlineparser.cpp | 1 + cli/cppcheckexecutor.cpp | 1 - lib/analyzerinfo.h | 1 + lib/astutils.h | 4 +++- lib/checkmemoryleak.cpp | 1 + lib/pathmatch.cpp | 1 + lib/platform.cpp | 1 - lib/preprocessor.cpp | 2 -- lib/preprocessor.h | 4 +++- lib/symboldatabase.h | 1 + lib/tokenize.cpp | 1 - lib/tokenize.h | 2 -- lib/tokenlist.cpp | 1 + lib/tokenlist.h | 1 + test/testlibrary.cpp | 2 +- test/testother.cpp | 1 - test/testpreprocessor.cpp | 1 + 17 files changed, 15 insertions(+), 11 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 960ab2cb2..446642a68 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #ifdef HAVE_RULES // xml is used for rules diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index 4d3ee752e..b622adeba 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -32,7 +32,6 @@ #include "preprocessor.h" #include "settings.h" #include "suppressions.h" -#include "threadexecutor.h" #include "utils.h" #include "checkunusedfunctions.h" diff --git a/lib/analyzerinfo.h b/lib/analyzerinfo.h index 26b0ae151..ae9d084cd 100644 --- a/lib/analyzerinfo.h +++ b/lib/analyzerinfo.h @@ -24,6 +24,7 @@ #include "config.h" #include "importproject.h" +#include #include #include #include diff --git a/lib/astutils.h b/lib/astutils.h index 9fbf706a8..1eeffb640 100644 --- a/lib/astutils.h +++ b/lib/astutils.h @@ -26,13 +26,15 @@ #include #include #include +#include +#include #include #include "config.h" #include "errortypes.h" +#include "library.h" #include "symboldatabase.h" -class Library; class Settings; class Token; diff --git a/lib/checkmemoryleak.cpp b/lib/checkmemoryleak.cpp index ba877ea14..4e347cde3 100644 --- a/lib/checkmemoryleak.cpp +++ b/lib/checkmemoryleak.cpp @@ -29,6 +29,7 @@ #include #include +#include #include //--------------------------------------------------------------------------- diff --git a/lib/pathmatch.cpp b/lib/pathmatch.cpp index 2131f4a70..a1fda0f64 100644 --- a/lib/pathmatch.cpp +++ b/lib/pathmatch.cpp @@ -22,6 +22,7 @@ #include "utils.h" #include +#include PathMatch::PathMatch(std::vector excludedPaths, bool caseSensitive) : mExcludedPaths(std::move(excludedPaths)), mCaseSensitive(caseSensitive) diff --git a/lib/platform.cpp b/lib/platform.cpp index 35cc9f3dc..578a365f1 100644 --- a/lib/platform.cpp +++ b/lib/platform.cpp @@ -20,7 +20,6 @@ #include "path.h" -#include #include #include #include diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index c212ff16f..aa1f07148 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -29,8 +29,6 @@ #include #include -#include -#include #include // back_inserter #include #include diff --git a/lib/preprocessor.h b/lib/preprocessor.h index 26a436415..cc641368b 100644 --- a/lib/preprocessor.h +++ b/lib/preprocessor.h @@ -24,7 +24,7 @@ #include "config.h" #include -#include +#include #include #include #include @@ -32,6 +32,8 @@ #include #include +#include + class ErrorLogger; class Settings; diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index abef43245..5b5fb6711 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -22,6 +22,7 @@ //--------------------------------------------------------------------------- #include "config.h" +#include "errortypes.h" #include "library.h" #include "mathlib.h" #include "sourcelocation.h" diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 0856fb84d..1a0a0fa5a 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/tokenize.h b/lib/tokenize.h index 7362ec41a..28934713f 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -29,8 +29,6 @@ #include #include #include -#include -#include #include class Settings; diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 2239b674a..c258cbec2 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -23,6 +23,7 @@ #include "errorlogger.h" #include "errortypes.h" #include "library.h" +#include "mathlib.h" #include "path.h" #include "settings.h" #include "standards.h" diff --git a/lib/tokenlist.h b/lib/tokenlist.h index 0167fd87f..c51e65a8f 100644 --- a/lib/tokenlist.h +++ b/lib/tokenlist.h @@ -24,6 +24,7 @@ #include "config.h" #include "token.h" +#include #include #include #include diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp index 6bf72d0de..a03602155 100644 --- a/test/testlibrary.cpp +++ b/test/testlibrary.cpp @@ -521,7 +521,7 @@ private: const Library::ArgumentChecks::MinSize &m = minsizes->front(); ASSERT(Library::ArgumentChecks::MinSize::Type::VALUE == m.type); ASSERT_EQUALS(500, m.value); - ASSERT_EQUALS(emptyString, m.baseType); + ASSERT_EQUALS("", m.baseType); } // arg5: type=value diff --git a/test/testother.cpp b/test/testother.cpp index 80c74ea94..525b7dbb5 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -27,7 +27,6 @@ #include "tokenize.h" #include -#include #include #include #include diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 43c5c3bd1..7b7406457 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -24,6 +24,7 @@ #include "platform.h" #include "preprocessor.h" #include "settings.h" +#include "suppressions.h" #include "testsuite.h" #include "testutils.h"