Skip to content

Commit 6f8e42a

Browse files
author
Daniel Marjamäki
committed
changed the astyle formatting flags
1 parent b792efb commit 6f8e42a

File tree

180 files changed

+7392
-15312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+7392
-15312
lines changed

cli/cmdlineparser.cpp

Lines changed: 81 additions & 163 deletions
Large diffs are not rendered by default.

cli/cmdlineparser.h

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ class Settings;
3636
* based on options user has given. Couple of options are handled as
3737
* class internal options.
3838
*/
39-
class CmdLineParser
40-
{
39+
class CmdLineParser {
4140
public:
4241
/**
4342
* The constructor.
@@ -55,48 +54,42 @@ class CmdLineParser
5554
/**
5655
* Return if user wanted to see program version.
5756
*/
58-
bool GetShowVersion() const
59-
{
57+
bool GetShowVersion() const {
6058
return _showVersion;
6159
}
6260

6361
/**
6462
* Return if user wanted to see list of error messages.
6563
*/
66-
bool GetShowErrorMessages() const
67-
{
64+
bool GetShowErrorMessages() const {
6865
return _showErrorMessages;
6966
}
7067

7168
/**
7269
* Return the path names user gave to command line.
7370
*/
74-
std::vector<std::string> GetPathNames() const
75-
{
71+
std::vector<std::string> GetPathNames() const {
7672
return _pathnames;
7773
}
7874

7975
/**
8076
* Return if help is shown to user.
8177
*/
82-
bool GetShowHelp() const
83-
{
78+
bool GetShowHelp() const {
8479
return _showHelp;
8580
}
8681

8782
/**
8883
* Return if we should exit after printing version, help etc.
8984
*/
90-
bool ExitAfterPrinting() const
91-
{
85+
bool ExitAfterPrinting() const {
9286
return _exitAfterPrint;
9387
}
9488

9589
/**
9690
* Return a list of paths user wants to ignore.
9791
*/
98-
std::vector<std::string> GetIgnoredPaths() const
99-
{
92+
std::vector<std::string> GetIgnoredPaths() const {
10093
return _ignoredPaths;
10194
}
10295

cli/cppcheckexecutor.cpp

Lines changed: 31 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
4949
bool success = parser.ParseFromArgs(argc, argv);
5050
cppcheck->settings(_settings); // copy the settings
5151

52-
if (success)
53-
{
54-
if (parser.GetShowVersion() && !parser.GetShowErrorMessages())
55-
{
52+
if (success) {
53+
if (parser.GetShowVersion() && !parser.GetShowErrorMessages()) {
5654
const char * extraVersion = cppcheck->extraVersion();
5755
if (strlen(extraVersion) > 0)
5856
std::cout << "Cppcheck " << cppcheck->version() << " ("
@@ -61,8 +59,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
6159
std::cout << "Cppcheck " << cppcheck->version() << std::endl;
6260
}
6361

64-
if (parser.GetShowErrorMessages())
65-
{
62+
if (parser.GetShowErrorMessages()) {
6663
errorlist = true;
6764
std::cout << ErrorLogger::ErrorMessage::getXMLHeader(_settings._xml_version);
6865
cppcheck->getErrorMessages();
@@ -78,13 +75,11 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
7875
std::list<std::string>::iterator iter;
7976
for (iter = _settings._includePaths.begin();
8077
iter != _settings._includePaths.end();
81-
)
82-
{
78+
) {
8379
const std::string path(Path::toNativeSeparators(*iter));
8480
if (FileLister::isDirectory(path))
8581
++iter;
86-
else
87-
{
82+
else {
8883
// If the include path is not found, warn user and remove the
8984
// non-existing path from the list.
9085
std::cout << "cppcheck: warning: Couldn't find path given by -I '" + path + "'" << std::endl;
@@ -97,30 +92,25 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
9792
std::vector<std::string> filenames;
9893
std::map<std::string, long> filesizes;
9994

100-
if (!pathnames.empty())
101-
{
95+
if (!pathnames.empty()) {
10296
// Execute recursiveAddFiles() to each given file parameter
10397
std::vector<std::string>::const_iterator iter;
10498
for (iter = pathnames.begin(); iter != pathnames.end(); ++iter)
10599
FileLister::recursiveAddFiles(filenames, filesizes, Path::toNativeSeparators(*iter));
106100
}
107101

108-
if (!filenames.empty())
109-
{
102+
if (!filenames.empty()) {
110103
// Remove header files from the list of ignored files.
111104
// Also output a warning for the user.
112105
// TODO: Remove all unknown files? (use FileLister::acceptFile())
113106
bool warned = false;
114107
std::vector<std::string> ignored = parser.GetIgnoredPaths();
115108
std::vector<std::string>::iterator iterIgnored = ignored.begin();
116-
for (int i = (int)ignored.size() - 1; i >= 0; i--)
117-
{
109+
for (int i = (int)ignored.size() - 1; i >= 0; i--) {
118110
const std::string extension = Path::getFilenameExtension(ignored[i]);
119-
if (extension == ".h" || extension == ".hpp")
120-
{
111+
if (extension == ".h" || extension == ".hpp") {
121112
ignored.erase(iterIgnored + i);
122-
if (!warned)
123-
{
113+
if (!warned) {
124114
std::cout << "cppcheck: filename exclusion does not apply to header (.h and .hpp) files." << std::endl;
125115
std::cout << "cppcheck: Please use --suppress for ignoring results from the header files." << std::endl;
126116
warned = true; // Warn only once
@@ -130,8 +120,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
130120

131121
PathMatch matcher(parser.GetIgnoredPaths());
132122
std::vector<std::string>::iterator iterBegin = filenames.begin();
133-
for (int i = (int)filenames.size() - 1; i >= 0; i--)
134-
{
123+
for (int i = (int)filenames.size() - 1; i >= 0; i--) {
135124
#if defined(_WIN32)
136125
// For Windows we want case-insensitive path matching
137126
const bool caseSensitive = false;
@@ -141,26 +130,20 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
141130
if (matcher.Match(filenames[(unsigned int)i], caseSensitive))
142131
filenames.erase(iterBegin + i);
143132
}
144-
}
145-
else
146-
{
133+
} else {
147134
std::cout << "cppcheck: error: could not find or open any of the paths given." << std::endl;
148135
return false;
149136
}
150137

151-
if (!filenames.empty())
152-
{
138+
if (!filenames.empty()) {
153139
std::vector<std::string>::iterator iter;
154-
for (iter = filenames.begin(); iter != filenames.end(); ++iter)
155-
{
140+
for (iter = filenames.begin(); iter != filenames.end(); ++iter) {
156141
_filenames.push_back(*iter);
157142
_filesizes[*iter] = filesizes[*iter];
158143
}
159144

160145
return true;
161-
}
162-
else
163-
{
146+
} else {
164147
std::cout << "cppcheck: error: no files to check - all paths ignored." << std::endl;
165148
return false;
166149
}
@@ -171,64 +154,52 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
171154
Preprocessor::missingIncludeFlag = false;
172155

173156
CppCheck cppCheck(*this, true);
174-
if (!parseFromArgs(&cppCheck, argc, argv))
175-
{
157+
if (!parseFromArgs(&cppCheck, argc, argv)) {
176158
return EXIT_FAILURE;
177159
}
178160

179161
if (cppCheck.settings().reportProgress)
180162
time1 = std::time(0);
181163

182164
_settings = cppCheck.settings();
183-
if (_settings._xml)
184-
{
165+
if (_settings._xml) {
185166
reportErr(ErrorLogger::ErrorMessage::getXMLHeader(_settings._xml_version));
186167
}
187168

188169
unsigned int returnValue = 0;
189-
if (_settings._jobs == 1)
190-
{
170+
if (_settings._jobs == 1) {
191171
// Single process
192172

193173
long totalfilesize = 0;
194-
for (std::map<std::string, long>::const_iterator i = _filesizes.begin(); i != _filesizes.end(); ++i)
195-
{
174+
for (std::map<std::string, long>::const_iterator i = _filesizes.begin(); i != _filesizes.end(); ++i) {
196175
totalfilesize += i->second;
197176
}
198177

199178
long processedsize = 0;
200-
for (unsigned int c = 0; c < _filenames.size(); c++)
201-
{
179+
for (unsigned int c = 0; c < _filenames.size(); c++) {
202180
returnValue += cppCheck.check(_filenames[c]);
203-
if (_filesizes.find(_filenames[c]) != _filesizes.end())
204-
{
181+
if (_filesizes.find(_filenames[c]) != _filesizes.end()) {
205182
processedsize += _filesizes[_filenames[c]];
206183
}
207184
if (!_settings._errorsOnly)
208185
reportStatus(c + 1, _filenames.size(), processedsize, totalfilesize);
209186
}
210187

211188
cppCheck.checkFunctionUsage();
212-
}
213-
else if (!ThreadExecutor::isEnabled())
214-
{
189+
} else if (!ThreadExecutor::isEnabled()) {
215190
std::cout << "No thread support yet implemented for this platform." << std::endl;
216-
}
217-
else
218-
{
191+
} else {
219192
// Multiple processes
220193
Settings &settings = cppCheck.settings();
221194
ThreadExecutor executor(_filenames, _filesizes, settings, *this);
222195
returnValue = executor.check();
223196
}
224197

225-
if (!cppCheck.settings().checkConfiguration)
226-
{
198+
if (!cppCheck.settings().checkConfiguration) {
227199
if (!_settings._errorsOnly)
228200
reportUnmatchedSuppressions(cppCheck.settings().nomsg.getUnmatchedGlobalSuppressions());
229201

230-
if (Preprocessor::missingIncludeFlag)
231-
{
202+
if (Preprocessor::missingIncludeFlag) {
232203
const std::list<ErrorLogger::ErrorMessage::FileLocation> callStack;
233204
ErrorLogger::ErrorMessage msg(callStack,
234205
Severity::information,
@@ -244,8 +215,7 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
244215
}
245216
}
246217

247-
if (_settings._xml)
248-
{
218+
if (_settings._xml) {
249219
reportErr(ErrorLogger::ErrorMessage::getXMLFooter(_settings._xml_version));
250220
}
251221

@@ -279,8 +249,7 @@ void CppCheckExecutor::reportProgress(const std::string &filename, const char st
279249

280250
// Report progress messages every 10 seconds
281251
const std::time_t time2 = std::time(NULL);
282-
if (time2 >= (time1 + 10))
283-
{
252+
if (time2 >= (time1 + 10)) {
284253
time1 = time2;
285254

286255
// current time in the format "Www Mmm dd hh:mm:ss yyyy"
@@ -301,8 +270,7 @@ void CppCheckExecutor::reportProgress(const std::string &filename, const char st
301270

302271
void CppCheckExecutor::reportStatus(unsigned int fileindex, unsigned int filecount, long sizedone, long sizetotal)
303272
{
304-
if (filecount > 1)
305-
{
273+
if (filecount > 1) {
306274
std::ostringstream oss;
307275
oss << fileindex << "/" << filecount
308276
<< " files checked " <<
@@ -314,16 +282,11 @@ void CppCheckExecutor::reportStatus(unsigned int fileindex, unsigned int filecou
314282

315283
void CppCheckExecutor::reportErr(const ErrorLogger::ErrorMessage &msg)
316284
{
317-
if (errorlist)
318-
{
285+
if (errorlist) {
319286
reportOut(msg.toXML(false, _settings._xml_version));
320-
}
321-
else if (_settings._xml)
322-
{
287+
} else if (_settings._xml) {
323288
reportErr(msg.toXML(_settings._verbose, _settings._xml_version));
324-
}
325-
else
326-
{
289+
} else {
327290
reportErr(msg.toString(_settings._verbose, _settings._outputFormat));
328291
}
329292
}

cli/cppcheckexecutor.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ class CppCheck;
3535
* just rewrite this class for your needs and possibly use other methods
3636
* from CppCheck class instead the ones used here.
3737
*/
38-
class CppCheckExecutor : public ErrorLogger
39-
{
38+
class CppCheckExecutor : public ErrorLogger {
4039
public:
4140
/**
4241
* Constructor

0 commit comments

Comments
 (0)