diff --git a/cfg/std.cfg b/cfg/std.cfg index 77d66fcea..fabea1c01 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -2878,15 +2878,13 @@ - + false - - - + @@ -2903,7 +2901,7 @@ - + false @@ -2933,7 +2931,7 @@ - + false @@ -2962,7 +2960,7 @@ - + false @@ -2975,7 +2973,7 @@ - + false @@ -3006,7 +3004,7 @@ - + false @@ -3035,7 +3033,7 @@ - + false @@ -3068,7 +3066,7 @@ - + false @@ -3104,7 +3102,7 @@ - + false @@ -3139,7 +3137,7 @@ - + false @@ -3154,7 +3152,7 @@ - + false @@ -3170,7 +3168,7 @@ - + false @@ -3182,7 +3180,7 @@ - + false @@ -3197,7 +3195,7 @@ - + false @@ -3212,13 +3210,13 @@ - + false - + false @@ -3229,7 +3227,7 @@ - + false @@ -3238,7 +3236,7 @@ - + false @@ -3253,7 +3251,7 @@ - + false @@ -3267,8 +3265,8 @@ - - + + false @@ -3281,7 +3279,7 @@ - + false @@ -3296,7 +3294,7 @@ - + false @@ -3310,7 +3308,7 @@ - + false @@ -3325,7 +3323,7 @@ - + false @@ -3356,7 +3354,7 @@ - + false @@ -3364,6 +3362,9 @@ + + + diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 1da5cd3de..d3f9a06a7 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2128,7 +2128,7 @@ void Tokenizer::simplifyDoublePlusAndDoubleMinus() void Tokenizer::arraySize() { for (Token *tok = list.front(); tok; tok = tok->next()) { - if (!tok->isName() || !Token::Match( tok, "%name% [ ] =" ) ) + if (!tok->isName() || !Token::Match(tok, "%name% [ ] =")) continue; bool addlength = false; if (Token::Match(tok, "%name% [ ] = { %str% } ;")) { @@ -8764,7 +8764,7 @@ void Tokenizer::simplifyStructDecl() // Add names for anonymous structs for (Token *tok = list.front(); tok; tok = tok->next()) { - if(!tok->isName() ) + if (!tok->isName()) continue; // check for anonymous struct/union if (Token::Match(tok, "struct|union {")) { diff --git a/test/cfg/std.c b/test/cfg/std.c index 0fbdf6f56..a138560eb 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -15,6 +15,7 @@ #include #include #include +#include void bufferAccessOutOfBounds(void) { @@ -2796,3 +2797,279 @@ void uninivar_wcscat(void) // cppcheck-suppress uninitvar (void)wcscat(deststr,srcstr); } + +void uninivar_wcrtomb(void) +{ + char *s; + wchar_t wc; + mbstate_t *ps; + // cppcheck-suppress uninitvar + (void)wcrtomb(s,wc,ps); +} + +void uninivar_strchr(void) +{ + char *cs; + int c; + // cppcheck-suppress uninitvar + (void)strchr(cs,c); +} + +void uninivar_wcschr(void) +{ + wchar_t *cs; + wchar_t c; + // cppcheck-suppress uninitvar + (void)wcschr(cs,c); +} + +void uninivar_strcmp(void) +{ + char *str1; + char *str2; + // cppcheck-suppress uninitvar + (void)strcmp(str1,str2); +} + +void uninivar_wcscmp(void) +{ + wchar_t *str1; + wchar_t *str2; + // cppcheck-suppress uninitvar + (void)wcscmp(str1,str2); +} + +void uninivar_strcpy(void) +{ + char *str1; + char *str2; + // cppcheck-suppress uninitvar + (void)strcpy(str1,str2); +} + +void uninivar_wcscpy(void) +{ + wchar_t *str1; + wchar_t *str2; + // cppcheck-suppress uninitvar + (void)wcscpy(str1,str2); +} + +void uninivar_strftime(void) +{ + char *s; + size_t max; + char *fmt; + struct tm *p; + // cppcheck-suppress uninitvar + (void)strftime(s,max,fmt,p); + + struct tmx *px; + // cppcheck-suppress uninitvar + (void)strfxtime(s,max,fmt,px); +} + +void uninivar_strlen(void) +{ + char *s; + // cppcheck-suppress uninitvar + (void)strlen(s); +} + +void uninivar_wcslen(void) +{ + wchar_t *s; + // cppcheck-suppress uninitvar + (void)wcslen(s); +} + +void uninivar_strncpy(void) +{ + char *s; + char *ct; + size_t n; + // cppcheck-suppress uninitvar + (void)strncpy(s,ct,n); +} + +void uninivar_strpbrk(void) +{ + char *cs; + char *ct; + // cppcheck-suppress uninitvar + (void)strpbrk(cs,ct); +} + +void uninivar_strncat(void) +{ + char *ct; + char *s; + size_t n; + // cppcheck-suppress uninitvar + (void)strncat(ct,s,n); +} + +void uninivar_wcsncat(void) +{ + wchar_t *ct; + wchar_t *s; + size_t n; + // cppcheck-suppress uninitvar + (void)wcsncat(ct,s,n); +} + +void uninivar_strncmp(void) +{ + char *ct; + char *s; + size_t n; + // cppcheck-suppress uninitvar + (void)strncmp(ct,s,n); +} + +void uninivar_wcsncmp(void) +{ + wchar_t *ct; + wchar_t *s; + size_t n; + // cppcheck-suppress uninitvar + (void)wcsncmp(ct,s,n); +} + +void uninivar_strstr(void) +{ + char *cs; + char *ct; + // cppcheck-suppress uninitvar + (void)strstr(cs,ct); +} + +void uninivar_wcsstr(void) +{ + wchar_t *cs; + wchar_t *ct; + // cppcheck-suppress uninitvar + (void)wcsstr(cs,ct); +} + +void uninivar_strspn(void) +{ + char *cs; + char *ct; + // cppcheck-suppress uninitvar + (void)strspn(cs,ct); +} + +void uninivar_strxfrm(void) +{ + char *ds; + char *ss; + size_t n; + // cppcheck-suppress uninitvar + (void)strxfrm(ds,ss,n); +} + +void uninivar_wcsxfrm(void) +{ + wchar_t *ds; + wchar_t *ss; + size_t n; + // cppcheck-suppress uninitvar + (void)wcsxfrm(ds,ss,n); +} + +void uninivar_wcsspn(void) +{ + wchar_t *ds; + wchar_t *ss; + // cppcheck-suppress uninitvar + (void)wcsspn(ds,ss); +} + +void uninivar_setlocale(void) +{ + int category; + char* locale; + // cppcheck-suppress uninitvar + (void)setlocale(category,locale); +} + +void uninivar_strerror(void) +{ + int i; + // cppcheck-suppress uninitvar + (void)strerror(i); +} + +void uninivar_strcspn(void) +{ + char *cs; + char *ct; + // cppcheck-suppress uninitvar + (void)strcspn(cs,ct); +} + +void uninivar_wcscspn(void) +{ + wchar_t *cs; + wchar_t *ct; + // cppcheck-suppress uninitvar + (void)wcscspn(cs,ct); +} + +void uninivar_wcspbrk(void) +{ + wchar_t *cs; + wchar_t *ct; + // cppcheck-suppress uninitvar + (void)wcspbrk(cs,ct); +} + +void uninivar_wcsncpy(void) +{ + wchar_t *cs; + wchar_t *ct; + size_t n; + // cppcheck-suppress uninitvar + (void)wcsncpy(cs,ct,n); +} + +void uninivar_strcoll(void) +{ + char *cs; + char *ct; + // cppcheck-suppress uninitvar + (void)strcoll(cs,ct); +} + +void uninivar_wcscoll(void) +{ + wchar_t *cs; + wchar_t *ct; + // cppcheck-suppress uninitvar + (void)wcscoll(cs,ct); +} + +void uninivar_strrchr(void) +{ + char * str; + int c; + // cppcheck-suppress uninitvar + (void)strrchr(str,c); +} + +void uninivar_strbprk(void) +{ + char *cs; + char *ct; + // cppcheck-suppress uninitvar + (void)strbprk(cs,ct); +} + +void uninivar_wcsrchr(void) +{ + wchar_t* ws; + wchar_t wc; + // cppcheck-suppress uninitvar + (void)wcsrchr(ws,wc); +} diff --git a/test/cfg/std.cpp b/test/cfg/std.cpp index 32f1983bd..023825980 100644 --- a/test/cfg/std.cpp +++ b/test/cfg/std.cpp @@ -2120,3 +2120,266 @@ void uninivar_wcscat(void) // cppcheck-suppress uninitvar (void)std::wcscat(deststr,srcstr); } +void uninivar_wcrtomb(void) +{ + char *s; + wchar_t wc; + mbstate_t *ps; + // cppcheck-suppress uninitvar + (void)std::wcrtomb(s,wc,ps); +} + +void uninivar_strchr(void) +{ + char *cs; + int c; + // cppcheck-suppress uninitvar + (void)std::strchr(cs,c); +} + +void uninivar_wcschr(void) +{ + wchar_t *cs; + wchar_t c; + // cppcheck-suppress uninitvar + (void)std::wcschr(cs,c); +} + +void uninivar_strcmp(void) +{ + char *str1; + char *str2; + // cppcheck-suppress uninitvar + (void)std::strcmp(str1,str2); +} + +void uninivar_wcscmp(void) +{ + wchar_t *str1; + wchar_t *str2; + // cppcheck-suppress uninitvar + (void)std::wcscmp(str1,str2); +} + +void uninivar_strcpy(void) +{ + char *str1; + char *str2; + // cppcheck-suppress uninitvar + (void)std::strcpy(str1,str2); +} + +void uninivar_wcscpy(void) +{ + wchar_t *str1; + wchar_t *str2; + // cppcheck-suppress uninitvar + (void)std::wcscpy(str1,str2); +} + +void uninivar_strftime(void) +{ + char *s; + size_t max; + char *fmt; + struct tm *p; + // cppcheck-suppress uninitvar + (void)std::strftime(s,max,fmt,p); +} + +void uninivar_strlen(void) +{ + char *s; + // cppcheck-suppress uninitvar + (void)std::strlen(s); +} + +void uninivar_wcslen(void) +{ + wchar_t *s; + // cppcheck-suppress uninitvar + (void)std::wcslen(s); +} + +void uninivar_strncpy(void) +{ + char *s; + char *ct; + size_t n; + // cppcheck-suppress uninitvar + (void)std::strncpy(s,ct,n); +} + +void uninivar_strpbrk(void) +{ + char *cs; + char *ct; + // cppcheck-suppress uninitvar + (void)std::strpbrk(cs,ct); +} + +void uninivar_strncat(void) +{ + char *ct; + char *s; + size_t n; + // cppcheck-suppress uninitvar + (void)std::strncat(ct,s,n); +} + +void uninivar_wcsncat(void) +{ + wchar_t *ct; + wchar_t *s; + size_t n; + // cppcheck-suppress uninitvar + (void)std::wcsncat(ct,s,n); +} + +void uninivar_strncmp(void) +{ + char *ct; + char *s; + size_t n; + // cppcheck-suppress uninitvar + (void)std::strncmp(ct,s,n); +} + +void uninivar_wcsncmp(void) +{ + wchar_t *ct; + wchar_t *s; + size_t n; + // cppcheck-suppress uninitvar + (void)std::wcsncmp(ct,s,n); +} + +void uninivar_strstr(void) +{ + char *cs; + char *ct; + // cppcheck-suppress uninitvar + (void)std::strstr(cs,ct); +} + +void uninivar_wcsstr(void) +{ + wchar_t *cs; + wchar_t *ct; + // cppcheck-suppress uninitvar + (void)std::wcsstr(cs,ct); +} + +void uninivar_strspn(void) +{ + char *cs; + char *ct; + // cppcheck-suppress uninitvar + (void)std::strspn(cs,ct); +} + +void uninivar_strxfrm(void) +{ + char *ds; + char *ss; + size_t n; + // cppcheck-suppress uninitvar + (void)std::strxfrm(ds,ss,n); +} + +void uninivar_wcsxfrm(void) +{ + wchar_t *ds; + wchar_t *ss; + size_t n; + // cppcheck-suppress uninitvar + (void)std::wcsxfrm(ds,ss,n); +} + +void uninivar_wcsspn(void) +{ + wchar_t *ds; + wchar_t *ss; + // cppcheck-suppress uninitvar + (void)std::wcsspn(ds,ss); +} + +void uninivar_setlocale(void) +{ + int category; + char* locale; + // cppcheck-suppress uninitvar + (void)std::setlocale(category,locale); +} +void uninivar_strerror(void) +{ + int i; + // cppcheck-suppress uninitvar + (void)std::strerror(i); +} + +void uninivar_strcspn(void) +{ + char *cs; + char *ct; + // cppcheck-suppress uninitvar + (void)std::strcspn(cs,ct); +} + +void uninivar_wcscspn(void) +{ + wchar_t *cs; + wchar_t *ct; + // cppcheck-suppress uninitvar + (void)std::wcscspn(cs,ct); +} + +void uninivar_wcspbrk(void) +{ + wchar_t *cs; + wchar_t *ct; + // cppcheck-suppress uninitvar + (void)std::wcspbrk(cs,ct); +} + +void uninivar_wcsncpy(void) +{ + wchar_t *cs; + wchar_t *ct; + size_t n; + // cppcheck-suppress uninitvar + (void)std::wcsncpy(cs,ct,n); +} + +void uninivar_strcoll(void) +{ + char *cs; + char *ct; + // cppcheck-suppress uninitvar + (void)std::strcoll(cs,ct); +} + +void uninivar_wcscoll(void) +{ + wchar_t *cs; + wchar_t *ct; + // cppcheck-suppress uninitvar + (void)std::wcscoll(cs,ct); +} + +void uninivar_strrchr(void) +{ + char * str; + int c; + // cppcheck-suppress uninitvar + (void)std::strrchr(str,c); +} + +void uninivar_wcsrchr(void) +{ + wchar_t* ws; + wchar_t wc; + // cppcheck-suppress uninitvar + (void)std::wcsrchr(ws,wc); +} +