astyle fix

This commit is contained in:
Reijo Tomperi 2011-11-20 23:43:55 +02:00
parent e0ea4228cd
commit 91e89380c2
3 changed files with 5 additions and 6 deletions

View File

@ -253,16 +253,15 @@ unsigned int CppCheck::processFile()
} catch (ErrorLogger::ErrorMessage &err) { } catch (ErrorLogger::ErrorMessage &err) {
// Catch exception from Token class // Catch exception from Token class
const std::string fixedpath = Path::toNativeSeparators(_filename); const std::string fixedpath = Path::toNativeSeparators(_filename);
if( err._callStack.empty() ){ if (err._callStack.empty()) {
ErrorLogger::ErrorMessage::FileLocation loc; ErrorLogger::ErrorMessage::FileLocation loc;
loc.setfile(fixedpath); loc.setfile(fixedpath);
err._callStack.push_back(loc); err._callStack.push_back(loc);
} } else {
else{
err._callStack.begin()->setfile(fixedpath); err._callStack.begin()->setfile(fixedpath);
} }
_errorLogger.reportErr(err ); _errorLogger.reportErr(err);
} }
if (!_settings._errorsOnly) if (!_settings._errorsOnly)

View File

@ -542,7 +542,7 @@ bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)
"Internal error. Token::Match called with varid 0.", "Internal error. Token::Match called with varid 0.",
"cppcheckError", "cppcheckError",
false); false);
throw errmsg; throw errmsg;
} }
if (tok->varId() != varid) if (tok->varId() != varid)

View File

@ -279,7 +279,7 @@ private:
givenACodeSampleToTokenize var("int a ; int b ;"); givenACodeSampleToTokenize var("int a ; int b ;");
// Varid == 0 should throw exception // Varid == 0 should throw exception
ASSERT_THROW(Token::Match(var.tokens(), "%type% %varid% ; %type% %var%", 0),ErrorLogger::ErrorMessage ); ASSERT_THROW(Token::Match(var.tokens(), "%type% %varid% ; %type% %var%", 0),ErrorLogger::ErrorMessage);
ASSERT_EQUALS(true, Token::Match(var.tokens(), "%type% %varid% ; %type% %var%", 1)); ASSERT_EQUALS(true, Token::Match(var.tokens(), "%type% %varid% ; %type% %var%", 1));
ASSERT_EQUALS(true, Token::Match(var.tokens(), "%type% %var% ; %type% %varid%", 2)); ASSERT_EQUALS(true, Token::Match(var.tokens(), "%type% %var% ; %type% %varid%", 2));