Skip to content

Commit eacf74b

Browse files
committed
Changed the order of some structures in order to improve, even if for a bit, their padding.
1 parent fc7f782 commit eacf74b

18 files changed

+62
-59
lines changed

cli/cmdlineparser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ class CmdLineParser {
106106
void PrintMessage(const std::string &message) const;
107107

108108
private:
109+
std::vector<std::string> _pathnames;
110+
std::vector<std::string> _ignoredPaths;
109111
Settings *_settings;
110112
bool _showHelp;
111113
bool _showVersion;
112114
bool _showErrorMessages;
113115
bool _exitAfterPrint;
114-
std::vector<std::string> _pathnames;
115-
std::vector<std::string> _ignoredPaths;
116116
};
117117

118118
/// @}

cli/cppcheckexecutor.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ class CppCheckExecutor : public ErrorLogger {
112112
*/
113113
std::set<std::string> _errorList;
114114

115+
/**
116+
* Filename associated with size of file
117+
*/
118+
std::map<std::string, size_t> _files;
119+
115120
/**
116121
* Report progress time
117122
*/
@@ -121,11 +126,6 @@ class CppCheckExecutor : public ErrorLogger {
121126
* Has --errorlist been given?
122127
*/
123128
bool errorlist;
124-
125-
/**
126-
* Filename associated with size of file
127-
*/
128-
std::map<std::string, size_t> _files;
129129
};
130130

131131
#endif // CPPCHECKEXECUTOR_H

cli/threadexecutor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ class ThreadExecutor : public ErrorLogger {
7979
* Write end of status pipe, different for each child.
8080
* Not used in master process.
8181
*/
82-
int _wpipe;
8382
std::list<std::string> _errorList;
83+
int _wpipe;
8484

8585
public:
8686
/**

lib/checkbufferoverrun.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ class CheckBufferOverrun : public Check {
114114
/** number of elements of array */
115115
std::vector<MathLib::bigint> _num;
116116

117+
/** full name of variable as pattern */
118+
std::string _varname;
119+
117120
/** size of each element in array */
118121
MathLib::bigint _element_size;
119122

120123
/** variable id */
121124
unsigned int _varid;
122125

123-
/** full name of variable as pattern */
124-
std::string _varname;
125-
126126
public:
127127
ArrayInfo();
128128
ArrayInfo(const ArrayInfo &);

lib/checkunusedvar.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class Variables {
4646
bool modified = false,
4747
bool allocateMemory = false) :
4848
_name(name),
49-
_type(type),
5049
_scope(scope),
50+
_type(type),
5151
_read(read),
5252
_write(write),
5353
_modified(modified),
@@ -65,15 +65,16 @@ class Variables {
6565
return (_read == false && _write == false);
6666
}
6767

68+
std::set<unsigned int> _aliases;
69+
std::set<const Scope*> _assignments;
70+
6871
const Token *_name;
69-
VariableType _type;
7072
const Scope *_scope;
73+
VariableType _type;
7174
bool _read;
7275
bool _write;
7376
bool _modified; // read/modify/write
7477
bool _allocateMemory;
75-
std::set<unsigned int> _aliases;
76-
std::set<const Scope*> _assignments;
7778
};
7879

7980
typedef std::map<unsigned int, VariableUsage> VariableMap;

lib/cppcheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static const char ExtraVersion[] = "";
4040
static TimerResults S_timerResults;
4141

4242
CppCheck::CppCheck(ErrorLogger &errorLogger, bool useGlobalSuppressions)
43-
: exitcode(0), _useGlobalSuppressions(useGlobalSuppressions), _errorLogger(errorLogger)
43+
: _errorLogger(errorLogger), exitcode(0), _useGlobalSuppressions(useGlobalSuppressions)
4444
{
4545
}
4646

lib/cppcheck.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,8 @@ class CppCheck : ErrorLogger {
167167
*/
168168
static void replaceAll(std::string& code, const std::string &from, const std::string &to);
169169

170-
unsigned int exitcode;
171170
std::list<std::string> _errorList;
172171
Settings _settings;
173-
bool _useGlobalSuppressions;
174172
std::string _fileContent;
175173
std::set<std::string> _dependencies;
176174

@@ -181,6 +179,10 @@ class CppCheck : ErrorLogger {
181179

182180
/** @brief Current preprocessor configuration */
183181
std::string cfg;
182+
183+
unsigned int exitcode;
184+
185+
bool _useGlobalSuppressions;
184186
};
185187

186188
/// @}

lib/errorlogger.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ ErrorLogger::ErrorMessage::ErrorMessage()
3737

3838
ErrorLogger::ErrorMessage::ErrorMessage(const std::list<FileLocation> &callStack, Severity::SeverityType severity, const std::string &msg, const std::string &id, bool inconclusive) :
3939
_callStack(callStack), // locations for this error message
40-
_severity(severity), // severity for this error message
4140
_id(id), // set the message id
41+
_severity(severity), // severity for this error message
4242
_inconclusive(inconclusive)
4343
{
4444
// set the summary and verbose messages
4545
setmsg(msg);
4646
}
4747

4848
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)
49-
: _severity(severity), _id(id), _inconclusive(inconclusive)
49+
: _id(id), _severity(severity), _inconclusive(inconclusive)
5050
{
5151
// Format callstack
5252
for (std::list<const Token *>::const_iterator it = callstack.begin(); it != callstack.end(); ++it) {

lib/errorlogger.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,14 @@ class ErrorLogger {
213213
bool deserialize(const std::string &data);
214214

215215
std::list<FileLocation> _callStack;
216-
Severity::SeverityType _severity;
217216
std::string _id;
218-
bool _inconclusive;
219217

220218
/** source file (not header) */
221219
std::string file0;
222220

221+
Severity::SeverityType _severity;
222+
bool _inconclusive;
223+
223224
/** set short and verbose messages */
224225
void setmsg(const std::string &msg);
225226

lib/preprocessor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,12 +2200,12 @@ class PreprocessorMacro {
22002200
/** macro definition in plain text */
22012201
const std::string _macro;
22022202

2203-
/** does this macro take a variable number of parameters? */
2204-
bool _variadic;
2205-
22062203
/** prefix that is used by cppcheck to separate macro parameters. Always "__cppcheck__" */
22072204
const std::string _prefix;
22082205

2206+
/** does this macro take a variable number of parameters? */
2207+
bool _variadic;
2208+
22092209
/** The macro has parentheses but no parameters.. "AAA()" */
22102210
bool _nopar;
22112211

0 commit comments

Comments
 (0)