Format with uncrustify (#3388)
This commit is contained in:
parent
f361106770
commit
7f358b2bed
File diff suppressed because it is too large
Load Diff
|
@ -102,8 +102,7 @@ CmdLineParser::CmdLineParser(Settings *settings)
|
|||
, mShowVersion(false)
|
||||
, mShowErrorMessages(false)
|
||||
, mExitAfterPrint(false)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void CmdLineParser::printMessage(const std::string &message)
|
||||
{
|
||||
|
|
|
@ -81,8 +81,7 @@
|
|||
|
||||
CppCheckExecutor::CppCheckExecutor()
|
||||
: mSettings(nullptr), mLatestProgressOutputTime(0), mErrorOutput(nullptr), mBugHuntingReport(nullptr), mShowAllErrors(false)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
CppCheckExecutor::~CppCheckExecutor()
|
||||
{
|
||||
|
@ -250,7 +249,7 @@ void CppCheckExecutor::setSettings(const Settings &settings)
|
|||
* \return size of array
|
||||
* */
|
||||
template<typename T, int size>
|
||||
std::size_t getArrayLength(const T(&)[size])
|
||||
std::size_t getArrayLength(const T (&)[size])
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
@ -589,15 +588,15 @@ namespace {
|
|||
};
|
||||
typedef BOOL (WINAPI *fpStackWalk64)(DWORD, HANDLE, HANDLE, LPSTACKFRAME64, PVOID, PREAD_PROCESS_MEMORY_ROUTINE64, PFUNCTION_TABLE_ACCESS_ROUTINE64, PGET_MODULE_BASE_ROUTINE64, PTRANSLATE_ADDRESS_ROUTINE64);
|
||||
fpStackWalk64 pStackWalk64;
|
||||
typedef DWORD64(WINAPI *fpSymGetModuleBase64)(HANDLE, DWORD64);
|
||||
typedef DWORD64 (WINAPI *fpSymGetModuleBase64)(HANDLE, DWORD64);
|
||||
fpSymGetModuleBase64 pSymGetModuleBase64;
|
||||
typedef BOOL (WINAPI *fpSymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
|
||||
fpSymGetSymFromAddr64 pSymGetSymFromAddr64;
|
||||
typedef BOOL (WINAPI *fpSymGetLineFromAddr64)(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
|
||||
fpSymGetLineFromAddr64 pSymGetLineFromAddr64;
|
||||
typedef DWORD (WINAPI *fpUnDecorateSymbolName)(const TCHAR*, PTSTR, DWORD, DWORD) ;
|
||||
typedef DWORD (WINAPI *fpUnDecorateSymbolName)(const TCHAR*, PTSTR, DWORD, DWORD);
|
||||
fpUnDecorateSymbolName pUnDecorateSymbolName;
|
||||
typedef PVOID(WINAPI *fpSymFunctionTableAccess64)(HANDLE, DWORD64);
|
||||
typedef PVOID (WINAPI *fpSymFunctionTableAccess64)(HANDLE, DWORD64);
|
||||
fpSymFunctionTableAccess64 pSymFunctionTableAccess64;
|
||||
typedef BOOL (WINAPI *fpSymInitialize)(HANDLE, PCSTR, BOOL);
|
||||
fpSymInitialize pSymInitialize;
|
||||
|
|
|
@ -88,7 +88,7 @@ int main(int argc, char* argv[])
|
|||
GetModuleFileNameA(nullptr, exename, sizeof(exename)/sizeof(exename[0])-1);
|
||||
argv[0] = exename;
|
||||
#endif
|
||||
|
||||
// *INDENT-OFF*
|
||||
#ifdef NDEBUG
|
||||
try {
|
||||
#endif
|
||||
|
@ -103,12 +103,13 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
return EXIT_FAILURE;
|
||||
#endif
|
||||
// *INDENT-ON*
|
||||
}
|
||||
|
||||
|
||||
// Warn about deprecated compilers
|
||||
#ifdef __clang__
|
||||
# if ( __clang_major__ < 2 || ( __clang_major__ == 2 && __clang_minor__ < 9))
|
||||
# if (__clang_major__ < 2 || (__clang_major__ == 2 && __clang_minor__ < 9))
|
||||
# warning "Using Clang 2.8 or earlier. Support for this version has been removed."
|
||||
# endif
|
||||
#elif defined(__GNUC__)
|
||||
|
|
|
@ -81,7 +81,7 @@ ThreadExecutor::~ThreadExecutor()
|
|||
|
||||
void ThreadExecutor::addFileContent(const std::string &path, const std::string &content)
|
||||
{
|
||||
mFileContents[ path ] = content;
|
||||
mFileContents[path] = content;
|
||||
}
|
||||
|
||||
int ThreadExecutor::handleRead(int rpipe, unsigned int &result)
|
||||
|
@ -139,11 +139,11 @@ int ThreadExecutor::handleRead(int rpipe, unsigned int &result)
|
|||
unsigned int fileResult = 0;
|
||||
iss >> fileResult;
|
||||
result += fileResult;
|
||||
delete [] buf;
|
||||
delete[] buf;
|
||||
return -1;
|
||||
}
|
||||
|
||||
delete [] buf;
|
||||
delete[] buf;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ unsigned int ThreadExecutor::check()
|
|||
resultOfCheck = fileChecker.check(*iFileSettings);
|
||||
} else if (!mFileContents.empty() && mFileContents.find(iFile->first) != mFileContents.end()) {
|
||||
// File content was given as a string
|
||||
resultOfCheck = fileChecker.check(iFile->first, mFileContents[ iFile->first ]);
|
||||
resultOfCheck = fileChecker.check(iFile->first, mFileContents[iFile->first]);
|
||||
} else {
|
||||
// Read file from a file
|
||||
resultOfCheck = fileChecker.check(iFile->first);
|
||||
|
@ -327,18 +327,18 @@ unsigned int ThreadExecutor::check()
|
|||
void ThreadExecutor::writeToPipe(PipeSignal type, const std::string &data)
|
||||
{
|
||||
unsigned int len = static_cast<unsigned int>(data.length() + 1);
|
||||
char *out = new char[ len + 1 + sizeof(len)];
|
||||
char *out = new char[len + 1 + sizeof(len)];
|
||||
out[0] = static_cast<char>(type);
|
||||
std::memcpy(&(out[1]), &len, sizeof(len));
|
||||
std::memcpy(&(out[1+sizeof(len)]), data.c_str(), len);
|
||||
if (write(mWpipe, out, len + 1 + sizeof(len)) <= 0) {
|
||||
delete [] out;
|
||||
delete[] out;
|
||||
out = nullptr;
|
||||
std::cerr << "#### ThreadExecutor::writeToPipe, Failed to write to pipe" << std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
delete [] out;
|
||||
delete[] out;
|
||||
}
|
||||
|
||||
void ThreadExecutor::reportOut(const std::string &outmsg, Color c)
|
||||
|
@ -523,7 +523,7 @@ void ThreadExecutor::reportInfo(const ErrorMessage &msg)
|
|||
report(msg, MessageType::REPORT_INFO);
|
||||
}
|
||||
|
||||
void ThreadExecutor::bughuntingReport(const std::string &/*str*/)
|
||||
void ThreadExecutor::bughuntingReport(const std::string & /*str*/)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
@ -562,32 +562,23 @@ void ThreadExecutor::report(const ErrorMessage &msg, MessageType msgType)
|
|||
|
||||
#else
|
||||
|
||||
void ThreadExecutor::addFileContent(const std::string &/*path*/, const std::string &/*content*/)
|
||||
{
|
||||
|
||||
}
|
||||
void ThreadExecutor::addFileContent(const std::string & /*path*/, const std::string & /*content*/)
|
||||
{}
|
||||
|
||||
unsigned int ThreadExecutor::check()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ThreadExecutor::reportOut(const std::string &/*outmsg*/, Color)
|
||||
{
|
||||
void ThreadExecutor::reportOut(const std::string & /*outmsg*/, Color)
|
||||
{}
|
||||
void ThreadExecutor::reportErr(const ErrorMessage & /*msg*/)
|
||||
{}
|
||||
|
||||
}
|
||||
void ThreadExecutor::reportErr(const ErrorMessage &/*msg*/)
|
||||
{
|
||||
void ThreadExecutor::reportInfo(const ErrorMessage & /*msg*/)
|
||||
{}
|
||||
|
||||
}
|
||||
|
||||
void ThreadExecutor::reportInfo(const ErrorMessage &/*msg*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ThreadExecutor::bughuntingReport(const std::string &/*str*/)
|
||||
{
|
||||
}
|
||||
void ThreadExecutor::bughuntingReport(const std::string & /*str*/)
|
||||
{}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
void bughuntingReport(const std::string&) override {}
|
||||
|
||||
void reportOut(const std::string &outmsg) override { }
|
||||
void reportOut(const std::string &outmsg) override {}
|
||||
void reportErr(const ErrorMessage &msg) override {
|
||||
const std::string s = msg.toString(true);
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ class QWidget;
|
|||
/// @{
|
||||
|
||||
/**
|
||||
* @brief About dialog
|
||||
*
|
||||
*/
|
||||
* @brief About dialog
|
||||
*
|
||||
*/
|
||||
class AboutDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -23,5 +23,4 @@ Application::Application(const QString &name, const QString &path,
|
|||
: mName(name)
|
||||
, mPath(path)
|
||||
, mParameters(params)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
|
|
@ -22,27 +22,27 @@
|
|||
#include <QString>
|
||||
|
||||
/**
|
||||
* @brief A class containing information of the application to execute.
|
||||
*
|
||||
* Each application has a name and a path. Name is displayed to the user
|
||||
* and has no other meaning. It isn't used to start the application.
|
||||
* Path contains the full path to the application containing the executable name.
|
||||
* Parameters contains the command line arguments for the executable.
|
||||
*
|
||||
* User can also specify certain predefined strings to parameters. These strings
|
||||
* will be replaced with appropriate values concerning the error. Strings are:
|
||||
* (file) - Filename containing the error
|
||||
* (line) - Line number containing the error
|
||||
* (message) - Error message
|
||||
* (severity) - Error severity
|
||||
*
|
||||
* Example opening a file with Kate and make Kate scroll to the correct line.
|
||||
* Executable: kate
|
||||
* Parameters: -l(line) (file)
|
||||
*/
|
||||
* @brief A class containing information of the application to execute.
|
||||
*
|
||||
* Each application has a name and a path. Name is displayed to the user
|
||||
* and has no other meaning. It isn't used to start the application.
|
||||
* Path contains the full path to the application containing the executable name.
|
||||
* Parameters contains the command line arguments for the executable.
|
||||
*
|
||||
* User can also specify certain predefined strings to parameters. These strings
|
||||
* will be replaced with appropriate values concerning the error. Strings are:
|
||||
* (file) - Filename containing the error
|
||||
* (line) - Line number containing the error
|
||||
* (message) - Error message
|
||||
* (severity) - Error severity
|
||||
*
|
||||
* Example opening a file with Kate and make Kate scroll to the correct line.
|
||||
* Executable: kate
|
||||
* Parameters: -l(line) (file)
|
||||
*/
|
||||
class Application {
|
||||
public:
|
||||
Application() { }
|
||||
Application() {}
|
||||
Application(const QString &name, const QString &path, const QString ¶ms);
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,11 +30,11 @@ class Application;
|
|||
/// @{
|
||||
|
||||
/**
|
||||
* @brief Dialog to edit a startable application.
|
||||
* User can open errors with user specified applications. This is a dialog
|
||||
* to modify/add an application to open errors with.
|
||||
*
|
||||
*/
|
||||
* @brief Dialog to edit a startable application.
|
||||
* User can open errors with user specified applications. This is a dialog
|
||||
* to modify/add an application to open errors with.
|
||||
*
|
||||
*/
|
||||
class ApplicationDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
|
||||
/**
|
||||
* @brief List of applications user has specified to open errors with.
|
||||
*/
|
||||
* @brief List of applications user has specified to open errors with.
|
||||
*/
|
||||
class ApplicationList : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -31,9 +31,9 @@ class ThreadResult;
|
|||
/// @{
|
||||
|
||||
/**
|
||||
* @brief Thread to run cppcheck
|
||||
*
|
||||
*/
|
||||
* @brief Thread to run cppcheck
|
||||
*
|
||||
*/
|
||||
class CheckThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -101,7 +101,7 @@ static const CodeEditorStyle defaultStyleLight(
|
|||
/* quote FG/Weight */ Qt::darkGreen, QFont::Normal,
|
||||
/* comment FG/Weight */ Qt::gray, QFont::Normal,
|
||||
/* Symbol FG/BG/Weight */ Qt::red, QColor(220, 220, 255), QFont::Normal
|
||||
);
|
||||
);
|
||||
|
||||
// Styling derived from Eclipse Color Theme - 'RecognEyes'
|
||||
// http://www.eclipsecolorthemes.org/?view=theme&id=30
|
||||
|
@ -114,6 +114,6 @@ static const CodeEditorStyle defaultStyleDark(
|
|||
/* quote FG/Weight */ QColor(0, 204, 0), QFont::Normal,
|
||||
/* comment FG/Weight */ QColor(180, 180, 180), QFont::Normal,
|
||||
/* Symbol FG/BG/Weight */ QColor(218, 32, 32), QColor(32, 32, 108), QFont::Normal
|
||||
);
|
||||
);
|
||||
|
||||
#endif /* CODEEDITORSTYLE_H */
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#define CLANG_TIDY "clang-tidy"
|
||||
|
||||
/**
|
||||
* QSetting value names
|
||||
*/
|
||||
* QSetting value names
|
||||
*/
|
||||
|
||||
// Window/dialog sizes
|
||||
#define SETTINGS_WINDOW_MAXIMIZED "Window maximized"
|
||||
|
|
|
@ -27,8 +27,7 @@ const unsigned int CppcheckLibraryData::Function::Arg::ANY = ~0U;
|
|||
const unsigned int CppcheckLibraryData::Function::Arg::VARIADIC = ~1U;
|
||||
|
||||
CppcheckLibraryData::CppcheckLibraryData()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
static std::string unhandledElement(const QXmlStreamReader &xmlReader)
|
||||
{
|
||||
|
|
|
@ -64,8 +64,7 @@ public:
|
|||
|
||||
struct Function {
|
||||
Function() : noreturn(Unknown), gccPure(false), gccConst(false),
|
||||
leakignore(false), useretval(false) {
|
||||
}
|
||||
leakignore(false), useretval(false) {}
|
||||
|
||||
QString comments;
|
||||
QString name;
|
||||
|
@ -89,8 +88,7 @@ public:
|
|||
} formatstr;
|
||||
struct Arg {
|
||||
Arg() : nr(0), notbool(false), notnull(false), notuninit(false),
|
||||
formatstr(false), strz(false) {
|
||||
}
|
||||
formatstr(false), strz(false) {}
|
||||
|
||||
QString name;
|
||||
unsigned int nr;
|
||||
|
|
|
@ -24,12 +24,10 @@
|
|||
|
||||
CsvReport::CsvReport(const QString &filename) :
|
||||
Report(filename)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
CsvReport::~CsvReport()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool CsvReport::create()
|
||||
{
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
|
||||
|
||||
/**
|
||||
* @brief CSV text file report.
|
||||
* This report exports results as CSV (comma separated values). CSV files are
|
||||
* easy to import to many other programs.
|
||||
* @todo This class should be inherited from TxtReport?
|
||||
*/
|
||||
* @brief CSV text file report.
|
||||
* This report exports results as CSV (comma separated values). CSV files are
|
||||
* easy to import to many other programs.
|
||||
* @todo This class should be inherited from TxtReport?
|
||||
*/
|
||||
class CsvReport : public Report {
|
||||
public:
|
||||
explicit CsvReport(const QString &filename);
|
||||
|
|
|
@ -24,8 +24,7 @@ QErrorPathItem::QErrorPathItem(const ErrorMessage::FileLocation &loc)
|
|||
, line(loc.line)
|
||||
, column(loc.column)
|
||||
, info(QString::fromStdString(loc.getinfo()))
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool operator==(const QErrorPathItem &i1, const QErrorPathItem &i2)
|
||||
{
|
||||
|
@ -38,8 +37,7 @@ ErrorItem::ErrorItem()
|
|||
, inconclusive(false)
|
||||
, cwe(-1)
|
||||
, hash(0)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
ErrorItem::ErrorItem(const ErrorMessage &errmsg)
|
||||
: file0(QString::fromStdString(errmsg.file0))
|
||||
|
|
|
@ -45,8 +45,8 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* @brief A class containing data for one error path item
|
||||
*/
|
||||
* @brief A class containing data for one error path item
|
||||
*/
|
||||
class QErrorPathItem {
|
||||
public:
|
||||
QErrorPathItem() : line(0), column(-1) {}
|
||||
|
@ -60,13 +60,13 @@ public:
|
|||
bool operator==(const QErrorPathItem &i1, const QErrorPathItem &i2);
|
||||
|
||||
/**
|
||||
* @brief A class containing error data for one error.
|
||||
*
|
||||
* The paths are stored with internal ("/") separators. Only when we show the
|
||||
* path or copy if for user (to clipboard) we convert to native separators.
|
||||
* Full path is stored instead of relative path for flexibility. It is easy
|
||||
* to get the relative path from full path when needed.
|
||||
*/
|
||||
* @brief A class containing error data for one error.
|
||||
*
|
||||
* The paths are stored with internal ("/") separators. Only when we show the
|
||||
* path or copy if for user (to clipboard) we convert to native separators.
|
||||
* Full path is stored instead of relative path for flexibility. It is easy
|
||||
* to get the relative path from full path when needed.
|
||||
*/
|
||||
class ErrorItem {
|
||||
public:
|
||||
ErrorItem();
|
||||
|
@ -105,8 +105,8 @@ public:
|
|||
Q_DECLARE_METATYPE(ErrorItem)
|
||||
|
||||
/**
|
||||
* @brief A class containing error data for one shown error line.
|
||||
*/
|
||||
* @brief A class containing error data for one shown error line.
|
||||
*/
|
||||
class ErrorLine {
|
||||
public:
|
||||
QString file;
|
||||
|
|
|
@ -31,11 +31,11 @@ class QTextEdit;
|
|||
|
||||
|
||||
/**
|
||||
* @brief File view -dialog.
|
||||
* This dialog shows text files. It is used for showing the license file and
|
||||
* the authors list.
|
||||
*
|
||||
*/
|
||||
* @brief File view -dialog.
|
||||
* This dialog shows text files. It is used for showing the license file and
|
||||
* the authors list.
|
||||
*
|
||||
*/
|
||||
class FileViewDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -82,7 +82,7 @@ HelpDialog::HelpDialog(QWidget *parent) :
|
|||
SLOT(setSource(QUrl)));
|
||||
|
||||
connect(mHelpEngine->indexWidget(),
|
||||
SIGNAL(linkActivated(QUrl, QString)),
|
||||
SIGNAL(linkActivated(QUrl,QString)),
|
||||
mUi->textBrowser,
|
||||
SLOT(setSource(QUrl)));
|
||||
}
|
||||
|
|
|
@ -528,14 +528,14 @@ void MainWindow::analyzeCode(const QString& code, const QString& filename)
|
|||
// Initialize dummy ThreadResult as ErrorLogger
|
||||
ThreadResult result;
|
||||
result.setFiles(QStringList(filename));
|
||||
connect(&result, SIGNAL(progress(int, const QString&)),
|
||||
mUI.mResults, SLOT(progress(int, const QString&)));
|
||||
connect(&result, SIGNAL(error(const ErrorItem &)),
|
||||
mUI.mResults, SLOT(error(const ErrorItem &)));
|
||||
connect(&result, SIGNAL(log(const QString &)),
|
||||
mUI.mResults, SLOT(log(const QString &)));
|
||||
connect(&result, SIGNAL(debugError(const ErrorItem &)),
|
||||
mUI.mResults, SLOT(debugError(const ErrorItem &)));
|
||||
connect(&result, SIGNAL(progress(int,const QString&)),
|
||||
mUI.mResults, SLOT(progress(int,const QString&)));
|
||||
connect(&result, SIGNAL(error(const ErrorItem&)),
|
||||
mUI.mResults, SLOT(error(const ErrorItem&)));
|
||||
connect(&result, SIGNAL(log(const QString&)),
|
||||
mUI.mResults, SLOT(log(const QString&)));
|
||||
connect(&result, SIGNAL(debugError(const ErrorItem&)),
|
||||
mUI.mResults, SLOT(debugError(const ErrorItem&)));
|
||||
|
||||
// Create CppCheck instance
|
||||
CppCheck cppcheck(result, true, nullptr);
|
||||
|
@ -1415,8 +1415,7 @@ void MainWindow::save()
|
|||
}
|
||||
|
||||
void MainWindow::resultsAdded()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void MainWindow::toggleMainToolBar()
|
||||
{
|
||||
|
|
|
@ -13,11 +13,11 @@ NewSuppressionDialog::NewSuppressionDialog(QWidget *parent) :
|
|||
|
||||
class QErrorLogger : public ErrorLogger {
|
||||
public:
|
||||
void reportOut(const std::string &/*outmsg*/, Color) override {}
|
||||
void reportOut(const std::string & /*outmsg*/, Color) override {}
|
||||
void reportErr(const ErrorMessage &msg) override {
|
||||
errorIds << QString::fromStdString(msg.id);
|
||||
}
|
||||
void bughuntingReport(const std::string &/*str*/) override {}
|
||||
void bughuntingReport(const std::string & /*str*/) override {}
|
||||
QStringList errorIds;
|
||||
};
|
||||
|
||||
|
|
|
@ -23,12 +23,10 @@
|
|||
|
||||
PrintableReport::PrintableReport() :
|
||||
Report(QString())
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
PrintableReport::~PrintableReport()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool PrintableReport::create()
|
||||
{
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
|
||||
/**
|
||||
* @brief Printable (in-memory) report.
|
||||
* This report formats results and exposes them for printing.
|
||||
*/
|
||||
* @brief Printable (in-memory) report.
|
||||
* This report formats results and exposes them for printing.
|
||||
*/
|
||||
class PrintableReport : public Report {
|
||||
public:
|
||||
PrintableReport();
|
||||
|
|
|
@ -36,10 +36,10 @@ class QXmlStreamWriter;
|
|||
|
||||
|
||||
/**
|
||||
* @brief A class that reads and writes project files.
|
||||
* The project files contain project-specific settings for checking. For
|
||||
* example a list of include paths.
|
||||
*/
|
||||
* @brief A class that reads and writes project files.
|
||||
* The project files contain project-specific settings for checking. For
|
||||
* example a list of include paths.
|
||||
*/
|
||||
class ProjectFile : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -681,7 +681,7 @@ void ProjectFileDialog::addSingleSuppression(const Suppressions::Suppression &su
|
|||
(suppression.fileName.find(sep) == std::string::npos)) {
|
||||
QFileInfo inf(mProjectFile->getFilename());
|
||||
QString rootpath = inf.absolutePath();
|
||||
if (QFile::exists(QString{"%1%2%3"} .arg(rootpath,
|
||||
if (QFile::exists(QString{"%1%2%3"}.arg(rootpath,
|
||||
QDir::separator(),
|
||||
QString::fromStdString(suppression.fileName)))) {
|
||||
Suppressions::Suppression sup = suppression;
|
||||
|
|
|
@ -37,8 +37,8 @@ class QCheckBox;
|
|||
class ProjectFile;
|
||||
|
||||
/**
|
||||
* @brief A dialog for editing project file data.
|
||||
*/
|
||||
* @brief A dialog for editing project file data.
|
||||
*/
|
||||
class ProjectFileDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
Report::Report(const QString &filename) :
|
||||
QObject(),
|
||||
mFilename(filename)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
Report::~Report()
|
||||
{
|
||||
|
|
|
@ -29,8 +29,8 @@ class ErrorItem;
|
|||
/// @{
|
||||
|
||||
/**
|
||||
* @brief A base class for reports.
|
||||
*/
|
||||
* @brief A base class for reports.
|
||||
*/
|
||||
class Report : public QObject {
|
||||
public:
|
||||
enum Type {
|
||||
|
|
|
@ -98,8 +98,7 @@ ResultsTree::ResultsTree(QWidget * parent) :
|
|||
}
|
||||
|
||||
ResultsTree::~ResultsTree()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void ResultsTree::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
|
|
|
@ -41,9 +41,9 @@ class QSettings;
|
|||
|
||||
|
||||
/**
|
||||
* @brief Cppcheck's results are shown in this tree
|
||||
*
|
||||
*/
|
||||
* @brief Cppcheck's results are shown in this tree
|
||||
*
|
||||
*/
|
||||
class ResultsTree : public QTreeView {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -328,7 +328,7 @@ void ResultsView::checkingFinished()
|
|||
msg.exec();
|
||||
} //If we have errors but they aren't visible, tell user about it
|
||||
else if (!mUI.mTree->hasVisibleResults()) {
|
||||
QString text = tr("Errors were found, but they are configured to be hidden.\n"\
|
||||
QString text = tr("Errors were found, but they are configured to be hidden.\n" \
|
||||
"To toggle what kind of errors are shown, open view menu.");
|
||||
QMessageBox msg(QMessageBox::Information,
|
||||
tr("Cppcheck"),
|
||||
|
|
|
@ -36,9 +36,9 @@ class CheckStatistics;
|
|||
/// @{
|
||||
|
||||
/**
|
||||
* @brief Widget to show cppcheck progressbar and result
|
||||
*
|
||||
*/
|
||||
* @brief Widget to show cppcheck progressbar and result
|
||||
*
|
||||
*/
|
||||
class ResultsView : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -28,8 +28,8 @@ class MainWindow;
|
|||
/// @{
|
||||
|
||||
/**
|
||||
* @brief A window with a text field that .
|
||||
*/
|
||||
* @brief A window with a text field that .
|
||||
*/
|
||||
class ScratchPad : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -70,7 +70,7 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
|
|||
mCurrentStyle = new CodeEditorStyle(CodeEditorStyle::loadSettings(&settings));
|
||||
manageStyleControls();
|
||||
|
||||
connect(mUI.mEditPythonPath, SIGNAL(textEdited(const QString &)),
|
||||
connect(mUI.mEditPythonPath, SIGNAL(textEdited(const QString&)),
|
||||
this, SLOT(validateEditPythonPath()));
|
||||
|
||||
connect(mUI.mButtons, &QDialogButtonBox::accepted, this, &SettingsDialog::ok);
|
||||
|
@ -83,7 +83,7 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
|
|||
this, SLOT(editApplication()));
|
||||
connect(mUI.mBtnDefaultApplication, SIGNAL(clicked()),
|
||||
this, SLOT(defaultApplication()));
|
||||
connect(mUI.mListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
|
||||
connect(mUI.mListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
|
||||
this, SLOT(editApplication()));
|
||||
|
||||
connect(mUI.mBtnBrowsePythonPath, &QPushButton::clicked, this, &SettingsDialog::browsePythonPath);
|
||||
|
|
|
@ -33,9 +33,9 @@ class CodeEditorStyle;
|
|||
/// @{
|
||||
|
||||
/**
|
||||
* @brief Settings dialog
|
||||
*
|
||||
*/
|
||||
* @brief Settings dialog
|
||||
*
|
||||
*/
|
||||
class SettingsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -32,9 +32,9 @@ class CheckStatistics;
|
|||
/// @{
|
||||
|
||||
/**
|
||||
* @brief A dialog that shows project and scan statistics.
|
||||
*
|
||||
*/
|
||||
* @brief A dialog that shows project and scan statistics.
|
||||
*
|
||||
*/
|
||||
class StatsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <QObject>
|
||||
#include "errorlogger.h"
|
||||
|
||||
class BenchmarkSimple: public QObject, public ErrorLogger {
|
||||
class BenchmarkSimple : public QObject, public ErrorLogger {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
|
@ -31,8 +31,6 @@ private slots:
|
|||
private:
|
||||
// Empty implementations of ErrorLogger methods.
|
||||
// We don't care about the output in the benchmark tests.
|
||||
void reportOut(const std::string & outmsg) override {
|
||||
}
|
||||
void reportErr(const ErrorMessage &msg) override {
|
||||
}
|
||||
void reportOut(const std::string & outmsg) override {}
|
||||
void reportErr(const ErrorMessage &msg) override {}
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <QtTest/QtTest>
|
||||
#include "cppchecklibrarydata.h"
|
||||
|
||||
class TestCppcheckLibraryData: public QObject {
|
||||
class TestCppcheckLibraryData : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -292,9 +292,9 @@ void CheckOther::checkRedundantAssignmentInSwitch()
|
|||
}
|
||||
tok2 = endOfConditional;
|
||||
} else
|
||||
++ indentLevel;
|
||||
++indentLevel;
|
||||
} else if (tok2->str() == "}") {
|
||||
-- indentLevel;
|
||||
--indentLevel;
|
||||
|
||||
// End of the switch block
|
||||
if (indentLevel < 0)
|
||||
|
@ -343,7 +343,7 @@ void CheckOther::checkSwitchCaseFallThrough()
|
|||
while (tok) {
|
||||
|
||||
// Check the contents of the switch statement
|
||||
std::stack<std::pair<Token *, bool> > ifnest;
|
||||
std::stack<std::pair<Token *, bool>> ifnest;
|
||||
std::stack<Token *> loopnest;
|
||||
std::stack<Token *> scopenest;
|
||||
bool justbreak = true;
|
||||
|
@ -984,8 +984,8 @@ void CheckOther::checkMemsetZeroBytes()
|
|||
*/
|
||||
class ScopeInfo {
|
||||
public:
|
||||
ScopeInfo() : _token(NULL), _parent(NULL) { }
|
||||
ScopeInfo(const Token *token, ScopeInfo *parent_) : _token(token), _parent(parent_) { }
|
||||
ScopeInfo() : _token(NULL), _parent(NULL) {}
|
||||
ScopeInfo(const Token *token, ScopeInfo *parent_) : _token(token), _parent(parent_) {}
|
||||
~ScopeInfo();
|
||||
|
||||
ScopeInfo *parent() {
|
||||
|
@ -1053,8 +1053,7 @@ public:
|
|||
_read(read),
|
||||
_write(write),
|
||||
_modified(modified),
|
||||
_allocateMemory(allocateMemory) {
|
||||
}
|
||||
_allocateMemory(allocateMemory) {}
|
||||
|
||||
/** variable is used.. set both read+write */
|
||||
void use() {
|
||||
|
@ -1640,7 +1639,7 @@ void CheckOther::functionVariableUsage()
|
|||
while (tok->str() != "{")
|
||||
tok = tok->next();
|
||||
tok = tok->link();
|
||||
if (! tok)
|
||||
if (!tok)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2253,7 +2252,7 @@ void CheckOther::checkVariableScope()
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (! tok)
|
||||
if (!tok)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2268,7 +2267,7 @@ void CheckOther::checkVariableScope()
|
|||
if (indentlevel > 0 && Token::Match(tok, "[{};]")) {
|
||||
// First token of statement..
|
||||
const Token *tok1 = tok->next();
|
||||
if (! tok1)
|
||||
if (!tok1)
|
||||
continue;
|
||||
|
||||
if ((tok1->str() == "return") ||
|
||||
|
@ -2531,7 +2530,7 @@ void CheckOther::checkStructMemberUsage()
|
|||
}
|
||||
}
|
||||
|
||||
if (! used) {
|
||||
if (!used) {
|
||||
unusedStructMemberError(tok->next(), structname, varname);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Dummy test file.
|
||||
Dummy test file .
|
||||
|
|
|
@ -1 +1 @@
|
|||
Dummy test file.
|
||||
Dummy test file .
|
||||
|
|
|
@ -1 +1 @@
|
|||
Dummy test file.
|
||||
Dummy test file .
|
||||
|
|
|
@ -1 +1 @@
|
|||
Dummy test file.
|
||||
Dummy test file .
|
||||
|
|
|
@ -1 +1 @@
|
|||
Dummy test file.
|
||||
Dummy test file .
|
||||
|
|
|
@ -109,8 +109,8 @@ void TestFileList::filterFiles()
|
|||
QCOMPARE(files.size(), 5);
|
||||
QDir dir(QString(SRCDIR) + "/../data/files");
|
||||
QString base = dir.canonicalPath();
|
||||
QVERIFY(! files.contains(base + "/foo1.cpp"));
|
||||
QVERIFY(! files.contains(base + "/foo3.cpp"));
|
||||
QVERIFY(!files.contains(base + "/foo1.cpp"));
|
||||
QVERIFY(!files.contains(base + "/foo3.cpp"));
|
||||
}
|
||||
|
||||
void TestFileList::filterFiles2()
|
||||
|
@ -124,8 +124,8 @@ void TestFileList::filterFiles2()
|
|||
QCOMPARE(files.size(), 5);
|
||||
QDir dir(QString(SRCDIR) + "/../data/files");
|
||||
QString base = dir.canonicalPath();
|
||||
QVERIFY(! files.contains(base + "/foo1.cpp"));
|
||||
QVERIFY(! files.contains(base + "/foo3.cpp"));
|
||||
QVERIFY(!files.contains(base + "/foo1.cpp"));
|
||||
QVERIFY(!files.contains(base + "/foo3.cpp"));
|
||||
}
|
||||
|
||||
void TestFileList::filterFiles3()
|
||||
|
@ -139,10 +139,10 @@ void TestFileList::filterFiles3()
|
|||
QCOMPARE(files.size(), 6);
|
||||
QDir dir(QString(SRCDIR) + "/../data/files");
|
||||
QString base = dir.canonicalPath();
|
||||
QVERIFY(! files.contains(base + "/foo1.cpp"));
|
||||
QVERIFY(! files.contains(base + "/foo3.cpp"));
|
||||
QVERIFY(! files.contains(base + "/dir1/foo1.cpp"));
|
||||
QVERIFY(! files.contains(base + "/dir2/foo1.cpp"));
|
||||
QVERIFY(!files.contains(base + "/foo1.cpp"));
|
||||
QVERIFY(!files.contains(base + "/foo3.cpp"));
|
||||
QVERIFY(!files.contains(base + "/dir1/foo1.cpp"));
|
||||
QVERIFY(!files.contains(base + "/dir2/foo1.cpp"));
|
||||
}
|
||||
|
||||
void TestFileList::filterFiles4()
|
||||
|
@ -156,12 +156,12 @@ void TestFileList::filterFiles4()
|
|||
QCOMPARE(files.size(), 8);
|
||||
QDir dir(QString(SRCDIR) + "/../data/files");
|
||||
QString base = dir.canonicalPath();
|
||||
QVERIFY(! files.contains(base + "/dir1/foo1.cpp"));
|
||||
QVERIFY(! files.contains(base + "/dir1/dir11/foo11.cpp"));
|
||||
QVERIFY(!files.contains(base + "/dir1/foo1.cpp"));
|
||||
QVERIFY(!files.contains(base + "/dir1/dir11/foo11.cpp"));
|
||||
}
|
||||
/*
|
||||
void TestFileList::filterFiles5()
|
||||
{
|
||||
void TestFileList::filterFiles5()
|
||||
{
|
||||
FileList list;
|
||||
QStringList filters;
|
||||
filters << QDir(QString(SRCDIR) + "/../data/files/dir1/").absolutePath() + "/";
|
||||
|
@ -173,6 +173,6 @@ void TestFileList::filterFiles5()
|
|||
QString base = dir.canonicalPath();
|
||||
QVERIFY(! files.contains(base + "/dir1/foo1.cpp"));
|
||||
QVERIFY(! files.contains(base + "/dir1/dir11/foo11.cpp"));
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
QTEST_MAIN(TestFileList)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <QtTest/QtTest>
|
||||
#include <QObject>
|
||||
|
||||
class TestFileList: public QObject {
|
||||
class TestFileList : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <QtTest/QtTest>
|
||||
#include <QObject>
|
||||
|
||||
class TestProjectFile: public QObject {
|
||||
class TestProjectFile : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <QtTest/QtTest>
|
||||
#include <QObject>
|
||||
|
||||
class TestTranslationHandler: public QObject {
|
||||
class TestTranslationHandler : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <QtTest/QtTest>
|
||||
#include <QObject>
|
||||
|
||||
class TestXmlReportV2: public QObject {
|
||||
class TestXmlReportV2 : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -38,9 +38,9 @@ class ImportProject;
|
|||
|
||||
|
||||
/**
|
||||
* @brief This class handles creating threadresult and starting threads
|
||||
*
|
||||
*/
|
||||
* @brief This class handles creating threadresult and starting threads
|
||||
*
|
||||
*/
|
||||
class ThreadHandler : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -43,7 +43,7 @@ void ThreadResult::fileChecked(const QString &file)
|
|||
QMutexLocker locker(&mutex);
|
||||
|
||||
mProgress += QFile(file).size();
|
||||
mFilesChecked ++;
|
||||
mFilesChecked++;
|
||||
|
||||
if (mMaxProgress > 0) {
|
||||
const int value = static_cast<int>(PROGRESS_MAX * mProgress / mMaxProgress);
|
||||
|
|
|
@ -33,9 +33,9 @@ class ErrorItem;
|
|||
/// @{
|
||||
|
||||
/**
|
||||
* @brief Threads use this class to obtain new files to process and to publish results
|
||||
*
|
||||
*/
|
||||
* @brief Threads use this class to obtain new files to process and to publish results
|
||||
*
|
||||
*/
|
||||
class ThreadResult : public QObject, public ErrorLogger {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -31,12 +31,12 @@
|
|||
static void unused()
|
||||
{
|
||||
// NOTE: Keeping semi-colons at end of macro for style preference
|
||||
#if ((QT_VERSION >= 0x040000)&&(QT_VERSION < 0x050000))
|
||||
#if ((QT_VERSION >= 0x040000) && (QT_VERSION < 0x050000))
|
||||
Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "OK"));
|
||||
Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "Cancel"));
|
||||
Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "Close"));
|
||||
Q_UNUSED(QT_TRANSLATE_NOOP("QDialogButtonBox", "Save"));
|
||||
#elif ((QT_VERSION >= 0x050000)&&(QT_VERSION < 0x060000))
|
||||
#elif ((QT_VERSION >= 0x050000) && (QT_VERSION < 0x060000))
|
||||
Q_UNUSED(QT_TRANSLATE_NOOP("QPlatformTheme", "OK"));
|
||||
Q_UNUSED(QT_TRANSLATE_NOOP("QPlatformTheme", "Cancel"));
|
||||
Q_UNUSED(QT_TRANSLATE_NOOP("QPlatformTheme", "Close"));
|
||||
|
@ -69,8 +69,7 @@ TranslationHandler::TranslationHandler(QObject *parent) :
|
|||
}
|
||||
|
||||
TranslationHandler::~TranslationHandler()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
const QStringList TranslationHandler::getNames() const
|
||||
{
|
||||
|
|
|
@ -29,9 +29,9 @@ class QTranslator;
|
|||
/// @{
|
||||
|
||||
/**
|
||||
* @brief Information for one translation.
|
||||
*
|
||||
*/
|
||||
* @brief Information for one translation.
|
||||
*
|
||||
*/
|
||||
struct TranslationInfo {
|
||||
/**
|
||||
* @brief Readable name for the translation (e.g. "English").
|
||||
|
@ -53,12 +53,12 @@ struct TranslationInfo {
|
|||
};
|
||||
|
||||
/**
|
||||
* @brief A class handling the available translations.
|
||||
*
|
||||
* This class contains a list of available translations. The class also keeps
|
||||
* track which translation is the currently active translation.
|
||||
*
|
||||
*/
|
||||
* @brief A class handling the available translations.
|
||||
*
|
||||
* This class contains a list of available translations. The class also keeps
|
||||
* track which translation is the currently active translation.
|
||||
*
|
||||
*/
|
||||
class TranslationHandler : QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -23,12 +23,10 @@
|
|||
|
||||
TxtReport::TxtReport(const QString &filename) :
|
||||
Report(filename)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
TxtReport::~TxtReport()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
bool TxtReport::create()
|
||||
{
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
|
||||
|
||||
/**
|
||||
* @brief Text file report.
|
||||
* This report mimics the output of the command line cppcheck.
|
||||
*/
|
||||
* @brief Text file report.
|
||||
* This report mimics the output of the command line cppcheck.
|
||||
*/
|
||||
class TxtReport : public Report {
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ static const char VersionAttribute[] = "version";
|
|||
|
||||
XmlReport::XmlReport(const QString &filename) :
|
||||
Report(filename)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
QString XmlReport::quoteMessage(const QString &message)
|
||||
{
|
||||
|
|
|
@ -30,8 +30,8 @@ class ErrorItem;
|
|||
|
||||
|
||||
/**
|
||||
* @brief Base class for XML report classes.
|
||||
*/
|
||||
* @brief Base class for XML report classes.
|
||||
*/
|
||||
class XmlReport : public Report {
|
||||
public:
|
||||
explicit XmlReport(const QString &filename);
|
||||
|
|
|
@ -51,8 +51,7 @@ XmlReportV2::XmlReportV2(const QString &filename) :
|
|||
XmlReport(filename),
|
||||
mXmlReader(nullptr),
|
||||
mXmlWriter(nullptr)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
XmlReportV2::~XmlReportV2()
|
||||
{
|
||||
|
|
|
@ -30,10 +30,10 @@ class QXmlStreamWriter;
|
|||
|
||||
|
||||
/**
|
||||
* @brief XML file report version 2.
|
||||
* This report outputs XML-formatted report. The XML format must match command
|
||||
* line version's XML output.
|
||||
*/
|
||||
* @brief XML file report version 2.
|
||||
* This report outputs XML-formatted report. The XML format must match command
|
||||
* line version's XML output.
|
||||
*/
|
||||
class XmlReportV2 : public XmlReport {
|
||||
public:
|
||||
explicit XmlReportV2(const QString &filename);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <vector>
|
||||
|
||||
class Token;
|
||||
template <class T>
|
||||
template<class T>
|
||||
class ValuePtr;
|
||||
|
||||
struct Analyzer {
|
||||
|
@ -86,7 +86,9 @@ struct Analyzer {
|
|||
return get(Incremental);
|
||||
}
|
||||
|
||||
bool isSymbolicMatch() const { return get(SymbolicMatch); }
|
||||
bool isSymbolicMatch() const {
|
||||
return get(SymbolicMatch);
|
||||
}
|
||||
|
||||
bool matches() const {
|
||||
return get(Match);
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
/*
|
||||
* Cppcheck - A tool for static C/C++ code analysis
|
||||
* Copyright (C) 2007-2021 Cppcheck team.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Cppcheck - A tool for static C/C++ code analysis
|
||||
* Copyright (C) 2007-2021 Cppcheck team.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "analyzerinfo.h"
|
||||
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
/*
|
||||
* Cppcheck - A tool for static C/C++ code analysis
|
||||
* Copyright (C) 2007-2021 Cppcheck team.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Cppcheck - A tool for static C/C++ code analysis
|
||||
* Copyright (C) 2007-2021 Cppcheck team.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef analyzerinfoH
|
||||
|
@ -34,18 +34,18 @@ class ErrorMessage;
|
|||
/// @{
|
||||
|
||||
/**
|
||||
* @brief Analyzer information
|
||||
*
|
||||
* Store various analysis information:
|
||||
* - checksum
|
||||
* - error messages
|
||||
* - whole program analysis data
|
||||
*
|
||||
* The information can be used for various purposes. It allows:
|
||||
* - 'make' - only analyze TUs that are changed and generate full report
|
||||
* - should be possible to add distributed analysis later
|
||||
* - multi-threaded whole program analysis
|
||||
*/
|
||||
* @brief Analyzer information
|
||||
*
|
||||
* Store various analysis information:
|
||||
* - checksum
|
||||
* - error messages
|
||||
* - whole program analysis data
|
||||
*
|
||||
* The information can be used for various purposes. It allows:
|
||||
* - 'make' - only analyze TUs that are changed and generate full report
|
||||
* - should be possible to add distributed analysis later
|
||||
* - multi-threaded whole program analysis
|
||||
*/
|
||||
class CPPCHECKLIB AnalyzerInformation {
|
||||
public:
|
||||
~AnalyzerInformation();
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <stack>
|
||||
#include <utility>
|
||||
|
||||
template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*>)>
|
||||
template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )>
|
||||
void visitAstNodesGeneric(T *ast, std::function<ChildrenToVisit(T *)> visitor)
|
||||
{
|
||||
std::stack<T *> tokens;
|
||||
|
@ -344,7 +344,7 @@ static bool hasToken(const Token * startTok, const Token * stopTok, const Token
|
|||
return false;
|
||||
}
|
||||
|
||||
template <class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*>)>
|
||||
template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )>
|
||||
static T* previousBeforeAstLeftmostLeafGeneric(T* tok)
|
||||
{
|
||||
if (!tok)
|
||||
|
@ -364,7 +364,7 @@ Token* previousBeforeAstLeftmostLeaf(Token* tok)
|
|||
return previousBeforeAstLeftmostLeafGeneric(tok);
|
||||
}
|
||||
|
||||
template <class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*>)>
|
||||
template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )>
|
||||
static T* nextAfterAstRightmostLeafGeneric(T* tok)
|
||||
{
|
||||
const Token * rightmostLeaf = tok;
|
||||
|
@ -474,7 +474,7 @@ bool astIsRHS(const Token* tok)
|
|||
return parent->astOperand2() == tok;
|
||||
}
|
||||
|
||||
template <class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*>)>
|
||||
template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )>
|
||||
static T* getCondTokImpl(T* tok)
|
||||
{
|
||||
if (!tok)
|
||||
|
@ -489,7 +489,7 @@ static T* getCondTokImpl(T* tok)
|
|||
return tok->next()->astOperand2();
|
||||
}
|
||||
|
||||
template <class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*>)>
|
||||
template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )>
|
||||
static T* getCondTokFromEndImpl(T* endBlock)
|
||||
{
|
||||
if (!Token::simpleMatch(endBlock, "}"))
|
||||
|
@ -2102,7 +2102,9 @@ Token* findVariableChanged(Token *start, const Token *end, int indirect, const n
|
|||
return nullptr;
|
||||
if (depth < 0)
|
||||
return start;
|
||||
auto getExprTok = memoize([&] { return findExpression(start, exprid); });
|
||||
auto getExprTok = memoize([&] {
|
||||
return findExpression(start, exprid);
|
||||
});
|
||||
for (Token *tok = start; tok != end; tok = tok->next()) {
|
||||
if (tok->exprId() != exprid) {
|
||||
if (globalvar && Token::Match(tok, "%name% ("))
|
||||
|
@ -2279,7 +2281,7 @@ const Token *findLambdaStartToken(const Token *last)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
template<class T>
|
||||
T* findLambdaEndTokenGeneric(T* first)
|
||||
{
|
||||
if (!first || first->str() != "[")
|
||||
|
|
|
@ -62,8 +62,7 @@ public:
|
|||
|
||||
/** This constructor is used when running checks. */
|
||||
Check(const std::string &aname, const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: mTokenizer(tokenizer), mSettings(settings), mErrorLogger(errorLogger), mName(aname) {
|
||||
}
|
||||
: mTokenizer(tokenizer), mSettings(settings), mErrorLogger(errorLogger), mName(aname) {}
|
||||
|
||||
virtual ~Check() {
|
||||
if (!mTokenizer)
|
||||
|
@ -116,7 +115,7 @@ 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;
|
||||
|
|
|
@ -43,13 +43,11 @@ class Tokenizer;
|
|||
class CPPCHECKLIB Check64BitPortability : public Check {
|
||||
public:
|
||||
/** This constructor is used when registering the Check64BitPortability */
|
||||
Check64BitPortability() : Check(myName()) {
|
||||
}
|
||||
Check64BitPortability() : Check(myName()) {}
|
||||
|
||||
/** This constructor is used when running checks. */
|
||||
Check64BitPortability(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks against the normal token list */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -42,12 +42,10 @@ class Tokenizer;
|
|||
|
||||
class CPPCHECKLIB CheckAssert : public Check {
|
||||
public:
|
||||
CheckAssert() : Check(myName()) {
|
||||
}
|
||||
CheckAssert() : Check(myName()) {}
|
||||
|
||||
CheckAssert(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** run checks, the token list is not simplified */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -42,13 +42,11 @@ class Variable;
|
|||
class CPPCHECKLIB CheckAutoVariables : public Check {
|
||||
public:
|
||||
/** This constructor is used when registering the CheckClass */
|
||||
CheckAutoVariables() : Check(myName()) {
|
||||
}
|
||||
CheckAutoVariables() : Check(myName()) {}
|
||||
|
||||
/** This constructor is used when running checks. */
|
||||
CheckAutoVariables(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks against the normal token list */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -41,13 +41,11 @@ class Tokenizer;
|
|||
class CPPCHECKLIB CheckBool : public Check {
|
||||
public:
|
||||
/** @brief This constructor is used when registering the CheckClass */
|
||||
CheckBool() : Check(myName()) {
|
||||
}
|
||||
CheckBool() : Check(myName()) {}
|
||||
|
||||
/** @brief This constructor is used when running checks. */
|
||||
CheckBool(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks against the normal token list */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -40,13 +40,11 @@ class Token;
|
|||
class CPPCHECKLIB CheckBoost : public Check {
|
||||
public:
|
||||
/** This constructor is used when registering the CheckClass */
|
||||
CheckBoost() : Check(myName()) {
|
||||
}
|
||||
CheckBoost() : Check(myName()) {}
|
||||
|
||||
/** This constructor is used when running checks. */
|
||||
CheckBoost(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks against the normal token list */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -60,13 +60,11 @@ class CPPCHECKLIB CheckBufferOverrun : public Check {
|
|||
public:
|
||||
|
||||
/** This constructor is used when registering the CheckClass */
|
||||
CheckBufferOverrun() : Check(myName()) {
|
||||
}
|
||||
CheckBufferOverrun() : Check(myName()) {}
|
||||
|
||||
/** This constructor is used when running checks. */
|
||||
CheckBufferOverrun(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
CheckBufferOverrun checkBufferOverrun(tokenizer, settings, errorLogger);
|
||||
|
|
|
@ -106,9 +106,7 @@ static bool isVclTypeInit(const Type *type)
|
|||
CheckClass::CheckClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger),
|
||||
mSymbolDatabase(tokenizer?tokenizer->getSymbolDatabase():nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// ClassCheck: Check that all class constructors are ok.
|
||||
|
@ -467,14 +465,14 @@ void CheckClass::copyconstructors()
|
|||
}
|
||||
|
||||
/* This doesn't work. See #4154
|
||||
void CheckClass::copyConstructorMallocError(const Token *cctor, const Token *alloc, const std::string& varname)
|
||||
{
|
||||
void CheckClass::copyConstructorMallocError(const Token *cctor, const Token *alloc, const std::string& varname)
|
||||
{
|
||||
std::list<const Token*> callstack;
|
||||
callstack.push_back(cctor);
|
||||
callstack.push_back(alloc);
|
||||
reportError(callstack, Severity::warning, "copyCtorNoAllocation", "Copy constructor does not allocate memory for member '" + varname + "' although memory has been allocated in other constructors.");
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
|
||||
void CheckClass::copyConstructorShallowCopyError(const Token *tok, const std::string& varname)
|
||||
{
|
||||
|
@ -1111,7 +1109,7 @@ static bool checkFunctionUsage(const Function *privfunc, const Scope* scope)
|
|||
}
|
||||
|
||||
const std::map<std::string, Type*>::const_iterator end = scope->definedTypesMap.end();
|
||||
for (std::map<std::string, Type*>::const_iterator iter = scope->definedTypesMap.begin(); iter != end; ++ iter) {
|
||||
for (std::map<std::string, Type*>::const_iterator iter = scope->definedTypesMap.begin(); iter != end; ++iter) {
|
||||
const Type *type = (*iter).second;
|
||||
if (type->enclosingScope == scope && checkFunctionUsage(privfunc, type->classScope))
|
||||
return true;
|
||||
|
@ -2296,7 +2294,7 @@ void CheckClass::checkConstError2(const Token *tok1, const Token *tok2, const st
|
|||
namespace { // avoid one-definition-rule violation
|
||||
struct VarInfo {
|
||||
VarInfo(const Variable *_var, const Token *_tok)
|
||||
: var(_var), tok(_tok) { }
|
||||
: var(_var), tok(_tok) {}
|
||||
|
||||
const Variable *var;
|
||||
const Token *tok;
|
||||
|
@ -2406,9 +2404,9 @@ void CheckClass::selfInitializationError(const Token* tok, const std::string& va
|
|||
|
||||
void CheckClass::checkVirtualFunctionCallInConstructor()
|
||||
{
|
||||
if (! mSettings->severity.isEnabled(Severity::warning))
|
||||
if (!mSettings->severity.isEnabled(Severity::warning))
|
||||
return;
|
||||
std::map<const Function *, std::list<const Token *> > virtualFunctionCallsMap;
|
||||
std::map<const Function *, std::list<const Token *>> virtualFunctionCallsMap;
|
||||
for (const Scope *scope : mSymbolDatabase->functionScopes) {
|
||||
if (scope->function == nullptr || !scope->function->hasBody() ||
|
||||
!(scope->function->isConstructor() ||
|
||||
|
@ -2432,9 +2430,9 @@ void CheckClass::checkVirtualFunctionCallInConstructor()
|
|||
}
|
||||
|
||||
const std::list<const Token *> & CheckClass::getVirtualFunctionCalls(const Function & function,
|
||||
std::map<const Function *, std::list<const Token *> > & virtualFunctionCallsMap)
|
||||
std::map<const Function *, std::list<const Token *>> & virtualFunctionCallsMap)
|
||||
{
|
||||
const std::map<const Function *, std::list<const Token *> >::const_iterator found = virtualFunctionCallsMap.find(&function);
|
||||
const std::map<const Function *, std::list<const Token *>>::const_iterator found = virtualFunctionCallsMap.find(&function);
|
||||
if (found != virtualFunctionCallsMap.end())
|
||||
return found->second;
|
||||
|
||||
|
@ -2489,7 +2487,7 @@ const std::list<const Token *> & CheckClass::getVirtualFunctionCalls(const Funct
|
|||
}
|
||||
|
||||
void CheckClass::getFirstVirtualFunctionCallStack(
|
||||
std::map<const Function *, std::list<const Token *> > & virtualFunctionCallsMap,
|
||||
std::map<const Function *, std::list<const Token *>> & virtualFunctionCallsMap,
|
||||
const Token * callToken,
|
||||
std::list<const Token *> & pureFuncStack)
|
||||
{
|
||||
|
@ -2498,7 +2496,7 @@ void CheckClass::getFirstVirtualFunctionCallStack(
|
|||
pureFuncStack.push_back(callFunction->tokenDef);
|
||||
return;
|
||||
}
|
||||
std::map<const Function *, std::list<const Token *> >::const_iterator found = virtualFunctionCallsMap.find(callFunction);
|
||||
std::map<const Function *, std::list<const Token *>>::const_iterator found = virtualFunctionCallsMap.find(callFunction);
|
||||
if (found == virtualFunctionCallsMap.end() || found->second.empty()) {
|
||||
pureFuncStack.clear();
|
||||
return;
|
||||
|
|
|
@ -44,8 +44,7 @@ class Token;
|
|||
class CPPCHECKLIB CheckClass : public Check {
|
||||
public:
|
||||
/** @brief This constructor is used when registering the CheckClass */
|
||||
CheckClass() : Check(myName()), mSymbolDatabase(nullptr) {
|
||||
}
|
||||
CheckClass() : Check(myName()), mSymbolDatabase(nullptr) {}
|
||||
|
||||
/** @brief This constructor is used when running checks. */
|
||||
CheckClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger);
|
||||
|
@ -310,7 +309,7 @@ private:
|
|||
// constructors helper function
|
||||
/** @brief Information about a member variable. Used when checking for uninitialized variables */
|
||||
struct Usage {
|
||||
explicit Usage(const Variable *var) : var(var), assign(false), init(false) { }
|
||||
explicit Usage(const Variable *var) : var(var), assign(false), init(false) {}
|
||||
|
||||
/** Variable that this usage is for */
|
||||
const Variable *var;
|
||||
|
@ -374,7 +373,7 @@ private:
|
|||
*/
|
||||
const std::list<const Token *> & getVirtualFunctionCalls(
|
||||
const Function & function,
|
||||
std::map<const Function *, std::list<const Token *> > & virtualFunctionCallsMap);
|
||||
std::map<const Function *, std::list<const Token *>> & virtualFunctionCallsMap);
|
||||
|
||||
/**
|
||||
* @brief looks for the first virtual function call stack
|
||||
|
@ -383,7 +382,7 @@ private:
|
|||
* @param[in,out] pureFuncStack list to append the stack
|
||||
*/
|
||||
void getFirstVirtualFunctionCallStack(
|
||||
std::map<const Function *, std::list<const Token *> > & virtualFunctionCallsMap,
|
||||
std::map<const Function *, std::list<const Token *>> & virtualFunctionCallsMap,
|
||||
const Token *callToken,
|
||||
std::list<const Token *> & pureFuncStack);
|
||||
|
||||
|
|
|
@ -885,7 +885,7 @@ static std::string invertOperatorForOperandSwap(std::string s)
|
|||
return s;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
static bool checkIntRelation(const std::string &op, const T value1, const T value2)
|
||||
{
|
||||
return (op == "==" && value1 == value2) ||
|
||||
|
@ -1172,7 +1172,7 @@ void CheckCondition::checkIncorrectLogicOperator()
|
|||
const double d2 = (isfloat) ? MathLib::toDoubleNumber(value2) : 0;
|
||||
const MathLib::bigint i1 = (isfloat) ? 0 : MathLib::toLongNumber(value1);
|
||||
const MathLib::bigint i2 = (isfloat) ? 0 : MathLib::toLongNumber(value2);
|
||||
const bool useUnsignedInt = (std::numeric_limits<MathLib::bigint>::max()==i1)||(std::numeric_limits<MathLib::bigint>::max()==i2);
|
||||
const bool useUnsignedInt = (std::numeric_limits<MathLib::bigint>::max()==i1) || (std::numeric_limits<MathLib::bigint>::max()==i2);
|
||||
const MathLib::biguint u1 = (useUnsignedInt) ? MathLib::toLongNumber(value1) : 0;
|
||||
const MathLib::biguint u2 = (useUnsignedInt) ? MathLib::toLongNumber(value2) : 0;
|
||||
// evaluate if expression is always true/false
|
||||
|
|
|
@ -47,13 +47,11 @@ class ValueType;
|
|||
class CPPCHECKLIB CheckCondition : public Check {
|
||||
public:
|
||||
/** This constructor is used when registering the CheckAssignIf */
|
||||
CheckCondition() : Check(myName()) {
|
||||
}
|
||||
CheckCondition() : Check(myName()) {}
|
||||
|
||||
/** This constructor is used when running checks. */
|
||||
CheckCondition(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
CheckCondition checkCondition(tokenizer, settings, errorLogger);
|
||||
|
|
|
@ -54,13 +54,11 @@ static const struct CWE CWE480(480U); // Use of Incorrect Operator
|
|||
class CPPCHECKLIB CheckExceptionSafety : public Check {
|
||||
public:
|
||||
/** This constructor is used when registering the CheckClass */
|
||||
CheckExceptionSafety() : Check(myName()) {
|
||||
}
|
||||
CheckExceptionSafety() : Check(myName()) {}
|
||||
|
||||
/** This constructor is used when running checks. */
|
||||
CheckExceptionSafety(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
if (tokenizer->isC())
|
||||
|
|
|
@ -51,13 +51,11 @@ namespace ValueFlow {
|
|||
class CPPCHECKLIB CheckFunctions : public Check {
|
||||
public:
|
||||
/** This constructor is used when registering the CheckFunctions */
|
||||
CheckFunctions() : Check(myName()) {
|
||||
}
|
||||
CheckFunctions() : Check(myName()) {}
|
||||
|
||||
/** This constructor is used when running checks. */
|
||||
CheckFunctions(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks against the normal token list */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -36,13 +36,11 @@
|
|||
class CPPCHECKLIB CheckInternal : public Check {
|
||||
public:
|
||||
/** This constructor is used when registering the CheckClass */
|
||||
CheckInternal() : Check(myName()) {
|
||||
}
|
||||
CheckInternal() : Check(myName()) {}
|
||||
|
||||
/** This constructor is used when running checks. */
|
||||
CheckInternal(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
if (!settings->checks.isEnabled(Checks::internalCheck))
|
||||
|
|
|
@ -108,8 +108,7 @@ struct Filepointer {
|
|||
AppendMode append_mode;
|
||||
std::string filename;
|
||||
explicit Filepointer(OpenMode mode_ = OpenMode::UNKNOWN_OM)
|
||||
: mode(mode_), mode_indent(0), lastOperation(Operation::NONE), op_indent(0), append_mode(AppendMode::UNKNOWN_AM) {
|
||||
}
|
||||
: mode(mode_), mode_indent(0), lastOperation(Operation::NONE), op_indent(0), append_mode(AppendMode::UNKNOWN_AM) {}
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
@ -1214,7 +1213,7 @@ void CheckIO::checkFormatString(const Token * const tok,
|
|||
break;
|
||||
case 'p':
|
||||
if (argInfo.typeToken->tokType() == Token::eString)
|
||||
;// string literals are passed as pointers to literal start, okay
|
||||
; // string literals are passed as pointers to literal start, okay
|
||||
else if (argInfo.isKnownType() && !argInfo.isArrayOrPointer())
|
||||
invalidPrintfArgTypeError_p(tok, numFormat, &argInfo);
|
||||
done = true;
|
||||
|
|
|
@ -43,13 +43,11 @@ class ErrorLogger;
|
|||
class CPPCHECKLIB CheckIO : public Check {
|
||||
public:
|
||||
/** @brief This constructor is used when registering CheckIO */
|
||||
CheckIO() : Check(myName()) {
|
||||
}
|
||||
CheckIO() : Check(myName()) {}
|
||||
|
||||
/** @brief This constructor is used when running checks. */
|
||||
CheckIO(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks on the normal token list */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -257,12 +257,12 @@ static bool isLocalVarNoAutoDealloc(const Token *varTok, const bool isCpp)
|
|||
}
|
||||
|
||||
/** checks if nameToken is a name of a function in a function call:
|
||||
* func(arg)
|
||||
* or
|
||||
* func<temp1_arg>(arg)
|
||||
* @param nameToken Function name token
|
||||
* @return opening parenthesis token or NULL if not a function call
|
||||
*/
|
||||
* func(arg)
|
||||
* or
|
||||
* func<temp1_arg>(arg)
|
||||
* @param nameToken Function name token
|
||||
* @return opening parenthesis token or NULL if not a function call
|
||||
*/
|
||||
|
||||
static const Token * isFunctionCall(const Token * nameToken)
|
||||
{
|
||||
|
|
|
@ -108,13 +108,11 @@ public:
|
|||
class CPPCHECKLIB CheckLeakAutoVar : public Check {
|
||||
public:
|
||||
/** This constructor is used when registering the CheckLeakAutoVar */
|
||||
CheckLeakAutoVar() : Check(myName()) {
|
||||
}
|
||||
CheckLeakAutoVar() : Check(myName()) {}
|
||||
|
||||
/** This constructor is used when running checks. */
|
||||
CheckLeakAutoVar(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
CheckLeakAutoVar checkLeakAutoVar(tokenizer, settings, errorLogger);
|
||||
|
|
|
@ -82,11 +82,11 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getAllocationType(const Token *tok2,
|
|||
tok2 = tok2->link();
|
||||
tok2 = tok2 ? tok2->next() : nullptr;
|
||||
}
|
||||
if (! tok2)
|
||||
if (!tok2)
|
||||
return No;
|
||||
if (tok2->str() == "::")
|
||||
tok2 = tok2->next();
|
||||
if (! tok2->isName())
|
||||
if (!tok2->isName())
|
||||
return No;
|
||||
|
||||
if (!Token::Match(tok2, "%name% ::|. %type%")) {
|
||||
|
@ -169,7 +169,7 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::getReallocationType(const Token *tok
|
|||
tok2 = tok2->link();
|
||||
tok2 = tok2 ? tok2->next() : nullptr;
|
||||
}
|
||||
if (! tok2)
|
||||
if (!tok2)
|
||||
return No;
|
||||
|
||||
if (!Token::Match(tok2, "%name% ("))
|
||||
|
|
|
@ -88,8 +88,7 @@ public:
|
|||
void operator=(const CheckMemoryLeak &) = delete;
|
||||
|
||||
CheckMemoryLeak(const Tokenizer *t, ErrorLogger *e, const Settings *s)
|
||||
: mTokenizer_(t), mErrorLogger_(e), mSettings_(s) {
|
||||
}
|
||||
: mTokenizer_(t), mErrorLogger_(e), mSettings_(s) {}
|
||||
|
||||
/** @brief What type of allocation are used.. the "Many" means that several types of allocation and deallocation are used */
|
||||
enum AllocType { No, Malloc, New, NewArray, File, Fd, Pipe, OtherMem, OtherRes, Many };
|
||||
|
@ -172,13 +171,11 @@ public:
|
|||
class CPPCHECKLIB CheckMemoryLeakInFunction : private Check, public CheckMemoryLeak {
|
||||
public:
|
||||
/** @brief This constructor is used when registering this class */
|
||||
CheckMemoryLeakInFunction() : Check(myName()), CheckMemoryLeak(nullptr, nullptr, nullptr) {
|
||||
}
|
||||
CheckMemoryLeakInFunction() : Check(myName()), CheckMemoryLeak(nullptr, nullptr, nullptr) {}
|
||||
|
||||
/** @brief This constructor is used when running checks */
|
||||
CheckMemoryLeakInFunction(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {}
|
||||
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
CheckMemoryLeakInFunction checkMemoryLeak(tokenizer, settings, errorLogger);
|
||||
|
@ -234,12 +231,10 @@ private:
|
|||
|
||||
class CPPCHECKLIB CheckMemoryLeakInClass : private Check, private CheckMemoryLeak {
|
||||
public:
|
||||
CheckMemoryLeakInClass() : Check(myName()), CheckMemoryLeak(nullptr, nullptr, nullptr) {
|
||||
}
|
||||
CheckMemoryLeakInClass() : Check(myName()), CheckMemoryLeak(nullptr, nullptr, nullptr) {}
|
||||
|
||||
CheckMemoryLeakInClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {}
|
||||
|
||||
void runChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) OVERRIDE {
|
||||
if (!tokenizr->isCPP())
|
||||
|
@ -281,12 +276,10 @@ private:
|
|||
|
||||
class CPPCHECKLIB CheckMemoryLeakStructMember : private Check, private CheckMemoryLeak {
|
||||
public:
|
||||
CheckMemoryLeakStructMember() : Check(myName()), CheckMemoryLeak(nullptr, nullptr, nullptr) {
|
||||
}
|
||||
CheckMemoryLeakStructMember() : Check(myName()), CheckMemoryLeak(nullptr, nullptr, nullptr) {}
|
||||
|
||||
CheckMemoryLeakStructMember(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {}
|
||||
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
CheckMemoryLeakStructMember checkMemoryLeak(tokenizer, settings, errorLogger);
|
||||
|
@ -302,8 +295,7 @@ private:
|
|||
|
||||
void checkStructVariable(const Variable * const variable);
|
||||
|
||||
void getErrorMessages(ErrorLogger * /*errorLogger*/, const Settings * /*settings*/) const OVERRIDE {
|
||||
}
|
||||
void getErrorMessages(ErrorLogger * /*errorLogger*/, const Settings * /*settings*/) const OVERRIDE {}
|
||||
|
||||
static std::string myName() {
|
||||
return "Memory leaks (struct members)";
|
||||
|
@ -320,12 +312,10 @@ private:
|
|||
|
||||
class CPPCHECKLIB CheckMemoryLeakNoVar : private Check, private CheckMemoryLeak {
|
||||
public:
|
||||
CheckMemoryLeakNoVar() : Check(myName()), CheckMemoryLeak(nullptr, nullptr, nullptr) {
|
||||
}
|
||||
CheckMemoryLeakNoVar() : Check(myName()), CheckMemoryLeak(nullptr, nullptr, nullptr) {}
|
||||
|
||||
CheckMemoryLeakNoVar(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger), CheckMemoryLeak(tokenizer, errorLogger, settings) {}
|
||||
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
CheckMemoryLeakNoVar checkMemoryLeak(tokenizer, settings, errorLogger);
|
||||
|
|
|
@ -46,13 +46,11 @@ class Tokenizer;
|
|||
class CPPCHECKLIB CheckNullPointer : public Check {
|
||||
public:
|
||||
/** @brief This constructor is used when registering the CheckNullPointer */
|
||||
CheckNullPointer() : Check(myName()) {
|
||||
}
|
||||
CheckNullPointer() : Check(myName()) {}
|
||||
|
||||
/** @brief This constructor is used when running checks. */
|
||||
CheckNullPointer(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks against the normal token list */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -1218,7 +1218,7 @@ static bool canBeConst(const Variable *var)
|
|||
return false;
|
||||
else {
|
||||
const Variable* argVar = tok3->astOperand1()->function()->getArgumentVar(argNr);
|
||||
if (!argVar|| (!argVar->isConst() && argVar->isReference()))
|
||||
if (!argVar || (!argVar->isConst() && argVar->isReference()))
|
||||
return false;
|
||||
}
|
||||
} else if (parent->isUnaryOp("&")) {
|
||||
|
@ -1268,8 +1268,7 @@ void CheckOther::checkPassByReference()
|
|||
|
||||
bool inconclusive = false;
|
||||
|
||||
if (var->valueType() && var->valueType()->type == ValueType::Type::CONTAINER) {
|
||||
} else if (var->type() && !var->type()->isEnumType()) { // Check if type is a struct or class.
|
||||
if (var->valueType() && var->valueType()->type == ValueType::Type::CONTAINER) {} else if (var->type() && !var->type()->isEnumType()) { // Check if type is a struct or class.
|
||||
// Ensure that it is a large object.
|
||||
if (!var->type()->classScope)
|
||||
inconclusive = true;
|
||||
|
@ -2076,7 +2075,7 @@ namespace {
|
|||
for (const Scope &scope : symbolDatabase->scopeList) {
|
||||
// only add const functions that do not have a non-const overloaded version
|
||||
// since it is pretty much impossible to tell which is being called.
|
||||
using StringFunctionMap = std::map<std::string, std::list<const Function*> >;
|
||||
using StringFunctionMap = std::map<std::string, std::list<const Function*>>;
|
||||
StringFunctionMap functionsByName;
|
||||
for (const Function &func : scope.functionList) {
|
||||
functionsByName[func.tokenDef->str()].push_back(&func);
|
||||
|
|
|
@ -50,13 +50,11 @@ class ErrorLogger;
|
|||
class CPPCHECKLIB CheckOther : public Check {
|
||||
public:
|
||||
/** @brief This constructor is used when registering the CheckClass */
|
||||
CheckOther() : Check(myName()) {
|
||||
}
|
||||
CheckOther() : Check(myName()) {}
|
||||
|
||||
/** @brief This constructor is used when running checks. */
|
||||
CheckOther(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks against the normal token list */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -42,13 +42,11 @@ class Token;
|
|||
class CPPCHECKLIB CheckPostfixOperator : public Check {
|
||||
public:
|
||||
/** This constructor is used when registering the CheckPostfixOperator */
|
||||
CheckPostfixOperator() : Check(myName()) {
|
||||
}
|
||||
CheckPostfixOperator() : Check(myName()) {}
|
||||
|
||||
/** This constructor is used when running checks. */
|
||||
CheckPostfixOperator(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
if (tokenizer->isC())
|
||||
|
|
|
@ -41,13 +41,11 @@ class Tokenizer;
|
|||
class CPPCHECKLIB CheckSizeof : public Check {
|
||||
public:
|
||||
/** @brief This constructor is used when registering the CheckClass */
|
||||
CheckSizeof() : Check(myName()) {
|
||||
}
|
||||
CheckSizeof() : Check(myName()) {}
|
||||
|
||||
/** @brief This constructor is used when running checks. */
|
||||
CheckSizeof(const Tokenizer* tokenizer, const Settings* settings, ErrorLogger* errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks against the normal token list */
|
||||
void runChecks(const Tokenizer* tokenizer, const Settings* settings, ErrorLogger* errorLogger) OVERRIDE {
|
||||
|
|
|
@ -988,7 +988,7 @@ void CheckStl::invalidContainer()
|
|||
const ValueFlow::Value* v = nullptr;
|
||||
ErrorPath errorPath;
|
||||
PathAnalysis::Info info =
|
||||
PathAnalysis{endToken, library} .forwardFind([&](const PathAnalysis::Info& info) {
|
||||
PathAnalysis{endToken, library}.forwardFind([&](const PathAnalysis::Info& info) {
|
||||
if (!info.tok->variable())
|
||||
return false;
|
||||
if (info.tok->varId() == 0)
|
||||
|
|
|
@ -46,13 +46,11 @@ class ErrorLogger;
|
|||
class CPPCHECKLIB CheckStl : public Check {
|
||||
public:
|
||||
/** This constructor is used when registering the CheckClass */
|
||||
CheckStl() : Check(myName()) {
|
||||
}
|
||||
CheckStl() : Check(myName()) {}
|
||||
|
||||
/** This constructor is used when running checks. */
|
||||
CheckStl(const Tokenizer* tokenizer, const Settings* settings, ErrorLogger* errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** run checks, the token list is not simplified */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -41,13 +41,11 @@ class Tokenizer;
|
|||
class CPPCHECKLIB CheckString : public Check {
|
||||
public:
|
||||
/** @brief This constructor is used when registering the CheckClass */
|
||||
CheckString() : Check(myName()) {
|
||||
}
|
||||
CheckString() : Check(myName()) {}
|
||||
|
||||
/** @brief This constructor is used when running checks. */
|
||||
CheckString(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks against the normal token list */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -40,13 +40,11 @@ class Tokenizer;
|
|||
class CPPCHECKLIB CheckType : public Check {
|
||||
public:
|
||||
/** @brief This constructor is used when registering the CheckClass */
|
||||
CheckType() : Check(myName()) {
|
||||
}
|
||||
CheckType() : Check(myName()) {}
|
||||
|
||||
/** @brief This constructor is used when running checks. */
|
||||
CheckType(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks against the normal token list */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -306,7 +306,7 @@ static void conditionAlwaysTrueOrFalse(const Token *tok, const std::map<nonneg i
|
|||
else if (tok->str() == "!") {
|
||||
bool t=false,f=false;
|
||||
conditionAlwaysTrueOrFalse(tok->astOperand1(), variableValue, &t, &f);
|
||||
if (t||f) {
|
||||
if (t || f) {
|
||||
*alwaysTrue = !t;
|
||||
*alwaysFalse = !f;
|
||||
}
|
||||
|
|
|
@ -55,13 +55,11 @@ struct VariableValue {
|
|||
class CPPCHECKLIB CheckUninitVar : public Check {
|
||||
public:
|
||||
/** @brief This constructor is used when registering the CheckUninitVar */
|
||||
CheckUninitVar() : Check(myName()) {
|
||||
}
|
||||
CheckUninitVar() : Check(myName()) {}
|
||||
|
||||
/** @brief This constructor is used when running checks. */
|
||||
CheckUninitVar(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
/** @brief Run checks against the normal token list */
|
||||
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) OVERRIDE {
|
||||
|
|
|
@ -223,7 +223,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi
|
|||
}
|
||||
|
||||
if (funcname) {
|
||||
FunctionUsage &func = mFunctions[ funcname->str()];
|
||||
FunctionUsage &func = mFunctions[funcname->str()];
|
||||
const std::string& called_from_file = tokenizer.list.getSourceFilePath();
|
||||
|
||||
if (func.filename.empty() || func.filename == "+" || func.filename != called_from_file)
|
||||
|
@ -305,7 +305,7 @@ bool CheckUnusedFunctions::check(ErrorLogger * const errorLogger, const Settings
|
|||
filename = func.filename;
|
||||
unusedFunctionError(errorLogger, filename, func.lineNumber, it->first);
|
||||
errors = true;
|
||||
} else if (! func.usedOtherFile) {
|
||||
} else if (!func.usedOtherFile) {
|
||||
/** @todo add error message "function is only used in <file> it can be static" */
|
||||
/*
|
||||
std::ostringstream errmsg;
|
||||
|
@ -355,8 +355,7 @@ bool CheckUnusedFunctions::analyseWholeProgram(const CTU::FileInfo *ctu, const s
|
|||
|
||||
CheckUnusedFunctions::FunctionDecl::FunctionDecl(const Function *f)
|
||||
: functionName(f->name()), lineNumber(f->token->linenr())
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
std::string CheckUnusedFunctions::analyzerInfo() const
|
||||
{
|
||||
|
|
|
@ -42,13 +42,11 @@ class Tokenizer;
|
|||
class CPPCHECKLIB CheckUnusedFunctions : public Check {
|
||||
public:
|
||||
/** @brief This constructor is used when registering the CheckUnusedFunctions */
|
||||
CheckUnusedFunctions() : Check(myName()) {
|
||||
}
|
||||
CheckUnusedFunctions() : Check(myName()) {}
|
||||
|
||||
/** @brief This constructor is used when running checks. */
|
||||
CheckUnusedFunctions(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {
|
||||
}
|
||||
: Check(myName(), tokenizer, settings, errorLogger) {}
|
||||
|
||||
static void clear() {
|
||||
instance.mFunctions.clear();
|
||||
|
@ -101,8 +99,7 @@ private:
|
|||
|
||||
class CPPCHECKLIB FunctionUsage {
|
||||
public:
|
||||
FunctionUsage() : lineNumber(0), usedSameFile(false), usedOtherFile(false) {
|
||||
}
|
||||
FunctionUsage() : lineNumber(0), usedSameFile(false), usedOtherFile(false) {}
|
||||
|
||||
std::string filename;
|
||||
unsigned int lineNumber;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue