Page MenuHomePhabricator

Fix a -Wbitwise-conditional-parentheses warning in _LIBUNWIND_ARM_EHABI libunwind builds
ClosedPublic

Authored by thakis on Feb 3 2020, 6:30 AM.

Details

Summary
src/UnwindCursor.hpp:1344:51: error: operator '?:' has lower precedence than '|';
    '|' will be evaluated first [-Werror,-Wbitwise-conditional-parentheses]
  _info.flags = isSingleWordEHT ? 1 : 0 | scope32 ? 0x2 : 0;  // Use enum?
                                      ~~~~~~~~~~~ ^
src/UnwindCursor.hpp:1344:51: note: place parentheses around the '|' expression
    to silence this warning
  _info.flags = isSingleWordEHT ? 1 : 0 | scope32 ? 0x2 : 0;  // Use enum?
                                                  ^
                                      (          )
src/UnwindCursor.hpp:1344:51: note: place parentheses around the '?:' expression
    to evaluate it first
  _info.flags = isSingleWordEHT ? 1 : 0 | scope32 ? 0x2 : 0;  // Use enum?
                                                  ^
                                          (                )

But 0 | is a no-op for either of those two interpretations, so I think what was meant here was

_info.flags = (isSingleWordEHT ? 1 : 0) | (scope32 ? 0x2 : 0);  // Use enum?

Previously, if isSingleWordEHT was set, bit 2 would never be set. Now it is. From what I can tell, the only thing that checks these bitmask is ProcessDescriptors in Unwind-EHABI.cpp, and that only cares about bit 1, so in practice this shouldn't have much of an effect.

Diff Detail

Event Timeline

thakis created this revision.Feb 3 2020, 6:30 AM
thakis updated this revision to Diff 242055.Feb 3 2020, 6:30 AM
awong accepted this revision.Feb 3 2020, 10:31 AM
This revision is now accepted and ready to land.Feb 3 2020, 10:31 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2020, 11:20 AM