cleaned up includes based on include-what-you-use (#2600)

* cleaned up includes based on include-what-you-use

* check.h: trying to work around Visual Studio 2012 bug

* fixed Visual Studio compilation
This commit is contained in:
Oliver Stöneberg 2020-04-13 13:44:48 +02:00 committed by GitHub
parent 5c02eea0b6
commit 2c1e36e63e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 98 additions and 84 deletions

View File

@ -29,7 +29,6 @@
#include "pathmatch.h"
#include "preprocessor.h"
#include "settings.h"
#include "standards.h"
#include "suppressions.h"
#include "threadexecutor.h"
#include "utils.h"

View File

@ -19,8 +19,8 @@
#ifndef THREADEXECUTOR_H
#define THREADEXECUTOR_H
#include "config.h"
#include "errorlogger.h"
#include "importproject.h"
#include <cstddef>
#include <list>
@ -32,6 +32,8 @@
#elif defined(_WIN32)
#define THREADING_MODEL_WIN
#include <windows.h>
#include "importproject.h"
#endif
class Settings;

View File

@ -22,10 +22,10 @@
#include <QThread>
#include "cppcheck.h"
#include "threadresult.h"
#include "suppressions.h"
class Settings;
class ThreadResult;
/// @addtogroup GUI
/// @{

View File

@ -1,6 +1,7 @@
#include <QtWidgets>
#include <QShortcut>
#include "codeeditor.h"
#include "codeeditorstyle.h"
Highlighter::Highlighter(QTextDocument *parent,

View File

@ -5,16 +5,13 @@
#include <QPlainTextEdit>
#include <QObject>
#include <QRegularExpression>
#include "codeeditorstyle.h"
class CodeEditorStyle;
class QPaintEvent;
class QResizeEvent;
class QSize;
class QWidget;
class LineNumberArea;
class Highlighter : public QSyntaxHighlighter {
Q_OBJECT

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "codeeditor.h"
#include "codeeditstyledialog.h"
#include "codeeditstylecontrols.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QFormLayout>

View File

@ -21,10 +21,12 @@
#include <QDialog>
#include <QPushButton>
#include "codeeditstylecontrols.h"
#include "codeeditor.h"
#include "codeeditorstyle.h"
class CodeEditor;
class SelectColorButton;
class SelectFontWeightCombo;
class StyleEditDialog : public QDialog {
Q_OBJECT
public:

View File

@ -20,6 +20,7 @@
#include <QString>
#include <QDir>
#include <QTextStream>
#include "erroritem.h"
#include "report.h"
#include "csvreport.h"

View File

@ -24,8 +24,6 @@
#include <QMetaType>
#include "errorlogger.h"
class ErrorLine;
/// @addtogroup GUI
/// @{

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "erroritem.h"
#include "printablereport.h"
#include <QDir>

View File

@ -26,7 +26,6 @@
#include "common.h"
#include "importproject.h"
#include "path.h"
#include "settings.h"
ProjectFile::ProjectFile(QObject *parent) :

View File

@ -22,7 +22,8 @@
#include <QObject>
#include <QString>
#include <QFile>
#include "erroritem.h"
class ErrorItem;
/// @addtogroup GUI
/// @{

View File

@ -17,6 +17,7 @@
*/
#include <QDir>
#include "erroritem.h"
#include "txtreport.h"
TxtReport::TxtReport(const QString &filename) :

View File

@ -22,8 +22,8 @@
#include <QString>
#include <QList>
#include "report.h"
#include "erroritem.h"
class ErrorItem;
class QObject;
/// @addtogroup GUI

View File

@ -23,6 +23,7 @@
//---------------------------------------------------------------------------
#include <functional>
#include <set>
#include <string>
#include <vector>
@ -31,7 +32,6 @@
class Library;
class Settings;
class Scope;
class Token;
class Variable;

View File

@ -19,6 +19,7 @@
//---------------------------------------------------------------------------
#include "check.h"
#include "settings.h"
#include <iostream>

View File

@ -22,11 +22,8 @@
//---------------------------------------------------------------------------
#include "config.h"
#include "errorlogger.h"
#include "settings.h"
#include "token.h"
#include "tokenize.h"
#include "valueflow.h"
#include <list>
#include <string>
@ -39,6 +36,13 @@ namespace CTU {
class FileInfo;
}
namespace ValueFlow {
class Value;
}
class Settings;
class Token;
/** Use WRONG_DATA in checkers to mark conditions that check that data is correct */
#define WRONG_DATA(COND, TOK) (wrongData((TOK), (COND), #COND))
@ -110,10 +114,10 @@ public:
}
// Return true if an error is reported.
virtual bool analyseWholeProgram(const CTU::FileInfo *ctu, const std::list<FileInfo*> &fileInfo, const Settings& settings, ErrorLogger &errorLogger) {
virtual bool analyseWholeProgram(const CTU::FileInfo *ctu, const std::list<FileInfo*> &fileInfo, const Settings& /*settings*/, ErrorLogger &errorLogger) {
(void)ctu;
(void)fileInfo;
(void)settings;
//(void)settings;
(void)errorLogger;
return false;
}

View File

@ -24,10 +24,10 @@
#include "check.h"
#include "config.h"
#include "errorlogger.h"
#include <string>
class ErrorLogger;
class Settings;
class Token;
class Tokenizer;

View File

@ -27,7 +27,6 @@
#include "symboldatabase.h"
#include "token.h"
#include "tokenize.h"
#include "valueflow.h"
#include <cstddef>
#include <list>

View File

@ -29,7 +29,6 @@
#include "symboldatabase.h"
#include "token.h"
#include "tokenize.h"
#include "tokenlist.h"
#include "utils.h"
#include "valueflow.h"
@ -38,8 +37,6 @@
#include <cstdlib>
#include <numeric> // std::accumulate
#include <sstream>
#include <stack>
#include <utility>
//---------------------------------------------------------------------------

View File

@ -25,10 +25,9 @@
#include "check.h"
#include "config.h"
#include "ctu.h"
#include "errorlogger.h"
#include "mathlib.h"
#include "tokenize.h"
#include "symboldatabase.h"
#include "valueflow.h"
#include <cstddef>
#include <list>
@ -36,6 +35,14 @@
#include <string>
#include <vector>
namespace tinyxml2 {
class XMLElement;
}
class ErrorLogger;
class Settings;
class Token;
class Tokenizer;
/// @addtogroup Checks
/// @{

View File

@ -31,7 +31,6 @@
#include <algorithm>
#include <cstdlib>
#include <stack>
#include <utility>
//---------------------------------------------------------------------------

View File

@ -24,11 +24,11 @@
#include "check.h"
#include "config.h"
#include "errorlogger.h"
#include "mathlib.h"
#include <string>
class ErrorLogger;
class Settings;
class Token;
class Tokenizer;

View File

@ -26,7 +26,6 @@
#include "errorlogger.h"
#include "token.h"
#include "tokenize.h"
#include "utils.h"
#include <list>
#include <string>

View File

@ -21,8 +21,10 @@
#include "checkinternal.h"
#include "astutils.h"
#include "errorlogger.h"
#include "symboldatabase.h"
#include "utils.h"
#include "token.h"
#include "tokenize.h"
#include <set>
#include <cstring>

View File

@ -24,6 +24,7 @@
#include "check.h"
#include "config.h"
#include "settings.h"
#include <string>

View File

@ -31,7 +31,6 @@
#include "symboldatabase.h"
#include "token.h"
#include "tokenize.h"
#include "valueflow.h"
#include <cstddef>
#include <iostream>

View File

@ -21,20 +21,15 @@
#include "astutils.h"
#include "library.h"
#include "mathlib.h"
#include "settings.h"
#include "standards.h"
#include "symboldatabase.h"
#include "token.h"
#include "tokenize.h"
#include "tokenlist.h"
#include "utils.h"
#include "valueflow.h"
#include <algorithm>
#include <cstddef>
#include <set>
#include <stack>
//---------------------------------------------------------------------------

View File

@ -43,7 +43,6 @@
class Function;
class Scope;
class Settings;
class SymbolDatabase;
class Token;
class Variable;

View File

@ -23,11 +23,11 @@
#include "astutils.h"
#include "errorlogger.h"
#include "library.h"
#include "mathlib.h"
#include "settings.h"
#include "symboldatabase.h"
#include "token.h"
#include "tokenize.h"
#include "utils.h"
#include <algorithm>
#include <cctype>

View File

@ -36,7 +36,6 @@
#include <list>
#include <map>
#include <ostream>
#include <set>
#include <utility>
//---------------------------------------------------------------------------

View File

@ -24,13 +24,17 @@
#include "check.h"
#include "config.h"
#include "valueflow.h"
#include "errorlogger.h"
#include "utils.h"
#include <cstddef>
#include <string>
#include <vector>
class ErrorLogger;
namespace ValueFlow {
class Value;
}
class Settings;
class Token;
class Tokenizer;

View File

@ -18,8 +18,9 @@
#include "checkstl.h"
#include "checknullpointer.h"
#include "errorlogger.h"
#include "library.h"
#include "mathlib.h"
#include "settings.h"
#include "standards.h"
#include "symboldatabase.h"

View File

@ -24,13 +24,13 @@
#include "check.h"
#include "config.h"
#include "library.h"
#include "errorlogger.h"
#include "tokenize.h"
#include "utils.h"
#include "valueflow.h"
#include <map>
#include <string>
class ErrorLogger;
class Scope;
class Settings;
class Token;

View File

@ -31,14 +31,18 @@
#include "tokenize.h"
#include "valueflow.h"
#include <tinyxml2.h>
#include <cassert>
#include <cstddef>
#include <list>
#include <map>
#include <stack>
#include <utility>
namespace tinyxml2 {
class XMLElement;
}
//---------------------------------------------------------------------------
// Register this check class (by creating a static instance of it)

View File

@ -25,13 +25,15 @@
#include "check.h"
#include "config.h"
#include "ctu.h"
#include "errorlogger.h"
#include "mathlib.h"
#include "settings.h"
#include "utils.h"
#include <set>
#include <string>
class ErrorLogger;
class Scope;
class Settings;
class Token;
class Tokenizer;
class Variable;

View File

@ -28,7 +28,6 @@
#include "preprocessor.h" // Preprocessor
#include "suppressions.h"
#include "timer.h"
#include "token.h"
#include "tokenize.h" // Tokenizer
#include "tokenlist.h"
#include "version.h"

View File

@ -20,6 +20,7 @@
//---------------------------------------------------------------------------
#include "ctu.h"
#include "astutils.h"
#include "settings.h"
#include "symboldatabase.h"
#include <tinyxml2.h>
#include <iterator> // back_inserter

View File

@ -26,10 +26,9 @@
#include <functional>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include <stdint.h>
#include <cstdint>
class ErrorLogger;
class Tokenizer;

View File

@ -3,6 +3,7 @@
#include "settings.h"
#include "symboldatabase.h"
#include "token.h"
#include "valueptr.h"
#include <functional>

View File

@ -19,11 +19,11 @@
#ifndef forwardanalyzerH
#define forwardanalyzerH
#include "token.h"
#include "valueptr.h"
#include <vector>
class Settings;
class Token;
struct ForwardAnalyzer {
struct Action {

View File

@ -20,10 +20,10 @@
#include "path.h"
#include "settings.h"
#include "suppressions.h"
#include "tinyxml2.h"
#include "token.h"
#include "tokenize.h"
#include "tokenlist.h"
#include "utils.h"
#define PICOJSON_USE_INT64
#include <picojson.h>

View File

@ -1,10 +1,8 @@
#include "pathanalysis.h"
#include "astutils.h"
#include "library.h"
#include "mathlib.h"
#include "settings.h"
#include "symboldatabase.h"
#include "token.h"
#include "valueflow.h"
const Scope* PathAnalysis::findOuterScope(const Scope * scope)
{

View File

@ -4,10 +4,8 @@
#include <functional>
#include "errorlogger.h"
#include "utils.h"
class Library;
class Settings;
class Scope;
class Token;

View File

@ -1,13 +1,14 @@
#ifndef GUARD_PROGRAMMEMORY_H
#define GUARD_PROGRAMMEMORY_H
#include "config.h"
#include "utils.h"
#include "valueflow.h"
#include "mathlib.h"
#include <map>
#include <unordered_map>
class Token;
struct ProgramMemory {
using Map = std::unordered_map<nonneg int, ValueFlow::Value>;
Map values;

View File

@ -30,8 +30,6 @@
#include <sstream>
#include <utility>
class ErrorLogger;
static bool isAcceptedErrorIdChar(char c)
{
switch (c) {

View File

@ -24,7 +24,6 @@
#include <istream>
#include <list>
#include <set>
#include <string>
#include <vector>

View File

@ -24,8 +24,8 @@
#include "config.h"
#include "library.h"
#include "mathlib.h"
#include "platform.h"
#include "token.h"
#include "utils.h"
#include <cstddef>
#include <list>
@ -35,6 +35,10 @@
#include <utility>
#include <vector>
namespace cppcheck {
class Platform;
}
class ErrorLogger;
class Function;
class Scope;

View File

@ -22,7 +22,6 @@
#include "check.h"
#include "library.h"
#include "mathlib.h"
#include "path.h"
#include "platform.h"
#include "settings.h"
#include "standards.h"

View File

@ -20,9 +20,10 @@
#include "tokenlist.h"
#include "errorlogger.h"
#include "mathlib.h"
#include "library.h"
#include "path.h"
#include "settings.h"
#include "standards.h"
#include "token.h"
#include <simplecpp.h>

View File

@ -28,7 +28,6 @@
#include <vector>
class Settings;
class Token;
namespace simplecpp {
class TokenList;

View File

@ -17,11 +17,13 @@
*/
#include "check.h"
#include "checkbufferoverrun.h"
#include "config.h"
#include "ctu.h"
#include "library.h"
#include "settings.h"
#include "testsuite.h"
#include "token.h"
#include "tokenize.h"
#include <tinyxml2.h>

View File

@ -16,9 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "exprengine.h"
#include "library.h"
#include "platform.h"
#include "settings.h"
#include "symboldatabase.h"
#include "token.h"
#include "tokenize.h"
#include "testsuite.h"

View File

@ -16,22 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "checkmemoryleak.h"
#include "preprocessor.h"
#include "config.h"
#include "settings.h"
#include "simplecpp.h"
#include "standards.h"
#include "symboldatabase.h"
#include "testsuite.h"
#include "token.h"
#include "tokenize.h"
#include "tokenlist.h"
#include <list>
#include <ostream>
#include <string>
#include <vector>
struct InternalError;
class TestMemleak : private TestFixture {

View File

@ -16,8 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "check.h"
#include "checknullpointer.h"
#include "checkuninitvar.h"
#include "config.h"
#include "ctu.h"
#include "library.h"
#include "settings.h"
#include "testsuite.h"
@ -25,7 +27,6 @@
#include "tokenize.h"
#include <simplecpp.h>
#include <tinyxml2.h>
#include <list>
#include <map>
#include <string>

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "errorlogger.h"
#include "config.h"
#include "platform.h"
#include "testsuite.h"

View File

@ -16,13 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "cppcheckexecutor.h"
#include "errorlogger.h"
#include "cppcheck.h"
#include "filelister.h"
#include "path.h"
#include "pathmatch.h"
#include "redirect.h"
#include "settings.h"
#include "testsuite.h"
#include <algorithm>

View File

@ -17,12 +17,12 @@
*/
#include "config.h"
#include "platform.h"
#include "settings.h"
#include "testsuite.h"
#include "token.h"
#include "tokenize.h"
#include "tokenlist.h"
struct InternalError;

View File

@ -22,7 +22,6 @@
#include "suppressions.h"
#include "testsuite.h"
#include "threadexecutor.h"
#include "path.h"
#include <cstddef>
#include <list>

View File

@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "library.h"
#include "platform.h"
#include "settings.h"
#include "symboldatabase.h"
@ -24,7 +26,6 @@
#include "token.h"
#include "tokenize.h"
#include "tokenlist.h"
#include "utils.h"
#include <climits>
#include <cstddef>