Added support for fgetc() to std.cfg.

This commit is contained in:
orbitcowboy 2014-03-20 00:59:52 +01:00
parent be0fcefe1d
commit b37e9601c1
3 changed files with 29 additions and 1 deletions

View File

@ -27,7 +27,18 @@
<arg nr="2"><not-uninit/><not-bool/><valid>0-</valid></arg>
<arg nr="3"><not-null/><not-uninit/></arg>
</function>
<function name="fsetpos"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg><arg nr="2"><not-null/><not-uninit/></arg></function>
<function name="fsetpos">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
</function>
<function name="fputc">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/><not-bool/><valid>0-</valid></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
</function>
<function name="isalnum"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function>
<function name="isalpha"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0-255</valid></arg> </function>

View File

@ -2414,6 +2414,9 @@ private:
check("void f(char * p,char * q){ fopen (p,q);if(!p||!q){}}");
ASSERT_EQUALS(errpq,errout.str());
check("void f(char * p,FILE * q){ fputc (*p,q);if(!p||!q){}}");
ASSERT_EQUALS(errpq,errout.str());
check("void f(FILE * p,fpos_t * q){ fgetpos (p,q);if(!p||!q){}}");
ASSERT_EQUALS(errpq,errout.str());

View File

@ -3590,6 +3590,20 @@ private:
" fgets (s, n, f);\n"
"}");
ASSERT_EQUALS("", errout.str());
// fputc
checkUninitVar("void f() {\n"
" int c;\n"
" FILE *f;"
" fputc (c, f);\n"
"}");
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: c\n"
"[test.cpp:3]: (error) Uninitialized variable: f\n", errout.str());
checkUninitVar("void f(int c, FILE *f) {\n"
" fputc (c, f);\n"
"}");
ASSERT_EQUALS("", errout.str());
}
};