posix.cfg: Fixed FP for isatty() function and added unit cases.
This commit is contained in:
parent
7eb3988415
commit
66329fe8b8
|
@ -28,7 +28,7 @@
|
|||
<leak-ignore/>
|
||||
</function>
|
||||
<function name="rename"> <noreturn>false</noreturn> <arg nr="1"><not-uninit/><not-null/></arg> <leak-ignore/> </function>
|
||||
<function name="isatty"> <noreturn>false</noreturn> <arg nr="1"><not-uninit/><not-null/></arg> <leak-ignore/> </function>
|
||||
<function name="isatty"> <noreturn>false</noreturn> <arg nr="1"><not-uninit/></arg> <leak-ignore/> </function>
|
||||
<resource>
|
||||
<dealloc>close</dealloc>
|
||||
<alloc init="true">open</alloc>
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue