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/+/1095033
GitOrigin-RevId: f3cd0f2ee0d6078a80bca9fdfbce18c07dd0e154
Change-Id: If359d0f92efd92b420d1bc33db71c9f59f9be653
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/230572
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 0e348ae commit db3e878
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "pw_bluetooth_sapphire/internal/host/hci-spec/constants.h"
#include "pw_bluetooth_sapphire/internal/host/l2cap/l2cap_defs.h"

#pragma clang diagnostic ignored "-Wc99-extensions"
#pragma clang diagnostic ignored "-Wflexible-array-extensions"

namespace bt::att {
Expand Down Expand Up @@ -130,13 +129,16 @@ enum class ExecuteWriteFlag : uint8_t {
kWritePending = 0x01,
};

PW_MODIFY_DIAGNOSTICS_PUSH();
PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions");
struct AttributeData {
AttributeData() = default;
BT_DISALLOW_COPY_ASSIGN_AND_MOVE(AttributeData);

Handle handle;
uint8_t value[];
} __attribute__((packed));
PW_MODIFY_DIAGNOSTICS_POP();

// ============== ATT PDUs ==============
constexpr OpCode kInvalidOpCode = 0x00;
Expand Down Expand Up @@ -198,6 +200,8 @@ using InformationData128 = InformationData<UUIDType::k128Bit>;
constexpr OpCode kFindByTypeValueRequest = 0x06;
constexpr OpCode kFindByTypeValueResponse = 0x07;

PW_MODIFY_DIAGNOSTICS_PUSH();
PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions");
struct FindByTypeValueRequestParams {
FindByTypeValueRequestParams() = default;
BT_DISALLOW_COPY_ASSIGN_AND_MOVE(FindByTypeValueRequestParams);
Expand All @@ -207,6 +211,7 @@ struct FindByTypeValueRequestParams {
AttributeType16 type;
uint8_t value[];
} __attribute__((packed));
PW_MODIFY_DIAGNOSTICS_POP();

struct HandlesInformationList {
Handle handle;
Expand Down Expand Up @@ -236,13 +241,16 @@ struct ReadByTypeRequestParams {
using ReadByTypeRequestParams16 = ReadByTypeRequestParams<UUIDType::k16Bit>;
using ReadByTypeRequestParams128 = ReadByTypeRequestParams<UUIDType::k128Bit>;

PW_MODIFY_DIAGNOSTICS_PUSH();
PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions");
struct ReadByTypeResponseParams {
ReadByTypeResponseParams() = default;
BT_DISALLOW_COPY_ASSIGN_AND_MOVE(ReadByTypeResponseParams);

uint8_t length;
AttributeData attribute_data_list[];
} __attribute__((packed));
PW_MODIFY_DIAGNOSTICS_POP();

// ====
// Read
Expand Down Expand Up @@ -288,6 +296,8 @@ constexpr uint8_t kMaxReadByGroupTypeValueLength = 251;
using ReadByGroupTypeRequestParams16 = ReadByTypeRequestParams16;
using ReadByGroupTypeRequestParams128 = ReadByTypeRequestParams128;

PW_MODIFY_DIAGNOSTICS_PUSH();
PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions");
struct AttributeGroupDataEntry {
AttributeGroupDataEntry() = default;
BT_DISALLOW_COPY_ASSIGN_AND_MOVE(AttributeGroupDataEntry);
Expand All @@ -296,14 +306,18 @@ struct AttributeGroupDataEntry {
Handle group_end_handle;
uint8_t value[];
} __attribute__((packed));
PW_MODIFY_DIAGNOSTICS_POP();

PW_MODIFY_DIAGNOSTICS_PUSH();
PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions");
struct ReadByGroupTypeResponseParams {
ReadByGroupTypeResponseParams() = default;
BT_DISALLOW_COPY_ASSIGN_AND_MOVE(ReadByGroupTypeResponseParams);

uint8_t length;
AttributeGroupDataEntry attribute_data_list[];
} __attribute__((packed));
PW_MODIFY_DIAGNOSTICS_POP();

// =====
// Write
Expand All @@ -319,6 +333,8 @@ using WriteRequestParams = AttributeData;
constexpr OpCode kPrepareWriteRequest = 0x16;
constexpr OpCode kPrepareWriteResponse = 0x17;

PW_MODIFY_DIAGNOSTICS_PUSH();
PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions");
struct PrepareWriteRequestParams {
PrepareWriteRequestParams() = default;
BT_DISALLOW_COPY_ASSIGN_AND_MOVE(PrepareWriteRequestParams);
Expand All @@ -327,6 +343,7 @@ struct PrepareWriteRequestParams {
uint16_t offset;
uint8_t part_value[];
} __attribute__((packed));
PW_MODIFY_DIAGNOSTICS_POP();

using PrepareWriteResponseParams = PrepareWriteRequestParams;

Expand Down

0 comments on commit db3e878

Please sign in to comment.