posix.cfg add more interfaces from stdlib.h. run astyle
This commit is contained in:
parent
80be769912
commit
42d9afe7de
|
@ -16,6 +16,13 @@
|
|||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- void _Exit(int status); -->
|
||||
<function name="_Exit">
|
||||
<noreturn>true</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- int access(const char *pathname, int mode); -->
|
||||
<function name="access">
|
||||
<noreturn>false</noreturn>
|
||||
|
@ -1495,6 +1502,43 @@
|
|||
</arg>
|
||||
<leak-ignore/>
|
||||
</function>
|
||||
<!-- http://pubs.opengroup.org/onlinepubs/009695399/basedefs/stdlib.h.html -->
|
||||
<!-- double drand48(void); -->
|
||||
<function name="drand48">
|
||||
<noreturn>false</noreturn>
|
||||
<use-retval/>
|
||||
</function>
|
||||
<!-- int putenv(char *string); -->
|
||||
<function name="putenv">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<not-null/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- int setenv(const char *envname, const char *envval, int overwrite); -->
|
||||
<function name="setenv">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<not-null/>
|
||||
</arg>
|
||||
<arg nr="2">
|
||||
<not-uninit/>
|
||||
<not-null/>
|
||||
</arg>
|
||||
<arg nr="3">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- int unsetenv(const char *name); -->
|
||||
<function name="unsetenv">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<not-null/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- http://pubs.opengroup.org/onlinepubs/007908799/xsh/time.h.html -->
|
||||
<!-- int clock_settime(clockid_t clock_id, const struct timespec *tp); -->
|
||||
<function name="clock_settime">
|
||||
|
|
|
@ -2308,41 +2308,41 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:4]: (error) Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. You should not use 'auto_ptr' for pointers obtained with function 'malloc'.\n", errout.str());
|
||||
|
||||
check("int main()\n"
|
||||
"{\n"
|
||||
" auto_ptr<int> x((int*)malloc(sizeof(int)*4));\n"
|
||||
"}");
|
||||
"{\n"
|
||||
" auto_ptr<int> x((int*)malloc(sizeof(int)*4));\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (error) Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. You should not use 'auto_ptr' for pointers obtained with function 'malloc'.\n", errout.str());
|
||||
|
||||
check("int main()\n"
|
||||
"{\n"
|
||||
" auto_ptr<int> b(static_cast<int*>(malloc(sizeof(int)*4)));\n"
|
||||
"}");
|
||||
"{\n"
|
||||
" auto_ptr<int> b(static_cast<int*>(malloc(sizeof(int)*4)));\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (error) Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. You should not use 'auto_ptr' for pointers obtained with function 'malloc'.\n", errout.str());
|
||||
|
||||
check("int main()\n"
|
||||
"{\n"
|
||||
" auto_ptr<int> x = (int*)malloc(sizeof(int)*4);\n"
|
||||
"}");
|
||||
"{\n"
|
||||
" auto_ptr<int> x = (int*)malloc(sizeof(int)*4);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (error) Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. You should not use 'auto_ptr' for pointers obtained with function 'malloc'.\n", errout.str());
|
||||
|
||||
check("int main()\n"
|
||||
"{\n"
|
||||
" auto_ptr<int> x = static_cast<int*>(malloc(sizeof(int)*4));\n"
|
||||
"}");
|
||||
"{\n"
|
||||
" auto_ptr<int> x = static_cast<int*>(malloc(sizeof(int)*4));\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (error) Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. You should not use 'auto_ptr' for pointers obtained with function 'malloc'.\n", errout.str());
|
||||
|
||||
check("int main()\n"
|
||||
"{\n"
|
||||
" auto_ptr<int> x;\n"
|
||||
" x.reset((int*)malloc(sizeof(int)*4));\n"
|
||||
"}");
|
||||
"{\n"
|
||||
" auto_ptr<int> x;\n"
|
||||
" x.reset((int*)malloc(sizeof(int)*4));\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (error) Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. You should not use 'auto_ptr' for pointers obtained with function 'malloc'.\n", errout.str());
|
||||
|
||||
check("int main()\n"
|
||||
"{\n"
|
||||
" auto_ptr<int> x;\n"
|
||||
" x.reset(static_cast<int*>(malloc(sizeof(int)*4)));\n"
|
||||
"}");
|
||||
"{\n"
|
||||
" auto_ptr<int> x;\n"
|
||||
" x.reset(static_cast<int*>(malloc(sizeof(int)*4)));\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (error) Object pointed by an 'auto_ptr' is destroyed using operator 'delete'. You should not use 'auto_ptr' for pointers obtained with function 'malloc'.\n", errout.str());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue