Fixed #7918 (::exit() not recognized as noreturn)

This commit is contained in:
Daniel Marjamäki 2017-02-25 12:12:39 +01:00
parent 99544069d1
commit 55d7ab65b9
2 changed files with 5 additions and 1 deletions

View File

@ -715,7 +715,9 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
// function calls are interesting..
const Token *tok2 = tok;
while (Token::Match(tok2->next(), "%name% ."))
if (Token::Match(tok2, "[{};] :: %name%"))
tok2 = tok2->next();
while (Token::Match(tok2->next(), "%name% ::|. %name%"))
tok2 = tok2->tokAt(2);
if (Token::Match(tok2->next(), "%name% ("))
;

View File

@ -560,6 +560,8 @@ private:
ASSERT_EQUALS(";;exit;", getcode("char *s; abort();", "s"));
ASSERT_EQUALS(";;callfunc;", getcode("char *s; err(0);", "s")); // not in std.cfg
ASSERT_EQUALS(";;if{exit;}", getcode("char *s; if (a) { exit(0); }", "s"));
ASSERT_EQUALS(";;if{exit;}", getcode("char *s; if (a) { ::exit(0); }", "s"));
ASSERT_EQUALS(";;if{exit;}", getcode("char *s; if (a) { std::exit(0); }", "s"));
// list_for_each
ASSERT_EQUALS(";;exit;{}}", getcode("void f() { char *s; list_for_each(x,y,s) { } }", "s"));