From c5e7f145a147f3ab3ed86dc758875af0ab09bc79 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Fri, 23 Aug 2024 18:14:03 +0000 Subject: [PATCH] pw_bluetooth_sapphire: Handle C99 warning with pigweed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle C99 extensions warning with pigweed diagnostics. Bug: b/355511476 Test: fx test //src/connectivity/bluetooth/core/bt-host Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1095034 GitOrigin-RevId: 74ccafca7c5a5fd2e5d5ba49207af12a2a5016cb Change-Id: I9a95aef276cb31c34f840fdba1a1c7b76dc18c66 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/230573 Reviewed-by: Lulu Wang Lint: Lint 🤖 Commit-Queue: Jason Graffius --- .../internal/host/hci-spec/protocol.h | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h b/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h index 9b7379ea79..b24f4631c0 100644 --- a/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h +++ b/pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/internal/host/hci-spec/protocol.h @@ -35,8 +35,6 @@ // MutableBufferView::mutable_payload(), or CommandPacket::mutable_payload() // instead. Take extra care when accessing flexible array members. -#pragma clang diagnostic ignored "-Wc99-extensions" - namespace bt::hci_spec { using pw::bluetooth::emboss::ConnectionRole; @@ -824,6 +822,8 @@ constexpr EventCode kReadRemoteVersionInfoCompleteEventCode = 0x0C; // Command Complete Event (v1.1) constexpr EventCode kCommandCompleteEventCode = 0x0E; +PW_MODIFY_DIAGNOSTICS_PUSH(); +PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions"); struct CommandCompleteEventParams { CommandCompleteEventParams() = delete; BT_DISALLOW_COPY_ASSIGN_AND_MOVE(CommandCompleteEventParams); @@ -841,6 +841,7 @@ struct CommandCompleteEventParams { // parameters associated with that command. uint8_t return_parameters[]; } __attribute__((packed)); +PW_MODIFY_DIAGNOSTICS_POP(); // =========================== // Command Status Event (v1.1) @@ -945,6 +946,8 @@ constexpr EventCode kUserPasskeyNotificationEventCode = 0x3B; // LE Meta Event (v4.0) (LE) constexpr EventCode kLEMetaEventCode = 0x3E; +PW_MODIFY_DIAGNOSTICS_PUSH(); +PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions"); struct LEMetaEventParams { LEMetaEventParams() = delete; BT_DISALLOW_COPY_ASSIGN_AND_MOVE(LEMetaEventParams); @@ -955,6 +958,7 @@ struct LEMetaEventParams { // Beginning of parameters that are specific to the LE subevent. uint8_t subevent_parameters[]; } __attribute__((packed)); +PW_MODIFY_DIAGNOSTICS_POP(); // LE Connection Complete Event (v4.0) (LE) constexpr EventCode kLEConnectionCompleteSubeventCode = 0x01; @@ -1114,6 +1118,8 @@ struct LEDirectedAdvertisingReportData { int8_t rssi; } __attribute__((packed)); +PW_MODIFY_DIAGNOSTICS_PUSH(); +PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions"); struct LEDirectedAdvertisingReportSubeventParams { LEDirectedAdvertisingReportSubeventParams() = delete; BT_DISALLOW_COPY_ASSIGN_AND_MOVE(LEDirectedAdvertisingReportSubeventParams); @@ -1125,6 +1131,7 @@ struct LEDirectedAdvertisingReportSubeventParams { // The report array parameters. LEDirectedAdvertisingReportData reports[]; } __attribute__((packed)); +PW_MODIFY_DIAGNOSTICS_POP(); // LE PHY Update Complete Event (v5.0) (LE) constexpr EventCode kLEPHYUpdateCompleteSubeventCode = 0x0C; @@ -1183,6 +1190,8 @@ struct LEPeriodicAdvertisingSyncEstablishedSubeventParams { // LE Periodic Advertising Report Event (v5.0) (LE) constexpr EventCode kLEPeriodicAdvertisingReportSubeventCode = 0x0F; +PW_MODIFY_DIAGNOSTICS_PUSH(); +PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions"); struct LEPeriodicAdvertisingReportSubeventParams { LEPeriodicAdvertisingReportSubeventParams() = delete; BT_DISALLOW_COPY_ASSIGN_AND_MOVE(LEPeriodicAdvertisingReportSubeventParams); @@ -1213,6 +1222,7 @@ struct LEPeriodicAdvertisingReportSubeventParams { // |data_length| octets of data received from a Periodic Advertising packet. uint8_t data[]; } __attribute__((packed)); +PW_MODIFY_DIAGNOSTICS_POP(); // LE Periodic Advertising Sync Lost Event (v5.0) (LE) constexpr EventCode kLEPeriodicAdvertisingSyncLostSubeventCode = 0x10; @@ -1283,6 +1293,8 @@ struct NumberOfCompletedDataBlocksEventData { uint16_t num_of_completed_blocks; } __attribute__((packed)); +PW_MODIFY_DIAGNOSTICS_PUSH(); +PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions"); struct NumberOfCompletedDataBlocksEventParams { NumberOfCompletedDataBlocksEventParams() = delete; BT_DISALLOW_COPY_ASSIGN_AND_MOVE(NumberOfCompletedDataBlocksEventParams); @@ -1291,6 +1303,7 @@ struct NumberOfCompletedDataBlocksEventParams { uint8_t number_of_handles; NumberOfCompletedDataBlocksEventData data[]; } __attribute__((packed)); +PW_MODIFY_DIAGNOSTICS_POP(); // ================================================================ // Authenticated Payload Timeout Expired Event (v4.1) (BR/EDR & LE) @@ -2190,6 +2203,8 @@ struct LESetPeriodicAdvertisingParametersCommandParams { constexpr OpCode kLESetPeriodicAdvertisingData = LEControllerCommandOpCode(0x003F); +PW_MODIFY_DIAGNOSTICS_PUSH(); +PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions"); struct LESetPeriodicAdvertisingDataCommandParams { LESetPeriodicAdvertisingDataCommandParams() = delete; BT_DISALLOW_COPY_ASSIGN_AND_MOVE(LESetPeriodicAdvertisingDataCommandParams); @@ -2208,6 +2223,7 @@ struct LESetPeriodicAdvertisingDataCommandParams { // Variable length advertising data. uint8_t adv_data[]; } __attribute__((packed)); +PW_MODIFY_DIAGNOSTICS_POP(); // ====================================================== // LE Set Periodic Advertising Enable Command (v5.0) (LE)