| 314 | static const Token *checkMissingReturnScope(const Token *tok, const Library &library); |
| 315 | |
| 316 | void CheckFunctionsImpl::checkMissingReturn() |
| 317 | { |
| 318 | logChecker("CheckFunctions::checkMissingReturn"); |
| 319 | const SymbolDatabase *symbolDatabase = mTokenizer->getSymbolDatabase(); |
| 320 | for (const Scope *scope : symbolDatabase->functionScopes) { |
| 321 | const Function *function = scope->function; |
| 322 | if (!function || !function->hasBody()) |
| 323 | continue; |
| 324 | if (function->name() == "main" && !(mTokenizer->isC() && mSettings.standards.c < Standards::C99)) |
| 325 | continue; |
| 326 | if (function->type != FunctionType::eFunction && function->type != FunctionType::eOperatorEqual) |
| 327 | continue; |
| 328 | if (Token::Match(function->retDef, "%name% (") && function->retDef->isUpperCaseName()) |
| 329 | continue; |
| 330 | if (Function::returnsVoid(function, true)) |
| 331 | continue; |
| 332 | const Token *errorToken = checkMissingReturnScope(scope->bodyEnd, mSettings.library); |
| 333 | if (errorToken) |
| 334 | missingReturnError(errorToken); |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | static bool isForwardJump(const Token *gotoToken) |
| 339 | { |
no test coverage detected