Fixed false positive #5578
This commit is contained in:
parent
af161fc361
commit
3a4b7e5c07
|
@ -250,7 +250,7 @@ void CheckIO::checkFileUsage()
|
|||
case Filepointer::POSITIONING:
|
||||
if (f.mode == CLOSED)
|
||||
useClosedFileError(tok);
|
||||
else if (f.append_mode == Filepointer::APPEND && _settings->isEnabled("warning"))
|
||||
else if (f.append_mode == Filepointer::APPEND && tok->str() != "fflush" && _settings->isEnabled("warning"))
|
||||
seekOnAppendedFileError(tok);
|
||||
break;
|
||||
case Filepointer::READ:
|
||||
|
|
|
@ -550,6 +550,12 @@ private:
|
|||
" fseek(f, 0, SEEK_SET);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (warning) Repositioning operation performed on a file opened in append mode has no effect.\n", errout.str());
|
||||
|
||||
check("void foo() {\n"
|
||||
" FILE* f = fopen(\"\", \"a\");\n"
|
||||
" fflush(f);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str()); // #5578
|
||||
}
|
||||
|
||||
void fflushOnInputStream() {
|
||||
|
|
Loading…
Reference in New Issue