diff --git a/cfg/std.cfg b/cfg/std.cfg index 7842dc05f..ae96b397c 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -2319,6 +2319,28 @@ 0: + + + + + false + + + + + + + + + + + + + + + 0: + + false diff --git a/test/cfg/std.c b/test/cfg/std.c index b6d4ea178..e332b418d 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -177,7 +177,7 @@ void nullpointerMemchr2(char *p, char *s) p = memchr(s, 0, strlen(s)); } -void nullpointerMemchr3(char *p) +void nullPointer_memchr(char *p) { char *s = 0; // cppcheck-suppress nullPointer @@ -185,13 +185,17 @@ void nullpointerMemchr3(char *p) p = memchr(s, 0, strlen(s)); } -void nullpointerMemcmp(char *p) +void nullPointer_memcmp(char *p) { - // cppcheck-suppress ignoredReturnValue // cppcheck-suppress nullPointer - memcmp(p, 0, 123); + (void)memcmp(p, 0, 123); } +void nullPointer_wmemcmp(wchar_t *p) +{ + // cppcheck-suppress nullPointer + (void)wmemcmp(p, 0, 123); +} // uninit pointers @@ -2395,6 +2399,15 @@ void uninitvar_memcmp(void) (void)memcmp(s1,s2,n); } +void uninitvar_wmemcmp(void) +{ + wchar_t *s1; + wchar_t *s2; + size_t n; + // cppcheck-suppress uninitvar + (void)wmemcmp(s1,s2,n); +} + void uninitvar_memcpy(void) { void *ct; diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index e73a85b47..8af4d67c2 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -1747,6 +1747,15 @@ void uninitvar_memcmp(void) (void)std::memcmp(s1,s2,n); } +void uninitvar_wmemcmp(void) +{ + wchar_t *s1; + wchar_t *s2; + size_t n; + // cppcheck-suppress uninitvar + (void)std::wmemcmp(s1,s2,n); +} + void uninitvar_memcpy(void) { void *ct; @@ -2870,12 +2879,12 @@ void uninitvar_find(std::string s) char c; // cppcheck-suppress uninitvar (void)s.find(c,pos); -/* - // testing of size_t find (const char* pc, size_t pos, size_t n) const; - size_t n; - // cppcheck-suppress uninitvar - (void)s.find(pc,pos,n); // #6991 -*/ + /* + // testing of size_t find (const char* pc, size_t pos, size_t n) const; + size_t n; + // cppcheck-suppress uninitvar + (void)s.find(pc,pos,n); // #6991 + */ } void invalidFunctionArgBool_abs(bool b, double x, double y) @@ -2986,3 +2995,15 @@ void nullPointer_atof(void) // cppcheck-suppress nullPointer (void)std::atof(0); } + +void nullPointer_memcmp(char *p) +{ + // cppcheck-suppress nullPointer + (void)std::memcmp(p, 0, 123); +} + +void nullPointer_wmemcmp(wchar_t *p) +{ + // cppcheck-suppress nullPointer + (void)std::wmemcmp(p, 0, 123); +}