Fix output when note contains
This commit is contained in:
parent
485153c930
commit
bbd3a992b8
|
@ -1457,7 +1457,7 @@ void CheckOther::constVariableError(const Variable *var, const Function *functio
|
||||||
std::string message = "$symbol:" + varname + "\n" + vartype + " '$symbol' can be declared with const";
|
std::string message = "$symbol:" + varname + "\n" + vartype + " '$symbol' can be declared with const";
|
||||||
errorPath.push_back(ErrorPathItem(var ? var->nameToken() : nullptr, message));
|
errorPath.push_back(ErrorPathItem(var ? var->nameToken() : nullptr, message));
|
||||||
if (var && var->isArgument() && function && function->functionPointerUsage) {
|
if (var && var->isArgument() && function && function->functionPointerUsage) {
|
||||||
errorPath.push_back(ErrorPathItem(function->functionPointerUsage, "You might need to cast the function pointer here"));
|
errorPath.push_front(ErrorPathItem(function->functionPointerUsage, "You might need to cast the function pointer here"));
|
||||||
id += "Callback";
|
id += "Callback";
|
||||||
message += ". However it seems that '" + function->name() + "' is a callback function, if '$symbol' is declared with const you might also need to cast function pointer(s).";
|
message += ". However it seems that '" + function->name() + "' is a callback function, if '$symbol' is declared with const you might also need to cast function pointer(s).";
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,13 @@ ErrorMessage::ErrorMessage(const ErrorPath &errorPath, const TokenList *tokenLis
|
||||||
// Format callstack
|
// Format callstack
|
||||||
for (const ErrorPathItem& e: errorPath) {
|
for (const ErrorPathItem& e: errorPath) {
|
||||||
const Token *tok = e.first;
|
const Token *tok = e.first;
|
||||||
const std::string &info = e.second;
|
std::string info = e.second;
|
||||||
|
|
||||||
|
if (info.compare(0,8,"$symbol:") == 0 && info.find("\n") < info.size()) {
|
||||||
|
const std::string::size_type pos = info.find("\n");
|
||||||
|
const std::string &symbolName = info.substr(8, pos - 8);
|
||||||
|
info = replaceStr(info.substr(pos+1), "$symbol", symbolName);
|
||||||
|
}
|
||||||
|
|
||||||
// --errorlist can provide null values here
|
// --errorlist can provide null values here
|
||||||
if (tok)
|
if (tok)
|
||||||
|
|
Loading…
Reference in New Issue