Skip to content

Commit

Permalink
Format with uncrustify (danmar#3388)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfultz2 authored Aug 7, 2021
1 parent f361106 commit 7f358b2
Show file tree
Hide file tree
Showing 287 changed files with 27,969 additions and 24,323 deletions.
3,128 changes: 3,128 additions & 0 deletions .uncrustify.cfg

Large diffs are not rendered by default.

599 changes: 299 additions & 300 deletions cli/cmdlineparser.cpp

Large diffs are not rendered by default.

41 changes: 20 additions & 21 deletions cli/cppcheckexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@

CppCheckExecutor::CppCheckExecutor()
: mSettings(nullptr), mLatestProgressOutputTime(0), mErrorOutput(nullptr), mBugHuntingReport(nullptr), mShowAllErrors(false)
{
}
{}

CppCheckExecutor::~CppCheckExecutor()
{
Expand Down Expand Up @@ -125,7 +124,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
{
for (std::list<std::string>::iterator iter = settings.includePaths.begin();
iter != settings.includePaths.end();
) {
) {
const std::string path(Path::toNativeSeparators(*iter));
if (FileLister::isDirectory(path))
++iter;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -548,7 +547,7 @@ static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context)
(type==0) ? "reading " : "writing ",
(unsigned long)info->si_addr,
(isAddressOnStack)?" Stackoverflow?":""
);
);
break;
case SIGUSR1:
fputs("cppcheck received signal ", output);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -630,9 +629,9 @@ namespace {
hProcess,
nullptr,
TRUE
);
CONTEXT context = *(ex->ContextRecord);
STACKFRAME64 stack= {0};
);
CONTEXT context = *(ex->ContextRecord);
STACKFRAME64 stack= {0};
#ifdef _M_IX86
stack.AddrPC.Offset = context.Eip;
stack.AddrPC.Mode = AddrModeFlat;
Expand All @@ -657,18 +656,18 @@ namespace {
BOOL result = pStackWalk64
(
#ifdef _M_IX86
IMAGE_FILE_MACHINE_I386,
IMAGE_FILE_MACHINE_I386,
#else
IMAGE_FILE_MACHINE_AMD64,
IMAGE_FILE_MACHINE_AMD64,
#endif
hProcess,
hThread,
&stack,
&context,
nullptr,
pSymFunctionTableAccess64,
pSymGetModuleBase64,
nullptr
hProcess,
hThread,
&stack,
&context,
nullptr,
pSymFunctionTableAccess64,
pSymGetModuleBase64,
nullptr
);
if (!result) // official end...
break;
Expand Down
32 changes: 16 additions & 16 deletions cli/cppcheckexecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ class CppCheckExecutor : public ErrorLogger {
*/
static void setExceptionOutput(FILE* exceptionOutput);
/**
* @return file name to be used for output from exception handler. Has to be either "stdout" or "stderr".
*/
* @return file name to be used for output from exception handler. Has to be either "stdout" or "stderr".
*/
static FILE* getExceptionOutput();

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

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

/**
* Starts the checking.
*
* @param cppcheck cppcheck instance
* @param argc from main()
* @param argv from main()
* @return EXIT_FAILURE if arguments are invalid or no input files
* were found.
* If errors are found and --error-exitcode is used,
* given value is returned instead of default 0.
* If no errors are found, 0 is returned.
*/
* Starts the checking.
*
* @param cppcheck cppcheck instance
* @param argc from main()
* @param argv from main()
* @return EXIT_FAILURE if arguments are invalid or no input files
* were found.
* If errors are found and --error-exitcode is used,
* given value is returned instead of default 0.
* If no errors are found, 0 is returned.
*/
int check_internal(CppCheck& cppcheck, int argc, const char* const argv[]);

/**
Expand Down
2 changes: 1 addition & 1 deletion cli/filelister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static std::string addFiles2(std::map<std::string, std::size_t> &files,
const std::set<std::string> &extra,
bool recursive,
const PathMatch& ignored
)
)
{
struct stat file_stat;
if (stat(path.c_str(), &file_stat) != -1) {
Expand Down
6 changes: 3 additions & 3 deletions cli/filelister.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ class FileLister {
static bool isDirectory(const std::string &path);

/**
* @brief Check if the given path is a file and if it exists?
* @return true if path points to file and the file exists.
*/
* @brief Check if the given path is a file and if it exists?
* @return true if path points to file and the file exists.
*/
static bool fileExists(const std::string &path);
};

Expand Down
5 changes: 3 additions & 2 deletions cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__)
Expand Down
47 changes: 19 additions & 28 deletions cli/threadexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ using std::memset;

ThreadExecutor::ThreadExecutor(const std::map<std::string, std::size_t> &files, Settings &settings, ErrorLogger &errorLogger)
: mFiles(files), mSettings(settings), mErrorLogger(errorLogger), mFileCount(0)
// Not initialized mFileSync, mErrorSync, mReportSync
// Not initialized mFileSync, mErrorSync, mReportSync
{
#if defined(THREADING_MODEL_FORK)
mWpipe = 0;
Expand All @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion democlient/democlient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CppcheckExecutor : public ErrorLogger {

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);

Expand Down
6 changes: 3 additions & 3 deletions gui/aboutdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class QWidget;
/// @{

/**
* @brief About dialog
*
*/
* @brief About dialog
*
*/
class AboutDialog : public QDialog {
Q_OBJECT
public:
Expand Down
3 changes: 1 addition & 2 deletions gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ Application::Application(const QString &name, const QString &path,
: mName(name)
, mPath(path)
, mParameters(params)
{
}
{}
Loading

0 comments on commit 7f358b2

Please sign in to comment.