Skip to content

Commit

Permalink
pw_bluetooth_sapphire: Apply common bt-host copts to all source
Browse files Browse the repository at this point in the history
And fix a couple more -Wswitch-enum cases.

Bug: 345799180
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1097800
GitOrigin-RevId: 6c58e68fbf9faa88215c2147549b3203b1d95f17
Change-Id: I639ef563362d8b57613d491e54ea1801e0e32a8a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/230538
Reviewed-by: Lulu Wang <[email protected]>
Commit-Queue: Ben Lawson <[email protected]>
Lint: Lint 🤖 <[email protected]>
  • Loading branch information
studgeek authored and CQ Bot Account committed Aug 28, 2024
1 parent d62f6ce commit a99f4b8
Show file tree
Hide file tree
Showing 18 changed files with 79 additions and 26 deletions.
2 changes: 2 additions & 0 deletions pw_bluetooth_sapphire/host/att/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ cc_library(
srcs = [
"packet.cc",
],
copts = COPTS,
deps = [
"//pw_bluetooth_sapphire:public",
"//pw_bluetooth_sapphire/host/common",
Expand Down Expand Up @@ -61,6 +62,7 @@ cc_library(
"error_test.cc",
"permissions_test.cc",
],
copts = COPTS,
tags = ["manual"],
visibility = ["//visibility:public"],
deps = [
Expand Down
4 changes: 4 additions & 0 deletions pw_bluetooth_sapphire/host/att/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ pw_source_set("definitions") {
"$dir_public_att/packet.h",
]

configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]

sources = [ "packet.cc" ]

public_deps = [
Expand Down Expand Up @@ -83,6 +85,8 @@ pw_test("tests") {
"permissions_test.cc",
]

configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]

deps = [
":att",
"$dir_pw_bluetooth_sapphire/host/l2cap:testing",
Expand Down
2 changes: 2 additions & 0 deletions pw_bluetooth_sapphire/host/common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ cc_library(
cc_library(
name = "uuid_string_util",
srcs = ["uuid_string_util.cc"],
copts = COPTS,
deps = [":common"],
)

Expand Down Expand Up @@ -104,6 +105,7 @@ cc_library(
"weak_self_test.cc",
"windowed_inspect_numeric_property_test.cc",
],
copts = COPTS,
tags = ["manual"],
visibility = ["//visibility:public"],
deps = [
Expand Down
4 changes: 4 additions & 0 deletions pw_bluetooth_sapphire/host/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ pw_source_set("common") {

pw_source_set("uuid_string_util") {
sources = [ "uuid_string_util.cc" ]
configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]
public_deps = [ ":common" ]
}

Expand All @@ -133,6 +134,8 @@ pw_test("common_tests") {
"windowed_inspect_numeric_property_test.cc",
]

configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]

deps = [
":common",
":uuid_string_util",
Expand All @@ -145,6 +148,7 @@ pw_test("common_tests") {

pw_fuzzer("advertising_data_fuzzer") {
sources = [ "advertising_data_fuzztest.cc" ]
configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]
deps = [ ":common" ]
}

Expand Down
6 changes: 3 additions & 3 deletions pw_bluetooth_sapphire/host/gap/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cc_library(
srcs = [
"gap.cc",
],
copts = COPTS,
deps = [
"//pw_bluetooth_sapphire:public",
"//pw_bluetooth_sapphire/host/common",
Expand Down Expand Up @@ -87,9 +88,7 @@ cc_library(
"fake_adapter.cc",
"fake_pairing_delegate.cc",
],
copts = [
"-Wno-unused-parameter",
],
copts = COPTS,
deps = [
":gap",
"//pw_bluetooth_sapphire:public",
Expand Down Expand Up @@ -122,6 +121,7 @@ cc_library(
"secure_simple_pairing_state_test.cc",
"types_test.cc",
],
copts = COPTS,
tags = ["manual"],
visibility = ["//visibility:public"],
deps = [
Expand Down
7 changes: 6 additions & 1 deletion pw_bluetooth_sapphire/host/gap/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ dir_public_gap = "../../public/pw_bluetooth_sapphire/internal/host/gap"

pw_source_set("definitions") {
public = [ "$dir_public_gap/gap.h" ]

sources = [ "gap.cc" ]
configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]
deps = [ "$dir_pw_bluetooth_sapphire/host/common" ]
}

Expand Down Expand Up @@ -132,6 +132,8 @@ pw_source_set("testing") {
"fake_pairing_delegate.cc",
]

configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]

public_deps = [
":gap",
"$dir_pw_bluetooth_sapphire/host/l2cap:testing",
Expand Down Expand Up @@ -162,6 +164,8 @@ pw_test("gap_tests") {
"types_test.cc",
]

configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]

deps = [
":gap",
":testing",
Expand All @@ -179,6 +183,7 @@ pw_test("gap_tests") {

pw_fuzzer("peer_cache_fuzzer") {
sources = [ "peer_cache_fuzztest.cc" ]
configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]
deps = [
":gap",
"$dir_pw_async:fake_dispatcher",
Expand Down
1 change: 1 addition & 0 deletions pw_bluetooth_sapphire/host/hci-spec/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ cc_library(
srcs = [
"util_test.cc",
],
copts = COPTS,
tags = ["manual"],
visibility = ["//visibility:public"],
deps = [
Expand Down
5 changes: 2 additions & 3 deletions pw_bluetooth_sapphire/host/hci/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ cc_library(
"fake_low_energy_connection.cc",
"fake_sco_connection.cc",
],
copts = [
"-Wno-unused-parameter",
],
copts = COPTS,
deps = [
":hci",
"//pw_bluetooth_sapphire:public",
Expand All @@ -86,6 +84,7 @@ cc_library(
"low_energy_scanner_test.cc",
"sequential_command_runner_test.cc",
],
copts = COPTS,
tags = ["manual"],
visibility = ["//visibility:public"],
deps = [
Expand Down
7 changes: 6 additions & 1 deletion pw_bluetooth_sapphire/host/hci/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ pw_source_set("testing") {
public_deps = [ ":hci" ]

remove_configs = [ "$dir_pw_build:internal_strict_warnings" ]
configs = [ "$dir_pw_build:internal_strict_warnings_core" ]
configs = [
"$dir_pw_build:internal_strict_warnings_core",
"$dir_pw_bluetooth_sapphire/host:copts",
]
}

pw_test("tests") {
Expand All @@ -112,6 +115,8 @@ pw_test("tests") {
"sequential_command_runner_test.cc",
]

configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]

deps = [
":testing",
"$dir_pw_bluetooth:emboss_hci_test",
Expand Down
3 changes: 2 additions & 1 deletion pw_bluetooth_sapphire/host/hci/connection_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ class LinkTypeConnectionTest
return NewACLConnection(role, handle);
case bt::LinkType::kLE:
return NewLEConnection(role, handle);
default:
case bt::LinkType::kSCO:
case bt::LinkType::kESCO:
break;
}
BT_PANIC("Invalid link type: %u", static_cast<unsigned>(ll_type));
Expand Down
5 changes: 2 additions & 3 deletions pw_bluetooth_sapphire/host/l2cap/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ cc_library(
"mock_channel_test.cc",
"test_packets.cc",
],
copts = [
"-Wno-unused-parameter",
],
copts = COPTS,
deps = [
":l2cap",
"//pw_bluetooth_sapphire:public",
Expand Down Expand Up @@ -149,6 +147,7 @@ cc_library(
"signaling_channel_test.cc",
"types_test.cc",
],
copts = COPTS,
tags = ["manual"],
visibility = ["//visibility:public"],
deps = [
Expand Down
16 changes: 14 additions & 2 deletions pw_bluetooth_sapphire/host/l2cap/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ pw_source_set("testing") {
]

remove_configs = [ "$dir_pw_build:internal_strict_warnings" ]
configs = [ "$dir_pw_build:internal_strict_warnings_core" ]
configs = [
"$dir_pw_build:internal_strict_warnings_core",
"$dir_pw_bluetooth_sapphire/host:copts",
]
}

pw_test("l2cap_tests") {
Expand Down Expand Up @@ -210,13 +213,17 @@ pw_test("l2cap_tests") {
]

remove_configs = [ "$dir_pw_build:internal_strict_warnings" ]
configs = [ "$dir_pw_build:internal_strict_warnings_core" ]
configs = [
"$dir_pw_build:internal_strict_warnings_core",
"$dir_pw_bluetooth_sapphire/host:copts",
]

test_main = "$dir_pw_bluetooth_sapphire/host/testing:gtest_main"
}

pw_fuzzer("basic_mode_rx_engine_fuzzer") {
sources = [ "basic_mode_rx_engine_fuzztest.cc" ]
configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]
deps = [
":l2cap",
":testing",
Expand All @@ -225,6 +232,7 @@ pw_fuzzer("basic_mode_rx_engine_fuzzer") {

pw_fuzzer("enhanced_retransmission_mode_engines_fuzzer") {
sources = [ "enhanced_retransmission_mode_engines_fuzztest.cc" ]
configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]
deps = [
":l2cap",
":testing",
Expand All @@ -233,6 +241,7 @@ pw_fuzzer("enhanced_retransmission_mode_engines_fuzzer") {

pw_fuzzer("bredr_dynamic_channel_registry_fuzzer") {
sources = [ "bredr_dynamic_channel_registry_fuzztest.cc" ]
configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]
deps = [
":l2cap",
":testing",
Expand All @@ -242,6 +251,7 @@ pw_fuzzer("bredr_dynamic_channel_registry_fuzzer") {

pw_fuzzer("channel_configuration_fuzzer") {
sources = [ "channel_configuration_fuzztest.cc" ]
configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]
deps = [
":l2cap",
":testing",
Expand All @@ -250,6 +260,7 @@ pw_fuzzer("channel_configuration_fuzzer") {

pw_fuzzer("common_handler_fuzzer") {
sources = [ "common_handler_fuzztest.cc" ]
configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]
deps = [
":l2cap",
":testing",
Expand All @@ -258,6 +269,7 @@ pw_fuzzer("common_handler_fuzzer") {

pw_fuzzer("l2cap_fuzzer") {
sources = [ "l2cap_fuzztest.cc" ]
configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]
deps = [
":l2cap",
"$dir_pw_bluetooth_sapphire/host/testing",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ A2dpOffloadManager::Configuration BuildConfiguration(
android_emb::LdacBitrateIndex::LOW);
config.ldac_configuration.view().ldac_channel_mode().stereo().Write(true);
break;
default:
case android_emb::A2dpCodecType::APTX:
case android_emb::A2dpCodecType::APTX_HD:
break;
}

Expand Down
3 changes: 2 additions & 1 deletion pw_bluetooth_sapphire/host/l2cap/channel_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ A2dpOffloadManager::Configuration BuildConfiguration(
android_emb::LdacBitrateIndex::LOW);
config.ldac_configuration.view().ldac_channel_mode().stereo().Write(true);
break;
default:
case android_emb::A2dpCodecType::APTX:
case android_emb::A2dpCodecType::APTX_HD:
break;
}

Expand Down
8 changes: 6 additions & 2 deletions pw_bluetooth_sapphire/host/l2cap/test_packets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ DynamicByteBuffer AclConfigReq(l2cap::CommandId id,
0x00,
LowerBits(l2cap::kMaxInboundPduPayloadSize),
UpperBits(l2cap::kMaxInboundPduPayloadSize)));
default:
case l2cap::RetransmissionAndFlowControlMode::kRetransmission:
case l2cap::RetransmissionAndFlowControlMode::kFlowControl:
case l2cap::RetransmissionAndFlowControlMode::kStreaming:
BT_ASSERT_MSG(false, "unsupported mode");
}
}
Expand Down Expand Up @@ -369,7 +371,9 @@ DynamicByteBuffer AclConfigRsp(l2cap::CommandId id,
LowerBits(l2cap::kMaxInboundPduPayloadSize),
UpperBits(l2cap::kMaxInboundPduPayloadSize)));
}
default:
case l2cap::RetransmissionAndFlowControlMode::kRetransmission:
case l2cap::RetransmissionAndFlowControlMode::kFlowControl:
case l2cap::RetransmissionAndFlowControlMode::kStreaming:
BT_ASSERT_MSG(false, "unsupported mode");
}
}
Expand Down
6 changes: 3 additions & 3 deletions pw_bluetooth_sapphire/host/sm/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ cc_library(
"security_request_phase.cc",
"util.cc",
],
copts = COPTS,
deps = [
":definitions",
"//pw_bluetooth_sapphire:public",
Expand All @@ -65,9 +66,7 @@ cc_library(
srcs = [
"test_security_manager.cc",
],
copts = [
"-Wno-unused-parameter",
],
copts = COPTS,
deps = [
":sm",
"//pw_bluetooth_sapphire:public",
Expand All @@ -94,6 +93,7 @@ cc_library(
"types_test.cc",
"util_test.cc",
],
copts = COPTS,
tags = ["manual"],
visibility = ["//visibility:public"],
deps = [
Expand Down
13 changes: 11 additions & 2 deletions pw_bluetooth_sapphire/host/sm/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ pw_source_set("sm") {
]

remove_configs = [ "$dir_pw_build:internal_strict_warnings" ]
configs = [ "$dir_pw_build:internal_strict_warnings_core" ]
configs = [
"$dir_pw_build:internal_strict_warnings_core",
"$dir_pw_bluetooth_sapphire/host:copts",
]
}

pw_source_set("testing") {
Expand All @@ -104,7 +107,10 @@ pw_source_set("testing") {
deps = [ ":sm" ]

remove_configs = [ "$dir_pw_build:internal_strict_warnings" ]
configs = [ "$dir_pw_build:internal_strict_warnings_core" ]
configs = [
"$dir_pw_build:internal_strict_warnings_core",
"$dir_pw_bluetooth_sapphire/host:copts",
]
}

pw_test("sm_tests") {
Expand All @@ -126,6 +132,8 @@ pw_test("sm_tests") {
"util_test.cc",
]

configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]

deps = [
":sm",
":testing",
Expand All @@ -139,6 +147,7 @@ pw_test("sm_tests") {

pw_fuzzer("valid_packet_reader_fuzzer") {
sources = [ "valid_packet_reader_parse_sdu_fuzztest.cc" ]
configs = [ "$dir_pw_bluetooth_sapphire/host:copts" ]
deps = [ ":definitions" ]
}

Expand Down
Loading

0 comments on commit a99f4b8

Please sign in to comment.