Title: [253315] trunk/Source/WTF
Revision
253315
Author
[email protected]
Date
2019-12-09 17:54:17 -0800 (Mon, 09 Dec 2019)

Log Message

[MSVC] writeNumberToBufferUnsigned is unsafe for bool type
https://bugs.webkit.org/show_bug.cgi?id=204873

Reviewed by Darin Adler.

MSVC reports warning for using / operator for bool type.
> warning C4804: '/': unsafe use of type 'bool' in operation

And, 'bool' isn't expected to be serialized as '0' or '1'. 'bool' isn't supported.

* wtf/text/IntegerToStringConversion.h: Added a static_assert to ensure UnsignedIntegerType isn't bool.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (253314 => 253315)


--- trunk/Source/WTF/ChangeLog	2019-12-10 01:54:07 UTC (rev 253314)
+++ trunk/Source/WTF/ChangeLog	2019-12-10 01:54:17 UTC (rev 253315)
@@ -1,3 +1,17 @@
+2019-12-09  Fujii Hironori  <[email protected]>
+
+        [MSVC] writeNumberToBufferUnsigned is unsafe for bool type
+        https://bugs.webkit.org/show_bug.cgi?id=204873
+
+        Reviewed by Darin Adler.
+
+        MSVC reports warning for using / operator for bool type.
+        > warning C4804: '/': unsafe use of type 'bool' in operation
+
+        And, 'bool' isn't expected to be serialized as '0' or '1'. 'bool' isn't supported.
+
+        * wtf/text/IntegerToStringConversion.h: Added a static_assert to ensure UnsignedIntegerType isn't bool.
+
 2019-07-13  Darin Adler  <[email protected]>
 
         Streamline PODIntervalTree code and remove ValueToString

Modified: trunk/Source/WTF/wtf/text/IntegerToStringConversion.h (253314 => 253315)


--- trunk/Source/WTF/wtf/text/IntegerToStringConversion.h	2019-12-10 01:54:07 UTC (rev 253314)
+++ trunk/Source/WTF/wtf/text/IntegerToStringConversion.h	2019-12-10 01:54:17 UTC (rev 253315)
@@ -64,6 +64,7 @@
 template<typename CharacterType, typename UnsignedIntegerType, PositiveOrNegativeNumber NumberType>
 static void writeNumberToBufferImpl(UnsignedIntegerType number, CharacterType* destination)
 {
+    static_assert(!std::is_same_v<bool, std::remove_cv_t<UnsignedIntegerType>>, "'bool' not supported");
     LChar buf[sizeof(UnsignedIntegerType) * 3 + 1];
     LChar* end = std::end(buf);
     LChar* p = end;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to