You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (var && var->isArgument() && function && function->functionPointerUsage) {
1444
+
errorPath.push_back(ErrorPathItem(function->functionPointerUsage, "You might need to cast the function pointer here"));
1445
+
id += "Callback";
1446
+
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).";
1444
1447
}
1445
-
reportError(tok, Severity::style, "const" + id, id + " '" + name + "' can be declared with const", CWE398, false);
auto addMatchingFunctions = [&](const Scope *scope) {
4618
4633
for (std::multimap<std::string, const Function *>::const_iterator it = scope->functionMap.find(tok->str()); it != scope->functionMap.cend() && it->first == tok->str(); ++it) {
ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:2]: (style) Parameter 'x' can be declared with const. However it seems that 'callback' is a callback function, if 'x' is declared with const you might also need to cast function pointer(s).\n", errout.str());
2530
+
2531
+
// #9906
2532
+
check("class EventEngine : public IEventEngine {\n"
2533
+
"public:\n"
2534
+
" EventEngine();\n"
2535
+
"\n"
2536
+
"private:\n"
2537
+
" void signalEvent(ev::sig& signal, int revents);\n"
"void EventEngine::signalEvent(ev::sig& signal, int revents) {\n"
2545
+
" switch (signal.signum) {}\n"
2546
+
"}");
2547
+
ASSERT_EQUALS("[test.cpp:13] -> [test.cpp:10]: (style) Parameter 'signal' can be declared with const. However it seems that 'signalEvent' is a callback function, if 'signal' is declared with const you might also need to cast function pointer(s).\n", errout.str());
0 commit comments