Null pointers: Don't warn when first argument to freopen() is NULL

This commit is contained in:
Daniel Marjamäki 2013-11-08 13:22:07 +01:00
parent 52df31b501
commit 20b84fcdee
2 changed files with 4 additions and 1 deletions

View File

@ -110,7 +110,6 @@ void CheckNullPointer::parseFunctionCall(const Token &tok, std::list<const Token
functionNames1_all.insert("fgetwc");
functionNames1_all.insert("fgetpos");
functionNames1_all.insert("fsetpos");
functionNames1_all.insert("freopen");
functionNames1_all.insert("fscanf");
functionNames1_all.insert("fprintf");
functionNames1_all.insert("fwscanf");
@ -161,6 +160,7 @@ void CheckNullPointer::parseFunctionCall(const Token &tok, std::list<const Token
functionNames1_uninit.insert("perror");
functionNames1_uninit.insert("fflush");
functionNames1_uninit.insert("freopen");
}
// standard functions that dereference second parameter..

View File

@ -1719,6 +1719,9 @@ private:
" typeof(*NULL) y;\n"
"}", true);
ASSERT_EQUALS("", errout.str());
check("void f() { freopen(NULL, m, stdin); }");
ASSERT_EQUALS("", errout.str());
}
void gcc_statement_expression() {