diff --git a/cfg/posix.cfg b/cfg/posix.cfg
index cc8062add..c4106606d 100644
--- a/cfg/posix.cfg
+++ b/cfg/posix.cfg
@@ -28,7 +28,7 @@
false
- false
+ false
close
open
diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp
index a60cb18bd..8f5f74716 100644
--- a/test/testnullpointer.cpp
+++ b/test/testnullpointer.cpp
@@ -88,6 +88,11 @@ private:
// Test that std.cfg is configured correctly
TEST_CASE(stdcfg);
+
+ // Load posix library file
+ LOAD_LIB_2(settings.library, "posix.cfg");
+ // Test that posix.cfg is configured correctly
+ TEST_CASE(posixcfg);
}
void check(const char code[], bool inconclusive = false, const char filename[] = "test.cpp", bool verify=true) {
@@ -2591,6 +2596,16 @@ private:
"}\n");
ASSERT_EQUALS("[test.cpp:2]: (error) Null pointer dereference\n", errout.str());
}
+
+ void posixcfg() {
+ const char errp[] = "[test.cpp:1] -> [test.cpp:1]: (warning) Possible null pointer dereference: p - otherwise it is redundant to check it against null.\n";
+
+ check("void f(FILE *p){ isatty (*p);if(!p){}}");
+ ASSERT_EQUALS(errp,errout.str());
+
+ check("void f(){ isatty (0);}");
+ ASSERT_EQUALS("",errout.str());
+ }
};
REGISTER_TEST(TestNullPointer)