Skip to content

Commit

Permalink
pw_bluetooth_sapphire: Handle zero length warning with pigweed
Browse files Browse the repository at this point in the history
Handle zero length array 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/+/1095795
GitOrigin-RevId: 025e09d905c8c85be80d2aa26596dcfd7cafc289
Change-Id: I5512c7a744a28d3ac027682d16b1d3b973aa5035
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/230536
Lint: Lint 🤖 <[email protected]>
Commit-Queue: Jason Graffius <[email protected]>
Reviewed-by: Josh Conner <[email protected]>
  • Loading branch information
EricRahm authored and CQ Bot Account committed Aug 23, 2024
1 parent c5e7f14 commit 386ab03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pw_bluetooth_sapphire/host/common/packet_view_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
#include <string>

#include "pw_bluetooth_sapphire/internal/host/common/byte_buffer.h"
#include "pw_bluetooth_sapphire/internal/host/common/macros.h"
#include "pw_bluetooth_sapphire/internal/host/testing/test_helpers.h"
#include "pw_unit_test/framework.h"

#pragma clang diagnostic ignored "-Wzero-length-array"

namespace bt {
namespace {

Expand All @@ -30,12 +29,15 @@ struct TestHeader {
uint8_t field8;
} __attribute__((packed));

PW_MODIFY_DIAGNOSTICS_PUSH();
PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wzero-length-array");
struct TestPayload {
uint8_t arg0;
uint16_t arg1;
uint8_t arg2[2];
uint8_t arg3[0];
} __attribute__((packed));
PW_MODIFY_DIAGNOSTICS_POP();

TEST(PacketViewTest, EmptyPayload) {
constexpr size_t kBufferSize = sizeof(TestHeader);
Expand Down

0 comments on commit 386ab03

Please sign in to comment.