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/+/1092957
GitOrigin-RevId: e0381227753aff4229124822910e9d0e2c765188
Change-Id: Ie65a53c84c33c9fcfbc2632db728c0f0fd3d5c1c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/230552
Commit-Queue: Jason Graffius <[email protected]>
Reviewed-by: Lulu Wang <[email protected]>
Lint: Lint 🤖 <[email protected]>
  • Loading branch information
EricRahm authored and CQ Bot Account committed Aug 23, 2024
1 parent 5152d11 commit 9a6adf1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pw_bluetooth_sapphire/host/common/byte_buffer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
#include <cstddef>
#include <type_traits>

#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 "-Wc99-extensions"

namespace bt {
namespace {

Expand Down Expand Up @@ -518,13 +517,16 @@ TEST(ByteBufferTest, ByteBufferToDoesNotReadUnaligned) {
}

TEST(ByteBufferTest, ByteBufferReadMember) {
PW_MODIFY_DIAGNOSTICS_PUSH();
PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions");
struct [[gnu::packed]] Point {
uint8_t x;
const uint8_t y;
const uint8_t array[2];
char multi[2][1];
uint8_t flex[];
};
PW_MODIFY_DIAGNOSTICS_POP();

StaticByteBuffer data(0x01, 0x02, 0x03, 0x37, 0x7f, 0x02, 0x45);
auto x = data.ReadMember<&Point::x>();
Expand Down Expand Up @@ -608,10 +610,13 @@ TEST(ByteBufferDeathTest, ByteBufferReadMemberOfStdArrayType) {
}

TEST(ByteBufferDeathTest, ByteBufferReadMemberOfFlexibleArrayType) {
PW_MODIFY_DIAGNOSTICS_PUSH();
PW_MODIFY_DIAGNOSTIC_CLANG(ignored, "-Wc99-extensions");
struct [[gnu::packed]] Point {
uint16_t dimensions;
int8_t coordinates[];
};
PW_MODIFY_DIAGNOSTICS_POP();

StaticByteBuffer data(0, 0, 0x01, 0x02);
ASSERT_LE(sizeof(Point), data.size());
Expand Down

0 comments on commit 9a6adf1

Please sign in to comment.