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)
@ -1288,7 +1302,7 @@ namespace simplecpp {
if (!expandArg(tokens, tok, tok->location, macros, expandedmacros, parametertokens)) {
bool expanded = false;
const std::map<TokenString, Macro>::const_iterator it = macros.find(tok->str);
if (it != macros.end() && expandedmacros.find(tok->str) == expandedmacros.end()) {
if (it != macros.end() && expandedmacros.find(tok->str) == expandedmacros.end()) {
const Macro &m = it->second;
if (!m.functionLike()) {
m.expand(tokens, tok, macros, files);

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,20 +147,35 @@ 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;
const ErrorLogger::ErrorMessage::FileLocation loc1(it->location.file(), it->location.line);
std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
callstack.push_back(loc1);
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;
};
ErrorLogger::ErrorMessage errmsg(callstack,
"",
Severity::error,
it->msg,
"syntaxError",
false);
_errorLogger.reportErr(errmsg);
return 1;
if (err) {
const ErrorLogger::ErrorMessage::FileLocation loc1(it->location.file(), it->location.line);
std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
callstack.push_back(loc1);
ErrorLogger::ErrorMessage errmsg(callstack,
"",
Severity::error,
it->msg,
"syntaxError",
false);
_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;
};

View File

@ -67,7 +67,7 @@ private:
}
void isVariableChanged() {
// #8211 - no lhs for >> , do not crash
// #8211 - no lhs for >> , do not crash
ASSERT_EQUALS(true,
isVariableChanged("void f() {\n"
" int b;\n"