bump simplecpp
This commit is contained in:
parent
37dea8a5cf
commit
5c7cf584ef
|
@ -401,6 +401,20 @@ void simplecpp::TokenList::readfile(std::istream &istr, const std::string &filen
|
||||||
if (ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r')
|
if (ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r')
|
||||||
ch = ' ';
|
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 (ch == '\n') {
|
||||||
if (cback() && cback()->op == '\\') {
|
if (cback() && cback()->op == '\\') {
|
||||||
if (location.col > cback()->location.col + 1U)
|
if (location.col > cback()->location.col + 1U)
|
||||||
|
|
|
@ -164,7 +164,8 @@ namespace simplecpp {
|
||||||
MISSING_HEADER,
|
MISSING_HEADER,
|
||||||
INCLUDE_NESTED_TOO_DEEPLY,
|
INCLUDE_NESTED_TOO_DEEPLY,
|
||||||
SYNTAX_ERROR,
|
SYNTAX_ERROR,
|
||||||
PORTABILITY_BACKSLASH
|
PORTABILITY_BACKSLASH,
|
||||||
|
UNHANDLED_CHAR_ERROR
|
||||||
} type;
|
} type;
|
||||||
Location location;
|
Location location;
|
||||||
std::string msg;
|
std::string msg;
|
||||||
|
|
|
@ -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
|
// If there is a syntax error, report it and stop
|
||||||
for (simplecpp::OutputList::const_iterator it = outputList.begin(); it != outputList.end(); ++it) {
|
for (simplecpp::OutputList::const_iterator it = outputList.begin(); it != outputList.end(); ++it) {
|
||||||
if (it->type != simplecpp::Output::SYNTAX_ERROR)
|
bool err;
|
||||||
continue;
|
switch (it->type) {
|
||||||
const ErrorLogger::ErrorMessage::FileLocation loc1(it->location.file(), it->location.line);
|
case simplecpp::Output::ERROR:
|
||||||
std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
|
case simplecpp::Output::INCLUDE_NESTED_TOO_DEEPLY:
|
||||||
callstack.push_back(loc1);
|
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,
|
if (err) {
|
||||||
"",
|
const ErrorLogger::ErrorMessage::FileLocation loc1(it->location.file(), it->location.line);
|
||||||
Severity::error,
|
std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
|
||||||
it->msg,
|
callstack.push_back(loc1);
|
||||||
"syntaxError",
|
|
||||||
false);
|
ErrorLogger::ErrorMessage errmsg(callstack,
|
||||||
_errorLogger.reportErr(errmsg);
|
"",
|
||||||
return 1;
|
Severity::error,
|
||||||
|
it->msg,
|
||||||
|
"syntaxError",
|
||||||
|
false);
|
||||||
|
_errorLogger.reportErr(errmsg);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
preprocessor.loadFiles(tokens1, files);
|
preprocessor.loadFiles(tokens1, files);
|
||||||
|
|
|
@ -550,6 +550,7 @@ static bool hasErrors(const simplecpp::OutputList &outputList)
|
||||||
case simplecpp::Output::ERROR:
|
case simplecpp::Output::ERROR:
|
||||||
case simplecpp::Output::INCLUDE_NESTED_TOO_DEEPLY:
|
case simplecpp::Output::INCLUDE_NESTED_TOO_DEEPLY:
|
||||||
case simplecpp::Output::SYNTAX_ERROR:
|
case simplecpp::Output::SYNTAX_ERROR:
|
||||||
|
case simplecpp::Output::UNHANDLED_CHAR_ERROR:
|
||||||
return true;
|
return true;
|
||||||
case simplecpp::Output::WARNING:
|
case simplecpp::Output::WARNING:
|
||||||
case simplecpp::Output::MISSING_HEADER:
|
case simplecpp::Output::MISSING_HEADER:
|
||||||
|
@ -688,6 +689,7 @@ void Preprocessor::reportOutput(const simplecpp::OutputList &outputList, bool sh
|
||||||
break;
|
break;
|
||||||
case simplecpp::Output::INCLUDE_NESTED_TOO_DEEPLY:
|
case simplecpp::Output::INCLUDE_NESTED_TOO_DEEPLY:
|
||||||
case simplecpp::Output::SYNTAX_ERROR:
|
case simplecpp::Output::SYNTAX_ERROR:
|
||||||
|
case simplecpp::Output::UNHANDLED_CHAR_ERROR:
|
||||||
error(it->location.file(), it->location.line, it->msg);
|
error(it->location.file(), it->location.line, it->msg);
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,7 +67,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void isVariableChanged() {
|
void isVariableChanged() {
|
||||||
// #8211 - no lhs for >> , do not crash
|
// #8211 - no lhs for >> , do not crash
|
||||||
ASSERT_EQUALS(true,
|
ASSERT_EQUALS(true,
|
||||||
isVariableChanged("void f() {\n"
|
isVariableChanged("void f() {\n"
|
||||||
" int b;\n"
|
" int b;\n"
|
||||||
|
|
Loading…
Reference in New Issue