gnu.cfg: Added support for error() function. And a TODO testcase for ticket #11197.

This commit is contained in:
orbitcowboy 2022-07-17 14:43:52 +02:00
parent 4894cdab8f
commit 4de443957c
2 changed files with 18 additions and 0 deletions

View File

@ -1585,6 +1585,16 @@
<not-uninit/>
</arg>
</function>
<!-- https://man7.org/linux/man-pages/man3/error.3.html -->
<!-- void error(int status, int errnum, const char *format, ...); -->
<function name="error">
<noreturn>true</noreturn>
<leak-ignore/>
<returnValue type="void"/>
<arg nr="any" direction="in">
<not-uninit/>
</arg>
</function>
<!-- ########## Resource allocation ########## -->
<resource>
<alloc init="true">mkostemp</alloc>

View File

@ -23,7 +23,15 @@
#include <sys/epoll.h>
#endif
#include <strings.h>
#include <error.h>
void unreachableCode_error(void) // #11197
{
error(1, 0, ""); // will call exit() if the first parameter is non-zero
// cppcheck-suppress unusedVariable
// TODO cppcheck-suppress unreachableCode
int i;
}
int nullPointer_getservent_r(struct servent *restrict result_buf, char *restrict buf, size_t buflen, struct servent **restrict result)
{