Extended std.cfg about more missing functions. Moved POSIX functions to posix.cfg. Extended posix.cfg about more memory allocating functions.

This commit is contained in:
orbitcowboy 2014-06-25 12:00:24 +02:00
parent 0023dec567
commit 95c49ec5dc
3 changed files with 209 additions and 31 deletions

View File

@ -3,7 +3,28 @@
<function name="usleep"> <noreturn>false</noreturn> <arg nr="1"><not-bool/><valid>0:999999</valid></arg> </function>
<function name="_exit"> <noreturn>true</noreturn> </function>
<function name="closedir"> <noreturn>false</noreturn> <arg nr="1"><not-bool/><not-uninit/><not-null/></arg> </function>
<function name="strdup">
<noreturn>false</noreturn>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="strdupa">
<noreturn>false</noreturn>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="strndup">
<noreturn>false</noreturn>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-uninit/></arg>
</function>
<function name="strndupa">
<noreturn>false</noreturn>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-uninit/></arg>
</function>
<function name="wcsdup">
<noreturn>false</noreturn>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="mkstemp"> <noreturn>false</noreturn> <arg nr="1"><not-uninit/><not-null/></arg> <leak-ignore/> </function>
<function name="mkdtemp"> <noreturn>false</noreturn> <arg nr="1"><not-uninit/><not-null/></arg> <leak-ignore/> </function>
<function name="mktemp"> <noreturn>false</noreturn> <arg nr="1"><not-uninit/><not-null/></arg> <leak-ignore/> </function>
@ -33,6 +54,15 @@
<function name="pclose"><noreturn>false</noreturn><arg nr="1"><not-null/><not-uninit/></arg></function>
<function name="fdopen"><noreturn>false</noreturn><arg nr="1"><not-null/><not-uninit/></arg></function>
<memory>
<dealloc>free</dealloc>
<alloc init="true">strdup</alloc>
<alloc init="true">strndup</alloc>
<alloc init="true">strdupa</alloc>
<alloc init="true">strndupa</alloc>
<alloc init="true">wcsdup</alloc>
</memory>
<resource>
<dealloc>close</dealloc>
<alloc init="true">open</alloc>

View File

@ -296,8 +296,6 @@
<alloc init="false">malloc</alloc>
<alloc init="true">calloc</alloc>
<alloc init="true">strdup</alloc>
<alloc init="true">strndup</alloc>
<alloc init="true">realloc</alloc>
</memory>
@ -307,35 +305,191 @@
<alloc init="true">freopen</alloc>
</resource>
<function name="strcat"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strchr"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> </function>
<function name="strcmp"> <noreturn>false</noreturn> <pure/> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strcat">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
</function>
<function name="wcscat">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
</function>
<function name="strchr">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="wcschr">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="strcmp">
<noreturn>false</noreturn>
<pure/>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
</function>
<function name="wcscmp">
<noreturn>false</noreturn>
<pure/>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
</function>
<function name="strcpy"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strdup"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> </function>
<function name="strlen"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> </function>
<function name="strncpy"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg> </function>
<function name="strncat"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg> </function>
<function name="strncmp"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> <arg nr="3"><not-bool/><valid>0:</valid></arg> </function>
<function name="strncat">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0:</valid></arg>
</function>
<function name="wcsncat">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0:</valid></arg>
</function>
<function name="strncmp">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0:</valid></arg>
</function>
<function name="wcsncmp">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
<arg nr="3"><not-bool/><valid>0:</valid></arg>
</function>
<function name="strstr"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strspn"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strerror"> <noreturn>false</noreturn> <leak-ignore/></function>
<function name="strcspn"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strcoll"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="2"><not-null/><not-uninit/></arg> </function>
<function name="strcspn">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
</function>
<function name="wcscspn">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
</function>
<function name="strcoll">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
</function>
<function name="wcscoll">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><not-null/><not-uninit/></arg>
</function>
<function name="strrchr">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="2"><valid>0:255</valid></arg>
</function>
<function name="wcsrchr">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="strtol">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="3"><valid>0,2:36</valid></arg>
</function>
<function name="strtoll"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="strtoul"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="strtoull"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><not-null/><not-uninit/></arg> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="strtof">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="strtod">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="strtold">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="strtoul">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="3"><valid>0,2:36</valid></arg>
</function>
<function name="strtoll">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="3"><valid>0,2:36</valid></arg>
</function>
<function name="strtoull">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/>
</arg> <arg nr="3"><valid>0,2:36</valid></arg>
</function>
<function name="tolower"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="toupper"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="1"><valid>0:255</valid></arg> </function>
<function name="wcstol"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="wcstoll"> <noreturn>false</noreturn><leak-ignore/> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="wcstoul"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="wcstoull"> <noreturn>false</noreturn> <leak-ignore/> <arg nr="3"><valid>0,2:36</valid></arg> </function>
<function name="wcstof">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="wcstod">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="wcstold">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
</function>
<function name="wcstol">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="3"><valid>0,2:36</valid></arg>
</function>
<function name="wcstoll">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="3"><valid>0,2:36</valid></arg>
</function>
<function name="wcstoul">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="3"><valid>0,2:36</valid></arg>
</function>
<function name="wcstoull">
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1"><not-null/><not-uninit/></arg>
<arg nr="3"><valid>0,2:36</valid></arg>
</function>
<function name="wprintf"> <noreturn>false</noreturn> <leak-ignore/> <formatstr/> <arg nr="1"><formatstr/></arg> </function>
<function name="sprintf"> <noreturn>false</noreturn> <leak-ignore/> <formatstr/> <arg nr="2"><formatstr/></arg> </function>

View File

@ -43,7 +43,6 @@ private:
TEST_CASE(nullpointerExecutionPaths);
TEST_CASE(nullpointerExecutionPathsLoop);
TEST_CASE(nullpointer7);
TEST_CASE(nullpointer8);
TEST_CASE(nullpointer9);
TEST_CASE(nullpointer10);
TEST_CASE(nullpointer11); // ticket #2812
@ -1114,15 +1113,6 @@ private:
ASSERT_EQUALS("", errout.str());
}
void nullpointer8() {
check("void foo()\n"
"{\n"
" char const * x = 0;\n"
" strdup(x);\n"
"}");
ASSERT_EQUALS("[test.cpp:4]: (error) Possible null pointer dereference: x\n", errout.str());
}
void nullpointer9() { //#ticket 1778
check("void foo()\n"
"{\n"
@ -2530,9 +2520,6 @@ private:
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());
check("void f(char * p){ strlen (p);if(!p){}}");
ASSERT_EQUALS(errp,errout.str());
@ -2651,6 +2638,13 @@ private:
check("void f(char *p){ mkdir (p, *0);}");
ASSERT_EQUALS("[test.cpp:1]: (error) Null pointer dereference\n",errout.str());
check("void foo()\n"
"{\n"
" char const * x = 0;\n"
" strdup(x);\n"
"}");
ASSERT_EQUALS("[test.cpp:4]: (error) Possible null pointer dereference: x\n", errout.str());
}
};