Fixed compiler error introduced in previous commit and several MSVC warnings
This commit is contained in:
parent
6b124a37d8
commit
93c02ce826
|
@ -536,7 +536,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintCallstack(FILE* output, PEXCEPTION_POINTERS ex)
|
void PrintCallstack(FILE* outputFile, PEXCEPTION_POINTERS ex)
|
||||||
{
|
{
|
||||||
if (!loadDbgHelp())
|
if (!loadDbgHelp())
|
||||||
return;
|
return;
|
||||||
|
@ -595,11 +595,11 @@ namespace {
|
||||||
++beyond_main;
|
++beyond_main;
|
||||||
if (_tcscmp(undname, _T("main"))==0)
|
if (_tcscmp(undname, _T("main"))==0)
|
||||||
beyond_main=0;
|
beyond_main=0;
|
||||||
fprintf(output,
|
fprintf(outputFile,
|
||||||
"%lu. 0x%08I64X in ",
|
"%lu. 0x%08I64X in ",
|
||||||
frame, (ULONG64)stack.AddrPC.Offset);
|
frame, (ULONG64)stack.AddrPC.Offset);
|
||||||
fputs((const char *)undname, output);
|
fputs((const char *)undname, outputFile);
|
||||||
fputc('\n', output);
|
fputc('\n', outputFile);
|
||||||
if (0==stack.AddrReturn.Offset || beyond_main>2) // StackWalk64() sometimes doesn't reach any end...
|
if (0==stack.AddrReturn.Offset || beyond_main>2) // StackWalk64() sometimes doesn't reach any end...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -608,24 +608,24 @@ namespace {
|
||||||
hLibDbgHelp=0;
|
hLibDbgHelp=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeMemoryErrorDetails(FILE* output, PEXCEPTION_POINTERS ex, const char* description)
|
void writeMemoryErrorDetails(FILE* outputFile, PEXCEPTION_POINTERS ex, const char* description)
|
||||||
{
|
{
|
||||||
fputs(description, output);
|
fputs(description, outputFile);
|
||||||
fprintf(output, " (instruction: 0x%p) ", ex->ExceptionRecord->ExceptionAddress);
|
fprintf(outputFile, " (instruction: 0x%p) ", ex->ExceptionRecord->ExceptionAddress);
|
||||||
// Using %p for ULONG_PTR later on, so it must have size identical to size of pointer
|
// Using %p for ULONG_PTR later on, so it must have size identical to size of pointer
|
||||||
// This is not the universally portable solution but good enough for Win32/64
|
// This is not the universally portable solution but good enough for Win32/64
|
||||||
C_ASSERT(sizeof(void*) == sizeof(ex->ExceptionRecord->ExceptionInformation[1]));
|
C_ASSERT(sizeof(void*) == sizeof(ex->ExceptionRecord->ExceptionInformation[1]));
|
||||||
switch (ex->ExceptionRecord->ExceptionInformation[0]) {
|
switch (ex->ExceptionRecord->ExceptionInformation[0]) {
|
||||||
case 0:
|
case 0:
|
||||||
fprintf(output, "reading from 0x%p",
|
fprintf(outputFile, "reading from 0x%p",
|
||||||
reinterpret_cast<void*>(ex->ExceptionRecord->ExceptionInformation[1]));
|
reinterpret_cast<void*>(ex->ExceptionRecord->ExceptionInformation[1]));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
fprintf(output, "writing to 0x%p",
|
fprintf(outputFile, "writing to 0x%p",
|
||||||
reinterpret_cast<void*>(ex->ExceptionRecord->ExceptionInformation[1]));
|
reinterpret_cast<void*>(ex->ExceptionRecord->ExceptionInformation[1]));
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
fprintf(output, "data execution prevention at 0x%p",
|
fprintf(outputFile, "data execution prevention at 0x%p",
|
||||||
reinterpret_cast<void*>(ex->ExceptionRecord->ExceptionInformation[1]));
|
reinterpret_cast<void*>(ex->ExceptionRecord->ExceptionInformation[1]));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -638,83 +638,83 @@ namespace {
|
||||||
*/
|
*/
|
||||||
int filterException(int code, PEXCEPTION_POINTERS ex)
|
int filterException(int code, PEXCEPTION_POINTERS ex)
|
||||||
{
|
{
|
||||||
FILE *output = stdout;
|
FILE *outputFile = stdout;
|
||||||
fputs("Internal error: ", output);
|
fputs("Internal error: ", outputFile);
|
||||||
switch (ex->ExceptionRecord->ExceptionCode) {
|
switch (ex->ExceptionRecord->ExceptionCode) {
|
||||||
case EXCEPTION_ACCESS_VIOLATION:
|
case EXCEPTION_ACCESS_VIOLATION:
|
||||||
writeMemoryErrorDetails(output, ex, "Access violation");
|
writeMemoryErrorDetails(outputFile, ex, "Access violation");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
||||||
fputs("Out of array bounds", output);
|
fputs("Out of array bounds", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_BREAKPOINT:
|
case EXCEPTION_BREAKPOINT:
|
||||||
fputs("Breakpoint", output);
|
fputs("Breakpoint", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
||||||
fputs("Misaligned data", output);
|
fputs("Misaligned data", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
||||||
fputs("Denormalized floating-point value", output);
|
fputs("Denormalized floating-point value", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||||
fputs("Floating-point divide-by-zero", output);
|
fputs("Floating-point divide-by-zero", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_INEXACT_RESULT:
|
case EXCEPTION_FLT_INEXACT_RESULT:
|
||||||
fputs("Inexact floating-point value", output);
|
fputs("Inexact floating-point value", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_INVALID_OPERATION:
|
case EXCEPTION_FLT_INVALID_OPERATION:
|
||||||
fputs("Invalid floating-point operation", output);
|
fputs("Invalid floating-point operation", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_OVERFLOW:
|
case EXCEPTION_FLT_OVERFLOW:
|
||||||
fputs("Floating-point overflow", output);
|
fputs("Floating-point overflow", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_STACK_CHECK:
|
case EXCEPTION_FLT_STACK_CHECK:
|
||||||
fputs("Floating-point stack overflow", output);
|
fputs("Floating-point stack overflow", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_UNDERFLOW:
|
case EXCEPTION_FLT_UNDERFLOW:
|
||||||
fputs("Floating-point underflow", output);
|
fputs("Floating-point underflow", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_GUARD_PAGE:
|
case EXCEPTION_GUARD_PAGE:
|
||||||
fputs("Page-guard access", output);
|
fputs("Page-guard access", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||||
fputs("Illegal instruction", output);
|
fputs("Illegal instruction", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_IN_PAGE_ERROR:
|
case EXCEPTION_IN_PAGE_ERROR:
|
||||||
writeMemoryErrorDetails(output, ex, "Invalid page access");
|
writeMemoryErrorDetails(outputFile, ex, "Invalid page access");
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||||
fputs("Integer divide-by-zero", output);
|
fputs("Integer divide-by-zero", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_INT_OVERFLOW:
|
case EXCEPTION_INT_OVERFLOW:
|
||||||
fputs("Integer overflow", output);
|
fputs("Integer overflow", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_INVALID_DISPOSITION:
|
case EXCEPTION_INVALID_DISPOSITION:
|
||||||
fputs("Invalid exception dispatcher", output);
|
fputs("Invalid exception dispatcher", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_INVALID_HANDLE:
|
case EXCEPTION_INVALID_HANDLE:
|
||||||
fputs("Invalid handle", output);
|
fputs("Invalid handle", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
||||||
fputs("Non-continuable exception", output);
|
fputs("Non-continuable exception", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_PRIV_INSTRUCTION:
|
case EXCEPTION_PRIV_INSTRUCTION:
|
||||||
fputs("Invalid instruction", output);
|
fputs("Invalid instruction", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_SINGLE_STEP:
|
case EXCEPTION_SINGLE_STEP:
|
||||||
fputs("Single instruction step", output);
|
fputs("Single instruction step", outputFile);
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_STACK_OVERFLOW:
|
case EXCEPTION_STACK_OVERFLOW:
|
||||||
fputs("Stack overflow", output);
|
fputs("Stack overflow", outputFile);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(output, "Unknown exception (%d)\n",
|
fprintf(outputFile, "Unknown exception (%d)\n",
|
||||||
code);
|
code);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fputc('\n', output);
|
fputc('\n', outputFile);
|
||||||
PrintCallstack(output, ex);
|
PrintCallstack(outputFile, ex);
|
||||||
fflush(output);
|
fflush(outputFile);
|
||||||
return EXCEPTION_EXECUTE_HANDLER;
|
return EXCEPTION_EXECUTE_HANDLER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -729,12 +729,12 @@ namespace {
|
||||||
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
|
#ifdef USE_WINDOWS_SEH
|
||||||
FILE *output = stdout;
|
FILE *outputFile = stdout;
|
||||||
__try {
|
__try {
|
||||||
return check_internal(cppcheck, argc, argv);
|
return check_internal(cppcheck, argc, argv);
|
||||||
} __except (filterException(GetExceptionCode(), GetExceptionInformation())) {
|
} __except (filterException(GetExceptionCode(), GetExceptionInformation())) {
|
||||||
// reporting to stdout may not be helpful within a GUI application...
|
// reporting to stdout may not be helpful within a GUI application...
|
||||||
fputs("Please report this to the cppcheck developers!\n", output);
|
fputs("Please report this to the cppcheck developers!\n", outputFile);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#elif defined(USE_UNIX_SIGNAL_HANDLING)
|
#elif defined(USE_UNIX_SIGNAL_HANDLING)
|
||||||
|
|
|
@ -267,7 +267,7 @@ void CheckString::checkIncorrectStringCompare()
|
||||||
tok = tok->next()->link();
|
tok = tok->next()->link();
|
||||||
|
|
||||||
if (Token::simpleMatch(tok, ". substr (") && Token::Match(tok->tokAt(3)->nextArgument(), "%num% )")) {
|
if (Token::simpleMatch(tok, ". substr (") && Token::Match(tok->tokAt(3)->nextArgument(), "%num% )")) {
|
||||||
MathLib::bigint clen = MathLib::toLongNumber(tok->linkAt(2)->strAt(-1));
|
MathLib::biguint clen = MathLib::toULongNumber(tok->linkAt(2)->strAt(-1));
|
||||||
const Token* begin = tok->previous();
|
const Token* begin = tok->previous();
|
||||||
for (;;) { // Find start of statement
|
for (;;) { // Find start of statement
|
||||||
while (begin->link() && Token::Match(begin, "]|)|>"))
|
while (begin->link() && Token::Match(begin, "]|)|>"))
|
||||||
|
|
|
@ -3922,7 +3922,7 @@ std::string ValueType::str() const
|
||||||
ret += " double";
|
ret += " double";
|
||||||
else if (type == LONGDOUBLE)
|
else if (type == LONGDOUBLE)
|
||||||
ret += " long double";
|
ret += " long double";
|
||||||
for (int p = 0; p < pointer; p++) {
|
for (unsigned int p = 0; p < pointer; p++) {
|
||||||
ret += " *";
|
ret += " *";
|
||||||
if (constness & (2 << p))
|
if (constness & (2 << p))
|
||||||
ret += " const";
|
ret += " const";
|
||||||
|
|
|
@ -1046,8 +1046,7 @@ bool TemplateSimplifier::simplifyCalculations(Token *_tokens)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token::Match(tok->previous(), "(|&&|%oror% %char% %comp% %num% &&|%oror%|)")) {
|
if (Token::Match(tok->previous(), "(|&&|%oror% %char% %comp% %num% &&|%oror%|)")) {
|
||||||
int c = MathLib::toLongNumber(tok->str());
|
tok->str(MathLib::toString(MathLib::toLongNumber(tok->str())));
|
||||||
tok->str(MathLib::toString(c));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok->isNumber()) {
|
if (tok->isNumber()) {
|
||||||
|
|
|
@ -2188,7 +2188,7 @@ void Tokenizer::arraySize()
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (Token::Match(tok, "%var% [ ] = {")) {
|
else if (Token::Match(tok, "%var% [ ] = {")) {
|
||||||
unsigned int sz = 1;
|
MathLib::biguint sz = 1;
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
Token *end = tok->linkAt(3);
|
Token *end = tok->linkAt(3);
|
||||||
for (Token *tok2 = tok->tokAt(4); tok2 && tok2 != end; tok2 = tok2->next()) {
|
for (Token *tok2 = tok->tokAt(4); tok2 && tok2 != end; tok2 = tok2->next()) {
|
||||||
|
|
|
@ -2187,8 +2187,8 @@ private:
|
||||||
if (db) {
|
if (db) {
|
||||||
ASSERT_EQUALS(2, db->scopeList.size());
|
ASSERT_EQUALS(2, db->scopeList.size());
|
||||||
ASSERT_EQUALS(2, db->getVariableListSize()-1);
|
ASSERT_EQUALS(2, db->getVariableListSize()-1);
|
||||||
ASSERT(db->getVariableFromVarId(1));
|
ASSERT(db->getVariableFromVarId(1) != nullptr);
|
||||||
ASSERT(db->getVariableFromVarId(2));
|
ASSERT(db->getVariableFromVarId(2) != nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2198,8 +2198,8 @@ private:
|
||||||
|
|
||||||
ASSERT(db != nullptr);
|
ASSERT(db != nullptr);
|
||||||
if (db) {
|
if (db) {
|
||||||
ASSERT(db->getVariableFromVarId(1));
|
ASSERT(db->getVariableFromVarId(1) != nullptr);
|
||||||
ASSERT(db->getVariableFromVarId(2));
|
ASSERT(db->getVariableFromVarId(2) != nullptr);
|
||||||
ASSERT_EQUALS(false, db->getVariableFromVarId(1)->isClass());
|
ASSERT_EQUALS(false, db->getVariableFromVarId(1)->isClass());
|
||||||
ASSERT_EQUALS(false, db->getVariableFromVarId(2)->isClass());
|
ASSERT_EQUALS(false, db->getVariableFromVarId(2)->isClass());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue