Skip to content

Commit 7f358b2

Browse files
authored
Format with uncrustify (cppcheck-opensource#3388)
1 parent f361106 commit 7f358b2

287 files changed

Lines changed: 27969 additions & 24323 deletions

File tree

Some content is hidden

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

.uncrustify.cfg

Lines changed: 3128 additions & 0 deletions
Large diffs are not rendered by default.

cli/cmdlineparser.cpp

Lines changed: 299 additions & 300 deletions
Large diffs are not rendered by default.

cli/cppcheckexecutor.cpp

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@
8181

8282
CppCheckExecutor::CppCheckExecutor()
8383
: mSettings(nullptr), mLatestProgressOutputTime(0), mErrorOutput(nullptr), mBugHuntingReport(nullptr), mShowAllErrors(false)
84-
{
85-
}
84+
{}
8685

8786
CppCheckExecutor::~CppCheckExecutor()
8887
{
@@ -125,7 +124,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
125124
{
126125
for (std::list<std::string>::iterator iter = settings.includePaths.begin();
127126
iter != settings.includePaths.end();
128-
) {
127+
) {
129128
const std::string path(Path::toNativeSeparators(*iter));
130129
if (FileLister::isDirectory(path))
131130
++iter;
@@ -250,7 +249,7 @@ void CppCheckExecutor::setSettings(const Settings &settings)
250249
* \return size of array
251250
* */
252251
template<typename T, int size>
253-
std::size_t getArrayLength(const T(&)[size])
252+
std::size_t getArrayLength(const T (&)[size])
254253
{
255254
return size;
256255
}
@@ -548,7 +547,7 @@ static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context)
548547
(type==0) ? "reading " : "writing ",
549548
(unsigned long)info->si_addr,
550549
(isAddressOnStack)?" Stackoverflow?":""
551-
);
550+
);
552551
break;
553552
case SIGUSR1:
554553
fputs("cppcheck received signal ", output);
@@ -589,15 +588,15 @@ namespace {
589588
};
590589
typedef BOOL (WINAPI *fpStackWalk64)(DWORD, HANDLE, HANDLE, LPSTACKFRAME64, PVOID, PREAD_PROCESS_MEMORY_ROUTINE64, PFUNCTION_TABLE_ACCESS_ROUTINE64, PGET_MODULE_BASE_ROUTINE64, PTRANSLATE_ADDRESS_ROUTINE64);
591590
fpStackWalk64 pStackWalk64;
592-
typedef DWORD64(WINAPI *fpSymGetModuleBase64)(HANDLE, DWORD64);
591+
typedef DWORD64 (WINAPI *fpSymGetModuleBase64)(HANDLE, DWORD64);
593592
fpSymGetModuleBase64 pSymGetModuleBase64;
594593
typedef BOOL (WINAPI *fpSymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
595594
fpSymGetSymFromAddr64 pSymGetSymFromAddr64;
596595
typedef BOOL (WINAPI *fpSymGetLineFromAddr64)(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
597596
fpSymGetLineFromAddr64 pSymGetLineFromAddr64;
598-
typedef DWORD (WINAPI *fpUnDecorateSymbolName)(const TCHAR*, PTSTR, DWORD, DWORD) ;
597+
typedef DWORD (WINAPI *fpUnDecorateSymbolName)(const TCHAR*, PTSTR, DWORD, DWORD);
599598
fpUnDecorateSymbolName pUnDecorateSymbolName;
600-
typedef PVOID(WINAPI *fpSymFunctionTableAccess64)(HANDLE, DWORD64);
599+
typedef PVOID (WINAPI *fpSymFunctionTableAccess64)(HANDLE, DWORD64);
601600
fpSymFunctionTableAccess64 pSymFunctionTableAccess64;
602601
typedef BOOL (WINAPI *fpSymInitialize)(HANDLE, PCSTR, BOOL);
603602
fpSymInitialize pSymInitialize;
@@ -630,9 +629,9 @@ namespace {
630629
hProcess,
631630
nullptr,
632631
TRUE
633-
);
634-
CONTEXT context = *(ex->ContextRecord);
635-
STACKFRAME64 stack= {0};
632+
);
633+
CONTEXT context = *(ex->ContextRecord);
634+
STACKFRAME64 stack= {0};
636635
#ifdef _M_IX86
637636
stack.AddrPC.Offset = context.Eip;
638637
stack.AddrPC.Mode = AddrModeFlat;
@@ -657,18 +656,18 @@ namespace {
657656
BOOL result = pStackWalk64
658657
(
659658
#ifdef _M_IX86
660-
IMAGE_FILE_MACHINE_I386,
659+
IMAGE_FILE_MACHINE_I386,
661660
#else
662-
IMAGE_FILE_MACHINE_AMD64,
661+
IMAGE_FILE_MACHINE_AMD64,
663662
#endif
664-
hProcess,
665-
hThread,
666-
&stack,
667-
&context,
668-
nullptr,
669-
pSymFunctionTableAccess64,
670-
pSymGetModuleBase64,
671-
nullptr
663+
hProcess,
664+
hThread,
665+
&stack,
666+
&context,
667+
nullptr,
668+
pSymFunctionTableAccess64,
669+
pSymGetModuleBase64,
670+
nullptr
672671
);
673672
if (!result) // official end...
674673
break;

cli/cppcheckexecutor.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ class CppCheckExecutor : public ErrorLogger {
9999
*/
100100
static void setExceptionOutput(FILE* exceptionOutput);
101101
/**
102-
* @return file name to be used for output from exception handler. Has to be either "stdout" or "stderr".
103-
*/
102+
* @return file name to be used for output from exception handler. Has to be either "stdout" or "stderr".
103+
*/
104104
static FILE* getExceptionOutput();
105105

106106
/**
107-
* Tries to load a library and prints warning/error messages
108-
* @return false, if an error occurred (except unknown XML elements)
109-
*/
107+
* Tries to load a library and prints warning/error messages
108+
* @return false, if an error occurred (except unknown XML elements)
109+
*/
110110
static bool tryLoadLibrary(Library& destination, const char* basepath, const char* filename);
111111

112112
/**
@@ -152,17 +152,17 @@ class CppCheckExecutor : public ErrorLogger {
152152
int check_wrapper(CppCheck& cppcheck, int argc, const char* const argv[]);
153153

154154
/**
155-
* Starts the checking.
156-
*
157-
* @param cppcheck cppcheck instance
158-
* @param argc from main()
159-
* @param argv from main()
160-
* @return EXIT_FAILURE if arguments are invalid or no input files
161-
* were found.
162-
* If errors are found and --error-exitcode is used,
163-
* given value is returned instead of default 0.
164-
* If no errors are found, 0 is returned.
165-
*/
155+
* Starts the checking.
156+
*
157+
* @param cppcheck cppcheck instance
158+
* @param argc from main()
159+
* @param argv from main()
160+
* @return EXIT_FAILURE if arguments are invalid or no input files
161+
* were found.
162+
* If errors are found and --error-exitcode is used,
163+
* given value is returned instead of default 0.
164+
* If no errors are found, 0 is returned.
165+
*/
166166
int check_internal(CppCheck& cppcheck, int argc, const char* const argv[]);
167167

168168
/**

cli/filelister.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static std::string addFiles2(std::map<std::string, std::size_t> &files,
193193
const std::set<std::string> &extra,
194194
bool recursive,
195195
const PathMatch& ignored
196-
)
196+
)
197197
{
198198
struct stat file_stat;
199199
if (stat(path.c_str(), &file_stat) != -1) {

cli/filelister.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ class FileLister {
8181
static bool isDirectory(const std::string &path);
8282

8383
/**
84-
* @brief Check if the given path is a file and if it exists?
85-
* @return true if path points to file and the file exists.
86-
*/
84+
* @brief Check if the given path is a file and if it exists?
85+
* @return true if path points to file and the file exists.
86+
*/
8787
static bool fileExists(const std::string &path);
8888
};
8989

cli/main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int main(int argc, char* argv[])
8888
GetModuleFileNameA(nullptr, exename, sizeof(exename)/sizeof(exename[0])-1);
8989
argv[0] = exename;
9090
#endif
91-
91+
// *INDENT-OFF*
9292
#ifdef NDEBUG
9393
try {
9494
#endif
@@ -103,12 +103,13 @@ int main(int argc, char* argv[])
103103
}
104104
return EXIT_FAILURE;
105105
#endif
106+
// *INDENT-ON*
106107
}
107108

108109

109110
// Warn about deprecated compilers
110111
#ifdef __clang__
111-
# if ( __clang_major__ < 2 || ( __clang_major__ == 2 && __clang_minor__ < 9))
112+
# if (__clang_major__ < 2 || (__clang_major__ == 2 && __clang_minor__ < 9))
112113
# warning "Using Clang 2.8 or earlier. Support for this version has been removed."
113114
# endif
114115
#elif defined(__GNUC__)

cli/threadexecutor.cpp

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ using std::memset;
5555

5656
ThreadExecutor::ThreadExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger)
5757
: mFiles(files), mSettings(settings), mErrorLogger(errorLogger), mFileCount(0)
58-
// Not initialized mFileSync, mErrorSync, mReportSync
58+
// Not initialized mFileSync, mErrorSync, mReportSync
5959
{
6060
#if defined(THREADING_MODEL_FORK)
6161
mWpipe = 0;
@@ -81,7 +81,7 @@ ThreadExecutor::~ThreadExecutor()
8181

8282
void ThreadExecutor::addFileContent(const std::string &path, const std::string &content)
8383
{
84-
mFileContents[ path ] = content;
84+
mFileContents[path] = content;
8585
}
8686

8787
int ThreadExecutor::handleRead(int rpipe, unsigned int &result)
@@ -139,11 +139,11 @@ int ThreadExecutor::handleRead(int rpipe, unsigned int &result)
139139
unsigned int fileResult = 0;
140140
iss >> fileResult;
141141
result += fileResult;
142-
delete [] buf;
142+
delete[] buf;
143143
return -1;
144144
}
145145

146-
delete [] buf;
146+
delete[] buf;
147147
return 1;
148148
}
149149

@@ -224,7 +224,7 @@ unsigned int ThreadExecutor::check()
224224
resultOfCheck = fileChecker.check(*iFileSettings);
225225
} else if (!mFileContents.empty() && mFileContents.find(iFile->first) != mFileContents.end()) {
226226
// File content was given as a string
227-
resultOfCheck = fileChecker.check(iFile->first, mFileContents[ iFile->first ]);
227+
resultOfCheck = fileChecker.check(iFile->first, mFileContents[iFile->first]);
228228
} else {
229229
// Read file from a file
230230
resultOfCheck = fileChecker.check(iFile->first);
@@ -327,18 +327,18 @@ unsigned int ThreadExecutor::check()
327327
void ThreadExecutor::writeToPipe(PipeSignal type, const std::string &data)
328328
{
329329
unsigned int len = static_cast<unsigned int>(data.length() + 1);
330-
char *out = new char[ len + 1 + sizeof(len)];
330+
char *out = new char[len + 1 + sizeof(len)];
331331
out[0] = static_cast<char>(type);
332332
std::memcpy(&(out[1]), &len, sizeof(len));
333333
std::memcpy(&(out[1+sizeof(len)]), data.c_str(), len);
334334
if (write(mWpipe, out, len + 1 + sizeof(len)) <= 0) {
335-
delete [] out;
335+
delete[] out;
336336
out = nullptr;
337337
std::cerr << "#### ThreadExecutor::writeToPipe, Failed to write to pipe" << std::endl;
338338
std::exit(EXIT_FAILURE);
339339
}
340340

341-
delete [] out;
341+
delete[] out;
342342
}
343343

344344
void ThreadExecutor::reportOut(const std::string &outmsg, Color c)
@@ -523,7 +523,7 @@ void ThreadExecutor::reportInfo(const ErrorMessage &msg)
523523
report(msg, MessageType::REPORT_INFO);
524524
}
525525

526-
void ThreadExecutor::bughuntingReport(const std::string &/*str*/)
526+
void ThreadExecutor::bughuntingReport(const std::string & /*str*/)
527527
{
528528
// TODO
529529
}
@@ -562,32 +562,23 @@ void ThreadExecutor::report(const ErrorMessage &msg, MessageType msgType)
562562

563563
#else
564564

565-
void ThreadExecutor::addFileContent(const std::string &/*path*/, const std::string &/*content*/)
566-
{
567-
568-
}
565+
void ThreadExecutor::addFileContent(const std::string & /*path*/, const std::string & /*content*/)
566+
{}
569567

570568
unsigned int ThreadExecutor::check()
571569
{
572570
return 0;
573571
}
574572

575-
void ThreadExecutor::reportOut(const std::string &/*outmsg*/, Color)
576-
{
573+
void ThreadExecutor::reportOut(const std::string & /*outmsg*/, Color)
574+
{}
575+
void ThreadExecutor::reportErr(const ErrorMessage & /*msg*/)
576+
{}
577577

578-
}
579-
void ThreadExecutor::reportErr(const ErrorMessage &/*msg*/)
580-
{
578+
void ThreadExecutor::reportInfo(const ErrorMessage & /*msg*/)
579+
{}
581580

582-
}
583-
584-
void ThreadExecutor::reportInfo(const ErrorMessage &/*msg*/)
585-
{
586-
587-
}
588-
589-
void ThreadExecutor::bughuntingReport(const std::string &/*str*/)
590-
{
591-
}
581+
void ThreadExecutor::bughuntingReport(const std::string & /*str*/)
582+
{}
592583

593584
#endif

democlient/democlient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CppcheckExecutor : public ErrorLogger {
4646

4747
void bughuntingReport(const std::string&) override {}
4848

49-
void reportOut(const std::string &outmsg) override { }
49+
void reportOut(const std::string &outmsg) override {}
5050
void reportErr(const ErrorMessage &msg) override {
5151
const std::string s = msg.toString(true);
5252

gui/aboutdialog.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class QWidget;
2929
/// @{
3030

3131
/**
32-
* @brief About dialog
33-
*
34-
*/
32+
* @brief About dialog
33+
*
34+
*/
3535
class AboutDialog : public QDialog {
3636
Q_OBJECT
3737
public:

0 commit comments

Comments
 (0)