Skip to content

Commit d0ff2a0

Browse files
committed
posix.cfg: Added support for wcwidth().
1 parent 4ddd7e5 commit d0ff2a0

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

cfg/posix.cfg

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4729,6 +4729,18 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
47294729
<valid>0:</valid>
47304730
</arg>
47314731
</function>
4732+
<!-- https://man7.org/linux/man-pages/man3/wcwidth.3.html -->
4733+
<!-- int wcwidth(wchar_t c); -->
4734+
<function name="wcwidth">
4735+
<returnValue type="int"/>
4736+
<use-retval/>
4737+
<noreturn>false</noreturn>
4738+
<leak-ignore/>
4739+
<arg nr="1" direction="in">
4740+
<not-uninit/>
4741+
<not-bool/>
4742+
</arg>
4743+
</function>
47324744
<!-- http://man7.org/linux/man-pages/man3/ffs.3.html -->
47334745
<!-- int ffs(int i); -->
47344746
<function name="ffs">

test/cfg/posix.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@
3131
#include <wchar.h>
3232
#include <string.h>
3333

34+
int uninitvar_wcwidth(const wchar_t c)
35+
{
36+
wchar_t wc;
37+
// cppcheck-suppress uninitvar
38+
(void)wcwidth(wc);
39+
// No warning is expected
40+
return wcwidth(c);
41+
}
42+
3443
int nullPointer_wcsnlen(const wchar_t *s, size_t n)
3544
{
3645
// cppcheck-suppress nullPointer

0 commit comments

Comments
 (0)