From b37e9601c17420aa95c4594b19bf38dd6b1e602b Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Thu, 20 Mar 2014 00:59:52 +0100 Subject: [PATCH] Added support for fgetc() to std.cfg. --- cfg/std.cfg | 13 ++++++++++++- test/testnullpointer.cpp | 3 +++ test/testuninitvar.cpp | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index 2035a8e27..9e65a8367 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -27,7 +27,18 @@ 0- - false + + false + + + + + + false + + 0- + + false 0-255 false 0-255 diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index f49612b9d..6e55af5b8 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -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()); diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 726e1119d..6429adfb6 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -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()); } };