Title: [263280] trunk/Source/WTF
Revision
263280
Author
[email protected]
Date
2020-06-19 12:52:22 -0700 (Fri, 19 Jun 2020)

Log Message

-Wsign-compare in isValidOptionSet
https://bugs.webkit.org/show_bug.cgi?id=213383

Patch by Michael Catanzaro <[email protected]> on 2020-06-19
Reviewed by Darin Adler.

The OptionSet's StorageType is always unsigned, even if the enum's underlying value is not.
Match this in isValidOptionSet to avoid -Wsign-compare during validity checking.

* wtf/OptionSet.h:
(WTF::isValidOptionSet):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (263279 => 263280)


--- trunk/Source/WTF/ChangeLog	2020-06-19 19:39:08 UTC (rev 263279)
+++ trunk/Source/WTF/ChangeLog	2020-06-19 19:52:22 UTC (rev 263280)
@@ -1,3 +1,16 @@
+2020-06-19  Michael Catanzaro  <[email protected]>
+
+        -Wsign-compare in isValidOptionSet
+        https://bugs.webkit.org/show_bug.cgi?id=213383
+
+        Reviewed by Darin Adler.
+
+        The OptionSet's StorageType is always unsigned, even if the enum's underlying value is not.
+        Match this in isValidOptionSet to avoid -Wsign-compare during validity checking.
+
+        * wtf/OptionSet.h:
+        (WTF::isValidOptionSet):
+
 2020-06-19  Myles C. Maxfield  <[email protected]>
 
         [Cocoa] Unify "font:" CSS shorthand values between macOS and iOS family

Modified: trunk/Source/WTF/wtf/OptionSet.h (263279 => 263280)


--- trunk/Source/WTF/wtf/OptionSet.h	2020-06-19 19:39:08 UTC (rev 263279)
+++ trunk/Source/WTF/wtf/OptionSet.h	2020-06-19 19:52:22 UTC (rev 263280)
@@ -253,7 +253,7 @@
 template<typename E>
 WARN_UNUSED_RETURN constexpr bool isValidOptionSet(OptionSet<E> optionSet)
 {
-    auto allValidBitsValue = OptionSetValueChecker<std::underlying_type_t<E>, typename EnumTraits<E>::values>::allValidBits();
+    auto allValidBitsValue = OptionSetValueChecker<std::make_unsigned_t<std::underlying_type_t<E>>, typename EnumTraits<E>::values>::allValidBits();
     return (optionSet.toRaw() | allValidBitsValue) == allValidBitsValue;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to