From 6507824a34d6830168e4ecd10fe33f093547ad7a Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Thu, 20 Mar 2014 05:49:38 +0100 Subject: [PATCH] Added support for putchar() to std.cfg. --- cfg/std.cfg | 21 +++++++++++++-------- test/testnullpointer.cpp | 3 +++ test/testuninitvar.cpp | 11 +++++++++++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index 3d2aed7ce..007b2f879 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -45,16 +45,21 @@ - - false - + + false + - - - false - + + + false + - + + + false + + 0- + false 0-255 false 0-255 false 0-255 diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index eec9fda93..1e1ecf532 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -2435,6 +2435,9 @@ private: check("void f(char * p){ strchr (p,c);if(!p){}}"); ASSERT_EQUALS(errp,errout.str()); + check("void f(char * p){ putchar (*p);if(!p){}}"); + ASSERT_EQUALS(errp,errout.str()); + check("void f(char * p){ strdup (p);if(!p){}}"); ASSERT_EQUALS(errp,errout.str()); diff --git a/test/testuninitvar.cpp b/test/testuninitvar.cpp index 690064e1a..f9ddf60f7 100644 --- a/test/testuninitvar.cpp +++ b/test/testuninitvar.cpp @@ -3643,6 +3643,17 @@ private: "}"); ASSERT_EQUALS("", errout.str()); + // putchar + checkUninitVar("void f() {\n" + " char *c;" + " putchar (*c);\n" + "}"); + ASSERT_EQUALS("[test.cpp:2]: (error) Uninitialized variable: c\n", errout.str()); + + checkUninitVar("void f( char *c) {\n" + " putchar (*c);\n" + "}"); + ASSERT_EQUALS("", errout.str()); } };