On Mon Apr 6 17:58:29 2026 +0000, Vitaly Lipatov wrote:
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. In any case, __has_builtin(__builtin_wmemchr) looks more clear than `__has_feature(cxx_constexpr_string_builtins). Will I replace it?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10577#note_135143