Fix Wbitwise-instead-of-logical warnings
`a || b` only evaluates b if a is false. `a | b` always evaluates both a and b. If a and b are of type bool, || is usually what you want, so clang now warns on `|` where both arguments are of type bool. This warning fires twice in harfbuzz. In both cases, `|` is used intentionally, with a comment explaining this. Slightly reorder the code a bit to make the compiler happy, and to make it obvious even without a comment that both calls should be evaluated. No intended behavior change.
This commit is contained in:
parent
b621c4fc29
commit
96299d70ed
|
@ -1220,9 +1220,9 @@ struct PairSet
|
||||||
record_size);
|
record_size);
|
||||||
if (record)
|
if (record)
|
||||||
{
|
{
|
||||||
/* Note the intentional use of "|" instead of short-circuit "||". */
|
bool applied_first = valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos());
|
||||||
if (valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos()) |
|
bool applied_second = valueFormats[1].apply_value (c, this, &record->values[len1], buffer->pos[pos]);
|
||||||
valueFormats[1].apply_value (c, this, &record->values[len1], buffer->pos[pos]))
|
if (applied_first || applied_second)
|
||||||
buffer->unsafe_to_break (buffer->idx, pos + 1);
|
buffer->unsafe_to_break (buffer->idx, pos + 1);
|
||||||
if (len2)
|
if (len2)
|
||||||
pos++;
|
pos++;
|
||||||
|
@ -1560,9 +1560,9 @@ struct PairPosFormat2
|
||||||
if (unlikely (klass1 >= class1Count || klass2 >= class2Count)) return_trace (false);
|
if (unlikely (klass1 >= class1Count || klass2 >= class2Count)) return_trace (false);
|
||||||
|
|
||||||
const Value *v = &values[record_len * (klass1 * class2Count + klass2)];
|
const Value *v = &values[record_len * (klass1 * class2Count + klass2)];
|
||||||
/* Note the intentional use of "|" instead of short-circuit "||". */
|
bool applied_first = valueFormat1.apply_value (c, this, v, buffer->cur_pos());
|
||||||
if (valueFormat1.apply_value (c, this, v, buffer->cur_pos()) |
|
bool applied_second = valueFormat2.apply_value (c, this, v + len1, buffer->pos[skippy_iter.idx]);
|
||||||
valueFormat2.apply_value (c, this, v + len1, buffer->pos[skippy_iter.idx]))
|
if (applied_first || applied_second)
|
||||||
buffer->unsafe_to_break (buffer->idx, skippy_iter.idx + 1);
|
buffer->unsafe_to_break (buffer->idx, skippy_iter.idx + 1);
|
||||||
|
|
||||||
buffer->idx = skippy_iter.idx;
|
buffer->idx = skippy_iter.idx;
|
||||||
|
|
Loading…
Reference in New Issue