Fixes for Doxygen + code formatting

This commit is contained in:
Alexander Mai 2014-04-07 20:39:19 +02:00
parent 9ae59290dd
commit a06371e063
3 changed files with 27 additions and 25 deletions

View File

@ -349,7 +349,6 @@ static int filterException(int code, PEXCEPTION_POINTERS ex)
code);
break;
}
fprintf(stderr, "Please report this to the cppcheck developers!\n");
return EXCEPTION_EXECUTE_HANDLER;
}
#endif
@ -360,14 +359,13 @@ static int filterException(int code, PEXCEPTION_POINTERS ex)
* TODO Check for multi-threading issues!
*
*/
int CppCheckExecutor::check_wrapper(CppCheck& cppCheck, int argc, const char* const argv[])
int CppCheckExecutor::check_wrapper(CppCheck& cppcheck, int argc, const char* const argv[])
{
#ifdef USE_WINDOWS_SEH
__try {
return check_internal(cppCheck, argc, argv);
return check_internal(cppcheck, argc, argv);
} __except (filterException(GetExceptionCode(), GetExceptionInformation())) {
// reporting to stdout may not be helpful within a GUI application..
fprintf(stderr, "Internal error\n");
fprintf(stderr, "Please report this to the cppcheck developers!\n");
return -1;
}
@ -379,18 +377,18 @@ int CppCheckExecutor::check_wrapper(CppCheck& cppCheck, int argc, const char* co
for (std::size_t s=0; s<GetArrayLength(listofsignals); ++s) {
sigaction(listofsignals[s].signalnumber, &act, NULL);
}
return check_internal(cppCheck, argc, argv);
return check_internal(cppcheck, argc, argv);
#else
return check_internal(cppCheck, argc, argv);
return check_internal(cppcheck, argc, argv);
#endif
}
/*
* That is a method which gets called from check_wrapper
* */
int CppCheckExecutor::check_internal(CppCheck& cppCheck, int /*argc*/, const char* const argv[])
int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const char* const argv[])
{
Settings& settings = cppCheck.settings();
Settings& settings = cppcheck.settings();
_settings = &settings;
bool std = settings.library.load(argv[0], "std.cfg");
bool posix = true;
@ -436,7 +434,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppCheck, int /*argc*/, const cha
for (std::map<std::string, std::size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
if (!_settings->library.markupFile(i->first)
|| !_settings->library.processMarkupAfterCode(i->first)) {
returnValue += cppCheck.check(i->first);
returnValue += cppcheck.check(i->first);
processedsize += i->second;
if (!settings._errorsOnly)
reportStatus(c + 1, _files.size(), processedsize, totalfilesize);
@ -448,7 +446,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppCheck, int /*argc*/, const cha
// c/cpp files have been parsed and checked
for (std::map<std::string, std::size_t>::const_iterator i = _files.begin(); i != _files.end(); ++i) {
if (_settings->library.markupFile(i->first) && _settings->library.processMarkupAfterCode(i->first)) {
returnValue += cppCheck.check(i->first);
returnValue += cppcheck.check(i->first);
processedsize += i->second;
if (!settings._errorsOnly)
reportStatus(c + 1, _files.size(), processedsize, totalfilesize);
@ -456,7 +454,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppCheck, int /*argc*/, const cha
}
}
cppCheck.checkFunctionUsage();
cppcheck.checkFunctionUsage();
} else if (!ThreadExecutor::isEnabled()) {
std::cout << "No thread support yet implemented for this platform." << std::endl;
} else {
@ -469,7 +467,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppCheck, int /*argc*/, const cha
reportUnmatchedSuppressions(settings.nomsg.getUnmatchedGlobalSuppressions());
if (!settings.checkConfiguration) {
cppCheck.tooManyConfigsError("",0U);
cppcheck.tooManyConfigsError("",0U);
if (settings.isEnabled("missingInclude") && Preprocessor::missingIncludeFlag) {
const std::list<ErrorLogger::ErrorMessage::FileLocation> callStack;

View File

@ -112,12 +112,16 @@ private:
* Wrapper around check_internal
* - installs optional platform dependent signal handling
*
* * @param cppcheck cppcheck instance
* @param argc from main()
* @param argv from main()
**/
int check_wrapper(CppCheck& cppCheck, int argc, const char* const argv[]);
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
@ -126,7 +130,7 @@ private:
* 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[]);
int check_internal(CppCheck& cppcheck, int argc, const char* const argv[]);
/**
* Pointer to current settings; set while check() is running.
*/

View File

@ -2538,20 +2538,20 @@ private:
void nullpointerFputc() {
check("int main () {\n"
"FILE *fp = fopen(\"file.txt\", \"w+\");\n"
"fputc(000, fp); \n"
"fclose(fp);\n"
"return 0 ;\n"
"}\n");
"FILE *fp = fopen(\"file.txt\", \"w+\");\n"
"fputc(000, fp); \n"
"fclose(fp);\n"
"return 0 ;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
check("int main () {\n"
"FILE *fp = fopen(\"file.txt\", \"w+\");\n"
"char *nullstring=0;"
"fputc(*nullstring, fp); \n"
"fclose(fp);\n"
"return 0 ;\n"
"}\n");
"FILE *fp = fopen(\"file.txt\", \"w+\");\n"
"char *nullstring=0;"
"fputc(*nullstring, fp); \n"
"fclose(fp);\n"
"return 0 ;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (error) Possible null pointer dereference: nullstring\n", errout.str());
}
};