Added temporary bailout code, cppcheck crashes when string checking leaks out. This needs a better fix, this is just to

see the problem more easily.
This commit is contained in:
Reijo Tomperi 2009-01-18 22:46:48 +00:00
parent f6d121443e
commit 50d9a085da
2 changed files with 11 additions and 3 deletions

View File

@ -818,8 +818,8 @@ void CheckOther::unreachableCode()
break;
// If there is a statement below the return it is unreachable
if ( !Token::Match(tok, "; case|default|}|#") && !Token::Match(tok, "; %var% :")
&& ( _settings._checkCodingStyle || !Token::simpleMatch(tok, "; break") ) )
if (!Token::Match(tok, "; case|default|}|#") && !Token::Match(tok, "; %var% :")
&& (_settings._checkCodingStyle || !Token::simpleMatch(tok, "; break")))
{
_errorLogger->reportErr(ErrorMessage::unreachableCode(_tokenizer, tok->next()));
}

View File

@ -610,7 +610,7 @@ public:
};
#include <iostream>
std::string Preprocessor::expandMacros(std::string code)
{
@ -668,6 +668,14 @@ std::string Preprocessor::expandMacros(std::string code)
if (code[pos1] == '\\')
++pos1;
++pos1;
if (!code[pos1])
{
// TODO, this code is here, because there is currently a bug in cppcheck
// Once it has been sorted out, this if can be removed
std::cout << "\n\n####### There is a bug in preprocessor.cpp that can cause crash, shutting down.\n\n" << std::endl;
exit(0);
}
}
continue;
}