Fix anonymous struct and union warnings
gui/BufferItem.h and android/sensor.h uses anymous structs and nested
anonymous unions, which are GNU extensions. sensor.h uses them as part
of its API, so disable the warnings in libgui, the only module that
tries to use it with -Weverything. BufferItem.h only uses the unioned
fields inside libgui, remove the union and do the 64-bit to 32-bit
slicing manually so libvulkan doesn't need the warnings disabled.
Bug: 31752268
Test: m -j
Change-Id: I92d59b1202f4d6e5419edaa6d27b6e1c50ac0042
diff --git a/include/gui/BufferItem.h b/include/gui/BufferItem.h
index 3ab63d0..5232d0f 100644
--- a/include/gui/BufferItem.h
+++ b/include/gui/BufferItem.h
@@ -74,13 +74,7 @@
// to set by queueBuffer each time this slot is queued. This value
// is guaranteed to be monotonically increasing for each newly
// acquired buffer.
- union {
- int64_t mTimestamp;
- struct {
- uint32_t mTimestampLo;
- uint32_t mTimestampHi;
- };
- };
+ int64_t mTimestamp;
// mIsAutoTimestamp indicates whether mTimestamp was generated
// automatically when the buffer was queued.
@@ -92,13 +86,7 @@
android_dataspace mDataSpace;
// mFrameNumber is the number of the queued frame for this slot.
- union {
- uint64_t mFrameNumber;
- struct {
- uint32_t mFrameNumberLo;
- uint32_t mFrameNumberHi;
- };
- };
+ uint64_t mFrameNumber;
// mSlot is the slot index of this buffer (default INVALID_BUFFER_SLOT).
int mSlot;