[libc-commits] [libc] [libc] Stop duplicating wcschr(). (PR #150661)

via libc-commits libc-commits at lists.llvm.org
Fri Jul 25 10:39:35 PDT 2025


lntue wrote:

errors from the pre-commit:
```
In file included from /home/runner/work/llvm-project/llvm-project/libc/src/wchar/wcstok.cpp:13:
/home/runner/work/llvm-project/llvm-project/libc/src/wchar/wchar_utils.h:23:10: error: cannot initialize return object of type 'wchar_t *' with an rvalue of type 'const wchar_t *'
   23 |   return (*s == c) ? s : nullptr;
      |          ^~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/llvm-project/llvm-project/libc/src/wchar/wchar_utils.h:32:19: error: no matching function for call to 'wcschr'
   32 |     bool in_set = wcschr(s1[i], s2);
      |                   ^~~~~~
/home/runner/work/llvm-project/llvm-project/libc/src/wchar/wchar_utils.h:20:29: note: candidate function not viable: no known conversion from 'const wchar_t' to 'const wchar_t *' for 1st argument; take the address of the argument with &
   20 | LIBC_INLINE static wchar_t *wcschr(const wchar_t *s, wchar_t c) {
      |                             ^      ~~~~~~~~~~~~~~~~
   21 |   for (; *s && *s != c; ++s)
   22 |     ;
   23 |   return (*s == c) ? s : nullptr;
   24 | }
   ```

https://github.com/llvm/llvm-project/pull/150661


More information about the libc-commits mailing list