diff --git a/cfg/bsd.cfg b/cfg/bsd.cfg index 98e8db603..68e932c69 100644 --- a/cfg/bsd.cfg +++ b/cfg/bsd.cfg @@ -135,6 +135,28 @@ + + + + false + + + + + + + + + + + + + + + 0: + + diff --git a/test/cfg/bsd.c b/test/cfg/bsd.c new file mode 100644 index 000000000..44227b71a --- /dev/null +++ b/test/cfg/bsd.c @@ -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 + +// 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); +} diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh index bdc6175d5..042af9fed 100755 --- a/test/cfg/runtests.sh +++ b/test/cfg/runtests.sh @@ -31,6 +31,9 @@ ${CPPCHECK} ${CPPCHECK_OPT} --library=gnu ${DIR}gnu.c ${CXX} ${CXX_OPT} ${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 ${CC} ${CC_OPT} ${DIR}std.c ${CPPCHECK} ${CPPCHECK_OPT} ${DIR}std.c