Add more interfaces to gnu and posix libraries
This commit is contained in:
parent
b12ebc1733
commit
6bfeb71dd2
37
cfg/gnu.cfg
37
cfg/gnu.cfg
|
@ -23,4 +23,41 @@
|
|||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- http://www.gnu.org/software/libc/manual/html_node/Backtraces.html -->
|
||||
<!-- int backtrace (void **buffer, int size) -->
|
||||
<function name="backtrace">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="2">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- char ** backtrace_symbols (void *const *buffer, int size) -->
|
||||
<function name="backtrace_symbols">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="2">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- void backtrace_symbols_fd (void *const *buffer, int size, int fd) -->
|
||||
<function name="backtrace_symbols_fd">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="2">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="3">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
</def>
|
||||
|
|
|
@ -746,6 +746,82 @@
|
|||
<podtype name="termios"/>
|
||||
<podtype name="intptr_t"/>
|
||||
<podtype name="timespec"/>
|
||||
<!-- http://pubs.opengroup.org/onlinepubs/009695399/basedefs/arpa/inet.h.html -->
|
||||
<!-- uint32_t htonl(uint32_t); -->
|
||||
<function name="htonl">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- uint16_t htons(uint16_t); -->
|
||||
<function name="htons">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- uint32_t ntohl(uint32_t); -->
|
||||
<function name="ntohl">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- uint16_t ntohs(uint16_t); -->
|
||||
<function name="ntohs">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- http://pubs.opengroup.org/onlinepubs/009695399/basedefs/netdb.h.html -->
|
||||
<podtype name="addrinfo"/>
|
||||
<podtype name="hostent"/>
|
||||
<podtype name="netent"/>
|
||||
<podtype name="protoent"/>
|
||||
<podtype name="servent"/>
|
||||
<!-- void freeaddrinfo(struct addrinfo *ai); -->
|
||||
<function name="freeaddrinfo">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<not-null/>
|
||||
<!-- not-null is not required by the resource above, but some systems will segfault -->
|
||||
</arg>
|
||||
</function>
|
||||
<!-- int getaddrinfo(const char * nodename, const char * servname, const struct addrinfo * hints, struct addrinfo ** res); -->
|
||||
<function name="getaddrinfo">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="2">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="3">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="4">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- void endhostent(void); -->
|
||||
<function name="endhostent">
|
||||
<noreturn>false</noreturn>
|
||||
</function>
|
||||
<!-- struct hostent *gethostent(void); -->
|
||||
<function name="gethostent">
|
||||
<noreturn>false</noreturn>
|
||||
<use-retval/>
|
||||
</function>
|
||||
<!-- void sethostent(int stayopen); -->
|
||||
<function name="sethostent">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pwd.h.html -->
|
||||
<podtype name="passwd"/>
|
||||
<!--void endpwent(void); -->
|
||||
|
@ -791,7 +867,7 @@
|
|||
</function>
|
||||
<!-- http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html -->
|
||||
<podtype name="regex_t"/>
|
||||
<!-- int regcomp(regex_t *restrict, const char *restrict, int); -->
|
||||
<!-- int regcomp(regex_t *, const char *, int); -->
|
||||
<function name="regcomp">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
|
@ -804,7 +880,7 @@
|
|||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- size_t regerror(int, const regex_t *restrict, char *restrict, size_t); -->
|
||||
<!-- size_t regerror(int, const regex_t *, char *, size_t); -->
|
||||
<function name="regerror">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
|
@ -822,7 +898,7 @@
|
|||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- int regexec(const regex_t *restrict, const char *restrict, size_t, regmatch_t [restrict], int); -->
|
||||
<!-- int regexec(const regex_t *, const char *, size_t, regmatch_t [restrict], int); -->
|
||||
<function name="regexec">
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1">
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <sys/mman.h>
|
||||
#include <sys/socket.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
#include <regex.h>
|
||||
|
||||
|
@ -47,6 +48,13 @@ void nullPointer(char *p) {
|
|||
readdir (0);
|
||||
}
|
||||
|
||||
void memleak_getaddrinfo() {
|
||||
//TODO: nothing to report yet, see http://sourceforge.net/p/cppcheck/discussion/general/thread/d9737d5d/
|
||||
struct addrinfo * res=NULL;
|
||||
getaddrinfo("node", NULL, NULL, &res);
|
||||
freeaddrinfo(res);
|
||||
}
|
||||
|
||||
void memleak_mmap(int fd) {
|
||||
// cppcheck-suppress unreadVariable
|
||||
void *addr = mmap(NULL, 255, PROT_NONE, MAP_PRIVATE, fd, 0);
|
||||
|
|
Loading…
Reference in New Issue