From 30006cf06feecfbe3670826627a0185418cc09c3 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Thu, 20 Mar 2014 02:13:41 +0100 Subject: [PATCH] Added support for fputs() to std.cfg. --- cfg/std.cfg | 7 ++++++- test/testnullpointer.cpp | 3 +++ test/testuninitvar.cpp | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index 9e65a8367..ec2154f5a 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -39,7 +39,12 @@ 0- - + + false + + + + false 0-255 false 0-255 false 0-255 diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index 6e55af5b8..02573d660 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -2417,6 +2417,9 @@ private: check("void f(char * p,FILE * q){ fputc (*p,q);if(!p||!q){}}"); ASSERT_EQUALS(errpq,errout.str()); + check("void f(char * p,FILE * q){ fputs (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 6429adfb6..688837f7d 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -3604,6 +3604,21 @@ private: " fputc (c, f);\n" "}"); ASSERT_EQUALS("", errout.str()); + + + // fputs + checkUninitVar("void f() {\n" + " char *c;\n" + " FILE *f;" + " fputs (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(char *c, FILE *f) {\n" + " fputs (c, f);\n" + "}"); + ASSERT_EQUALS("", errout.str()); } };