bump simplecpp

This commit is contained in:
Daniel Marjamäki 2017-09-12 22:42:10 +02:00
parent 37dea8a5cf
commit 5c7cf584ef
5 changed files with 48 additions and 16 deletions

View File

@ -401,6 +401,20 @@ void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filen
if (ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r')
ch = ' ';
if (ch >= 0x80) {
if (outputList) {
simplecpp::Output err(files);
err.type = simplecpp::Output::UNHANDLED_CHAR_ERROR;
err.location = location;
std::ostringstream s;
s << (int)ch;
err.msg = "The code contains unhandled character(s) (character code=" + s.str() + "). Neither unicode nor extended ascii is supported.";
outputList->push_back(err);
}
clear();
return;
}
if (ch == '\n') {
if (cback() && cback()->op == '\\') {
if (location.col > cback()->location.col + 1U)

View File

@ -164,7 +164,8 @@ namespace simplecpp {
MISSING_HEADER,
INCLUDE_NESTED_TOO_DEEPLY,
SYNTAX_ERROR,
PORTABILITY_BACKSLASH
PORTABILITY_BACKSLASH,
UNHANDLED_CHAR_ERROR
} type;
Location location;
std::string msg;

View File

@ -147,8 +147,22 @@ unsigned int CppCheck::processFile(const std::string& filename, const std::strin
// If there is a syntax error, report it and stop
for (simplecpp::OutputList::const_iterator it = outputList.begin(); it != outputList.end(); ++it) {
if (it->type != simplecpp::Output::SYNTAX_ERROR)
continue;
bool err;
switch (it->type) {
case simplecpp::Output::ERROR:
case simplecpp::Output::INCLUDE_NESTED_TOO_DEEPLY:
case simplecpp::Output::SYNTAX_ERROR:
case simplecpp::Output::UNHANDLED_CHAR_ERROR:
err = true;
break;
case simplecpp::Output::WARNING:
case simplecpp::Output::MISSING_HEADER:
case simplecpp::Output::PORTABILITY_BACKSLASH:
err = false;
break;
};
if (err) {
const ErrorLogger::ErrorMessage::FileLocation loc1(it->location.file(), it->location.line);
std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
callstack.push_back(loc1);
@ -162,6 +176,7 @@ unsigned int CppCheck::processFile(const std::string& filename, const std::strin
_errorLogger.reportErr(errmsg);
return 1;
}
}
preprocessor.loadFiles(tokens1, files);

View File

@ -550,6 +550,7 @@ static bool hasErrors(const simplecpp::OutputList &outputList)
case simplecpp::Output::ERROR:
case simplecpp::Output::INCLUDE_NESTED_TOO_DEEPLY:
case simplecpp::Output::SYNTAX_ERROR:
case simplecpp::Output::UNHANDLED_CHAR_ERROR:
return true;
case simplecpp::Output::WARNING:
case simplecpp::Output::MISSING_HEADER:
@ -688,6 +689,7 @@ void Preprocessor::reportOutput(const simplecpp::OutputList &outputList, bool sh
break;
case simplecpp::Output::INCLUDE_NESTED_TOO_DEEPLY:
case simplecpp::Output::SYNTAX_ERROR:
case simplecpp::Output::UNHANDLED_CHAR_ERROR:
error(it->location.file(), it->location.line, it->msg);
break;
};