Skip to content

Commit

Permalink
pw_bluetooth_sapphire: Handle C99 warning with pigweed
Browse files Browse the repository at this point in the history
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 <[email protected]>
Lint: Lint 🤖 <[email protected]>
Commit-Queue: Jason Graffius <[email protected]>
  • Loading branch information
EricRahm authored and CQ Bot Account committed Aug 23, 2024
1 parent db3e878 commit c5e7f14
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit c5e7f14

Please sign in to comment.