casaroli opened a new pull request, #21125:
URL: https://github.com/apache/nuttx/pull/21125

   ## Summary
   
   POSIX.1-2008 `<wchar.h>` has `wcsdup()`, `wcsnlen()`, `wcpcpy()`, 
`wcpncpy()`, `wcscasecmp()` and `wcsncasecmp()`, the wide-character forms of 
`strdup()`, `strnlen()`, `stpcpy()`, `stpncpy()`, `strcasecmp()` and 
`strncasecmp()`. NuttX did not have them, so programs that use them did not 
compile (util-linux's `column`, for example, uses `wcsdup()`).
   
   This PR adds the six functions to `libs/libc/wchar` (Make.defs and 
CMakeLists.txt), declares them in `wchar.h` and lists them in 
`libs/libc/libc.csv`. `wcscasecmp()` and `wcsncasecmp()` compare with 
`towlower()`. `wchar.h` already had the macros `wcscasecmp_l()` and 
`wcsncasecmp_l()`, which call `wcscasecmp()` and `wcsncasecmp()`; programs that 
use them now link too.
   
   The second commit adds the unit POSIX_C_LANG_WIDE_CHAR_EXT to 
`Documentation/standards/posix.rst`: `mbsnrtowcs()`, `wcsnrtombs()` (already in 
NuttX) and the six new functions.
   
   ## Impact
   
   Six new functions in libc, in all build modes. No change to existing 
functions. No Kconfig option.
   
   ## Testing
   
   Test program `wcsposix.c` (cases dup, nlen, pcpy, pncpy, case, ncase), 
compiled against the export of the kernel build:
   
   | Build | Config | master (aeab6fbf989) | this PR |
   |---|---|---|---|
   | kernel, arm64 | `qemu-armv8a:knsh` (QEMU, HVF) | does not compile 
(implicit declarations) | all 6 PASS; ostest 0 |
   | flat, arm64 | `qemu-armv8a:nsh` (QEMU, HVF; the test as a builtin app) | | 
all 6 PASS; ostest 0 |
   
   Builds (make): `mps2-an500:knsh` (protected, armv7-m), `rv-virt:knsh64` 
(kernel, risc-v), `nucleo-f072rb:nsh` (flat, armv6-m): OK. CMake: 
`qemu-armv8a:nsh` builds the new files: OK.
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to