Changed the order of some structures in order to improve, even if for a bit, their padding.
This commit is contained in:
parent
fc7f78244e
commit
eacf74be8d
|
@ -106,13 +106,13 @@ protected:
|
||||||
void PrintMessage(const std::string &message) const;
|
void PrintMessage(const std::string &message) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::vector<std::string> _pathnames;
|
||||||
|
std::vector<std::string> _ignoredPaths;
|
||||||
Settings *_settings;
|
Settings *_settings;
|
||||||
bool _showHelp;
|
bool _showHelp;
|
||||||
bool _showVersion;
|
bool _showVersion;
|
||||||
bool _showErrorMessages;
|
bool _showErrorMessages;
|
||||||
bool _exitAfterPrint;
|
bool _exitAfterPrint;
|
||||||
std::vector<std::string> _pathnames;
|
|
||||||
std::vector<std::string> _ignoredPaths;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
@ -112,6 +112,11 @@ private:
|
||||||
*/
|
*/
|
||||||
std::set<std::string> _errorList;
|
std::set<std::string> _errorList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filename associated with size of file
|
||||||
|
*/
|
||||||
|
std::map<std::string, size_t> _files;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report progress time
|
* Report progress time
|
||||||
*/
|
*/
|
||||||
|
@ -121,11 +126,6 @@ private:
|
||||||
* Has --errorlist been given?
|
* Has --errorlist been given?
|
||||||
*/
|
*/
|
||||||
bool errorlist;
|
bool errorlist;
|
||||||
|
|
||||||
/**
|
|
||||||
* Filename associated with size of file
|
|
||||||
*/
|
|
||||||
std::map<std::string, size_t> _files;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CPPCHECKEXECUTOR_H
|
#endif // CPPCHECKEXECUTOR_H
|
||||||
|
|
|
@ -79,8 +79,8 @@ private:
|
||||||
* Write end of status pipe, different for each child.
|
* Write end of status pipe, different for each child.
|
||||||
* Not used in master process.
|
* Not used in master process.
|
||||||
*/
|
*/
|
||||||
int _wpipe;
|
|
||||||
std::list<std::string> _errorList;
|
std::list<std::string> _errorList;
|
||||||
|
int _wpipe;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -114,15 +114,15 @@ public:
|
||||||
/** number of elements of array */
|
/** number of elements of array */
|
||||||
std::vector<MathLib::bigint> _num;
|
std::vector<MathLib::bigint> _num;
|
||||||
|
|
||||||
|
/** full name of variable as pattern */
|
||||||
|
std::string _varname;
|
||||||
|
|
||||||
/** size of each element in array */
|
/** size of each element in array */
|
||||||
MathLib::bigint _element_size;
|
MathLib::bigint _element_size;
|
||||||
|
|
||||||
/** variable id */
|
/** variable id */
|
||||||
unsigned int _varid;
|
unsigned int _varid;
|
||||||
|
|
||||||
/** full name of variable as pattern */
|
|
||||||
std::string _varname;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArrayInfo();
|
ArrayInfo();
|
||||||
ArrayInfo(const ArrayInfo &);
|
ArrayInfo(const ArrayInfo &);
|
||||||
|
|
|
@ -46,8 +46,8 @@ public:
|
||||||
bool modified = false,
|
bool modified = false,
|
||||||
bool allocateMemory = false) :
|
bool allocateMemory = false) :
|
||||||
_name(name),
|
_name(name),
|
||||||
_type(type),
|
|
||||||
_scope(scope),
|
_scope(scope),
|
||||||
|
_type(type),
|
||||||
_read(read),
|
_read(read),
|
||||||
_write(write),
|
_write(write),
|
||||||
_modified(modified),
|
_modified(modified),
|
||||||
|
@ -65,15 +65,16 @@ public:
|
||||||
return (_read == false && _write == false);
|
return (_read == false && _write == false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::set<unsigned int> _aliases;
|
||||||
|
std::set<const Scope*> _assignments;
|
||||||
|
|
||||||
const Token *_name;
|
const Token *_name;
|
||||||
VariableType _type;
|
|
||||||
const Scope *_scope;
|
const Scope *_scope;
|
||||||
|
VariableType _type;
|
||||||
bool _read;
|
bool _read;
|
||||||
bool _write;
|
bool _write;
|
||||||
bool _modified; // read/modify/write
|
bool _modified; // read/modify/write
|
||||||
bool _allocateMemory;
|
bool _allocateMemory;
|
||||||
std::set<unsigned int> _aliases;
|
|
||||||
std::set<const Scope*> _assignments;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::map<unsigned int, VariableUsage> VariableMap;
|
typedef std::map<unsigned int, VariableUsage> VariableMap;
|
||||||
|
|
|
@ -40,7 +40,7 @@ static const char ExtraVersion[] = "";
|
||||||
static TimerResults S_timerResults;
|
static TimerResults S_timerResults;
|
||||||
|
|
||||||
CppCheck::CppCheck(ErrorLogger &errorLogger, bool useGlobalSuppressions)
|
CppCheck::CppCheck(ErrorLogger &errorLogger, bool useGlobalSuppressions)
|
||||||
: exitcode(0), _useGlobalSuppressions(useGlobalSuppressions), _errorLogger(errorLogger)
|
: _errorLogger(errorLogger), exitcode(0), _useGlobalSuppressions(useGlobalSuppressions)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,10 +167,8 @@ private:
|
||||||
*/
|
*/
|
||||||
static void replaceAll(std::string& code, const std::string &from, const std::string &to);
|
static void replaceAll(std::string& code, const std::string &from, const std::string &to);
|
||||||
|
|
||||||
unsigned int exitcode;
|
|
||||||
std::list<std::string> _errorList;
|
std::list<std::string> _errorList;
|
||||||
Settings _settings;
|
Settings _settings;
|
||||||
bool _useGlobalSuppressions;
|
|
||||||
std::string _fileContent;
|
std::string _fileContent;
|
||||||
std::set<std::string> _dependencies;
|
std::set<std::string> _dependencies;
|
||||||
|
|
||||||
|
@ -181,6 +179,10 @@ private:
|
||||||
|
|
||||||
/** @brief Current preprocessor configuration */
|
/** @brief Current preprocessor configuration */
|
||||||
std::string cfg;
|
std::string cfg;
|
||||||
|
|
||||||
|
unsigned int exitcode;
|
||||||
|
|
||||||
|
bool _useGlobalSuppressions;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
@ -37,8 +37,8 @@ ErrorLogger::ErrorMessage::ErrorMessage()
|
||||||
|
|
||||||
ErrorLogger::ErrorMessage::ErrorMessage(const std::list<FileLocation> &callStack, Severity::SeverityType severity, const std::string &msg, const std::string &id, bool inconclusive) :
|
ErrorLogger::ErrorMessage::ErrorMessage(const std::list<FileLocation> &callStack, Severity::SeverityType severity, const std::string &msg, const std::string &id, bool inconclusive) :
|
||||||
_callStack(callStack), // locations for this error message
|
_callStack(callStack), // locations for this error message
|
||||||
_severity(severity), // severity for this error message
|
|
||||||
_id(id), // set the message id
|
_id(id), // set the message id
|
||||||
|
_severity(severity), // severity for this error message
|
||||||
_inconclusive(inconclusive)
|
_inconclusive(inconclusive)
|
||||||
{
|
{
|
||||||
// set the summary and verbose messages
|
// set the summary and verbose messages
|
||||||
|
@ -46,7 +46,7 @@ ErrorLogger::ErrorMessage::ErrorMessage(const std::list<FileLocation> &callStack
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorLogger::ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const TokenList* list, Severity::SeverityType severity, const std::string& id, const std::string& msg, bool inconclusive)
|
ErrorLogger::ErrorMessage::ErrorMessage(const std::list<const Token*>& callstack, const TokenList* list, Severity::SeverityType severity, const std::string& id, const std::string& msg, bool inconclusive)
|
||||||
: _severity(severity), _id(id), _inconclusive(inconclusive)
|
: _id(id), _severity(severity), _inconclusive(inconclusive)
|
||||||
{
|
{
|
||||||
// Format callstack
|
// Format callstack
|
||||||
for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it) {
|
for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it) {
|
||||||
|
|
|
@ -213,13 +213,14 @@ public:
|
||||||
bool deserialize(const std::string &data);
|
bool deserialize(const std::string &data);
|
||||||
|
|
||||||
std::list<FileLocation> _callStack;
|
std::list<FileLocation> _callStack;
|
||||||
Severity::SeverityType _severity;
|
|
||||||
std::string _id;
|
std::string _id;
|
||||||
bool _inconclusive;
|
|
||||||
|
|
||||||
/** source file (not header) */
|
/** source file (not header) */
|
||||||
std::string file0;
|
std::string file0;
|
||||||
|
|
||||||
|
Severity::SeverityType _severity;
|
||||||
|
bool _inconclusive;
|
||||||
|
|
||||||
/** set short and verbose messages */
|
/** set short and verbose messages */
|
||||||
void setmsg(const std::string &msg);
|
void setmsg(const std::string &msg);
|
||||||
|
|
||||||
|
|
|
@ -2200,12 +2200,12 @@ private:
|
||||||
/** macro definition in plain text */
|
/** macro definition in plain text */
|
||||||
const std::string _macro;
|
const std::string _macro;
|
||||||
|
|
||||||
/** does this macro take a variable number of parameters? */
|
|
||||||
bool _variadic;
|
|
||||||
|
|
||||||
/** prefix that is used by cppcheck to separate macro parameters. Always "__cppcheck__" */
|
/** prefix that is used by cppcheck to separate macro parameters. Always "__cppcheck__" */
|
||||||
const std::string _prefix;
|
const std::string _prefix;
|
||||||
|
|
||||||
|
/** does this macro take a variable number of parameters? */
|
||||||
|
bool _variadic;
|
||||||
|
|
||||||
/** The macro has parentheses but no parameters.. "AAA()" */
|
/** The macro has parentheses but no parameters.. "AAA()" */
|
||||||
bool _nopar;
|
bool _nopar;
|
||||||
|
|
||||||
|
|
|
@ -1685,13 +1685,13 @@ const Variable* Function::getArgumentVar(unsigned int num) const
|
||||||
|
|
||||||
Scope::Scope(SymbolDatabase *check_, const Token *classDef_, Scope *nestedIn_, ScopeType type_, const Token *start_) :
|
Scope::Scope(SymbolDatabase *check_, const Token *classDef_, Scope *nestedIn_, ScopeType type_, const Token *start_) :
|
||||||
check(check_),
|
check(check_),
|
||||||
type(type_),
|
|
||||||
classDef(classDef_),
|
classDef(classDef_),
|
||||||
classStart(start_),
|
classStart(start_),
|
||||||
classEnd(start_->link()),
|
classEnd(start_->link()),
|
||||||
nestedIn(nestedIn_),
|
nestedIn(nestedIn_),
|
||||||
numConstructors(0),
|
numConstructors(0),
|
||||||
needInitialization(Scope::Unknown),
|
needInitialization(Scope::Unknown),
|
||||||
|
type(type_),
|
||||||
functionOf(NULL),
|
functionOf(NULL),
|
||||||
function(NULL)
|
function(NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -367,6 +367,8 @@ public:
|
||||||
token(NULL),
|
token(NULL),
|
||||||
arg(NULL),
|
arg(NULL),
|
||||||
start(NULL),
|
start(NULL),
|
||||||
|
functionScope(NULL),
|
||||||
|
type(eFunction),
|
||||||
access(Public),
|
access(Public),
|
||||||
hasBody(false),
|
hasBody(false),
|
||||||
isInline(false),
|
isInline(false),
|
||||||
|
@ -377,9 +379,7 @@ public:
|
||||||
isFriend(false),
|
isFriend(false),
|
||||||
isExplicit(false),
|
isExplicit(false),
|
||||||
isOperator(false),
|
isOperator(false),
|
||||||
retFuncPtr(false),
|
retFuncPtr(false) {
|
||||||
type(eFunction),
|
|
||||||
functionScope(NULL) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t argCount() const {
|
std::size_t argCount() const {
|
||||||
|
@ -396,6 +396,9 @@ public:
|
||||||
const Token *token; // function name token in implementation
|
const Token *token; // function name token in implementation
|
||||||
const Token *arg; // function argument start '('
|
const Token *arg; // function argument start '('
|
||||||
const Token *start; // function start '{'
|
const Token *start; // function start '{'
|
||||||
|
Scope *functionScope; // scope of function body
|
||||||
|
std::list<Variable> argumentList; // argument list
|
||||||
|
Type type; // constructor, destructor, ...
|
||||||
AccessControl access; // public/protected/private
|
AccessControl access; // public/protected/private
|
||||||
bool hasBody; // has implementation
|
bool hasBody; // has implementation
|
||||||
bool isInline; // implementation in class definition
|
bool isInline; // implementation in class definition
|
||||||
|
@ -407,9 +410,6 @@ public:
|
||||||
bool isExplicit; // is explicit
|
bool isExplicit; // is explicit
|
||||||
bool isOperator; // is operator
|
bool isOperator; // is operator
|
||||||
bool retFuncPtr; // returns function pointer
|
bool retFuncPtr; // returns function pointer
|
||||||
Type type; // constructor, destructor, ...
|
|
||||||
Scope *functionScope; // scope of function body
|
|
||||||
std::list<Variable> argumentList; // argument list
|
|
||||||
|
|
||||||
static bool argsMatch(const Scope *info, const Token *first, const Token *second, const std::string &path, unsigned int depth);
|
static bool argsMatch(const Scope *info, const Token *first, const Token *second, const std::string &path, unsigned int depth);
|
||||||
|
|
||||||
|
@ -423,10 +423,10 @@ class Scope {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct BaseInfo {
|
struct BaseInfo {
|
||||||
AccessControl access; // public/protected/private
|
|
||||||
bool isVirtual;
|
|
||||||
std::string name;
|
std::string name;
|
||||||
Scope *scope;
|
Scope *scope;
|
||||||
|
AccessControl access; // public/protected/private
|
||||||
|
bool isVirtual;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FriendInfo {
|
struct FriendInfo {
|
||||||
|
@ -441,7 +441,6 @@ public:
|
||||||
Scope(SymbolDatabase *check_, const Token *classDef_, Scope *nestedIn_, ScopeType type_, const Token *start_);
|
Scope(SymbolDatabase *check_, const Token *classDef_, Scope *nestedIn_, ScopeType type_, const Token *start_);
|
||||||
|
|
||||||
SymbolDatabase *check;
|
SymbolDatabase *check;
|
||||||
ScopeType type;
|
|
||||||
std::string className;
|
std::string className;
|
||||||
const Token *classDef; // class/struct/union/namespace token
|
const Token *classDef; // class/struct/union/namespace token
|
||||||
const Token *classStart; // '{' token
|
const Token *classStart; // '{' token
|
||||||
|
@ -453,8 +452,9 @@ public:
|
||||||
Scope *nestedIn;
|
Scope *nestedIn;
|
||||||
std::list<Scope *> nestedList;
|
std::list<Scope *> nestedList;
|
||||||
unsigned int numConstructors;
|
unsigned int numConstructors;
|
||||||
NeedInitialization needInitialization;
|
|
||||||
std::list<const Token *> usingList;
|
std::list<const Token *> usingList;
|
||||||
|
NeedInitialization needInitialization;
|
||||||
|
ScopeType type;
|
||||||
|
|
||||||
// function specific fields
|
// function specific fields
|
||||||
Scope *functionOf; // scope this function belongs to
|
Scope *functionOf; // scope this function belongs to
|
||||||
|
|
|
@ -60,10 +60,10 @@ void TimerResults::AddResults(const std::string& str, std::clock_t clocks)
|
||||||
|
|
||||||
Timer::Timer(const std::string& str, unsigned int showtimeMode, TimerResultsIntf* timerResults)
|
Timer::Timer(const std::string& str, unsigned int showtimeMode, TimerResultsIntf* timerResults)
|
||||||
: _str(str)
|
: _str(str)
|
||||||
, _showtimeMode(showtimeMode)
|
|
||||||
, _start(0)
|
|
||||||
, _stopped(false)
|
|
||||||
, _timerResults(timerResults)
|
, _timerResults(timerResults)
|
||||||
|
, _start(0)
|
||||||
|
, _showtimeMode(showtimeMode)
|
||||||
|
, _stopped(false)
|
||||||
{
|
{
|
||||||
if (showtimeMode != SHOWTIME_NONE)
|
if (showtimeMode != SHOWTIME_NONE)
|
||||||
_start = std::clock();
|
_start = std::clock();
|
||||||
|
|
|
@ -69,10 +69,10 @@ private:
|
||||||
Timer& operator=(const Timer&); // disallow assignments
|
Timer& operator=(const Timer&); // disallow assignments
|
||||||
|
|
||||||
const std::string _str;
|
const std::string _str;
|
||||||
const unsigned int _showtimeMode;
|
|
||||||
std::clock_t _start;
|
|
||||||
bool _stopped;
|
|
||||||
TimerResultsIntf* _timerResults;
|
TimerResultsIntf* _timerResults;
|
||||||
|
std::clock_t _start;
|
||||||
|
const unsigned int _showtimeMode;
|
||||||
|
bool _stopped;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,11 @@ Token::Token(Token **t) :
|
||||||
_next(0),
|
_next(0),
|
||||||
_previous(0),
|
_previous(0),
|
||||||
_link(0),
|
_link(0),
|
||||||
|
_str(""),
|
||||||
|
_varId(0),
|
||||||
|
_fileIndex(0),
|
||||||
|
_linenr(0),
|
||||||
|
_progressValue(0),
|
||||||
_type(eNone),
|
_type(eNone),
|
||||||
_isUnsigned(false),
|
_isUnsigned(false),
|
||||||
_isSigned(false),
|
_isSigned(false),
|
||||||
|
@ -40,12 +45,7 @@ Token::Token(Token **t) :
|
||||||
_isLong(false),
|
_isLong(false),
|
||||||
_isUnused(false),
|
_isUnused(false),
|
||||||
_isStandardType(false),
|
_isStandardType(false),
|
||||||
_isExpandedMacro(false),
|
_isExpandedMacro(false)
|
||||||
_varId(0),
|
|
||||||
_fileIndex(0),
|
|
||||||
_linenr(0),
|
|
||||||
_progressValue(0),
|
|
||||||
_str("")
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
lib/token.h
21
lib/token.h
|
@ -472,6 +472,16 @@ private:
|
||||||
Token *_next;
|
Token *_next;
|
||||||
Token *_previous;
|
Token *_previous;
|
||||||
Token *_link;
|
Token *_link;
|
||||||
|
std::string _str;
|
||||||
|
unsigned int _varId;
|
||||||
|
unsigned int _fileIndex;
|
||||||
|
unsigned int _linenr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A value from 0-100 that provides a rough idea about where in the token
|
||||||
|
* list this token is located.
|
||||||
|
*/
|
||||||
|
unsigned int _progressValue;
|
||||||
|
|
||||||
Type _type;
|
Type _type;
|
||||||
bool _isUnsigned;
|
bool _isUnsigned;
|
||||||
|
@ -481,9 +491,6 @@ private:
|
||||||
bool _isUnused;
|
bool _isUnused;
|
||||||
bool _isStandardType;
|
bool _isStandardType;
|
||||||
bool _isExpandedMacro;
|
bool _isExpandedMacro;
|
||||||
unsigned int _varId;
|
|
||||||
unsigned int _fileIndex;
|
|
||||||
unsigned int _linenr;
|
|
||||||
|
|
||||||
/** Updates internal property cache like _isName or _isBoolean.
|
/** Updates internal property cache like _isName or _isBoolean.
|
||||||
Called after any _str() modification. */
|
Called after any _str() modification. */
|
||||||
|
@ -491,14 +498,6 @@ private:
|
||||||
|
|
||||||
/** Update internal property cache about isStandardType() */
|
/** Update internal property cache about isStandardType() */
|
||||||
void update_property_isStandardType();
|
void update_property_isStandardType();
|
||||||
|
|
||||||
/**
|
|
||||||
* A value from 0-100 that provides a rough idea about where in the token
|
|
||||||
* list this token is located.
|
|
||||||
*/
|
|
||||||
unsigned int _progressValue;
|
|
||||||
|
|
||||||
std::string _str;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
|
|
||||||
options::options(int argc, const char* argv[])
|
options::options(int argc, const char* argv[])
|
||||||
:_options(&argv[1], &argv[0] + argc)
|
:_options(&argv[1], &argv[0] + argc)
|
||||||
|
,_which_test("")
|
||||||
,_gcc_style_errors(_options.count("-g") != 0)
|
,_gcc_style_errors(_options.count("-g") != 0)
|
||||||
,_quiet(_options.count("-q") != 0)
|
,_quiet(_options.count("-q") != 0)
|
||||||
,_which_test("")
|
|
||||||
{
|
{
|
||||||
_options.erase("-g");
|
_options.erase("-g");
|
||||||
_options.erase("-q");
|
_options.erase("-q");
|
||||||
|
|
|
@ -44,9 +44,9 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::set<std::string> _options;
|
std::set<std::string> _options;
|
||||||
|
std::string _which_test;
|
||||||
const bool _gcc_style_errors;
|
const bool _gcc_style_errors;
|
||||||
const bool _quiet;
|
const bool _quiet;
|
||||||
std::string _which_test;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue