Kaydet (Commit) 06e32106 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Avoid clang-cl -Werror,-Wbitfield-constant-conversion

...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
üst fea70bfb
......@@ -64,9 +64,9 @@ public:
double mfVal;
const OUString *mpStr;
};
bool mbAlloc : 1;
bool mbString : 1;
QueryOp meOp : 2;
bool mbAlloc;
bool mbString;
QueryOp meOp;
void deleteString()
{
......@@ -145,7 +145,7 @@ private:
{
SCROW mnRow;
SCTAB mnTab;
QueryOp meOp : 2;
QueryOp meOp;
QueryKey( const ScAddress & rAddress, const QueryOp eOp ) :
mnRow( rAddress.Row()),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment