From 09eaa412b11c9194a690bffb19605296443eebe5 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Wed, 13 Nov 2019 16:55:17 +0100 Subject: [PATCH] std.cfg: Improved cfg for 'mbstowcs' --- cfg/std.cfg | 4 +++- test/cfg/std.c | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/cfg/std.cfg b/cfg/std.cfg index 6266f35ca..c65f16c1d 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -2347,7 +2347,9 @@ false - + + + diff --git a/test/cfg/std.c b/test/cfg/std.c index 7e41ab410..f43a8acaf 100644 --- a/test/cfg/std.c +++ b/test/cfg/std.c @@ -1642,13 +1642,21 @@ void uninitvar_mbsinit(void) (void)mbsinit(ps); } -void uninitvar_mbstowcs(void) +void uninitvar_mbstowcs(wchar_t* d, const char* s, size_t m) { - wchar_t *ws; - char *s; - size_t n; + wchar_t *dest; + char *src; + size_t max; + // cppcheck-suppress uninitvar - (void)mbstowcs(ws,s,n); + (void)mbstowcs(dest,s,m); + // cppcheck-suppress uninitvar + (void)mbstowcs(d,src,m); + // cppcheck-suppress uninitvar + (void)mbstowcs(d,s,max); + + // No warning is expected + (void)mbstowcs(d,s,m); } void uninitvar_mbsrtowcs(wchar_t* d, const char** s, size_t m, mbstate_t *p) @@ -1657,6 +1665,7 @@ void uninitvar_mbsrtowcs(wchar_t* d, const char** s, size_t m, mbstate_t *p) const char* src; size_t max; mbstate_t* ps; + // cppcheck-suppress uninitvar (void)mbsrtowcs(dest,s,m,p); // cppcheck-suppress uninitvar