Skip to content

Commit 1067cb6

Browse files
committed
posix.cfg: Added support for wcswidth().
1 parent 5be16c3 commit 1067cb6

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

cfg/posix.cfg

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4580,6 +4580,24 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
45804580
<not-bool/>
45814581
</arg>
45824582
</function>
4583+
<!-- https://man7.org/linux/man-pages/man3/wcswidth.3.html -->
4584+
<!-- int wcswidth(const wchar_t *s, size_t n); -->
4585+
<function name="wcswidth">
4586+
<returnValue type="int"/>
4587+
<use-retval/>
4588+
<noreturn>false</noreturn>
4589+
<leak-ignore/>
4590+
<arg nr="1" direction="in">
4591+
<not-null/>
4592+
<not-uninit/>
4593+
<not-bool/>
4594+
</arg>
4595+
<arg nr="2" direction="in">
4596+
<not-uninit/>
4597+
<not-bool/>
4598+
<valid>0:</valid>
4599+
</arg>
4600+
</function>
45834601
<!-- http://man7.org/linux/man-pages/man3/scandir.3.html -->
45844602
<!-- int scandir(const char *dirp,
45854603
struct dirent ***namelist,

test/cfg/posix.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,18 @@
2727
#include <stdarg.h>
2828
#include <ctype.h>
2929
#include <stdbool.h>
30+
#define _XOPEN_SOURCE
3031
#include <wchar.h>
3132
#include <string.h>
3233

34+
int nullPointer_wcswidth(const wchar_t *s, size_t n)
35+
{
36+
// cppcheck-suppress nullPointer
37+
(void)wcswidth(NULL, n);
38+
// No warning is expected
39+
return wcswidth(s, n);
40+
}
41+
3342
int nullPointer_aio_cancel(int fd, struct aiocb *aiocbp)
3443
{
3544
// No warning is expected

0 commit comments

Comments
 (0)