bsd.cfg: Added support for strlcat().
This commit is contained in:
parent
d412c3908f
commit
c7993c38b5
22
cfg/bsd.cfg
22
cfg/bsd.cfg
|
@ -135,6 +135,28 @@
|
||||||
</arg>
|
</arg>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
</function>
|
</function>
|
||||||
|
<!-- https://www.freebsd.org/cgi/man.cgi?query=strlcat
|
||||||
|
size_t strlcat(char *dst, const char *src, size_t size); -->
|
||||||
|
<function name="strlcat">
|
||||||
|
<returnValue type="size_t"/>
|
||||||
|
<noreturn>false</noreturn>
|
||||||
|
<leak-ignore/>
|
||||||
|
<arg nr="1">
|
||||||
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
|
<strz/>
|
||||||
|
<minsize type="argvalue" arg="3"/>
|
||||||
|
</arg>
|
||||||
|
<arg nr="2">
|
||||||
|
<not-null/>
|
||||||
|
<not-uninit/>
|
||||||
|
</arg>
|
||||||
|
<arg nr="3">
|
||||||
|
<not-uninit/>
|
||||||
|
<not-bool/>
|
||||||
|
<valid>0:</valid>
|
||||||
|
</arg>
|
||||||
|
</function>
|
||||||
<podtype name="FTS"/>
|
<podtype name="FTS"/>
|
||||||
<podtype name="FTSENT"/>
|
<podtype name="FTSENT"/>
|
||||||
</def>
|
</def>
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
// Test library configuration for bsd.cfg
|
||||||
|
//
|
||||||
|
// Usage:
|
||||||
|
// $ cppcheck --library=bsd --check-library --enable=information --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/bsd.c
|
||||||
|
// =>
|
||||||
|
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
// size_t strlcat(char *dst, const char *src, size_t size);
|
||||||
|
void uninitvar_strlcat(char *Ct, const char *S, size_t N)
|
||||||
|
{
|
||||||
|
char *ct;
|
||||||
|
char *s;
|
||||||
|
size_t n;
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strlcat(ct,s,n);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strlcat(ct,S,N);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strlcat(Ct,s,N);
|
||||||
|
// cppcheck-suppress uninitvar
|
||||||
|
(void)strlcat(Ct,S,n);
|
||||||
|
|
||||||
|
// no warning is expected for
|
||||||
|
(void)strlcat(Ct,S,N);
|
||||||
|
}
|
|
@ -31,6 +31,9 @@ ${CPPCHECK} ${CPPCHECK_OPT} --library=gnu ${DIR}gnu.c
|
||||||
${CXX} ${CXX_OPT} ${DIR}qt.cpp
|
${CXX} ${CXX_OPT} ${DIR}qt.cpp
|
||||||
${CPPCHECK} --enable=style --enable=information --inconclusive --inline-suppr --error-exitcode=1 --library=qt ${DIR}qt.cpp
|
${CPPCHECK} --enable=style --enable=information --inconclusive --inline-suppr --error-exitcode=1 --library=qt ${DIR}qt.cpp
|
||||||
|
|
||||||
|
# bsd.c
|
||||||
|
${CPPCHECK} ${CPPCHECK_OPT} --library=bsd ${DIR}bsd.c
|
||||||
|
|
||||||
# std.c
|
# std.c
|
||||||
${CC} ${CC_OPT} ${DIR}std.c
|
${CC} ${CC_OPT} ${DIR}std.c
|
||||||
${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.c
|
${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.c
|
||||||
|
|
Loading…
Reference in New Issue