⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 263280 in webkit


Ignore:
Timestamp:
Jun 19, 2020, 12:52:22 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Michael Catanzaro <Michael Catanzaro> 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):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r263255 r263280  
     12020-06-19  Michael Catanzaro  <mcatanzaro@gnome.org>
     2
     3        -Wsign-compare in isValidOptionSet
     4        https://bugs.webkit.org/show_bug.cgi?id=213383
     5
     6        Reviewed by Darin Adler.
     7
     8        The OptionSet's StorageType is always unsigned, even if the enum's underlying value is not.
     9        Match this in isValidOptionSet to avoid -Wsign-compare during validity checking.
     10
     11        * wtf/OptionSet.h:
     12        (WTF::isValidOptionSet):
     13
    1142020-06-19  Myles C. Maxfield  <mmaxfield@apple.com>
    215
  • trunk/Source/WTF/wtf/OptionSet.h

    r263208 r263280  
    254254WARN_UNUSED_RETURN constexpr bool isValidOptionSet(OptionSet<E> optionSet)
    255255{
    256     auto allValidBitsValue = OptionSetValueChecker<std::underlying_type_t<E>, typename EnumTraits<E>::values>::allValidBits();
     256    auto allValidBitsValue = OptionSetValueChecker<std::make_unsigned_t<std::underlying_type_t<E>>, typename EnumTraits<E>::values>::allValidBits();
    257257    return (optionSet.toRaw() | allValidBitsValue) == allValidBitsValue;
    258258}
Note: See TracChangeset for help on using the changeset viewer.