Skip to content

Commit aca1330

Browse files
studgeekCQ Bot Account
authored and
CQ Bot Account
committed
pw_bluetooth_sapphire: Add [[maybe_unused]] where needed
Removes need for -Wno-unused-parameter which will allow us to remove emboss's public_config disable of that warning in later CL. Bug: 345799180 Change-Id: I7aa78d70265ed1b5d4ff28fd83989be4ee2740f8 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/252355 Commit-Queue: David Rees <drees@google.com> Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com> Docs-Not-Needed: David Rees <drees@google.com> Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Josh Conner <joshconner@google.com>
1 parent 4d16136 commit aca1330

File tree

6 files changed

+25
-20
lines changed

6 files changed

+25
-20
lines changed

pw_bluetooth_sapphire/host/l2cap/bredr_dynamic_channel_registry_fuzztest.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
6060
pw::bluetooth::emboss::ConnectionRole::CENTRAL,
6161
dispatcher);
6262

63-
auto open_cb = [](auto chan) {};
64-
auto close_cb = [](auto chan) {};
65-
auto service_chan_cb = [](auto chan) {};
63+
auto open_cb = []([[maybe_unused]] auto chan) {};
64+
auto close_cb = []([[maybe_unused]] auto chan) {};
65+
auto service_chan_cb = []([[maybe_unused]] auto chan) {};
6666

67-
auto service_cb = [&](auto psm) {
67+
auto service_cb = [&]([[maybe_unused]] auto psm) {
6868
// Reject some PSMs.
6969
if (provider.ConsumeBool()) {
7070
return std::optional<

pw_bluetooth_sapphire/host/l2cap/l2cap_fuzztest.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ class FuzzerController : public ControllerTestDoubleBase,
4848

4949
private:
5050
// Controller overrides:
51-
void SendCommand(pw::span<const std::byte> command) override {}
52-
void SendAclData(pw::span<const std::byte> data) override {}
53-
void SendScoData(pw::span<const std::byte> data) override {}
54-
void SendIsoData(pw::span<const std::byte> data) override {}
51+
void SendCommand(
52+
[[maybe_unused]] pw::span<const std::byte> command) override {}
53+
void SendAclData([[maybe_unused]] pw::span<const std::byte> data) override {}
54+
void SendScoData([[maybe_unused]] pw::span<const std::byte> data) override {}
55+
void SendIsoData([[maybe_unused]] pw::span<const std::byte> data) override {}
5556
};
5657

5758
// Reuse ControllerTest test fixture code even though we're not using gtest.

pw_bluetooth_sapphire/host/testing/fake_controller.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -2612,7 +2612,8 @@ void FakeController::OnLEStartEncryptionCommand(
26122612
}
26132613

26142614
void FakeController::OnWriteSynchronousFlowControlEnableCommand(
2615-
const pwemb::WriteSynchronousFlowControlEnableCommandView& params) {
2615+
[[maybe_unused]] const pwemb::WriteSynchronousFlowControlEnableCommandView&
2616+
params) {
26162617
if (!settings_.SupportedCommandsView()
26172618
.write_synchronous_flow_control_enable()
26182619
.Read()) {
@@ -3429,7 +3430,8 @@ void FakeController::SendAndroidLEMultipleAdvertisingStateChangeSubevent(
34293430
}
34303431

34313432
void FakeController::OnReadLocalSupportedControllerDelay(
3432-
const pwemb::ReadLocalSupportedControllerDelayCommandView& params) {
3433+
[[maybe_unused]] const pwemb::ReadLocalSupportedControllerDelayCommandView&
3434+
params) {
34333435
auto packet = hci::EventPacket::New<
34343436
pwemb::ReadLocalSupportedControllerDelayCommandCompleteEventWriter>(
34353437
hci_spec::kCommandCompleteEventCode);

pw_bluetooth_sapphire/host/testing/fake_signaling_server.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ void FakeSignalingServer::ProcessConfigurationRequest(
188188

189189
void FakeSignalingServer::ProcessConfigurationResponse(
190190
hci_spec::ConnectionHandle conn,
191-
l2cap::CommandId id,
191+
[[maybe_unused]] l2cap::CommandId id,
192192
const ByteBuffer& configuration_res) {
193193
const l2cap::ChannelId local_cid =
194194
configuration_res
@@ -253,9 +253,10 @@ void FakeSignalingServer::SendCFrame(hci_spec::ConnectionHandle conn,
253253
return callback(conn, l2cap::kSignalingChannelId, response_buffer);
254254
}
255255

256-
void FakeSignalingServer::SendCommandReject(hci_spec::ConnectionHandle conn,
257-
l2cap::CommandId id,
258-
l2cap::RejectReason reason) {
256+
void FakeSignalingServer::SendCommandReject(
257+
hci_spec::ConnectionHandle conn,
258+
l2cap::CommandId id,
259+
[[maybe_unused]] l2cap::RejectReason reason) {
259260
DynamicByteBuffer payload_buffer(sizeof(l2cap::CommandRejectPayload));
260261
MutablePacketView<l2cap::CommandRejectPayload> payload_view(&payload_buffer);
261262
payload_view.mutable_header()->reason =

pw_bluetooth_sapphire/public/pw_bluetooth_sapphire/peripheral.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Peripheral final : public pw::bluetooth::low_energy::Peripheral2 {
5858

5959
// AdvertisedPeripheral2 overrides:
6060
async2::Poll<pw::bluetooth::low_energy::Connection2::Ptr> PendConnection(
61-
async2::Context& cx) override {
61+
[[maybe_unused]] async2::Context& cx) override {
6262
// TODO: https://pwbug.dev/377301546 - Implement connection handling.
6363
return async2::Pending();
6464
}

pw_bluetooth_sapphire/size_report/host.cc

+6-5
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@
2020
namespace {
2121
class BloatRandomGenerator final : public pw::random::RandomGenerator {
2222
public:
23-
void Get(pw::ByteSpan dest) override {}
23+
void Get([[maybe_unused]] pw::ByteSpan dest) override {}
2424
void InjectEntropyBits(uint32_t /*data*/,
2525
uint_fast8_t /*num_bits*/) override {}
2626
};
2727

2828
class BloatDispatcher final : public pw::async::Dispatcher {
2929
public:
30-
void PostAt(pw::async::Task& task,
31-
pw::chrono::SystemClock::time_point time) override {}
32-
bool Cancel(pw::async::Task& task) override { return true; }
30+
void PostAt(
31+
[[maybe_unused]] pw::async::Task& task,
32+
[[maybe_unused]] pw::chrono::SystemClock::time_point time) override {}
33+
bool Cancel([[maybe_unused]] pw::async::Task& task) override { return true; }
3334
pw::chrono::SystemClock::time_point now() override {
3435
return pw::chrono::SystemClock::time_point::min();
3536
}
@@ -48,7 +49,7 @@ int main() {
4849
bt::gap::Adapter::Config config{};
4950
std::unique_ptr<bt::gap::Adapter> adapter = bt::gap::Adapter::Create(
5051
dispatcher, transport->GetWeakPtr(), gatt->GetWeakPtr(), config);
51-
auto gap_init_cb = [](bool success) {};
52+
auto gap_init_cb = []([[maybe_unused]] bool success) {};
5253
auto transport_closed_cb = []() {};
5354
adapter->Initialize(std::move(gap_init_cb), std::move(transport_closed_cb));
5455
return 0;

0 commit comments

Comments
 (0)