• Stephan Bergmann's avatar
    Avoid clang-cl -Werror,-Wbitfield-constant-conversion · 06e32106
    Stephan Bergmann yazdı
    ...when (non-negative) QueryOp enumerators LESS/GREATER_EQUAL are crammed into
    a 2-bit meOp bitfield, where enums are implictly signed for MSVC, so the values
    actually storable in the bitfield range from -2 to +1.
    
    The clang-cl warning would go away when fixing the underlying type of QueryOp as
    unsigned, but then GCC would start to emit "error:
    ‘ScLookupCache::QueryCriteria::meOp’ is too small to hold all values of ‘enum
    ScLookupCache::QueryOp’ [-Werror]."
    
    So don't bother with bitfields at all:  For QueryCritera, for one there's a
    union member with a double and a pointer, so sizeof (QueryCriteria) will be
    twice the size of double anyway; and for another, MSVC doesn't combine bitfields
    of different type, so the bool members were separated from meOp anyway.  For
    QueryKey the reason for a bitfield is even less clear cut, and it might only
    have been there so that comparing (negative!) values read out of
    QueryCritera::meOp compare equal to values read out of QueryKey::meOp under
    MSVC.
    
    Change-Id: I69fb068bea914c00a29001155218cb9f1b8f8a9a
    06e32106
lookupcache.hxx 6.02 KB