NEW299689
Clang 21 complains about implicit casting between char32_t and char16_t throughout the codebase
https://bugs.webkit.org/show_bug.cgi?id=299689
Summary Clang 21 complains about implicit casting between char32_t and char16_t throu...
Ross Kirsling
Reported 2025-09-28 00:08:23 PDT
As of 271373@main, we decided to turn UChar32 (i.e. int32_t) into char32_t. More recently, we've also replaced UChar with char16_t (though that part is not an issue). Clang 21 introduces `character-conversion` warnings for implicit conversion between char32_t and char16_t (in both directions, citing it "may change the meaning of the represented code unit"). Addressing this will be a similarly-sized endeavor to 271373@main itself, and unfortunately involves patching gtest too. It took a couple of hours just to get through WTF, PAL, and gtest—see attached patch. I will temporarily set `-Wno-character-conversion` for PS port just because it's blocking our deployment of extra EWS bots.
Attachments
Ross Kirsling
Comment 1 2025-09-28 00:12:36 PDT
I'm getting 403 Forbidden when trying to attach a patch; you can find it on Slack instead: https://webkit.slack.com/archives/CU64U6FDW/p1759041829898719?thread_ts=1758976128.172549&cid=CU64U6FDW
Ross Kirsling
Comment 2 2025-09-28 01:03:30 PDT
`-Wno-character-conversion` has now been temporarily set for PS port: https://commits.webkit.org/300663@main
Darin Adler
Comment 3 2025-09-28 12:36:27 PDT
Ideally we would come up with a good way to set the warning flags based on clang version rather than platform. Dave, this new warning is coming up soon in clang 21.
Michael Catanzaro
Comment 4 2025-09-29 13:14:22 PDT
*** Bug 299535 has been marked as a duplicate of this bug. ***
Michael Catanzaro
Comment 5 2025-09-29 15:59:16 PDT
Michael Catanzaro
Comment 6 2025-09-29 16:24:44 PDT
(In reply to Darin Adler from comment #3) > Ideally we would come up with a good way to set the warning flags based on > clang version rather than platform. WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS checks whether the flag is supported or not, so it's safe to use it unconditionally. Ross proposed this in https://github.com/WebKit/WebKit/pull/51490.
Darin Adler
Comment 7 2025-09-29 18:14:23 PDT
(In reply to Michael Catanzaro from comment #6) > WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS checks whether the flag is supported or > not, so it's safe to use it unconditionally. Ross proposed this in > https://github.com/WebKit/WebKit/pull/51490. That’s neat. Maybe we should turn off this warning immediately using WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS and then turn the warning back on while patching all the call sites to adapt to it. No reason we have to choose, we can do both!
Radar WebKit Bug Importer
Comment 8 2025-10-05 00:09:15 PDT
Note You need to log in before you can comment on or make changes to this bug.