On Mon Apr 6 17:57:39 2026 +0000, Jacek Caban wrote:
Nevermind, it will not do what we need. Unfortunately __has_builtin(__builtin_wmemchr) returns true even on clang 11, where the builtin is not actually inlined for Windows targets — clang emits an external jmp wmemchr call instead:
``` $ echo '#if __has_builtin(__builtin_wmemchr) extern "C" const wchar_t *f(const wchar_t *s, wchar_t c, __SIZE_TYPE__ n) { return __builtin_wmemchr(s, c, n); } #endif' | clang-11 -target x86_64-windows -O2 -S -o - -x c++ - 2>&1 | grep wmemchr jmp wmemchr # TAILCALL ``` On clang 19 the same test produces no external wmemchr reference (the builtin is properly inlined). Since __has_builtin doesn't distinguish these cases, I used __clang_major__ >= 13 instead. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10577#note_135140