RESOLVED FIXED 180622
Use relaxed constexpr for StringHasher
https://bugs.webkit.org/show_bug.cgi?id=180622
Summary Use relaxed constexpr for StringHasher
Yusuke Suzuki
Reported 2017-12-09 08:48:49 PST
Use relaxed constexpr for StringHasher
Attachments
Patch (14.23 KB, patch)
2017-12-09 08:49 PST, Yusuke Suzuki
no flags
Yusuke Suzuki
Comment 1 2017-12-09 08:49:39 PST
JF Bastien
Comment 2 2017-12-09 11:50:35 PST
Comment on attachment 328910 [details] Patch Wooh! r=me
Yusuke Suzuki
Comment 3 2017-12-09 11:52:35 PST
Comment on attachment 328910 [details] Patch Yay!
WebKit Commit Bot
Comment 4 2017-12-09 12:12:00 PST
Comment on attachment 328910 [details] Patch Clearing flags on attachment: 328910 Committed r225726: <https://trac.webkit.org/changeset/225726>
WebKit Commit Bot
Comment 5 2017-12-09 12:12:01 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 6 2017-12-09 12:12:57 PST
Darin Adler
Comment 7 2017-12-09 14:48:24 PST
Comment on attachment 328910 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=328910&action=review > Source/WTF/wtf/text/StringHasher.h:250 > + static constexpr UChar defaultConverter(char character) > { > return character; > } I believe this is incorrect on systems where char is signed. A correct version would be one of these: return static_cast<unsigned char>(character); return static_cast<uint8_t>(character); return static_cast<LChar>(character);
Yusuke Suzuki
Comment 8 2017-12-10 04:54:29 PST
Comment on attachment 328910 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=328910&action=review >> Source/WTF/wtf/text/StringHasher.h:250 >> } > > I believe this is incorrect on systems where char is signed. A correct version would be one of these: > > return static_cast<unsigned char>(character); > return static_cast<uint8_t>(character); > return static_cast<LChar>(character); Oh, nice. I think this does not cause a problem right now since it is only used for string literals: if a character's MSB is set, it is a leading character in UTF-8. I'll land a follow-up patch.
Yusuke Suzuki
Comment 9 2017-12-10 05:00:31 PST
JF Bastien
Comment 10 2017-12-11 09:40:12 PST
Looks like this or the follow-up causes build failures on some bots? Step #3: ../../Source/WTF/wtf/text/StringHasher.h:252:28: error: class member cannot be redeclared Step #3: static constexpr UChar defaultConverter(char16_t character) Step #3: ^ Step #3: ../../Source/WTF/wtf/text/StringHasher.h:237:28: note: previous definition is here Step #3: static constexpr UChar defaultConverter(UChar character) Step #3: ^ https://oss-fuzz-build-logs.storage.googleapis.com/log-520a7b40-d87a-4f05-a85f-074a673871b9.txt
Yusuke Suzuki
Comment 11 2017-12-11 10:07:44 PST
(In reply to JF Bastien from comment #10) > Looks like this or the follow-up causes build failures on some bots? > > > Step #3: ../../Source/WTF/wtf/text/StringHasher.h:252:28: error: class > member cannot be redeclared > Step #3: static constexpr UChar defaultConverter(char16_t character) > Step #3: ^ > Step #3: ../../Source/WTF/wtf/text/StringHasher.h:237:28: note: previous > definition is here > Step #3: static constexpr UChar defaultConverter(UChar character) > Step #3: ^ > > https://oss-fuzz-build-logs.storage.googleapis.com/log-520a7b40-d87a-4f05- > a85f-074a673871b9.txt Nice, I've opened a bug for this. https://bugs.webkit.org/show_bug.cgi?id=180656
Note You need to log in before you can comment on or make changes to this bug.