diff options
author | 2024-10-08 19:16:24 +0000 | |
---|---|---|
committer | 2024-10-08 19:16:24 +0000 | |
commit | cc89dd93a131f7ae466ad9ddb6f5b6525a1e6e47 (patch) | |
tree | 68213e83cedfc35eab372bf84524f7480e6e66f0 | |
parent | a836b2cc17bb64b72be7092415fe56067677aa8e (diff) | |
parent | a0950e32a21e15461a7ae9590cf4cee058fa3d7d (diff) |
Merge changes I450634af,Ifa12df68,I354095d1,Ib88a5957,I754d1bc2, ... into main
* changes:
BUILD.gn: Remove cflag -Wno-unused-parameter
system: Enforce -Wunused-parameter
system/osi/test/fuzzers: Enforce -Wunused-parameter
system/audio_bluetooth_hw/Android.bp: Enforce -Wunused-parameter
system/stack/test/fuzzers: Enforce -Wunused-parameter
system/bta/Android.bp: Enforce -Wunused-parameter
system/profile/avrcp/Android.bp: Enforce -Wunused-parameter
system/device/Android.bp: Enforce -Wunused-parameter
system/audio_hal_interface/Android.bp: Enforce -Wunused-parameter
system/osi/Android.bp: Enforce -Wunused-parameter
system/stack/Android.bp: Enforce -Wunused-parameter
system/gd/Android.bp: Enforce -Wunused-parameter
system/btif/Android.bp: Enforce -Wunused-parameter
145 files changed, 1300 insertions, 1259 deletions
diff --git a/system/audio_bluetooth_hw/Android.bp b/system/audio_bluetooth_hw/Android.bp index 8587c62e9d..fe53c511a2 100644 --- a/system/audio_bluetooth_hw/Android.bp +++ b/system/audio_bluetooth_hw/Android.bp @@ -50,7 +50,6 @@ cc_library_shared { "libbluetooth_audio_session", "libhidlbase", ], - cflags: ["-Wno-unused-parameter"], visibility: [ "//device/generic/goldfish/audio", ], diff --git a/system/audio_bluetooth_hw/audio_bluetooth_hw.cc b/system/audio_bluetooth_hw/audio_bluetooth_hw.cc index e752814d2a..15a7ddaf54 100644 --- a/system/audio_bluetooth_hw/audio_bluetooth_hw.cc +++ b/system/audio_bluetooth_hw/audio_bluetooth_hw.cc @@ -51,43 +51,49 @@ static int adev_set_parameters(struct audio_hw_device* dev, const char* kvpairs) return 0; } -static char* adev_get_parameters(const struct audio_hw_device* dev, const char* keys) { +static char* adev_get_parameters(const struct audio_hw_device* /*dev*/, const char* keys) { LOG(VERBOSE) << __func__ << ": keys=[" << keys << "]"; return strdup(""); } -static int adev_init_check(const struct audio_hw_device* dev) { return 0; } +static int adev_init_check(const struct audio_hw_device* /*dev*/) { return 0; } -static int adev_set_voice_volume(struct audio_hw_device* dev, float volume) { +static int adev_set_voice_volume(struct audio_hw_device* /*dev*/, float volume) { LOG(VERBOSE) << __func__ << ": volume=" << volume; return -ENOSYS; } -static int adev_set_master_volume(struct audio_hw_device* dev, float volume) { +static int adev_set_master_volume(struct audio_hw_device* /*dev*/, float volume) { LOG(VERBOSE) << __func__ << ": volume=" << volume; return -ENOSYS; } -static int adev_get_master_volume(struct audio_hw_device* dev, float* volume) { return -ENOSYS; } +static int adev_get_master_volume(struct audio_hw_device* /*dev*/, float* /*volume*/) { + return -ENOSYS; +} -static int adev_set_master_mute(struct audio_hw_device* dev, bool muted) { +static int adev_set_master_mute(struct audio_hw_device* /*dev*/, bool muted) { LOG(VERBOSE) << __func__ << ": mute=" << muted; return -ENOSYS; } -static int adev_get_master_mute(struct audio_hw_device* dev, bool* muted) { return -ENOSYS; } +static int adev_get_master_mute(struct audio_hw_device* /*dev*/, bool* /*muted*/) { + return -ENOSYS; +} -static int adev_set_mode(struct audio_hw_device* dev, audio_mode_t mode) { +static int adev_set_mode(struct audio_hw_device* /*dev*/, audio_mode_t mode) { LOG(VERBOSE) << __func__ << ": mode=" << mode; return 0; } -static int adev_set_mic_mute(struct audio_hw_device* dev, bool state) { +static int adev_set_mic_mute(struct audio_hw_device* /*dev*/, bool state) { LOG(VERBOSE) << __func__ << ": state=" << state; return -ENOSYS; } -static int adev_get_mic_mute(const struct audio_hw_device* dev, bool* state) { return -ENOSYS; } +static int adev_get_mic_mute(const struct audio_hw_device* /*dev*/, bool* /*state*/) { + return -ENOSYS; +} static int adev_create_audio_patch(struct audio_hw_device* device, unsigned int num_sources, const struct audio_port_config* sources, unsigned int num_sinks, @@ -145,7 +151,7 @@ static int adev_get_audio_port(struct audio_hw_device* device, struct audio_port return -ENOSYS; } -static int adev_dump(const audio_hw_device_t* device, int fd) { return 0; } +static int adev_dump(const audio_hw_device_t* /*device*/, int /*fd*/) { return 0; } static int adev_close(hw_device_t* device) { auto* bluetooth_device = reinterpret_cast<BluetoothAudioDevice*>(device); diff --git a/system/audio_bluetooth_hw/device_port_proxy.cc b/system/audio_bluetooth_hw/device_port_proxy.cc index 8f29654d1c..13d831f841 100644 --- a/system/audio_bluetooth_hw/device_port_proxy.cc +++ b/system/audio_bluetooth_hw/device_port_proxy.cc @@ -140,7 +140,7 @@ bool BluetoothAudioPortAidl::SetUp(audio_devices_t devices) { state_ = BluetoothStreamState::STANDBY; - auto control_result_cb = [port = this](uint16_t cookie, bool start_resp, + auto control_result_cb = [port = this](uint16_t cookie, bool /*start_resp*/, const BluetoothAudioStatus& status) { if (!port->in_use()) { LOG(ERROR) << "control_result_cb: BluetoothAudioPortAidl is not in use"; diff --git a/system/audio_bluetooth_hw/device_port_proxy.h b/system/audio_bluetooth_hw/device_port_proxy.h index 1409d33484..8466bdbaa7 100644 --- a/system/audio_bluetooth_hw/device_port_proxy.h +++ b/system/audio_bluetooth_hw/device_port_proxy.h @@ -101,16 +101,16 @@ public: /*** * Set the current BluetoothStreamState ***/ - virtual void SetState(BluetoothStreamState state) {} + virtual void SetState(BluetoothStreamState /*state*/) {} virtual bool IsA2dp() const { return false; } virtual bool IsLeAudio() const { return false; } - virtual bool GetPreferredDataIntervalUs(size_t* interval_us) const { return false; } + virtual bool GetPreferredDataIntervalUs(size_t* /*interval_us*/) const { return false; } - virtual size_t WriteData(const void* buffer, size_t bytes) const { return 0; } - virtual size_t ReadData(void* buffer, size_t bytes) const { return 0; } + virtual size_t WriteData(const void* /*buffer*/, size_t /*bytes*/) const { return 0; } + virtual size_t ReadData(void* /*buffer*/, size_t /*bytes*/) const { return 0; } }; namespace aidl { diff --git a/system/audio_bluetooth_hw/device_port_proxy_hidl.cc b/system/audio_bluetooth_hw/device_port_proxy_hidl.cc index 20bcb43bb9..92242c26ae 100644 --- a/system/audio_bluetooth_hw/device_port_proxy_hidl.cc +++ b/system/audio_bluetooth_hw/device_port_proxy_hidl.cc @@ -137,7 +137,7 @@ bool BluetoothAudioPortHidl::SetUp(audio_devices_t devices) { state_ = BluetoothStreamState::STANDBY; - auto control_result_cb = [port = this](uint16_t cookie, bool start_resp, + auto control_result_cb = [port = this](uint16_t cookie, bool /*start_resp*/, const BluetoothAudioStatusHidl& status) { if (!port->in_use()) { LOG(ERROR) << "control_result_cb: BluetoothAudioPort is not in use"; diff --git a/system/audio_bluetooth_hw/stream_apis.cc b/system/audio_bluetooth_hw/stream_apis.cc index cabcdcd607..7b96f5aa51 100644 --- a/system/audio_bluetooth_hw/stream_apis.cc +++ b/system/audio_bluetooth_hw/stream_apis.cc @@ -281,7 +281,7 @@ static int out_standby(struct audio_stream* stream) { return retval; } -static int out_dump(const struct audio_stream* stream, int fd) { +static int out_dump(const struct audio_stream* stream, int /*fd*/) { const auto* out = reinterpret_cast<const BluetoothStreamOut*>(stream); LOG(VERBOSE) << __func__ << ": state=" << out->bluetooth_output_->GetState(); return 0; @@ -691,7 +691,7 @@ static void out_update_source_metadata_v7(struct audio_stream_out* stream, } } -int adev_open_output_stream(struct audio_hw_device* dev, audio_io_handle_t handle, +int adev_open_output_stream(struct audio_hw_device* dev, audio_io_handle_t /*handle*/, audio_devices_t devices, audio_output_flags_t flags, struct audio_config* config, struct audio_stream_out** stream_out, const char* address __unused) { @@ -811,8 +811,8 @@ void adev_close_output_stream(struct audio_hw_device* dev, struct audio_stream_o delete out; } -size_t adev_get_input_buffer_size(const struct audio_hw_device* dev, - const struct audio_config* config) { +size_t adev_get_input_buffer_size(const struct audio_hw_device* /*dev*/, + const struct audio_config* /*config*/) { /* TODO: Adjust this value */ LOG(VERBOSE) << __func__; return 320; @@ -931,7 +931,7 @@ static int in_standby(struct audio_stream* stream) { return retval; } -static int in_dump(const struct audio_stream* stream, int fd) { +static int in_dump(const struct audio_stream* stream, int /*fd*/) { const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream); LOG(VERBOSE) << __func__ << ": state=" << in->bluetooth_input_->GetState(); @@ -1004,7 +1004,7 @@ static int in_remove_audio_effect(const struct audio_stream* stream, effect_hand return 0; } -static int in_set_gain(struct audio_stream_in* stream, float gain) { +static int in_set_gain(struct audio_stream_in* stream, float /*gain*/) { const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream); LOG(VERBOSE) << __func__ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState(); @@ -1104,8 +1104,8 @@ static int in_stop(const struct audio_stream_in* stream) { return 0; } -static int in_create_mmap_buffer(const struct audio_stream_in* stream, int32_t min_size_frames, - struct audio_mmap_buffer_info* info) { +static int in_create_mmap_buffer(const struct audio_stream_in* stream, int32_t /*min_size_frames*/, + struct audio_mmap_buffer_info* /*info*/) { const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream); LOG(VERBOSE) << __func__ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState(); @@ -1113,7 +1113,7 @@ static int in_create_mmap_buffer(const struct audio_stream_in* stream, int32_t m } static int in_get_mmap_position(const struct audio_stream_in* stream, - struct audio_mmap_position* position) { + struct audio_mmap_position* /*position*/) { const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream); LOG(VERBOSE) << __func__ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState(); @@ -1121,8 +1121,8 @@ static int in_get_mmap_position(const struct audio_stream_in* stream, } static int in_get_active_microphones(const struct audio_stream_in* stream, - struct audio_microphone_characteristic_t* mic_array, - size_t* mic_count) { + struct audio_microphone_characteristic_t* /*mic_array*/, + size_t* /*mic_count*/) { const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream); LOG(VERBOSE) << __func__ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState(); @@ -1130,14 +1130,14 @@ static int in_get_active_microphones(const struct audio_stream_in* stream, } static int in_set_microphone_direction(const struct audio_stream_in* stream, - audio_microphone_direction_t direction) { + audio_microphone_direction_t /*direction*/) { const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream); LOG(VERBOSE) << __func__ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState(); return -ENOSYS; } -static int in_set_microphone_field_dimension(const struct audio_stream_in* stream, float zoom) { +static int in_set_microphone_field_dimension(const struct audio_stream_in* stream, float /*zoom*/) { const auto* in = reinterpret_cast<const BluetoothStreamIn*>(stream); LOG(VERBOSE) << __func__ << ": NOT HANDLED! state=" << in->bluetooth_input_->GetState(); @@ -1164,7 +1164,7 @@ static void in_update_sink_metadata_v7(struct audio_stream_in* stream, ->UpdateSinkMetadata(sink_metadata); } -int adev_open_input_stream(struct audio_hw_device* dev, audio_io_handle_t handle, +int adev_open_input_stream(struct audio_hw_device* /*dev*/, audio_io_handle_t /*handle*/, audio_devices_t devices, struct audio_config* config, struct audio_stream_in** stream_in, audio_input_flags_t flags __unused, const char* address __unused, audio_source_t source __unused) { @@ -1246,7 +1246,7 @@ int adev_open_input_stream(struct audio_hw_device* dev, audio_io_handle_t handle return 0; } -void adev_close_input_stream(struct audio_hw_device* dev, struct audio_stream_in* stream) { +void adev_close_input_stream(struct audio_hw_device* /*dev*/, struct audio_stream_in* stream) { auto* in = reinterpret_cast<BluetoothStreamIn*>(stream); if (in->bluetooth_input_->GetState() != BluetoothStreamState::DISABLED) { diff --git a/system/audio_hal_interface/Android.bp b/system/audio_hal_interface/Android.bp index af82b6498c..1e5652c747 100644 --- a/system/audio_hal_interface/Android.bp +++ b/system/audio_hal_interface/Android.bp @@ -77,7 +77,6 @@ cc_library_static { }, host_supported: true, cflags: [ - "-Wno-unused-parameter", "-Wthread-safety", ], apex_available: [ @@ -140,7 +139,6 @@ cc_test { ], cflags: [ "-DUNIT_TESTS", - "-Wno-unused-parameter", ], host_supported: true, test_options: { @@ -381,6 +379,5 @@ cc_test { header_libs: ["libbluetooth_headers"], cflags: [ "-DBUILDCFG", - "-Wno-unused-parameter", ], } diff --git a/system/audio_hal_interface/a2dp_encoding_host.cc b/system/audio_hal_interface/a2dp_encoding_host.cc index 9ec22cbbdd..e9bb187339 100644 --- a/system/audio_hal_interface/a2dp_encoding_host.cc +++ b/system/audio_hal_interface/a2dp_encoding_host.cc @@ -216,8 +216,8 @@ void set_remote_delay(uint16_t delay_report) { remote_delay_report_ = delay_repo // Inform audio server about offloading codec; not used for now bool update_codec_offloading_capabilities( - const std::vector<btav_a2dp_codec_config_t>& framework_preference, - bool supports_a2dp_hw_offload_v2) { + const std::vector<btav_a2dp_codec_config_t>& /*framework_preference*/, + bool /*supports_a2dp_hw_offload_v2*/) { return false; } @@ -231,8 +231,8 @@ static BluetoothAudioPort null_audio_port; static BluetoothAudioPort const* bluetooth_audio_port = &null_audio_port; // Initialize BluetoothAudio HAL: openProvider -bool init(bluetooth::common::MessageLoopThread* message_loop, BluetoothAudioPort const* audio_port, - bool /*offload_enabled*/) { +bool init(bluetooth::common::MessageLoopThread* /*message_loop*/, + BluetoothAudioPort const* audio_port, bool /*offload_enabled*/) { a2dp_uipc = UIPC_Init(); total_bytes_read_ = 0; data_position_ = {}; @@ -273,7 +273,7 @@ void end_session() { a2dp_pending_cmd_ = A2DP_CTRL_CMD_NONE; } -void set_audio_low_latency_mode_allowed(bool allowed) {} +void set_audio_low_latency_mode_allowed(bool /*allowed*/) {} void ack_stream_started(BluetoothAudioStatus /*ack*/) { a2dp_pending_cmd_ = A2DP_CTRL_CMD_NONE; @@ -305,12 +305,12 @@ bool is_opus_supported() { return true; } namespace provider { // Lookup the codec info in the list of supported offloaded sink codecs. -std::optional<btav_a2dp_codec_index_t> sink_codec_index(const uint8_t* p_codec_info) { +std::optional<btav_a2dp_codec_index_t> sink_codec_index(const uint8_t* /*p_codec_info*/) { return std::nullopt; } // Lookup the codec info in the list of supported offloaded source codecs. -std::optional<btav_a2dp_codec_index_t> source_codec_index(const uint8_t* p_codec_info) { +std::optional<btav_a2dp_codec_index_t> source_codec_index(const uint8_t* /*p_codec_info*/) { return std::nullopt; } @@ -320,17 +320,17 @@ std::optional<btav_a2dp_codec_index_t> source_codec_index(const uint8_t* p_codec // BTAV_A2DP_CODEC_INDEX_SOURCE_EXT_MIN..BTAV_A2DP_CODEC_INDEX_SOURCE_EXT_MAX. // Returns nullopt if the codec_index is not assigned or codec extensibility // is not supported or enabled. -std::optional<const char*> codec_index_str(btav_a2dp_codec_index_t codec_index) { +std::optional<const char*> codec_index_str(btav_a2dp_codec_index_t /*codec_index*/) { return std::nullopt; } // Return true if the codec is supported for the session type // A2DP_HARDWARE_ENCODING_DATAPATH or A2DP_HARDWARE_DECODING_DATAPATH. -bool supports_codec(btav_a2dp_codec_index_t codec_index) { return false; } +bool supports_codec(btav_a2dp_codec_index_t /*codec_index*/) { return false; } // Return the A2DP capabilities for the selected codec. -bool codec_info(btav_a2dp_codec_index_t codec_index, uint64_t* codec_id, uint8_t* codec_info, - btav_a2dp_codec_config_t* codec_config) { +bool codec_info(btav_a2dp_codec_index_t /*codec_index*/, uint64_t* /*codec_id*/, + uint8_t* /*codec_info*/, btav_a2dp_codec_config_t* /*codec_config*/) { return false; } @@ -338,8 +338,8 @@ bool codec_info(btav_a2dp_codec_index_t codec_index, uint64_t* codec_id, uint8_t // The HAL is expected to pick the best audio configuration based on the // discovered remote SEPs. std::optional<a2dp_configuration> get_a2dp_configuration( - RawAddress peer_address, std::vector<a2dp_remote_capabilities> const& remote_seps, - btav_a2dp_codec_config_t const& user_preferences) { + RawAddress /*peer_address*/, std::vector<a2dp_remote_capabilities> const& /*remote_seps*/, + btav_a2dp_codec_config_t const& /*user_preferences*/) { return std::nullopt; } @@ -350,10 +350,10 @@ std::optional<a2dp_configuration> get_a2dp_configuration( // In case any of these checks fails, the corresponding A2DP // status is returned. If the configuration is valid and supported, // A2DP_OK is returned. -tA2DP_STATUS parse_a2dp_configuration(btav_a2dp_codec_index_t codec_index, - const uint8_t* codec_info, - btav_a2dp_codec_config_t* codec_parameters, - std::vector<uint8_t>* vendor_specific_parameters) { +tA2DP_STATUS parse_a2dp_configuration(btav_a2dp_codec_index_t /*codec_index*/, + const uint8_t* /*codec_info*/, + btav_a2dp_codec_config_t* /*codec_parameters*/, + std::vector<uint8_t>* /*vendor_specific_parameters*/) { return A2DP_FAIL; } diff --git a/system/audio_hal_interface/aidl/hearing_aid_software_encoding_aidl.cc b/system/audio_hal_interface/aidl/hearing_aid_software_encoding_aidl.cc index d3bc52f93c..64f4d3d6e4 100644 --- a/system/audio_hal_interface/aidl/hearing_aid_software_encoding_aidl.cc +++ b/system/audio_hal_interface/aidl/hearing_aid_software_encoding_aidl.cc @@ -55,7 +55,7 @@ public: total_bytes_read_(0), data_position_({}) {} - BluetoothAudioCtrlAck StartRequest(bool is_low_latency) override { + BluetoothAudioCtrlAck StartRequest(bool /*is_low_latency*/) override { log::info(""); if (stream_cb_.on_resume_(true)) { return BluetoothAudioCtrlAck::SUCCESS_FINISHED; @@ -83,7 +83,7 @@ public: } } - void SetLatencyMode(LatencyMode latency_mode) override {} + void SetLatencyMode(LatencyMode /*latency_mode*/) override {} bool GetPresentationPosition(uint64_t* remote_delay_report_ns, uint64_t* total_bytes_read, timespec* data_position) override { diff --git a/system/audio_hal_interface/aidl/hfp_client_interface_aidl.cc b/system/audio_hal_interface/aidl/hfp_client_interface_aidl.cc index b35cda1746..c1a72fa0f2 100644 --- a/system/audio_hal_interface/aidl/hfp_client_interface_aidl.cc +++ b/system/audio_hal_interface/aidl/hfp_client_interface_aidl.cc @@ -176,7 +176,7 @@ void HfpTransport::ResetPendingCmd() { hfp_pending_cmd_ = HFP_CTRL_CMD_NONE; } uint8_t HfpTransport::GetPendingCmd() const { return hfp_pending_cmd_; } // Unimplemented functions -void HfpTransport::LogBytesProcessed(size_t bytes_read) {} +void HfpTransport::LogBytesProcessed(size_t /*bytes_read*/) {} BluetoothAudioCtrlAck HfpTransport::SuspendRequest() { log::info("handling"); @@ -209,16 +209,17 @@ BluetoothAudioCtrlAck HfpTransport::SuspendRequest() { } } -void HfpTransport::SetLatencyMode(LatencyMode latency_mode) {} +void HfpTransport::SetLatencyMode(LatencyMode /*latency_mode*/) {} -void HfpTransport::SourceMetadataChanged(const source_metadata_v7_t& source_metadata) {} +void HfpTransport::SourceMetadataChanged(const source_metadata_v7_t& /*source_metadata*/) {} void HfpTransport::SinkMetadataChanged(const sink_metadata_v7_t&) {} void HfpTransport::ResetPresentationPosition() {} -bool HfpTransport::GetPresentationPosition(uint64_t* remote_delay_report_ns, - uint64_t* total_bytes_read, timespec* data_position) { +bool HfpTransport::GetPresentationPosition(uint64_t* /*remote_delay_report_ns*/, + uint64_t* /*total_bytes_read*/, + timespec* /*data_position*/) { return false; } @@ -230,7 +231,7 @@ HfpDecodingTransport::HfpDecodingTransport(SessionType session_type) HfpDecodingTransport::~HfpDecodingTransport() { delete transport_; } -BluetoothAudioCtrlAck HfpDecodingTransport::StartRequest(bool is_low_latency) { +BluetoothAudioCtrlAck HfpDecodingTransport::StartRequest(bool /*is_low_latency*/) { return transport_->StartRequest(); } @@ -285,7 +286,7 @@ HfpEncodingTransport::HfpEncodingTransport(SessionType session_type) HfpEncodingTransport::~HfpEncodingTransport() { delete transport_; } -BluetoothAudioCtrlAck HfpEncodingTransport::StartRequest(bool is_low_latency) { +BluetoothAudioCtrlAck HfpEncodingTransport::StartRequest(bool /*is_low_latency*/) { return transport_->StartRequest(); } diff --git a/system/audio_hal_interface/hearing_aid_software_encoding_host.cc b/system/audio_hal_interface/hearing_aid_software_encoding_host.cc index a085b650d7..b56f1f689c 100644 --- a/system/audio_hal_interface/hearing_aid_software_encoding_host.cc +++ b/system/audio_hal_interface/hearing_aid_software_encoding_host.cc @@ -22,7 +22,7 @@ namespace hearing_aid { bool is_hal_enabled() { return false; } -bool init(StreamCallbacks stream_cb, bluetooth::common::MessageLoopThread* message_loop) { +bool init(StreamCallbacks /*stream_cb*/, bluetooth::common::MessageLoopThread* /*message_loop*/) { return false; } @@ -32,9 +32,9 @@ void start_session() {} void end_session() {} -size_t read(uint8_t* p_buf, uint32_t len) { return 0; } +size_t read(uint8_t* /*p_buf*/, uint32_t /*len*/) { return 0; } -void set_remote_delay(uint16_t delay_report_ms) {} +void set_remote_delay(uint16_t /*delay_report_ms*/) {} } // namespace hearing_aid } // namespace audio diff --git a/system/audio_hal_interface/hfp_client_interface.cc b/system/audio_hal_interface/hfp_client_interface.cc index 9a61e6722b..22e6b99373 100644 --- a/system/audio_hal_interface/hfp_client_interface.cc +++ b/system/audio_hal_interface/hfp_client_interface.cc @@ -168,7 +168,7 @@ void HfpClientInterface::Decode::StopSession() { } void HfpClientInterface::Decode::UpdateAudioConfigToHal( - const ::hfp::offload_config& offload_config) { + const ::hfp::offload_config& /*offload_config*/) { log::warn( "'UpdateAudioConfigToHal(offload_config)' should not be called on " "HfpClientInterface::Decode"); @@ -335,7 +335,7 @@ void HfpClientInterface::Encode::StopSession() { } void HfpClientInterface::Encode::UpdateAudioConfigToHal( - const ::hfp::offload_config& offload_config) { + const ::hfp::offload_config& /*offload_config*/) { log::warn( "'UpdateAudioConfigToHal(offload_config)' should not be called on " "HfpClientInterface::Encode"); @@ -519,7 +519,7 @@ void HfpClientInterface::Offload::UpdateAudioConfigToHal( offload_config_to_hal_audio_config(offload_config)); } -void HfpClientInterface::Offload::UpdateAudioConfigToHal(const ::hfp::pcm_config& pcm_config) { +void HfpClientInterface::Offload::UpdateAudioConfigToHal(const ::hfp::pcm_config& /*pcm_config*/) { log::warn( "'UpdateAudioConfigToHal(pcm_config)' should not be called on " "HfpClientInterface::Offload"); diff --git a/system/audio_hal_interface/hfp_client_interface_host.cc b/system/audio_hal_interface/hfp_client_interface_host.cc index c48822065d..6a552ac1de 100644 --- a/system/audio_hal_interface/hfp_client_interface_host.cc +++ b/system/audio_hal_interface/hfp_client_interface_host.cc @@ -21,25 +21,25 @@ namespace audio { namespace hfp { HfpClientInterface::Decode* HfpClientInterface::GetDecode( - bluetooth::common::MessageLoopThread* message_loop) { + bluetooth::common::MessageLoopThread* /*message_loop*/) { return nullptr; } -bool HfpClientInterface::ReleaseDecode(HfpClientInterface::Decode* decode) { return false; } +bool HfpClientInterface::ReleaseDecode(HfpClientInterface::Decode* /*decode*/) { return false; } HfpClientInterface::Encode* HfpClientInterface::GetEncode( - bluetooth::common::MessageLoopThread* message_loop) { + bluetooth::common::MessageLoopThread* /*message_loop*/) { return nullptr; } -bool HfpClientInterface::ReleaseEncode(HfpClientInterface::Encode* encode) { return false; } +bool HfpClientInterface::ReleaseEncode(HfpClientInterface::Encode* /*encode*/) { return false; } HfpClientInterface::Offload* HfpClientInterface::GetOffload( - bluetooth::common::MessageLoopThread* message_loop) { + bluetooth::common::MessageLoopThread* /*message_loop*/) { return nullptr; } -bool HfpClientInterface::ReleaseOffload(HfpClientInterface::Offload* offload) { return false; } +bool HfpClientInterface::ReleaseOffload(HfpClientInterface::Offload* /*offload*/) { return false; } HfpClientInterface* HfpClientInterface::Get() { return nullptr; } @@ -48,9 +48,9 @@ HfpClientInterface::Offload::GetHfpScoConfig() { return std::unordered_map<tBTA_AG_UUID_CODEC, ::hfp::sco_config>(); } -size_t HfpClientInterface::Encode::Read(uint8_t* p_buf, uint32_t len) { return 0; } +size_t HfpClientInterface::Encode::Read(uint8_t* /*p_buf*/, uint32_t /*len*/) { return 0; } -size_t HfpClientInterface::Decode::Write(const uint8_t* p_buf, uint32_t len) { return 0; } +size_t HfpClientInterface::Decode::Write(const uint8_t* /*p_buf*/, uint32_t /*len*/) { return 0; } } // namespace hfp } // namespace audio } // namespace bluetooth diff --git a/system/audio_hal_interface/hfp_client_interface_unittest.cc b/system/audio_hal_interface/hfp_client_interface_unittest.cc index 64f31265bc..1668792080 100644 --- a/system/audio_hal_interface/hfp_client_interface_unittest.cc +++ b/system/audio_hal_interface/hfp_client_interface_unittest.cc @@ -63,7 +63,7 @@ BluetoothAudioSinkClientInterface::BluetoothAudioSinkClientInterface( : BluetoothAudioClientInterface{sink}, sink_(sink) {} BluetoothAudioSinkClientInterface::~BluetoothAudioSinkClientInterface() {} -size_t BluetoothAudioSinkClientInterface::ReadAudioData(uint8_t* p_buf, uint32_t len) { +size_t BluetoothAudioSinkClientInterface::ReadAudioData(uint8_t* /*p_buf*/, uint32_t len) { sink_client_read_called = true; return len; } @@ -73,33 +73,34 @@ BluetoothAudioSourceClientInterface::BluetoothAudioSourceClientInterface( : BluetoothAudioClientInterface{source}, source_(source) {} BluetoothAudioSourceClientInterface::~BluetoothAudioSourceClientInterface() {} -size_t BluetoothAudioSourceClientInterface::WriteAudioData(const uint8_t* p_buf, uint32_t len) { +size_t BluetoothAudioSourceClientInterface::WriteAudioData(const uint8_t* /*p_buf*/, uint32_t len) { source_client_write_called = true; return len; } bool BluetoothAudioClientInterface::IsValid() const { return true; } -bool BluetoothAudioClientInterface::SetAllowedLatencyModes(std::vector<LatencyMode> latency_modes) { +bool BluetoothAudioClientInterface::SetAllowedLatencyModes( + std::vector<LatencyMode> /*latency_modes*/) { return false; } void BluetoothAudioClientInterface::FlushAudioData() {} -bool BluetoothAudioClientInterface::UpdateAudioConfig(const AudioConfiguration& audio_config) { +bool BluetoothAudioClientInterface::UpdateAudioConfig(const AudioConfiguration& /*audio_config*/) { return false; } int BluetoothAudioClientInterface::StartSession() { return -EINVAL; } -void BluetoothAudioClientInterface::StreamStarted(const BluetoothAudioCtrlAck& ack) {} +void BluetoothAudioClientInterface::StreamStarted(const BluetoothAudioCtrlAck& /*ack*/) {} int BluetoothAudioClientInterface::EndSession() { return -EINVAL; } -void BluetoothAudioClientInterface::StreamSuspended(const BluetoothAudioCtrlAck& ack) {} +void BluetoothAudioClientInterface::StreamSuspended(const BluetoothAudioCtrlAck& /*ack*/) {} std::vector<AudioCapabilities> BluetoothAudioClientInterface::GetAudioCapabilities( - SessionType session_type) { + SessionType /*session_type*/) { return std::vector<AudioCapabilities>(0); } @@ -107,11 +108,11 @@ std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting> BluetoothAudioClientInterface::GetLeAudioAseConfiguration( std::optional< std::vector<std::optional<IBluetoothAudioProvider::LeAudioDeviceCapabilities>>>& - remoteSinkAudioCapabilities, + /*remoteSinkAudioCapabilities*/, std::optional< std::vector<std::optional<IBluetoothAudioProvider::LeAudioDeviceCapabilities>>>& - remoteSourceAudioCapabilities, - std::vector<IBluetoothAudioProvider::LeAudioConfigurationRequirement>& requirements) { + /*remoteSourceAudioCapabilities*/, + std::vector<IBluetoothAudioProvider::LeAudioConfigurationRequirement>& /*requirements*/) { return std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>(); } @@ -119,12 +120,12 @@ IBluetoothAudioProvider::LeAudioBroadcastConfigurationSetting BluetoothAudioClientInterface::getLeAudioBroadcastConfiguration( const std::optional< std::vector<std::optional<IBluetoothAudioProvider::LeAudioDeviceCapabilities>>>& - remoteSinkAudioCapabilities, - const IBluetoothAudioProvider::LeAudioBroadcastConfigurationRequirement& requirement) { + /*remoteSinkAudioCapabilities*/, + const IBluetoothAudioProvider::LeAudioBroadcastConfigurationRequirement& /*requirement*/) { return IBluetoothAudioProvider::LeAudioBroadcastConfigurationSetting(); } -std::ostream& operator<<(std::ostream& os, const BluetoothAudioCtrlAck& ack) { return os; } +std::ostream& operator<<(std::ostream& os, const BluetoothAudioCtrlAck& /*ack*/) { return os; } namespace hfp { @@ -138,21 +139,22 @@ BluetoothAudioCtrlAck HfpTransport::StartRequest() { void HfpTransport::StopRequest() {} void HfpTransport::ResetPendingCmd() {} uint8_t HfpTransport::GetPendingCmd() const { return HFP_CTRL_CMD_NONE; } -void HfpTransport::LogBytesProcessed(size_t bytes_read) {} +void HfpTransport::LogBytesProcessed(size_t /*bytes_read*/) {} BluetoothAudioCtrlAck HfpTransport::SuspendRequest() { return BluetoothAudioCtrlAck::SUCCESS_FINISHED; } -void HfpTransport::SetLatencyMode(LatencyMode latency_mode) {} -void HfpTransport::SourceMetadataChanged(const source_metadata_v7_t& source_metadata) {} +void HfpTransport::SetLatencyMode(LatencyMode /*latency_mode*/) {} +void HfpTransport::SourceMetadataChanged(const source_metadata_v7_t& /*source_metadata*/) {} void HfpTransport::SinkMetadataChanged(const sink_metadata_v7_t&) {} void HfpTransport::ResetPresentationPosition() {} -bool HfpTransport::GetPresentationPosition(uint64_t* remote_delay_report_ns, - uint64_t* total_bytes_read, timespec* data_position) { +bool HfpTransport::GetPresentationPosition(uint64_t* /*remote_delay_report_ns*/, + uint64_t* /*total_bytes_read*/, + timespec* /*data_position*/) { return false; } std::unordered_map<tBTA_AG_UUID_CODEC, ::hfp::sco_config> HfpTransport::GetHfpScoConfig( - SessionType sessionType) { + SessionType /*sessionType*/) { return std::unordered_map<tBTA_AG_UUID_CODEC, ::hfp::sco_config>{}; } @@ -161,22 +163,22 @@ HfpDecodingTransport::HfpDecodingTransport(SessionType session_type) : IBluetoothSourceTransportInstance(session_type, (AudioConfiguration){}) {} HfpDecodingTransport::~HfpDecodingTransport() {} -BluetoothAudioCtrlAck HfpDecodingTransport::StartRequest(bool is_low_latency) { +BluetoothAudioCtrlAck HfpDecodingTransport::StartRequest(bool /*is_low_latency*/) { return BluetoothAudioCtrlAck::SUCCESS_FINISHED; } BluetoothAudioCtrlAck HfpDecodingTransport::SuspendRequest() { return BluetoothAudioCtrlAck::SUCCESS_FINISHED; } -void HfpDecodingTransport::SetLatencyMode(LatencyMode latency_mode) {} -bool HfpDecodingTransport::GetPresentationPosition(uint64_t* remote_delay_report_ns, - uint64_t* total_bytes_written, - timespec* data_position) { +void HfpDecodingTransport::SetLatencyMode(LatencyMode /*latency_mode*/) {} +bool HfpDecodingTransport::GetPresentationPosition(uint64_t* /*remote_delay_report_ns*/, + uint64_t* /*total_bytes_written*/, + timespec* /*data_position*/) { return false; } -void HfpDecodingTransport::SourceMetadataChanged(const source_metadata_v7_t& source_metadata) {} -void HfpDecodingTransport::SinkMetadataChanged(const sink_metadata_v7_t& sink_metadata) {} +void HfpDecodingTransport::SourceMetadataChanged(const source_metadata_v7_t& /*source_metadata*/) {} +void HfpDecodingTransport::SinkMetadataChanged(const sink_metadata_v7_t& /*sink_metadata*/) {} void HfpDecodingTransport::ResetPresentationPosition() {} -void HfpDecodingTransport::LogBytesWritten(size_t bytes_written) {} +void HfpDecodingTransport::LogBytesWritten(size_t /*bytes_written*/) {} uint8_t HfpDecodingTransport::GetPendingCmd() const { return HFP_CTRL_CMD_NONE; } void HfpDecodingTransport::ResetPendingCmd() {} void HfpDecodingTransport::StopRequest() {} @@ -185,24 +187,24 @@ bool HfpDecodingTransport::IsStreamActive() { return decoding_transport_is_strea HfpEncodingTransport::HfpEncodingTransport(SessionType session_type) : IBluetoothSinkTransportInstance(session_type, (AudioConfiguration){}) {} HfpEncodingTransport::~HfpEncodingTransport() {} -BluetoothAudioCtrlAck HfpEncodingTransport::StartRequest(bool is_low_latency) { +BluetoothAudioCtrlAck HfpEncodingTransport::StartRequest(bool /*is_low_latency*/) { return BluetoothAudioCtrlAck::SUCCESS_FINISHED; } BluetoothAudioCtrlAck HfpEncodingTransport::SuspendRequest() { return BluetoothAudioCtrlAck::SUCCESS_FINISHED; } void HfpEncodingTransport::StopRequest() {} -void HfpEncodingTransport::SetLatencyMode(LatencyMode latency_mode) {} -bool HfpEncodingTransport::GetPresentationPosition(uint64_t* remote_delay_report_ns, - uint64_t* total_bytes_written, - timespec* data_position) { +void HfpEncodingTransport::SetLatencyMode(LatencyMode /*latency_mode*/) {} +bool HfpEncodingTransport::GetPresentationPosition(uint64_t* /*remote_delay_report_ns*/, + uint64_t* /*total_bytes_written*/, + timespec* /*data_position*/) { return false; } -void HfpEncodingTransport::SourceMetadataChanged(const source_metadata_v7_t& source_metadata) {} -void HfpEncodingTransport::SinkMetadataChanged(const sink_metadata_v7_t& sink_metadata) {} +void HfpEncodingTransport::SourceMetadataChanged(const source_metadata_v7_t& /*source_metadata*/) {} +void HfpEncodingTransport::SinkMetadataChanged(const sink_metadata_v7_t& /*sink_metadata*/) {} void HfpEncodingTransport::ResetPresentationPosition() {} -void HfpEncodingTransport::LogBytesRead(size_t bytes_written) {} +void HfpEncodingTransport::LogBytesRead(size_t /*bytes_written*/) {} uint8_t HfpEncodingTransport::GetPendingCmd() const { return HFP_CTRL_CMD_NONE; } void HfpEncodingTransport::ResetPendingCmd() {} bool HfpEncodingTransport::IsStreamActive() { return encoding_transport_is_stream_active_ret; } diff --git a/system/audio_hal_interface/le_audio_software_host.cc b/system/audio_hal_interface/le_audio_software_host.cc index cc8e561bfa..28f2592a6c 100644 --- a/system/audio_hal_interface/le_audio_software_host.cc +++ b/system/audio_hal_interface/le_audio_software_host.cc @@ -305,10 +305,10 @@ void LeAudioClientInterface::Sink::CancelStreamingRequest() { } void LeAudioClientInterface::Sink::UpdateAudioConfigToHal( - const ::le_audio::offload_config& offload_config) {} + const ::le_audio::offload_config& /*offload_config*/) {} void LeAudioClientInterface::Sink::UpdateBroadcastAudioConfigToHal( - ::le_audio::broadcast_offload_config const& config) {} + ::le_audio::broadcast_offload_config const& /*config*/) {} void LeAudioClientInterface::Sink::SuspendedForReconfiguration() { log::info(""); @@ -329,16 +329,17 @@ size_t LeAudioClientInterface::Sink::Read(uint8_t* p_buf, uint32_t len) { std::optional<::bluetooth::le_audio::set_configurations::AudioSetConfiguration> LeAudioClientInterface::Sink::GetUnicastConfig( - const ::bluetooth::le_audio::CodecManager::UnicastConfigurationRequirements& requirements) - const { + const ::bluetooth::le_audio::CodecManager:: + UnicastConfigurationRequirements& /*requirements*/) const { return std::nullopt; } std::optional<::bluetooth::le_audio::broadcaster::BroadcastConfiguration> LeAudioClientInterface::Sink::GetBroadcastConfig( - const std::vector<std::pair<::bluetooth::le_audio::types::LeAudioContextType, uint8_t>>& - subgroup_quality, - const std::optional<std::vector<::bluetooth::le_audio::types::acs_ac_record>>& pacs) const { + const std::vector<std::pair<::bluetooth::le_audio::types::LeAudioContextType, + uint8_t>>& /*subgroup_quality*/, + const std::optional<std::vector<::bluetooth::le_audio::types::acs_ac_record>>& /*pacs*/) + const { return std::nullopt; } @@ -456,7 +457,7 @@ void LeAudioClientInterface::Source::CancelStreamingRequest() { } void LeAudioClientInterface::Source::UpdateAudioConfigToHal( - const ::le_audio::offload_config& offload_config) {} + const ::le_audio::offload_config& /*offload_config*/) {} void LeAudioClientInterface::Source::SuspendedForReconfiguration() { log::info(""); @@ -471,7 +472,7 @@ size_t LeAudioClientInterface::Source::Write(const uint8_t* p_buf, uint32_t len) } LeAudioClientInterface::Sink* LeAudioClientInterface::GetSink( - StreamCallbacks stream_cb, bluetooth::common::MessageLoopThread* message_loop, + StreamCallbacks stream_cb, bluetooth::common::MessageLoopThread* /*message_loop*/, bool is_broadcasting_session_type) { if (is_broadcasting_session_type && !LeAudioHalVerifier::SupportsLeAudioBroadcast()) { log::warn("No support for broadcasting Le Audio"); @@ -517,7 +518,7 @@ bool LeAudioClientInterface::ReleaseSink(LeAudioClientInterface::Sink* sink) { } LeAudioClientInterface::Source* LeAudioClientInterface::GetSource( - StreamCallbacks stream_cb, bluetooth::common::MessageLoopThread* message_loop) { + StreamCallbacks stream_cb, bluetooth::common::MessageLoopThread* /*message_loop*/) { if (source_ == nullptr) { source_ = new Source(); } else { @@ -567,7 +568,7 @@ LeAudioClientInterface* LeAudioClientInterface::Get() { return LeAudioClientInterface::interface; } -void LeAudioClientInterface::SetAllowedDsaModes(DsaModes dsa_modes) { return; } +void LeAudioClientInterface::SetAllowedDsaModes(DsaModes /*dsa_modes*/) { return; } } // namespace le_audio } // namespace audio diff --git a/system/audio_hal_interface/le_audio_software_host_transport.cc b/system/audio_hal_interface/le_audio_software_host_transport.cc index e3eb36a06a..16796ec303 100644 --- a/system/audio_hal_interface/le_audio_software_host_transport.cc +++ b/system/audio_hal_interface/le_audio_software_host_transport.cc @@ -267,7 +267,8 @@ bool LeAudioSourceTransport::GetPresentationPosition(uint64_t* remote_delay_repo data_position); } -void LeAudioSourceTransport::SourceMetadataChanged(const source_metadata_v7_t& source_metadata) {} +void LeAudioSourceTransport::SourceMetadataChanged( + const source_metadata_v7_t& /*source_metadata*/) {} void LeAudioSourceTransport::SinkMetadataChanged(const sink_metadata_v7_t& sink_metadata) { transport_->SinkMetadataChanged(sink_metadata); diff --git a/system/bta/Android.bp b/system/bta/Android.bp index 319b5dbbf2..271b008ca0 100644 --- a/system/bta/Android.bp +++ b/system/bta/Android.bp @@ -133,7 +133,6 @@ cc_library_static { "vc/vc.cc", ], cflags: [ - "-Wno-unused-parameter", /* we export all classes, so change default visibility, instead of having EXPORT_SYMBOL on each class*/ "-fvisibility=default", ], @@ -204,7 +203,6 @@ cc_library_static { "sys/utl.cc", ], cflags: [ - "-Wno-unused-parameter", /* we export all classes, so change default visibility, instead of having EXPORT_SYMBOL on each class*/ "-fvisibility=default", ], @@ -333,7 +331,6 @@ cc_test { ], cflags: [ "-Wno-macro-redefined", - "-Wno-unused-parameter", ], target: { android: { @@ -399,7 +396,6 @@ cc_test { "libcom.android.sysprop.bluetooth.wrapped", "libgmock", ], - cflags: ["-Wno-unused-parameter"], } // bta unit tests for target @@ -448,7 +444,6 @@ cc_test { "libosi", "libstatslog_bt", ], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -513,7 +508,6 @@ cc_test { ], }, }, - cflags: ["-Wno-unused-parameter"], } // csis unit tests for host @@ -576,7 +570,6 @@ cc_test { undefined: true, }, }, - cflags: ["-Wno-unused-parameter"], } // groups unit tests for host @@ -623,7 +616,6 @@ cc_test { undefined: true, }, }, - cflags: ["-Wno-unused-parameter"], } // bta unit tests for host @@ -676,7 +668,6 @@ cc_test { sanitize: { cfi: false, }, - cflags: ["-Wno-unused-parameter"], } genrule { @@ -835,7 +826,6 @@ cc_test { cfi: false, }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -945,7 +935,6 @@ cc_test { cfi: false, }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -1064,7 +1053,6 @@ cc_test { undefined: true, }, }, - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -1131,7 +1119,6 @@ cc_test { undefined: true, }, }, - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -1209,7 +1196,6 @@ cc_test { undefined: true, }, }, - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -1270,7 +1256,6 @@ cc_test { undefined: true, }, }, - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -1349,7 +1334,6 @@ cc_test { undefined: true, }, }, - cflags: ["-Wno-unused-parameter"], } cc_test { diff --git a/system/bta/ag/bta_ag_act.cc b/system/bta/ag/bta_ag_act.cc index 716ca77186..32b19fc970 100644 --- a/system/bta/ag/bta_ag_act.cc +++ b/system/bta/ag/bta_ag_act.cc @@ -145,7 +145,7 @@ void bta_ag_register(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { * Returns void * ******************************************************************************/ -void bta_ag_deregister(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { +void bta_ag_deregister(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& /*data*/) { /* set dealloc */ p_scb->dealloc = true; @@ -169,7 +169,7 @@ void bta_ag_deregister(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { * Returns void * ******************************************************************************/ -void bta_ag_start_dereg(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { +void bta_ag_start_dereg(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& /*data*/) { /* set dealloc */ p_scb->dealloc = true; diff --git a/system/bta/ag/bta_ag_cmd.cc b/system/bta/ag/bta_ag_cmd.cc index 31c978c9fe..27ff562fb4 100644 --- a/system/bta/ag/bta_ag_cmd.cc +++ b/system/bta/ag/bta_ag_cmd.cc @@ -456,7 +456,7 @@ static uint8_t bta_ag_parse_chld(tBTA_AG_SCB* /* p_scb */, char* p_s) { * Returns Returns bitmap of supported codecs. * ******************************************************************************/ -static tBTA_AG_PEER_CODEC bta_ag_parse_bac(tBTA_AG_SCB* p_scb, char* p_s, char* p_end) { +static tBTA_AG_PEER_CODEC bta_ag_parse_bac(tBTA_AG_SCB* /*p_scb*/, char* p_s, char* p_end) { tBTA_AG_PEER_CODEC retval = BTM_SCO_CODEC_NONE; tBTA_AG_UUID_CODEC uuid_codec; char* p; @@ -1891,7 +1891,8 @@ void bta_ag_send_bcs(tBTA_AG_SCB* p_scb) { * Returns true if we can, false if not * ******************************************************************************/ -bool bta_ag_is_sco_open_allowed(tBTA_AG_SCB* p_scb, const std::string event) { +bool bta_ag_is_sco_open_allowed([[maybe_unused]] tBTA_AG_SCB* p_scb, + [[maybe_unused]] const std::string event) { #ifdef __ANDROID__ /* Do not open SCO if 1. the dual mode audio system property is enabled, 2. LEA is active, and 3. LEA is preferred for DUPLEX */ @@ -1952,7 +1953,7 @@ void bta_ag_send_ring(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& /* data */) { * Returns void * ******************************************************************************/ -void bta_ag_send_qcs(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { +void bta_ag_send_qcs(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* /*p_data*/) { tBTA_AG_UUID_CODEC codec_uuid; if (p_scb->codec_fallback) { if (p_scb->peer_codecs & BTM_SCO_CODEC_MSBC) { @@ -1977,7 +1978,7 @@ void bta_ag_send_qcs(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { * Returns void * ******************************************************************************/ -void bta_ag_send_qac(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { +void bta_ag_send_qac(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* /*p_data*/) { if (!get_swb_codec_status(bluetooth::headset::BTHF_SWB_CODEC_VENDOR_APTX, &p_scb->peer_addr)) { log::verbose("send +QAC codecs unsupported"); bta_ag_send_result(p_scb, BTA_AG_LOCAL_RES_QAC, SWB_CODECS_UNSUPPORTED, 0); diff --git a/system/bta/ag/bta_ag_sco.cc b/system/bta/ag/bta_ag_sco.cc index eb858adcc9..4a7a58393a 100644 --- a/system/bta/ag/bta_ag_sco.cc +++ b/system/bta/ag/bta_ag_sco.cc @@ -1555,7 +1555,7 @@ void bta_ag_sco_conn_close(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& /* data */) { * Returns void * ******************************************************************************/ -void bta_ag_sco_conn_rsp(tBTA_AG_SCB* p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA* p_data) { +void bta_ag_sco_conn_rsp(tBTA_AG_SCB* p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA* /*p_data*/) { bta_ag_cb.sco.is_local = false; log::verbose("eSCO {}, state {}", diff --git a/system/bta/ag/bta_ag_sdp.cc b/system/bta/ag/bta_ag_sdp.cc index cafbfb22f3..038b3fffdf 100644 --- a/system/bta/ag/bta_ag_sdp.cc +++ b/system/bta/ag/bta_ag_sdp.cc @@ -542,6 +542,6 @@ void bta_ag_do_disc(tBTA_AG_SCB* p_scb, tBTA_SERVICE_MASK service) { * Returns void * ******************************************************************************/ -void bta_ag_free_db(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { +void bta_ag_free_db(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& /*data*/) { osi_free_and_reset((void**)&p_scb->p_disc_db); } diff --git a/system/bta/ar/bta_ar.cc b/system/bta/ar/bta_ar.cc index 6d82b2b78c..4602930ec9 100644 --- a/system/bta/ar/bta_ar.cc +++ b/system/bta/ar/bta_ar.cc @@ -160,7 +160,8 @@ void bta_ar_dereg_avdt() { * Returns void * ******************************************************************************/ -void bta_ar_avdt_conn(tBTA_SYS_ID sys_id, const RawAddress& bd_addr, uint8_t scb_index) {} +void bta_ar_avdt_conn(tBTA_SYS_ID /*sys_id*/, const RawAddress& /*bd_addr*/, + uint8_t /*scb_index*/) {} /******************************************************************************* * diff --git a/system/bta/av/bta_av_aact.cc b/system/bta/av/bta_av_aact.cc index 739fd2b386..4adc3e2d6f 100644 --- a/system/bta/av/bta_av_aact.cc +++ b/system/bta/av/bta_av_aact.cc @@ -440,7 +440,8 @@ void bta_av_proc_stream_evt(uint8_t handle, const RawAddress& bd_addr, uint8_t e * Returns void * ******************************************************************************/ -void bta_av_sink_data_cback(uint8_t handle, BT_HDR* p_pkt, uint32_t time_stamp, uint8_t m_pt) { +void bta_av_sink_data_cback(uint8_t handle, BT_HDR* p_pkt, uint32_t /*time_stamp*/, + uint8_t /*m_pt*/) { int index = 0; tBTA_AV_SCB* p_scb; log::verbose( @@ -2702,7 +2703,7 @@ void bta_av_rcfg_connect(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* /* p_data */) { * Returns void * ******************************************************************************/ -void bta_av_rcfg_discntd(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { +void bta_av_rcfg_discntd(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* /*p_data*/) { log::error("num_recfg={} conn_lcb=0x{:x} peer_addr={}", p_scb->num_recfg, bta_av_cb.conn_lcb, p_scb->PeerAddress()); @@ -3164,7 +3165,7 @@ void bta_av_vendor_offload_stop() { * Returns void * ******************************************************************************/ -void bta_av_offload_req(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) { +void bta_av_offload_req(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* /*p_data*/) { tBTA_AV_STATUS status = BTA_AV_FAIL_RESOURCES; tBT_A2DP_OFFLOAD offload_start; diff --git a/system/bta/av/bta_av_main.cc b/system/bta/av/bta_av_main.cc index f1463fc93b..d8573d7f02 100644 --- a/system/bta/av/bta_av_main.cc +++ b/system/bta/av/bta_av_main.cc @@ -1026,7 +1026,7 @@ static void bta_av_sco_chg_cback(tBTA_SYS_CONN_STATUS status, uint8_t num_sco_li * Returns true, if role switch is done * ******************************************************************************/ -bool bta_av_switch_if_needed(tBTA_AV_SCB* p_scb) { +bool bta_av_switch_if_needed(tBTA_AV_SCB* /*p_scb*/) { // TODO: A workaround for devices that are connected first, become // Central, and block follow-up role changes - b/72122792 . return false; diff --git a/system/bta/csis/csis_client.cc b/system/bta/csis/csis_client.cc index 1359a0d3f1..92ff4c71a3 100644 --- a/system/bta/csis/csis_client.cc +++ b/system/bta/csis/csis_client.cc @@ -201,7 +201,9 @@ public: AssignCsisGroup(address, group_id, false, Uuid::kEmpty); } - void OnGroupRemovedCb(const bluetooth::Uuid& uuid, int group_id) { RemoveCsisGroup(group_id); } + void OnGroupRemovedCb(const bluetooth::Uuid& /*uuid*/, int group_id) { + RemoveCsisGroup(group_id); + } void OnGroupMemberRemovedCb(const RawAddress& address, int group_id) { log::debug("{}, group_id: {}", address, group_id); @@ -336,7 +338,8 @@ public: NotifyGroupStatus(group_id, false, status, std::move(cb)); } - void OnGattCsisWriteLockRsp(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, void* data) { + void OnGattCsisWriteLockRsp(tCONN_ID conn_id, tGATT_STATUS status, uint16_t /*handle*/, + void* data) { auto device = FindDeviceByConnId(conn_id); if (device == nullptr) { log::error("Device not there for conn_id: 0x{:04x}", conn_id); @@ -433,8 +436,8 @@ public: BtaGattQueue::WriteCharacteristic( device->conn_id, csis_instance->svc_data.lock_handle.val_hdl, value, GATT_WRITE, - [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* data) { + [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t /*len*/, + const uint8_t* /*value*/, void* data) { if (instance) { instance->OnGattCsisWriteLockRsp(conn_id, status, handle, data); } @@ -913,7 +916,7 @@ private: } } - void OnGattWriteCcc(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, void* user_data) { + void OnGattWriteCcc(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, void* /*user_data*/) { auto device = FindDeviceByConnId(conn_id); if (device == nullptr) { log::info("unknown conn_id= 0x{:04x}", conn_id); @@ -991,7 +994,7 @@ private: csis_group->SetTargetLockState(CsisLockState::CSIS_STATE_UNSET); } - void OnCsisLockNotifications(std::shared_ptr<CsisDevice>& device, + void OnCsisLockNotifications(std::shared_ptr<CsisDevice>& /*device*/, std::shared_ptr<CsisInstance>& csis_instance, uint16_t len, const uint8_t* value) { if (len != 1) { @@ -2144,8 +2147,8 @@ private: UINT16_TO_STREAM(value_ptr, GATT_CHAR_CLIENT_CONFIG_NOTIFICATION); BtaGattQueue::WriteDescriptor( conn_id, ccc_handle, std::move(value), GATT_WRITE, - [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* user_data) { + [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t /*len*/, + const uint8_t* /*value*/, void* user_data) { if (instance) { instance->OnGattWriteCcc(conn_id, status, handle, user_data); } @@ -2153,7 +2156,8 @@ private: nullptr); } - void DisableGattNotification(tCONN_ID conn_id, const RawAddress& address, uint16_t value_handle) { + void DisableGattNotification(tCONN_ID /*conn_id*/, const RawAddress& address, + uint16_t value_handle) { if (value_handle != GAP_INVALID_HANDLE) { tGATT_STATUS register_status = BTA_GATTC_DeregisterForNotifications(gatt_if_, address, value_handle); diff --git a/system/bta/csis/csis_client_test.cc b/system/bta/csis/csis_client_test.cc index 3306263a8a..fa61fa1c1f 100644 --- a/system/bta/csis/csis_client_test.cc +++ b/system/bta/csis/csis_client_test.cc @@ -39,10 +39,10 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" -bool gatt_cl_read_sirk_req(const RawAddress& peer_bda, +bool gatt_cl_read_sirk_req(const RawAddress& /*peer_bda*/, base::OnceCallback<void(tGATT_STATUS status, const RawAddress&, uint8_t sirk_type, Octet16& sirk)> - cb) { + /*cb*/) { return true; } @@ -419,7 +419,7 @@ protected: // default action for WriteDescriptor function call ON_CALL(gatt_queue, WriteDescriptor(_, _, _, _, _, _)) .WillByDefault(Invoke([](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, void* cb_data) -> void { if (cb) { cb(conn_id, GATT_SUCCESS, handle, value.size(), value.data(), cb_data); @@ -481,8 +481,8 @@ protected: EXPECT_CALL(*callbacks, OnDeviceAvailable(address, _, _, _, _)).Times(AtLeast(1)); EXPECT_CALL(gatt_interface, Open(gatt_if, address, BTM_BLE_DIRECT_CONNECTION, true)) - .WillOnce(Invoke([this, conn_id](tGATT_IF client_if, const RawAddress& remote_bda, - bool is_direct, bool opportunistic) { + .WillOnce(Invoke([this, conn_id](tGATT_IF /*client_if*/, const RawAddress& remote_bda, + bool /*is_direct*/, bool /*opportunistic*/) { InjectConnectedEvent(remote_bda, conn_id); GetSearchCompleteEvent(conn_id); })); @@ -560,7 +560,7 @@ protected: auto WriteDescriptorCbGenerator = [](tGATT_STATUS status, uint16_t ccc_handle) { return [status, ccc_handle](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, void* cb_data) -> void { if (cb) { if (ccc_handle) { @@ -823,7 +823,8 @@ TEST_F(CsisClientCallbackTest, test_on_group_lock_changed_group_not_found) { CsisClient::Get()->LockGroup( 2, true, base::BindOnce( - [](bool* callback_called, int group_id, bool locked, CsisGroupLockStatus status) { + [](bool* callback_called, int group_id, bool /*locked*/, + CsisGroupLockStatus status) { if ((group_id == 2) && (status == CsisGroupLockStatus::FAILED_INVALID_GROUP)) { *callback_called = true; } @@ -1200,7 +1201,7 @@ TEST_F(CsisMultiClientTest, test_lock_multiple_instances) { EXPECT_CALL(*csis_lock_callback_mock, CsisGroupLockCb(1, true, CsisGroupLockStatus::SUCCESS)); ON_CALL(gatt_queue, WriteCharacteristic(_, _, _, _, _, _)) .WillByDefault(Invoke([](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, void* cb_data) -> void { if (cb) { cb(conn_id, GATT_SUCCESS, handle, value.size(), value.data(), cb_data); @@ -1226,7 +1227,7 @@ TEST_F(CsisMultiClientTest, test_unlock_multiple_instances) { ON_CALL(gatt_queue, WriteCharacteristic(_, _, _, _, _, _)) .WillByDefault(Invoke([](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, void* cb_data) -> void { if (cb) { cb(conn_id, GATT_SUCCESS, handle, value.size(), value.data(), cb_data); @@ -1258,7 +1259,7 @@ TEST_F(CsisMultiClientTest, test_disconnect_locked_multiple_instances) { EXPECT_CALL(*csis_lock_callback_mock, CsisGroupLockCb(1, true, CsisGroupLockStatus::SUCCESS)); ON_CALL(gatt_queue, WriteCharacteristic(_, _, _, _, _, _)) .WillByDefault(Invoke([](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, void* cb_data) -> void { if (cb) { cb(conn_id, GATT_SUCCESS, handle, value.size(), value.data(), cb_data); @@ -1400,19 +1401,19 @@ TEST_F(CsisClientTest, test_database_out_of_sync) { // Simulated database changed on the remote side. ON_CALL(gatt_queue, WriteCharacteristic(_, _, _, _, _, _)) - .WillByDefault( - Invoke([this](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, void* cb_data) { - auto* svc = gatt::FindService(services_map[conn_id], handle); - if (svc == nullptr) { - return; - } + .WillByDefault(Invoke([this](uint16_t conn_id, uint16_t handle, + std::vector<uint8_t> value, tGATT_WRITE_TYPE /*write_type*/, + GATT_WRITE_OP_CB cb, void* cb_data) { + auto* svc = gatt::FindService(services_map[conn_id], handle); + if (svc == nullptr) { + return; + } - tGATT_STATUS status = GATT_DATABASE_OUT_OF_SYNC; - if (cb) { - cb(conn_id, status, handle, value.size(), value.data(), cb_data); - } - })); + tGATT_STATUS status = GATT_DATABASE_OUT_OF_SYNC; + if (cb) { + cb(conn_id, status, handle, value.size(), value.data(), cb_data); + } + })); ON_CALL(gatt_interface, ServiceSearchRequest(_, _)).WillByDefault(Return()); EXPECT_CALL(gatt_interface, ServiceSearchRequest(_, _)); diff --git a/system/bta/csis/csis_types.h b/system/bta/csis/csis_types.h index 22dcc00bd2..091470099e 100644 --- a/system/bta/csis/csis_types.h +++ b/system/bta/csis/csis_types.h @@ -95,7 +95,7 @@ public: uint16_t service_handle = GAP_INVALID_HANDLE; bool is_gatt_service_valid = false; - GattServiceDevice(const RawAddress& addr, bool first_connection) : addr(addr) {} + GattServiceDevice(const RawAddress& addr, bool /*first_connection*/) : addr(addr) {} GattServiceDevice() : GattServiceDevice(RawAddress::kEmpty, false) {} diff --git a/system/bta/gatt/bta_gattc_utils.cc b/system/bta/gatt/bta_gattc_utils.cc index ca911dec78..8b0870f55f 100644 --- a/system/bta/gatt/bta_gattc_utils.cc +++ b/system/bta/gatt/bta_gattc_utils.cc @@ -598,7 +598,7 @@ bool bta_gattc_check_notif_registry(tBTA_GATTC_RCB* p_clreg, tBTA_GATTC_SERV* p_ * Returns None. * ******************************************************************************/ -void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV* p_srcb, tCONN_ID conn_id, +void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV* /*p_srcb*/, tCONN_ID conn_id, uint16_t start_handle, uint16_t end_handle) { RawAddress remote_bda; tGATT_IF gatt_if; diff --git a/system/bta/gatt/bta_gatts_act.cc b/system/bta/gatt/bta_gatts_act.cc index 78bfb8bfcf..c9c4427f51 100644 --- a/system/bta/gatt/bta_gatts_act.cc +++ b/system/bta/gatt/bta_gatts_act.cc @@ -87,7 +87,7 @@ tGATT_APPL_INFO bta_gatts_nv_cback = {bta_gatts_nv_save_cback, bta_gatts_nv_srv_ * Returns none. * ******************************************************************************/ -static void bta_gatts_nv_save_cback(bool is_add, tGATTS_HNDL_RANGE* p_hndl_range) {} +static void bta_gatts_nv_save_cback(bool /*is_add*/, tGATTS_HNDL_RANGE* /*p_hndl_range*/) {} /******************************************************************************* * @@ -100,8 +100,8 @@ static void bta_gatts_nv_save_cback(bool is_add, tGATTS_HNDL_RANGE* p_hndl_range * Returns none. * ******************************************************************************/ -static bool bta_gatts_nv_srv_chg_cback(tGATTS_SRV_CHG_CMD cmd, tGATTS_SRV_CHG_REQ* p_req, - tGATTS_SRV_CHG_RSP* p_rsp) { +static bool bta_gatts_nv_srv_chg_cback(tGATTS_SRV_CHG_CMD /*cmd*/, tGATTS_SRV_CHG_REQ* /*p_req*/, + tGATTS_SRV_CHG_RSP* /*p_rsp*/) { return false; } @@ -285,7 +285,7 @@ void bta_gatts_deregister(tBTA_GATTS_CB* p_cb, tBTA_GATTS_DATA* p_msg) { * Returns none. * ******************************************************************************/ -void bta_gatts_delete_service(tBTA_GATTS_SRVC_CB* p_srvc_cb, tBTA_GATTS_DATA* p_msg) { +void bta_gatts_delete_service(tBTA_GATTS_SRVC_CB* p_srvc_cb, tBTA_GATTS_DATA* /*p_msg*/) { tBTA_GATTS_RCB* p_rcb = &bta_gatts_cb.rcb[p_srvc_cb->rcb_idx]; tBTA_GATTS cb_data; diff --git a/system/bta/has/has_client.cc b/system/bta/has/has_client.cc index 2701fc4731..03f75a72e9 100644 --- a/system/bta/has/has_client.cc +++ b/system/bta/has/has_client.cc @@ -471,8 +471,8 @@ public: EnqueueCtpOp(operation); BtaGattQueue::WriteCharacteristic( device->conn_id, device->cp_handle, operation.ToCharacteristicValue(), GATT_WRITE, - [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* user_data) { + [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t /*handle*/, uint16_t /*len*/, + const uint8_t* /*value*/, void* user_data) { if (instance) { instance->OnHasPresetNameGetStatus(conn_id, status, user_data); } @@ -571,8 +571,8 @@ public: EnqueueCtpOp(operation); BtaGattQueue::WriteCharacteristic( device.conn_id, device.cp_handle, operation.ToCharacteristicValue(), GATT_WRITE, - [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* user_data) { + [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t /*handle*/, uint16_t /*len*/, + const uint8_t* /*value*/, void* user_data) { if (instance) { instance->OnHasPresetIndexOperation(conn_id, status, user_data); } @@ -731,8 +731,8 @@ public: EnqueueCtpOp(operation); BtaGattQueue::WriteCharacteristic( device.conn_id, device.cp_handle, operation.ToCharacteristicValue(), GATT_WRITE, - [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* user_data) { + [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t /*handle*/, uint16_t /*len*/, + const uint8_t* /*value*/, void* user_data) { if (instance) { instance->OnHasActivePresetCycleStatus(conn_id, status, user_data); } @@ -791,8 +791,8 @@ public: EnqueueCtpOp(operation); BtaGattQueue::WriteCharacteristic( device.conn_id, device.cp_handle, operation.ToCharacteristicValue(), GATT_WRITE, - [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* user_data) { + [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t /*handle*/, uint16_t /*len*/, + const uint8_t* /*value*/, void* user_data) { if (instance) { instance->OnHasPresetNameSetStatus(conn_id, status, user_data); } @@ -981,7 +981,7 @@ public: dprintf(fd, "%s", stream.str().c_str()); } - void OnGroupOpCoordinatorTimeout(void* p) { + void OnGroupOpCoordinatorTimeout(void* /*p*/) { log::error( "Coordinated operation timeout: not all the devices notified their " "state change on time."); @@ -1137,7 +1137,7 @@ private: void OnHasFeaturesValue(std::variant<tCONN_ID, HasDevice*> conn_id_device_variant, tGATT_STATUS status, uint16_t handle, uint16_t len, const uint8_t* value, - void* user_data = nullptr) { + void* /*user_data*/ = nullptr) { log::debug(""); auto device = GetDevice(conn_id_device_variant); @@ -1539,7 +1539,7 @@ private: void OnHasActivePresetValue(std::variant<tCONN_ID, HasDevice*> conn_id_device_variant, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* user_data = nullptr) { + const uint8_t* value, void* /*user_data*/ = nullptr) { log::debug(""); auto device = GetDevice(conn_id_device_variant); @@ -1766,7 +1766,8 @@ private: return true; } - bool StartInitialHasDetailsReadAndValidation(const gatt::Service& service, HasDevice* device) { + bool StartInitialHasDetailsReadAndValidation(const gatt::Service& /*service*/, + HasDevice* device) { // Validate service structure if (device->features_handle == GAP_INVALID_HANDLE) { /* Missing key characteristic */ @@ -2142,8 +2143,8 @@ private: UINT16_TO_STREAM(value_ptr, ccc_val); BtaGattQueue::WriteDescriptor( conn_id, ccc_handle, std::move(value), GATT_WRITE, - [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t value_handle, uint16_t len, - const uint8_t* value, void* data) { + [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t value_handle, uint16_t /*len*/, + const uint8_t* /*value*/, void* data) { if (instance) { instance->OnGattWriteCcc(conn_id, status, value_handle, data); } diff --git a/system/bta/has/has_client_test.cc b/system/bta/has/has_client_test.cc index df98b10a42..9be5c92a69 100644 --- a/system/bta/has/has_client_test.cc +++ b/system/bta/has/has_client_test.cc @@ -45,7 +45,7 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" -bool gatt_profile_get_eatt_support(const RawAddress& addr) { return true; } +bool gatt_profile_get_eatt_support(const RawAddress& /*addr*/) { return true; } void osi_property_set_bool(const char* key, bool value); namespace bluetooth { @@ -292,8 +292,8 @@ protected: WriteCharacteristic(conn_id, HasDbBuilder::kPresetsCtpValHdl, _, GATT_WRITE, _, _)) .WillByDefault(Invoke([this, address](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, - void* cb_data) { + tGATT_WRITE_TYPE /*write_type*/, + GATT_WRITE_OP_CB cb, void* cb_data) { auto pp = value.data(); auto len = value.size(); uint8_t op, index, num_of_indices; @@ -634,9 +634,9 @@ protected: ON_CALL(btm_interface, IsLinkKeyKnown(_, _)).WillByDefault(DoAll(Return(true))); ON_CALL(btm_interface, SetEncryption(_, _, _, _, _)) - .WillByDefault(Invoke([this](const RawAddress& bd_addr, tBT_TRANSPORT transport, - tBTM_SEC_CALLBACK* p_callback, void* p_ref_data, - tBTM_BLE_SEC_ACT sec_act) -> tBTM_STATUS { + .WillByDefault(Invoke([this](const RawAddress& bd_addr, tBT_TRANSPORT /*transport*/, + tBTM_SEC_CALLBACK* /*p_callback*/, void* /*p_ref_data*/, + tBTM_BLE_SEC_ACT /*sec_act*/) -> tBTM_STATUS { InjectEncryptionEvent(bd_addr); return tBTM_STATUS::BTM_SUCCESS; })); @@ -695,7 +695,7 @@ protected: /* default action for WriteDescriptor function call */ ON_CALL(gatt_queue, WriteDescriptor(_, _, _, _, _, _)) .WillByDefault(Invoke([](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, void* cb_data) -> void { if (cb) { cb(conn_id, GATT_SUCCESS, handle, value.size(), value.data(), cb_data); @@ -704,8 +704,8 @@ protected: /* by default connect only direct connection requests */ ON_CALL(gatt_interface, Open(_, _, _, _)) - .WillByDefault(Invoke([&](tGATT_IF client_if, const RawAddress& remote_bda, - tBTM_BLE_CONN_TYPE connection_type, bool opportunistic) { + .WillByDefault(Invoke([&](tGATT_IF /*client_if*/, const RawAddress& remote_bda, + tBTM_BLE_CONN_TYPE connection_type, bool /*opportunistic*/) { if (connection_type == BTM_BLE_DIRECT_CONNECTION) { InjectConnectedEvent(remote_bda, GetTestConnId(remote_bda)); } @@ -3023,19 +3023,19 @@ TEST_F(HasClientTest, test_connect_database_out_of_sync) { TestConnect(test_address); ON_CALL(gatt_queue, WriteCharacteristic(_, _, _, _, _, _)) - .WillByDefault( - Invoke([this](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, void* cb_data) { - auto* svc = gatt::FindService(services_map[conn_id], handle); - if (svc == nullptr) { - return; - } + .WillByDefault(Invoke([this](uint16_t conn_id, uint16_t handle, + std::vector<uint8_t> value, tGATT_WRITE_TYPE /*write_type*/, + GATT_WRITE_OP_CB cb, void* cb_data) { + auto* svc = gatt::FindService(services_map[conn_id], handle); + if (svc == nullptr) { + return; + } - tGATT_STATUS status = GATT_DATABASE_OUT_OF_SYNC; - if (cb) { - cb(conn_id, status, handle, value.size(), value.data(), cb_data); - } - })); + tGATT_STATUS status = GATT_DATABASE_OUT_OF_SYNC; + if (cb) { + cb(conn_id, status, handle, value.size(), value.data(), cb_data); + } + })); ON_CALL(gatt_interface, ServiceSearchRequest(_, _)).WillByDefault(Return()); EXPECT_CALL(gatt_interface, ServiceSearchRequest(_, _)); diff --git a/system/bta/hearing_aid/hearing_aid.cc b/system/bta/hearing_aid/hearing_aid.cc index 796a8d2056..cb5974793d 100644 --- a/system/bta/hearing_aid/hearing_aid.cc +++ b/system/bta/hearing_aid/hearing_aid.cc @@ -224,7 +224,7 @@ public: }; static void write_rpt_ctl_cfg_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, const uint8_t* value, void* data) { + uint16_t len, const uint8_t* /*value*/, void* /*data*/) { if (status != GATT_SUCCESS) { log::error("handle= {}, conn_id={}, status= 0x{:x}, length={}", handle, conn_id, static_cast<uint8_t>(status), len); @@ -465,8 +465,8 @@ public: int GetDeviceCount() { return hearingDevices.size(); } - void OnGattConnected(tGATT_STATUS status, tCONN_ID conn_id, tGATT_IF client_if, - RawAddress address, tBT_TRANSPORT transport, uint16_t mtu) { + void OnGattConnected(tGATT_STATUS status, tCONN_ID conn_id, tGATT_IF /*client_if*/, + RawAddress address, tBT_TRANSPORT /*transport*/, uint16_t /*mtu*/) { HearingDevice* hearingDevice = hearingDevices.FindByAddress(address); if (!hearingDevice) { /* When Hearing Aid is quickly disabled and enabled in settings, this case @@ -882,8 +882,8 @@ public: device->command_acked = true; } - void OnReadOnlyPropertiesRead(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, uint8_t* value, void* data) { + void OnReadOnlyPropertiesRead(tCONN_ID conn_id, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t len, uint8_t* value, void* /*data*/) { HearingDevice* hearingDevice = hearingDevices.FindByConnId(conn_id); if (!hearingDevice) { log::error("unknown device: conn_id=0x{:x}", conn_id); @@ -989,13 +989,13 @@ public: } } - void OnAudioStatus(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) { + void OnAudioStatus(tCONN_ID /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t len, uint8_t* value, void* /*data*/) { log::info("{}", base::HexEncode(value, len)); } - void OnPsmRead(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) { + void OnPsmRead(tCONN_ID conn_id, tGATT_STATUS status, uint16_t /*handle*/, uint16_t len, + uint8_t* value, void* /*data*/) { HearingDevice* hearingDevice = hearingDevices.FindByConnId(conn_id); if (!hearingDevice) { log::error("unknown device: conn_id=0x{:x}", conn_id); @@ -1278,7 +1278,8 @@ public: } static void StartAudioCtrlCallbackStatic(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, const uint8_t* value, void* data) { + uint16_t /*len*/, const uint8_t* /*value*/, + void* /*data*/) { if (status != GATT_SUCCESS) { log::error("handle={}, conn_id={}, status=0x{:x}", handle, conn_id, static_cast<uint8_t>(status)); @@ -1553,7 +1554,7 @@ public: } } - void GapCallback(uint16_t gap_handle, uint16_t event, tGAP_CB_DATA* data) { + void GapCallback(uint16_t gap_handle, uint16_t event, tGAP_CB_DATA* /*data*/) { HearingDevice* hearingDevice = hearingDevices.FindByGapHandle(gap_handle); if (!hearingDevice) { log::error("unknown device: gap_handle={} event=0x{:x}", gap_handle, event); @@ -1768,7 +1769,7 @@ public: DoDisconnectAudioStop(); } - void OnGattDisconnected(tCONN_ID conn_id, tGATT_IF client_if, RawAddress remote_bda) { + void OnGattDisconnected(tCONN_ID conn_id, tGATT_IF /*client_if*/, RawAddress remote_bda) { HearingDevice* hearingDevice = hearingDevices.FindByConnId(conn_id); if (!hearingDevice) { log::error("unknown device: conn_id=0x{:x} bd_addr={}", conn_id, remote_bda); diff --git a/system/bta/hf_client/bta_hf_client_at.cc b/system/bta/hf_client/bta_hf_client_at.cc index f3494e215a..9be68cab97 100644 --- a/system/bta/hf_client/bta_hf_client_at.cc +++ b/system/bta/hf_client/bta_hf_client_at.cc @@ -1466,7 +1466,7 @@ static char* bta_hf_client_parse_rejectlisted(tBTA_HF_CLIENT_CB* client_cb, char return buffer; } -static char* bta_hf_client_skip_unknown(tBTA_HF_CLIENT_CB* client_cb, char* buffer) { +static char* bta_hf_client_skip_unknown(tBTA_HF_CLIENT_CB* /*client_cb*/, char* buffer) { char* start; char* tmp; diff --git a/system/bta/hh/bta_hh_act.cc b/system/bta/hh/bta_hh_act.cc index c2ba60c279..118a4b72f4 100644 --- a/system/bta/hh/bta_hh_act.cc +++ b/system/bta/hh/bta_hh_act.cc @@ -636,7 +636,7 @@ void bta_hh_open_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { * Returns void * ******************************************************************************/ -void bta_hh_data_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { +void bta_hh_data_act(tBTA_HH_DEV_CB* /*p_cb*/, const tBTA_HH_DATA* p_data) { BT_HDR* pdata = p_data->hid_cback.p_data; uint8_t* p_rpt = (uint8_t*)(pdata + 1) + pdata->offset; diff --git a/system/bta/hh/bta_hh_le.cc b/system/bta/hh/bta_hh_le.cc index fc980e01cf..92fffab8a6 100644 --- a/system/bta/hh/bta_hh_le.cc +++ b/system/bta/hh/bta_hh_le.cc @@ -656,7 +656,7 @@ static bool bta_hh_le_write_ccc(tBTA_HH_DEV_CB* p_cb, uint16_t char_handle, uint static bool bta_hh_le_write_rpt_clt_cfg(tBTA_HH_DEV_CB* p_cb); static void write_rpt_clt_cfg_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, const uint8_t* value, void* data) { + uint16_t /*len*/, const uint8_t* /*value*/, void* data) { tBTA_HH_DEV_CB* p_dev_cb = (tBTA_HH_DEV_CB*)data; const gatt::Characteristic* characteristic = BTA_GATTC_GetOwningCharacteristic(conn_id, handle); if (characteristic == nullptr) { @@ -756,8 +756,8 @@ void bta_hh_le_service_parsed(tBTA_HH_DEV_CB* p_dev_cb, tGATT_STATUS status) { } } -static void write_proto_mode_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, const uint8_t* value, void* data) { +static void write_proto_mode_cb(tCONN_ID /*conn_id*/, tGATT_STATUS status, uint16_t /*handle*/, + uint16_t /*len*/, const uint8_t* /*value*/, void* data) { tBTA_HH_DEV_CB* p_dev_cb = (tBTA_HH_DEV_CB*)data; bta_hh_le_service_parsed(p_dev_cb, status); } @@ -813,7 +813,7 @@ static bool bta_hh_le_set_protocol_mode(tBTA_HH_DEV_CB* p_cb, tBTA_HH_PROTO_MODE * application with the protocol mode. * ******************************************************************************/ -static void get_protocol_mode_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, +static void get_protocol_mode_cb(tCONN_ID /*conn_id*/, tGATT_STATUS status, uint16_t /*handle*/, uint16_t len, uint8_t* value, void* data) { tBTA_HH_DEV_CB* p_dev_cb = (tBTA_HH_DEV_CB*)data; tBTA_HH_HSDATA hs_data; @@ -1238,8 +1238,8 @@ static void bta_hh_le_gatt_disc_cmpl(tBTA_HH_DEV_CB* p_cb, tBTA_HH_STATUS status } } -static void read_hid_info_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) { +static void read_hid_info_cb(tCONN_ID /*conn_id*/, tGATT_STATUS status, uint16_t /*handle*/, + uint16_t len, uint8_t* value, void* data) { if (status != GATT_SUCCESS) { log::error("error:{}", status); return; @@ -1273,7 +1273,7 @@ void bta_hh_le_save_report_map(tBTA_HH_DEV_CB* p_dev_cb, uint16_t len, uint8_t* } } -static void read_hid_report_map_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, +static void read_hid_report_map_cb(tCONN_ID /*conn_id*/, tGATT_STATUS status, uint16_t /*handle*/, uint16_t len, uint8_t* value, void* data) { if (status != GATT_SUCCESS) { log::error("error reading characteristic:{}", status); @@ -1284,7 +1284,7 @@ static void read_hid_report_map_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16 bta_hh_le_save_report_map(p_dev_cb, len, value); } -static void read_ext_rpt_ref_desc_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, +static void read_ext_rpt_ref_desc_cb(tCONN_ID /*conn_id*/, tGATT_STATUS status, uint16_t /*handle*/, uint16_t len, uint8_t* value, void* data) { if (status != GATT_SUCCESS) { log::error("error:{}", status); @@ -1346,7 +1346,7 @@ static void read_report_ref_desc_cb(tCONN_ID conn_id, tGATT_STATUS status, uint1 bta_hh_le_save_report_ref(p_dev_cb, p_rpt, rpt_type, rpt_id); } -static void read_pref_conn_params_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, +static void read_pref_conn_params_cb(tCONN_ID /*conn_id*/, tGATT_STATUS status, uint16_t /*handle*/, uint16_t len, uint8_t* value, void* data) { if (status != GATT_SUCCESS) { log::error("error:{}", status); @@ -1875,8 +1875,8 @@ static void bta_hh_le_get_rpt(tBTA_HH_DEV_CB* p_cb, tBTA_HH_RPT_TYPE r_type, uin BtaGattQueue::ReadCharacteristic(p_cb->conn_id, p_rpt->char_inst_id, read_report_cb, p_cb); } -static void write_report_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* data) { +static void write_report_cb(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, + uint16_t /*len*/, const uint8_t* /*value*/, void* data) { tBTA_HH_CBDATA cback_data; tBTA_HH_DEV_CB* p_dev_cb = (tBTA_HH_DEV_CB*)data; uint16_t cb_evt = p_dev_cb->w4_evt; @@ -2283,8 +2283,8 @@ static void bta_hh_process_cache_rpt(tBTA_HH_DEV_CB* p_cb, tBTA_HH_RPT_CACHE_ENT } } -static bool bta_hh_le_iso_data_callback(const RawAddress& addr, uint16_t cis_conn_hdl, - uint8_t* data, uint16_t size, uint32_t timestamp) { +static bool bta_hh_le_iso_data_callback(const RawAddress& addr, uint16_t /*cis_conn_hdl*/, + uint8_t* data, uint16_t size, uint32_t /*timestamp*/) { if (!com::android::bluetooth::flags::leaudio_dynamic_spatial_audio()) { log::warn("DSA not supported"); return false; diff --git a/system/bta/le_audio/audio_hal_client/audio_hal_client.h b/system/bta/le_audio/audio_hal_client/audio_hal_client.h index decfe5e0b3..899bf171c5 100644 --- a/system/bta/le_audio/audio_hal_client/audio_hal_client.h +++ b/system/bta/le_audio/audio_hal_client/audio_hal_client.h @@ -154,7 +154,7 @@ public: virtual bool Start(const LeAudioCodecConfiguration& codecConfiguration, Callbacks* audioReceiver, DsaModes dsa_modes = {DsaMode::DISABLED}) = 0; virtual void Stop() = 0; - virtual size_t SendData(uint8_t* data, uint16_t size) { return 0; } + virtual size_t SendData(uint8_t* /*data*/, uint16_t /*size*/) { return 0; } virtual void ConfirmStreamingRequest() = 0; virtual void CancelStreamingRequest() = 0; virtual void UpdateRemoteDelay(uint16_t remote_delay_ms) = 0; diff --git a/system/bta/le_audio/audio_hal_client/audio_hal_client_test.cc b/system/bta/le_audio/audio_hal_client/audio_hal_client_test.cc index dac6c9dbd1..9efe7863c3 100644 --- a/system/bta/le_audio/audio_hal_client/audio_hal_client_test.cc +++ b/system/bta/le_audio/audio_hal_client/audio_hal_client_test.cc @@ -166,22 +166,24 @@ LeAudioClientInterface::Source* LeAudioClientInterface::GetSource( return interface_mock->GetSource(stream_cb, message_loop); } -bool LeAudioClientInterface::ReleaseSink(LeAudioClientInterface::Sink* sink) { return true; } -bool LeAudioClientInterface::ReleaseSource(LeAudioClientInterface::Source* source) { return true; } +bool LeAudioClientInterface::ReleaseSink(LeAudioClientInterface::Sink* /*sink*/) { return true; } +bool LeAudioClientInterface::ReleaseSource(LeAudioClientInterface::Source* /*source*/) { + return true; +} -void LeAudioClientInterface::SetAllowedDsaModes(DsaModes dsa_modes) { return; } +void LeAudioClientInterface::SetAllowedDsaModes(DsaModes /*dsa_modes*/) { return; } void LeAudioClientInterface::Sink::Cleanup() {} -void LeAudioClientInterface::Sink::SetPcmParameters(const PcmParameters& params) {} -void LeAudioClientInterface::Sink::SetRemoteDelay(uint16_t delay_report_ms) {} +void LeAudioClientInterface::Sink::SetPcmParameters(const PcmParameters& /*params*/) {} +void LeAudioClientInterface::Sink::SetRemoteDelay(uint16_t /*delay_report_ms*/) {} void LeAudioClientInterface::Sink::StartSession() {} void LeAudioClientInterface::Sink::StopSession() {} void LeAudioClientInterface::Sink::ConfirmStreamingRequest() {} void LeAudioClientInterface::Sink::CancelStreamingRequest() {} void LeAudioClientInterface::Sink::UpdateAudioConfigToHal( - const ::bluetooth::le_audio::offload_config& config) {} + const ::bluetooth::le_audio::offload_config& /*config*/) {} void LeAudioClientInterface::Sink::UpdateBroadcastAudioConfigToHal( - const ::bluetooth::le_audio::broadcast_offload_config& config) {} + const ::bluetooth::le_audio::broadcast_offload_config& /*config*/) {} std::optional<::le_audio::broadcaster::BroadcastConfiguration> LeAudioClientInterface::Sink::GetBroadcastConfig( const std::vector<std::pair<::le_audio::types::LeAudioContextType, uint8_t>>& quality, @@ -198,14 +200,14 @@ void LeAudioClientInterface::Sink::SuspendedForReconfiguration() {} void LeAudioClientInterface::Sink::ReconfigurationComplete() {} void LeAudioClientInterface::Source::Cleanup() {} -void LeAudioClientInterface::Source::SetPcmParameters(const PcmParameters& params) {} -void LeAudioClientInterface::Source::SetRemoteDelay(uint16_t delay_report_ms) {} +void LeAudioClientInterface::Source::SetPcmParameters(const PcmParameters& /*params*/) {} +void LeAudioClientInterface::Source::SetRemoteDelay(uint16_t /*delay_report_ms*/) {} void LeAudioClientInterface::Source::StartSession() {} void LeAudioClientInterface::Source::StopSession() {} void LeAudioClientInterface::Source::ConfirmStreamingRequest() {} void LeAudioClientInterface::Source::CancelStreamingRequest() {} void LeAudioClientInterface::Source::UpdateAudioConfigToHal( - const ::bluetooth::le_audio::offload_config& config) {} + const ::bluetooth::le_audio::offload_config& /*config*/) {} void LeAudioClientInterface::Source::SuspendedForReconfiguration() {} void LeAudioClientInterface::Source::ReconfigurationComplete() {} diff --git a/system/bta/le_audio/audio_hal_client/audio_sink_hal_client.cc b/system/bta/le_audio/audio_hal_client/audio_sink_hal_client.cc index 01eb27415d..8f05b7248b 100644 --- a/system/bta/le_audio/audio_hal_client/audio_sink_hal_client.cc +++ b/system/bta/le_audio/audio_hal_client/audio_sink_hal_client.cc @@ -122,7 +122,7 @@ void SinkImpl::Release() { } } -bool SinkImpl::OnResumeReq(bool start_media_task) { +bool SinkImpl::OnResumeReq(bool /*start_media_task*/) { if (audioSinkCallbacks_ == nullptr) { log::error("audioSinkCallbacks_ not set"); return false; @@ -319,7 +319,7 @@ std::unique_ptr<LeAudioSinkAudioHalClient> LeAudioSinkAudioHalClient::AcquireUni return std::move(impl); } -void LeAudioSinkAudioHalClient::DebugDump(int fd) { +void LeAudioSinkAudioHalClient::DebugDump(int /*fd*/) { /* TODO: Add some statistic for LeAudioSink Audio HAL interface */ } } // namespace bluetooth::le_audio diff --git a/system/bta/le_audio/audio_hal_client/audio_source_hal_client.cc b/system/bta/le_audio/audio_hal_client/audio_source_hal_client.cc index d6e4e9b537..b721d4546d 100644 --- a/system/bta/le_audio/audio_hal_client/audio_source_hal_client.cc +++ b/system/bta/le_audio/audio_hal_client/audio_source_hal_client.cc @@ -120,7 +120,7 @@ bool SourceImpl::Acquire() { .on_metadata_update_ = std::bind(&SourceImpl::OnMetadataUpdateReq, this, std::placeholders::_1, std::placeholders::_2), .on_sink_metadata_update_ = - [](const sink_metadata_v7_t& sink_metadata) { + [](const sink_metadata_v7_t& /*sink_metadata*/) { // TODO: update microphone configuration based on sink metadata return true; }, @@ -174,7 +174,7 @@ void SourceImpl::Release() { } } -bool SourceImpl::OnResumeReq(bool start_media_task) { +bool SourceImpl::OnResumeReq(bool /*start_media_task*/) { std::lock_guard<std::mutex> guard(audioSourceCallbacksMutex_); if (audioSourceCallbacks_ == nullptr) { log::error("audioSourceCallbacks_ not set"); diff --git a/system/bta/le_audio/broadcaster/broadcaster.cc b/system/bta/le_audio/broadcaster/broadcaster.cc index 2b4aed4981..a7b05339b1 100644 --- a/system/bta/le_audio/broadcaster/broadcaster.cc +++ b/system/bta/le_audio/broadcaster/broadcaster.cc @@ -1041,7 +1041,7 @@ private: } void OnStateMachineEvent(uint32_t broadcast_id, BroadcastStateMachine::State state, - const void* data) override { + const void* /*data*/) override { log::info("broadcast_id={} state={}", broadcast_id, ToString(state)); switch (state) { @@ -1095,7 +1095,8 @@ private: broadcast_id, static_cast<bluetooth::le_audio::BroadcastState>(state)); } - void OnOwnAddressResponse(uint32_t broadcast_id, uint8_t addr_type, RawAddress addr) override { + void OnOwnAddressResponse(uint32_t /*broadcast_id*/, uint8_t /*addr_type*/, + RawAddress /*addr*/) override { /* Not used currently */ } @@ -1165,17 +1166,18 @@ private: } } - void OnScanResponseDataSet(uint8_t advertiser_id, uint8_t status) { + void OnScanResponseDataSet(uint8_t advertiser_id, uint8_t /*status*/) { log::warn("Not being used, ignored OnScanResponseDataSet callback advertiser_id:{}", advertiser_id); } - void OnAdvertisingParametersUpdated(uint8_t advertiser_id, int8_t tx_power, uint8_t status) { + void OnAdvertisingParametersUpdated(uint8_t advertiser_id, int8_t /*tx_power*/, + uint8_t /*status*/) { log::warn("Not being used, ignored OnAdvertisingParametersUpdated callback advertiser_id:{}", advertiser_id); } - void OnPeriodicAdvertisingParametersUpdated(uint8_t advertiser_id, uint8_t status) { + void OnPeriodicAdvertisingParametersUpdated(uint8_t advertiser_id, uint8_t /*status*/) { log::warn( "Not being used, ignored OnPeriodicAdvertisingParametersUpdated " "callback advertiser_id:{}", @@ -1205,12 +1207,12 @@ private: } } - void OnPeriodicAdvertisingEnabled(uint8_t advertiser_id, bool enable, uint8_t status) { + void OnPeriodicAdvertisingEnabled(uint8_t advertiser_id, bool /*enable*/, uint8_t /*status*/) { log::warn("Not being used, ignored OnPeriodicAdvertisingEnabled callback advertiser_id:{}", advertiser_id); } - void OnOwnAddressRead(uint8_t advertiser_id, uint8_t address_type, RawAddress address) { + void OnOwnAddressRead(uint8_t advertiser_id, uint8_t /*address_type*/, RawAddress /*address*/) { log::warn("Not being used, ignored OnOwnAddressRead callback advertiser_id:{}", advertiser_id); } @@ -1360,7 +1362,7 @@ private: virtual void OnAudioMetadataUpdate( const std::vector<struct playback_track_metadata_v7> source_metadata, - DsaMode dsa_mode) override { + DsaMode /*dsa_mode*/) override { log::info(""); if (!instance) { return; diff --git a/system/bta/le_audio/broadcaster/broadcaster_test.cc b/system/bta/le_audio/broadcaster/broadcaster_test.cc index 75e693d802..1145b93a4a 100644 --- a/system/bta/le_audio/broadcaster/broadcaster_test.cc +++ b/system/bta/le_audio/broadcaster/broadcaster_test.cc @@ -91,7 +91,7 @@ void btsnd_hcic_ble_rand(base::Callback<void(BT_OCTET8)> cb) { generator_cb = cb std::atomic<int> num_async_tasks; bluetooth::common::MessageLoopThread message_loop_thread("test message loop"); bluetooth::common::MessageLoopThread* get_main_thread() { return &message_loop_thread; } -void invoke_switch_buffer_size_cb(bool is_low_latency_buffer_size) {} +void invoke_switch_buffer_size_cb(bool /*is_low_latency_buffer_size*/) {} bt_status_t do_in_main_thread(base::OnceClosure task) { // Wrap the task with task counter so we could later know if there are @@ -282,7 +282,7 @@ protected: } }; - test::mock::osi_alarm::alarm_set_on_mloop.body = [](alarm_t* alarm, uint64_t interval_ms, + test::mock::osi_alarm::alarm_set_on_mloop.body = [](alarm_t* alarm, uint64_t /*interval_ms*/, alarm_callback_t cb, void* data) { alarm->cb = cb; alarm->data = data; @@ -757,7 +757,7 @@ TEST_F(BroadcasterTest, UpdateMetadata) { }); EXPECT_CALL(*MockBroadcastStateMachine::GetLastInstance(), UpdatePublicBroadcastAnnouncement) - .WillOnce([&](uint32_t broadcast_id, const std::string& broadcast_name, + .WillOnce([&](uint32_t /*broadcast_id*/, const std::string& broadcast_name, const bluetooth::le_audio::PublicBroadcastAnnouncementData& announcement) { expected_broadcast_name = broadcast_name; expected_public_meta = types::LeAudioLtvMap(announcement.metadata).RawPacket(); @@ -1211,7 +1211,7 @@ TEST_F(BroadcasterTest, AudioActiveState) { ON_CALL(*sm, UpdatePublicBroadcastAnnouncement(broadcast_id, _, _)) .WillByDefault( - [&](uint32_t broadcast_id, const std::string& broadcast_name, + [&](uint32_t /*broadcast_id*/, const std::string& /*broadcast_name*/, const bluetooth::le_audio::PublicBroadcastAnnouncementData& announcement) { pb_announcement = announcement; updated_public_meta = types::LeAudioLtvMap(announcement.metadata).RawPacket(); diff --git a/system/bta/le_audio/broadcaster/broadcaster_types.cc b/system/bta/le_audio/broadcaster/broadcaster_types.cc index 718327f612..de55101fc2 100644 --- a/system/bta/le_audio/broadcaster/broadcaster_types.cc +++ b/system/bta/le_audio/broadcaster/broadcaster_types.cc @@ -50,7 +50,7 @@ static void EmitHeader(const BasicAudioAnnouncementData& announcement_data, static void EmitCodecConfiguration(const BasicAudioAnnouncementCodecConfig& config, std::vector<uint8_t>& data, - const BasicAudioAnnouncementCodecConfig* lower_lvl_config) { + const BasicAudioAnnouncementCodecConfig* /*lower_lvl_config*/) { size_t old_size = data.size(); // Add 5 for full, or 1 for short Codec ID diff --git a/system/bta/le_audio/broadcaster/mock_state_machine.cc b/system/bta/le_audio/broadcaster/mock_state_machine.cc index 8bcba137cd..253ffc3d8d 100644 --- a/system/bta/le_audio/broadcaster/mock_state_machine.cc +++ b/system/bta/le_audio/broadcaster/mock_state_machine.cc @@ -52,11 +52,13 @@ std::ostream& operator<<(std::ostream& os, const BroadcastStateMachine::State& s return os; } -std::ostream& operator<<(std::ostream& os, const BigConfig& config) { return os; } +std::ostream& operator<<(std::ostream& os, const BigConfig& /*config*/) { return os; } -std::ostream& operator<<(std::ostream& os, const BroadcastStateMachineConfig& config) { return os; } +std::ostream& operator<<(std::ostream& os, const BroadcastStateMachineConfig& /*config*/) { + return os; +} -std::ostream& operator<<(std::ostream& os, const BroadcastStateMachine& machine) { return os; } +std::ostream& operator<<(std::ostream& os, const BroadcastStateMachine& /*machine*/) { return os; } } // namespace broadcaster } // namespace bluetooth::le_audio diff --git a/system/bta/le_audio/broadcaster/mock_state_machine.h b/system/bta/le_audio/broadcaster/mock_state_machine.h index f0445fb27a..ebafbed398 100644 --- a/system/bta/le_audio/broadcaster/mock_state_machine.h +++ b/system/bta/le_audio/broadcaster/mock_state_machine.h @@ -37,7 +37,7 @@ public: ON_CALL(*this, ProcessMessage) .WillByDefault( [this](bluetooth::le_audio::broadcaster::BroadcastStateMachine::Message event, - const void* data) { + const void* /*data*/) { const void* sent_data = nullptr; switch (event) { case Message::START: diff --git a/system/bta/le_audio/broadcaster/state_machine_test.cc b/system/bta/le_audio/broadcaster/state_machine_test.cc index 2dca7c5bee..d8a51aa417 100644 --- a/system/bta/le_audio/broadcaster/state_machine_test.cc +++ b/system/bta/le_audio/broadcaster/state_machine_test.cc @@ -51,7 +51,7 @@ using testing::Test; // Disables most likely false-positives from base::SplitString() extern "C" const char* __asan_default_options() { return "detect_container_overflow=0"; } -void btsnd_hcic_ble_rand(base::Callback<void(BT_OCTET8)> cb) {} +void btsnd_hcic_ble_rand(base::Callback<void(BT_OCTET8)> /*cb*/) {} namespace bluetooth::le_audio { namespace broadcaster { @@ -121,14 +121,15 @@ protected: BroadcastStateMachine::Initialize(sm_callbacks_.get(), adv_callbacks_.get()); ON_CALL(*mock_ble_advertising_manager_, StartAdvertisingSet) - .WillByDefault([this](uint8_t client_id, int reg_id, - ::BleAdvertiserInterface::IdTxPowerStatusCallback register_cb, - ::AdvertiseParameters params, std::vector<uint8_t> advertise_data, - std::vector<uint8_t> scan_response_data, - ::PeriodicAdvertisingParameters periodic_params, - std::vector<uint8_t> periodic_data, uint16_t duration, - uint8_t maxExtAdvEvents, - ::BleAdvertiserInterface::IdStatusCallback timeout_cb) { + .WillByDefault([this](uint8_t /*client_id*/, int /*reg_id*/, + ::BleAdvertiserInterface::IdTxPowerStatusCallback /*register_cb*/, + ::AdvertiseParameters /*params*/, + std::vector<uint8_t> /*advertise_data*/, + std::vector<uint8_t> /*scan_response_data*/, + ::PeriodicAdvertisingParameters /*periodic_params*/, + std::vector<uint8_t> /*periodic_data*/, uint16_t /*duration*/, + uint8_t /*maxExtAdvEvents*/, + ::BleAdvertiserInterface::IdStatusCallback /*timeout_cb*/) { static uint8_t advertiser_id = 1; uint8_t tx_power = 32; uint8_t status = 0; @@ -139,32 +140,34 @@ protected: ON_CALL(*mock_ble_advertising_manager_, Enable) .WillByDefault([this](uint8_t advertiser_id, bool enable, - ::BleAdvertiserInterface::StatusCallback cb, uint16_t duration, - uint8_t maxExtAdvEvents, - ::BleAdvertiserInterface::StatusCallback timeout_cb) { + ::BleAdvertiserInterface::StatusCallback /*cb*/, + uint16_t /*duration*/, uint8_t /*maxExtAdvEvents*/, + ::BleAdvertiserInterface::StatusCallback /*timeout_cb*/) { uint8_t status = 0; this->adv_callbacks_->OnAdvertisingEnabled(advertiser_id, enable, status); }); ON_CALL(*mock_ble_advertising_manager_, GetOwnAddress) - .WillByDefault([](uint8_t inst_id, ::BleAdvertiserInterface::GetAddressCallback cb) { - uint8_t address_type = 0x02; - RawAddress address; - const uint8_t addr[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66}; - address.FromOctets(addr); - cb.Run(address_type, address); - }); + .WillByDefault( + [](uint8_t /*inst_id*/, ::BleAdvertiserInterface::GetAddressCallback cb) { + uint8_t address_type = 0x02; + RawAddress address; + const uint8_t addr[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66}; + address.FromOctets(addr); + cb.Run(address_type, address); + }); ON_CALL(*mock_ble_advertising_manager_, SetData) - .WillByDefault([this](int advertiser_id, bool set_scan_rsp, std::vector<uint8_t> data, - ::BleAdvertiserInterface::StatusCallback cb) { + .WillByDefault([this](int advertiser_id, bool /*set_scan_rsp*/, + std::vector<uint8_t> /*data*/, + ::BleAdvertiserInterface::StatusCallback /*cb*/) { uint8_t status = 0; this->adv_callbacks_->OnAdvertisingDataSet(advertiser_id, status); }); ON_CALL(*mock_ble_advertising_manager_, SetPeriodicAdvertisingData) - .WillByDefault([this](int advertiser_id, std::vector<uint8_t> data, - ::BleAdvertiserInterface::StatusCallback cb) { + .WillByDefault([this](int advertiser_id, std::vector<uint8_t> /*data*/, + ::BleAdvertiserInterface::StatusCallback /*cb*/) { uint8_t status = 0; this->adv_callbacks_->OnPeriodicAdvertisingDataSet(advertiser_id, status); }); @@ -191,7 +194,7 @@ protected: }); ON_CALL(*(adv_callbacks_.get()), OnAdvertisingSetStarted) - .WillByDefault([this](int reg_id, uint8_t advertiser_id, int8_t tx_power, + .WillByDefault([this](int /*reg_id*/, uint8_t advertiser_id, int8_t tx_power, uint8_t status) { pending_broadcasts_.back()->OnCreateAnnouncement(advertiser_id, tx_power, status); }); @@ -266,7 +269,7 @@ protected: }); ON_CALL(*mock_iso_manager_, SetupIsoDataPath) - .WillByDefault([this](uint16_t conn_handle, iso_data_path_params p) { + .WillByDefault([this](uint16_t conn_handle, iso_data_path_params /*p*/) { // Get the big_id encoded in conn_handle's MSB uint8_t big_id = conn_handle >> 8; auto bit = std::find_if(broadcasts_.begin(), broadcasts_.end(), @@ -280,7 +283,7 @@ protected: }); ON_CALL(*mock_iso_manager_, RemoveIsoDataPath) - .WillByDefault([this](uint16_t conn_handle, uint8_t iso_direction) { + .WillByDefault([this](uint16_t conn_handle, uint8_t /*iso_direction*/) { // Get the big_id encoded in conn_handle's MSB uint8_t big_id = conn_handle >> 8; auto bit = std::find_if(broadcasts_.begin(), broadcasts_.end(), @@ -366,14 +369,15 @@ protected: TEST_F(StateMachineTest, CreateInstanceFailed) { EXPECT_CALL(*mock_ble_advertising_manager_, StartAdvertisingSet) - .WillOnce([this](uint8_t client_id, int reg_id, - ::BleAdvertiserInterface::IdTxPowerStatusCallback register_cb, - ::AdvertiseParameters params, std::vector<uint8_t> advertise_data, - std::vector<uint8_t> scan_response_data, - ::PeriodicAdvertisingParameters periodic_params, - std::vector<uint8_t> periodic_data, uint16_t duration, - uint8_t maxExtAdvEvents, - ::BleAdvertiserInterface::IdStatusCallback timeout_cb) { + .WillOnce([this](uint8_t /*client_id*/, int /*reg_id*/, + ::BleAdvertiserInterface::IdTxPowerStatusCallback /*register_cb*/, + ::AdvertiseParameters /*params*/, + std::vector<uint8_t> /*advertise_data*/, + std::vector<uint8_t> /*scan_response_data*/, + ::PeriodicAdvertisingParameters /*periodic_params*/, + std::vector<uint8_t> /*periodic_data*/, uint16_t /*duration*/, + uint8_t /*maxExtAdvEvents*/, + ::BleAdvertiserInterface::IdStatusCallback /*timeout_cb*/) { uint8_t advertiser_id = 1; uint8_t tx_power = 0; uint8_t status = 1; @@ -853,7 +857,7 @@ TEST_F(StateMachineTest, OnSetupIsoDataPathError) { ASSERT_EQ(broadcasts_[broadcast_id]->GetState(), BroadcastStateMachine::State::CONFIGURED); EXPECT_CALL(*mock_iso_manager_, SetupIsoDataPath) - .WillOnce([this](uint16_t conn_handle, iso_data_path_params p) { + .WillOnce([this](uint16_t conn_handle, iso_data_path_params /*p*/) { // Get the big_id encoded in conn_handle's MSB uint8_t big_id = conn_handle >> 8; auto bit = std::find_if(broadcasts_.begin(), broadcasts_.end(), @@ -865,7 +869,7 @@ TEST_F(StateMachineTest, OnSetupIsoDataPathError) { } bit->second->OnSetupIsoDataPath(0, conn_handle); }) - .WillOnce([this](uint16_t conn_handle, iso_data_path_params p) { + .WillOnce([this](uint16_t conn_handle, iso_data_path_params /*p*/) { // Get the big_id encoded in conn_handle's MSB uint8_t big_id = conn_handle >> 8; auto bit = std::find_if(broadcasts_.begin(), broadcasts_.end(), @@ -886,7 +890,7 @@ TEST_F(StateMachineTest, OnSetupIsoDataPathError) { // And still be able to start again ON_CALL(*mock_iso_manager_, SetupIsoDataPath) - .WillByDefault([this](uint16_t conn_handle, iso_data_path_params p) { + .WillByDefault([this](uint16_t conn_handle, iso_data_path_params /*p*/) { // Get the big_id encoded in conn_handle's MSB uint8_t big_id = conn_handle >> 8; auto bit = std::find_if(broadcasts_.begin(), broadcasts_.end(), @@ -912,7 +916,7 @@ TEST_F(StateMachineTest, OnRemoveIsoDataPathError) { ASSERT_EQ(broadcasts_[broadcast_id]->GetState(), BroadcastStateMachine::State::STREAMING); EXPECT_CALL(*mock_iso_manager_, RemoveIsoDataPath) - .WillOnce([this](uint16_t conn_handle, uint8_t iso_direction) { + .WillOnce([this](uint16_t conn_handle, uint8_t /*iso_direction*/) { // Get the big_id encoded in conn_handle's MSB uint8_t big_id = conn_handle >> 8; auto bit = std::find_if(broadcasts_.begin(), broadcasts_.end(), @@ -924,7 +928,7 @@ TEST_F(StateMachineTest, OnRemoveIsoDataPathError) { } bit->second->OnRemoveIsoDataPath(0, conn_handle); }) - .WillOnce([this](uint16_t conn_handle, uint8_t iso_direction) { + .WillOnce([this](uint16_t conn_handle, uint8_t /*iso_direction*/) { // Get the big_id encoded in conn_handle's MSB uint8_t big_id = conn_handle >> 8; auto bit = std::find_if(broadcasts_.begin(), broadcasts_.end(), @@ -1027,14 +1031,14 @@ TEST_F(StateMachineTest, AnnouncementTest) { EXPECT_CALL(*mock_ble_advertising_manager_, StartAdvertisingSet) .WillOnce([this, &p_data, &a_data, &adv_params]( - uint8_t client_id, int reg_id, - ::BleAdvertiserInterface::IdTxPowerStatusCallback register_cb, + uint8_t /*client_id*/, int /*reg_id*/, + ::BleAdvertiserInterface::IdTxPowerStatusCallback /*register_cb*/, ::AdvertiseParameters params, std::vector<uint8_t> advertise_data, - std::vector<uint8_t> scan_response_data, - ::PeriodicAdvertisingParameters periodic_params, - std::vector<uint8_t> periodic_data, uint16_t duration, - uint8_t maxExtAdvEvents, - ::BleAdvertiserInterface::IdStatusCallback timeout_cb) { + std::vector<uint8_t> /*scan_response_data*/, + ::PeriodicAdvertisingParameters /*periodic_params*/, + std::vector<uint8_t> periodic_data, uint16_t /*duration*/, + uint8_t /*maxExtAdvEvents*/, + ::BleAdvertiserInterface::IdStatusCallback /*timeout_cb*/) { uint8_t advertiser_id = 1; uint8_t tx_power = 0; uint8_t status = 0; @@ -1087,8 +1091,8 @@ TEST_F(StateMachineTest, GetMetadataBeforeGettingAddress) { /* Address should be already known after notifying callback recipients */ EXPECT_CALL(*(sm_callbacks_.get()), OnStateMachineEvent(_, BroadcastStateMachine::State::CONFIGURED, _)) - .WillOnce([this](uint32_t broadcast_id, BroadcastStateMachine::State state, - const void* data) { + .WillOnce([this](uint32_t broadcast_id, BroadcastStateMachine::State /*state*/, + const void* /*data*/) { RawAddress test_address; RawAddress::FromString("00:00:00:00:00:00", test_address); diff --git a/system/bta/le_audio/client.cc b/system/bta/le_audio/client.cc index a0568998e2..20eb101f09 100644 --- a/system/bta/le_audio/client.cc +++ b/system/bta/le_audio/client.cc @@ -2057,8 +2057,8 @@ public: } } - void OnGattReadRsp(tCONN_ID conn_id, tGATT_STATUS status, uint16_t hdl, uint16_t len, - uint8_t* value, void* data) { + void OnGattReadRsp(tCONN_ID conn_id, tGATT_STATUS /*status*/, uint16_t hdl, uint16_t len, + uint8_t* value, void* /*data*/) { LeAudioCharValueHandle(conn_id, hdl, len, value); } @@ -2099,7 +2099,7 @@ public: } } - void OnGattConnected(tGATT_STATUS status, tCONN_ID conn_id, tGATT_IF client_if, + void OnGattConnected(tGATT_STATUS status, tCONN_ID conn_id, tGATT_IF /*client_if*/, RawAddress address, tBT_TRANSPORT transport, uint16_t mtu) { LeAudioDevice* leAudioDevice = leAudioDevices_.FindByAddress(address); @@ -2476,7 +2476,7 @@ public: std::chrono::milliseconds(kCsisGroupMemberDelayMs)); } - void OnGattDisconnected(tCONN_ID conn_id, tGATT_IF client_if, RawAddress address, + void OnGattDisconnected(tCONN_ID conn_id, tGATT_IF /*client_if*/, RawAddress address, tGATT_DISCONN_REASON reason) { LeAudioDevice* leAudioDevice = leAudioDevices_.FindByConnId(conn_id); @@ -2598,8 +2598,8 @@ public: BtaGattQueue::WriteDescriptor( conn_id, ccc_handle, std::move(value), GATT_WRITE, - [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* data) { + [](tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t /*len*/, + const uint8_t* /*value*/, void* data) { if (instance) { instance->OnGattWriteCcc(conn_id, status, handle, data); } @@ -3095,7 +3095,7 @@ public: bluetooth::le_audio::uuid::kCapServiceUuid); } - void OnGattWriteCcc(tCONN_ID conn_id, tGATT_STATUS status, uint16_t hdl, void* data) { + void OnGattWriteCcc(tCONN_ID conn_id, tGATT_STATUS status, uint16_t hdl, void* /*data*/) { LeAudioDevice* leAudioDevice = leAudioDevices_.FindByConnId(conn_id); std::vector<struct ase>::iterator ase_it; @@ -4880,7 +4880,7 @@ public: return remote_metadata; } - bool ReconfigureOrUpdateRemoteForPTS(LeAudioDeviceGroup* group, int remote_direction) { + bool ReconfigureOrUpdateRemoteForPTS(LeAudioDeviceGroup* group, int /*remote_direction*/) { log::info("{}", group->group_id_); // Use common audio stream contexts exposed by the PTS auto override_contexts = AudioContexts(0xFFFF); @@ -6000,8 +6000,10 @@ public: instance->OnGroupMemberRemovedCb(address, group_id); } } - void OnGroupRemoved(const bluetooth::Uuid& uuid, int group_id) { /* to implement if needed */ } - void OnGroupAddFromStorage(const RawAddress& address, const bluetooth::Uuid& uuid, int group_id) { + void OnGroupRemoved(const bluetooth::Uuid& /*uuid*/, + int /*group_id*/) { /* to implement if needed */ } + void OnGroupAddFromStorage(const RawAddress& /*address*/, const bluetooth::Uuid& /*uuid*/, + int /*group_id*/) { /* to implement if needed */ } }; diff --git a/system/bta/le_audio/codec_manager_test.cc b/system/bta/le_audio/codec_manager_test.cc index 13d9afc218..469241ad97 100644 --- a/system/bta/le_audio/codec_manager_test.cc +++ b/system/bta/le_audio/codec_manager_test.cc @@ -132,7 +132,7 @@ std::unique_ptr<LeAudioSourceAudioHalClient> LeAudioSourceAudioHalClient::Acquir return std::move(owned_mock_broadcast_le_audio_source_hal_client_); } -void LeAudioSourceAudioHalClient::DebugDump(int fd) {} +void LeAudioSourceAudioHalClient::DebugDump(int /*fd*/) {} class MockLeAudioSinkHalClient; MockLeAudioSinkHalClient* mock_le_audio_sink_hal_client_; @@ -511,8 +511,9 @@ TEST_F(CodecManagerTestAdsp, test_capabilities_none) { codec_manager->Start(offloading_preference); bool has_null_config = false; - auto match_first_config = [&](const CodecManager::UnicastConfigurationRequirements& requirements, - const set_configurations::AudioSetConfigurations* confs) + auto match_first_config = + [&](const CodecManager::UnicastConfigurationRequirements& /*requirements*/, + const set_configurations::AudioSetConfigurations* confs) -> std::unique_ptr<set_configurations::AudioSetConfiguration> { // Don't expect the matcher being called on nullptr if (confs == nullptr) { @@ -559,7 +560,7 @@ TEST_F(CodecManagerTestAdsp, test_capabilities) { size_t available_configs_size = 0; auto match_first_config = [&available_configs_size]( - const CodecManager::UnicastConfigurationRequirements& requirements, + const CodecManager::UnicastConfigurationRequirements& /*requirements*/, const set_configurations::AudioSetConfigurations* confs) -> std::unique_ptr<set_configurations::AudioSetConfiguration> { if (confs && confs->size()) { @@ -990,7 +991,7 @@ TEST_F(CodecManagerTestHost, test_dual_bidir_swb_supported) { bool got_null_cfgs_container = false; auto ptr = codec_manager->GetCodecConfig( {.audio_context_type = context}, - [&](const CodecManager::UnicastConfigurationRequirements& requirements, + [&](const CodecManager::UnicastConfigurationRequirements& /*requirements*/, const set_configurations::AudioSetConfigurations* confs) -> std::unique_ptr<set_configurations::AudioSetConfiguration> { if (confs == nullptr) { @@ -1040,7 +1041,7 @@ TEST_F(CodecManagerTestAdsp, test_dual_bidir_swb_supported) { bool got_null_cfgs_container = false; auto ptr = codec_manager->GetCodecConfig( {.audio_context_type = context}, - [&](const CodecManager::UnicastConfigurationRequirements& requirements, + [&](const CodecManager::UnicastConfigurationRequirements& /*requirements*/, const set_configurations::AudioSetConfigurations* confs) -> std::unique_ptr<set_configurations::AudioSetConfiguration> { if (confs == nullptr) { @@ -1072,7 +1073,7 @@ TEST_F(CodecManagerTestHostNoSwb, test_dual_bidir_swb_not_supported) { bool got_null_cfgs_container = false; auto ptr = codec_manager->GetCodecConfig( {.audio_context_type = context}, - [&](const CodecManager::UnicastConfigurationRequirements& requirements, + [&](const CodecManager::UnicastConfigurationRequirements& /*requirements*/, const set_configurations::AudioSetConfigurations* confs) -> std::unique_ptr<set_configurations::AudioSetConfiguration> { if (confs == nullptr) { @@ -1121,7 +1122,7 @@ TEST_F(CodecManagerTestAdspNoSwb, test_dual_bidir_swb_not_supported) { bool got_null_cfgs_container = false; auto ptr = codec_manager->GetCodecConfig( {.audio_context_type = context}, - [&](const CodecManager::UnicastConfigurationRequirements& requirements, + [&](const CodecManager::UnicastConfigurationRequirements& /*requirements*/, const set_configurations::AudioSetConfigurations* confs) -> std::unique_ptr<set_configurations::AudioSetConfiguration> { if (confs == nullptr) { @@ -1149,8 +1150,9 @@ TEST_F(CodecManagerTestHost, test_dont_update_broadcast_offloader) { bool was_called = false; codec_manager->UpdateBroadcastConnHandle( - {0x0001, 0x0002}, - [&](const bluetooth::le_audio::broadcast_offload_config& config) { was_called = true; }); + {0x0001, 0x0002}, [&](const bluetooth::le_audio::broadcast_offload_config& /*config*/) { + was_called = true; + }); // Expect no call for HOST encoding ASSERT_FALSE(was_called); diff --git a/system/bta/le_audio/devices.cc b/system/bta/le_audio/devices.cc index 28b9be0eed..d0b9b528af 100644 --- a/system/bta/le_audio/devices.cc +++ b/system/bta/le_audio/devices.cc @@ -1296,7 +1296,7 @@ LeAudioDevice* LeAudioDevices::FindByCisConnHdl(uint8_t cig_id, uint16_t conn_hd } void LeAudioDevices::SetInitialGroupAutoconnectState(int group_id, int gatt_if, - tBTM_BLE_CONN_TYPE reconnection_mode, + tBTM_BLE_CONN_TYPE /*reconnection_mode*/, bool current_dev_autoconnect_flag) { if (!current_dev_autoconnect_flag) { /* If current device autoconnect flag is false, check if there is other diff --git a/system/bta/le_audio/devices_test.cc b/system/bta/le_audio/devices_test.cc index d9845b2deb..1ad0684ce6 100644 --- a/system/bta/le_audio/devices_test.cc +++ b/system/bta/le_audio/devices_test.cc @@ -39,7 +39,9 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" -tACL_CONN* btm_bda_to_acl(const RawAddress& bda, tBT_TRANSPORT transport) { return nullptr; } +tACL_CONN* btm_bda_to_acl(const RawAddress& /*bda*/, tBT_TRANSPORT /*transport*/) { + return nullptr; +} namespace bluetooth { namespace le_audio { @@ -523,12 +525,12 @@ protected: MockCsisClient::SetMockInstanceForTesting(&mock_csis_client_module_); ON_CALL(mock_csis_client_module_, Get()).WillByDefault(Return(&mock_csis_client_module_)); ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); - ON_CALL(mock_csis_client_module_, GetDeviceList(_)).WillByDefault(Invoke([this](int group_id) { - return addresses_; - })); - ON_CALL(mock_csis_client_module_, GetDesiredSize(_)).WillByDefault(Invoke([this](int group_id) { - return desired_group_size_ > 0 ? desired_group_size_ : (int)(addresses_.size()); - })); + ON_CALL(mock_csis_client_module_, GetDeviceList(_)) + .WillByDefault(Invoke([this](int /*group_id*/) { return addresses_; })); + ON_CALL(mock_csis_client_module_, GetDesiredSize(_)) + .WillByDefault(Invoke([this](int /*group_id*/) { + return desired_group_size_ > 0 ? desired_group_size_ : (int)(addresses_.size()); + })); SetUpMockCodecManager(codec_location); } diff --git a/system/bta/le_audio/le_audio_client_test.cc b/system/bta/le_audio/le_audio_client_test.cc index 9b9498aa0f..28ca1826fc 100644 --- a/system/bta/le_audio/le_audio_client_test.cc +++ b/system/bta/le_audio/le_audio_client_test.cc @@ -135,7 +135,7 @@ bt_status_t do_in_main_thread(base::OnceClosure task) { return BT_STATUS_SUCCESS; } -bt_status_t do_in_main_thread_delayed(base::OnceClosure task, std::chrono::microseconds delay) { +bt_status_t do_in_main_thread_delayed(base::OnceClosure task, std::chrono::microseconds /*delay*/) { /* For testing purpose it is ok to just skip delay */ return do_in_main_thread(std::move(task)); } @@ -164,8 +164,8 @@ static void cleanup_message_loop_thread() { message_loop_thread.ShutDown(); } -void invoke_switch_codec_cb(bool is_low_latency_buffer_size) {} -void invoke_switch_buffer_size_cb(bool is_low_latency_buffer_size) {} +void invoke_switch_codec_cb(bool /*is_low_latency_buffer_size*/) {} +void invoke_switch_buffer_size_cb(bool /*is_low_latency_buffer_size*/) {} const std::string kSmpOptions("mock smp options"); bool get_pts_avrcp_test(void) { return false; } @@ -219,7 +219,7 @@ std::unique_ptr<LeAudioSourceAudioHalClient> LeAudioSourceAudioHalClient::Acquir return std::move(owned_mock_le_audio_source_hal_client_); } -void LeAudioSourceAudioHalClient::DebugDump(int fd) {} +void LeAudioSourceAudioHalClient::DebugDump(int /*fd*/) {} class MockLeAudioSinkHalClient; MockLeAudioSinkHalClient* mock_le_audio_sink_hal_client_; @@ -234,7 +234,7 @@ std::unique_ptr<LeAudioSinkAudioHalClient> LeAudioSinkAudioHalClient::AcquireUni return std::move(owned_mock_le_audio_sink_hal_client_); } -void LeAudioSinkAudioHalClient::DebugDump(int fd) {} +void LeAudioSinkAudioHalClient::DebugDump(int /*fd*/) {} RawAddress GetTestAddress(uint8_t index) { EXPECT_LT(index, UINT8_MAX); @@ -340,9 +340,9 @@ protected: is_audio_unicast_source_acquired = false; ON_CALL(*mock_le_audio_source_hal_client_, Start(_, _, _)) - .WillByDefault([this](const LeAudioCodecConfiguration& codec_configuration, + .WillByDefault([this](const LeAudioCodecConfiguration& /*codec_configuration*/, LeAudioSourceAudioHalClient::Callbacks* audioReceiver, - DsaModes dsa_modes) { + DsaModes /*dsa_modes*/) { unicast_source_hal_cb_ = audioReceiver; return true; }); @@ -359,9 +359,9 @@ protected: is_audio_unicast_sink_acquired = false; ON_CALL(*mock_le_audio_sink_hal_client_, Start(_, _, _)) - .WillByDefault([this](const LeAudioCodecConfiguration& codec_configuration, + .WillByDefault([this](const LeAudioCodecConfiguration& /*codec_configuration*/, LeAudioSinkAudioHalClient::Callbacks* audioReceiver, - DsaModes dsa_modes) { + DsaModes /*dsa_modes*/) { unicast_sink_hal_cb_ = audioReceiver; return true; }); @@ -387,9 +387,9 @@ protected: is_audio_unicast_source_acquired = false; ON_CALL(*mock_le_audio_source_hal_client_, Start(_, _, _)) - .WillByDefault([this](const LeAudioCodecConfiguration& codec_configuration, + .WillByDefault([this](const LeAudioCodecConfiguration& /*codec_configuration*/, LeAudioSourceAudioHalClient::Callbacks* audioReceiver, - DsaModes dsa_modes) { + DsaModes /*dsa_modes*/) { unicast_source_hal_cb_ = audioReceiver; return true; }); @@ -400,9 +400,9 @@ protected: is_audio_unicast_sink_acquired = false; ON_CALL(*mock_le_audio_sink_hal_client_, Start(_, _, _)) - .WillByDefault([this](const LeAudioCodecConfiguration& codec_configuration, + .WillByDefault([this](const LeAudioCodecConfiguration& /*codec_configuration*/, LeAudioSinkAudioHalClient::Callbacks* audioReceiver, - DsaModes dsa_modes) { + DsaModes /*dsa_modes*/) { unicast_sink_hal_cb_ = audioReceiver; return true; }); @@ -412,7 +412,7 @@ protected: }); ON_CALL(*mock_le_audio_sink_hal_client_, SendData) - .WillByDefault([](uint8_t* data, uint16_t size) { return size; }); + .WillByDefault([](uint8_t* /*data*/, uint16_t size) { return size; }); // HAL ON_CALL(mock_hal_2_1_verifier, Call()).WillByDefault([]() -> bool { return true; }); @@ -641,8 +641,9 @@ protected: // default action for WriteDescriptor function call ON_CALL(mock_gatt_queue_, WriteDescriptor(_, _, _, _, _, _)) .WillByDefault(Invoke([this](uint16_t conn_id, uint16_t handle, - std::vector<uint8_t> value, tGATT_WRITE_TYPE write_type, - GATT_WRITE_OP_CB cb, void* cb_data) -> void { + std::vector<uint8_t> value, + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, + void* cb_data) -> void { auto& ascs = peer_devices.at(conn_id)->ascs; uint8_t idx; @@ -673,8 +674,8 @@ protected: global_conn_id = 1; ON_CALL(mock_gatt_interface_, Open(_, _, BTM_BLE_DIRECT_CONNECTION, _)) - .WillByDefault(Invoke([&](tGATT_IF client_if, const RawAddress& remote_bda, - bool is_direct, bool opportunistic) { + .WillByDefault(Invoke([&](tGATT_IF /*client_if*/, const RawAddress& remote_bda, + bool /*is_direct*/, bool /*opportunistic*/) { InjectConnectedEvent(remote_bda, global_conn_id++); })); @@ -804,7 +805,7 @@ protected: ON_CALL(mock_groups_module_, Initialize(_)).WillByDefault(SaveArg<0>(&group_callbacks_)); ON_CALL(mock_groups_module_, GetGroupId(_, _)) - .WillByDefault([this](const RawAddress& addr, bluetooth::Uuid uuid) { + .WillByDefault([this](const RawAddress& addr, bluetooth::Uuid /*uuid*/) { if (groups.find(addr) != groups.end()) { return groups.at(addr); } @@ -812,7 +813,7 @@ protected: }); ON_CALL(mock_groups_module_, RemoveDevice(_, _)) - .WillByDefault([this](const RawAddress& addr, int group_id_) { + .WillByDefault([this](const RawAddress& addr, int /*group_id*/) { int group_id = -1; if (groups.find(addr) != groups.end()) { group_id = groups[addr]; @@ -833,20 +834,21 @@ protected: // Our test devices have unique LSB - use it for unique grouping when // devices added with a non-CIS context and no grouping info ON_CALL(mock_groups_module_, AddDevice(_, bluetooth::le_audio::uuid::kCapServiceUuid, _)) - .WillByDefault([this](const RawAddress& addr, - bluetooth::Uuid uuid = bluetooth::le_audio::uuid::kCapServiceUuid, - int group_id = bluetooth::groups::kGroupUnknown) -> int { - if (group_id == bluetooth::groups::kGroupUnknown) { - /* Generate group id from address */ - groups[addr] = addr.address[RawAddress::kLength - 1]; - group_id = groups[addr]; - } else { - groups[addr] = group_id; - } + .WillByDefault( + [this](const RawAddress& addr, + bluetooth::Uuid /*uuid*/ = bluetooth::le_audio::uuid::kCapServiceUuid, + int group_id = bluetooth::groups::kGroupUnknown) -> int { + if (group_id == bluetooth::groups::kGroupUnknown) { + /* Generate group id from address */ + groups[addr] = addr.address[RawAddress::kLength - 1]; + group_id = groups[addr]; + } else { + groups[addr] = group_id; + } - InjectGroupDeviceAdded(addr, groups[addr]); - return addr.address[RawAddress::kLength - 1]; - }); + InjectGroupDeviceAdded(addr, groups[addr]); + return addr.address[RawAddress::kLength - 1]; + }); ON_CALL(mock_state_machine_, Initialize(_)) .WillByDefault(SaveArg<0>(&state_machine_callbacks_)); @@ -1721,14 +1723,14 @@ protected: void DisconnectLeAudioWithGattClose( const RawAddress& address, uint16_t conn_id, - tGATT_DISCONN_REASON reason = GATT_CONN_TERMINATE_LOCAL_HOST) { + tGATT_DISCONN_REASON /*reason*/ = GATT_CONN_TERMINATE_LOCAL_HOST) { EXPECT_CALL(mock_audio_hal_client_callbacks_, OnConnectionState(ConnectionState::DISCONNECTED, address)) .Times(1); // For test purpose use the acl handle same as conn_id ON_CALL(mock_btm_interface_, GetHCIConnHandle(address, _)) - .WillByDefault([conn_id](RawAddress const& bd_addr, tBT_TRANSPORT transport) { + .WillByDefault([conn_id](RawAddress const& /*bd_addr*/, tBT_TRANSPORT /*transport*/) { return conn_id; }); EXPECT_CALL(mock_btm_interface_, AclDisconnectFromHandle(conn_id, _)).Times(0); @@ -1750,11 +1752,11 @@ protected: // For test purpose use the acl handle same as conn_id ON_CALL(mock_btm_interface_, GetHCIConnHandle(address, _)) - .WillByDefault([conn_id](RawAddress const& bd_addr, tBT_TRANSPORT transport) { + .WillByDefault([conn_id](RawAddress const& /*bd_addr*/, tBT_TRANSPORT /*transport*/) { return conn_id; }); EXPECT_CALL(mock_btm_interface_, AclDisconnectFromHandle(conn_id, _)) - .WillOnce([this, &reason](uint16_t handle, tHCI_STATUS rs) { + .WillOnce([this, &reason](uint16_t handle, tHCI_STATUS /*rs*/) { InjectDisconnectedEvent(handle, reason); }); EXPECT_CALL(mock_gatt_interface_, Close(conn_id)).Times(0); @@ -1949,7 +1951,7 @@ protected: Mock::VerifyAndClearExpectations(mock_le_audio_sink_hal_client_); } - void StartStreaming(audio_usage_t usage, audio_content_type_t content_type, int group_id, + void StartStreaming(audio_usage_t usage, audio_content_type_t content_type, int /*group_id*/, audio_source_t audio_source = AUDIO_SOURCE_INVALID, bool reconfigure_existing_stream = false, bool expected_resume_confirmation = true) { @@ -1978,7 +1980,7 @@ protected: SyncOnMainLoop(); } - void StopStreaming(int group_id, bool suspend_source = false) { + void StopStreaming(int /*group_id*/, bool suspend_source = false) { ASSERT_NE(unicast_source_hal_cb_, nullptr); /* TODO We should have a way to confirm Stop() otherwise, audio framework @@ -2579,8 +2581,8 @@ protected: if (cis_count_out) { EXPECT_CALL(*mock_iso_manager_, SendIsoData(_, _, _)) .Times(cis_count_out) - .WillRepeatedly([&handles](uint16_t iso_handle, const uint8_t* data, - uint16_t data_len) { handles.push_back(iso_handle); }); + .WillRepeatedly([&handles](uint16_t iso_handle, const uint8_t* /*data*/, + uint16_t /*data_len*/) { handles.push_back(iso_handle); }); } std::vector<uint8_t> data(data_len); unicast_source_hal_cb_->OnAudioDataReady(data); @@ -2729,17 +2731,18 @@ protected: EXPECT_CALL(mock_storage_load, Call()).Times(1); ON_CALL(mock_btm_interface_, GetHCIConnHandle(_, _)) - .WillByDefault([this](RawAddress const& bd_addr, tBT_TRANSPORT transport) -> uint16_t { - for (auto const& [conn_id, dev_wrapper] : peer_devices) { - if (dev_wrapper->addr == bd_addr) { - return conn_id; - } - } - log::error("GetHCIConnHandle Mock: not a valid test device!"); - return 0x00FE; - }); + .WillByDefault( + [this](RawAddress const& bd_addr, tBT_TRANSPORT /*transport*/) -> uint16_t { + for (auto const& [conn_id, dev_wrapper] : peer_devices) { + if (dev_wrapper->addr == bd_addr) { + return conn_id; + } + } + log::error("GetHCIConnHandle Mock: not a valid test device!"); + return 0x00FE; + }); ON_CALL(mock_btm_interface_, AclDisconnectFromHandle(_, _)) - .WillByDefault([this](uint16_t handle, tHCI_STATUS rs) { + .WillByDefault([this](uint16_t handle, tHCI_STATUS /*rs*/) { ASSERT_NE(handle, GATT_INVALID_CONN_ID); InjectDisconnectedEvent(handle, GATT_CONN_TERMINATE_LOCAL_HOST); }); @@ -3097,7 +3100,7 @@ TEST_F(UnicastTest, ConnectOneEarbudWithInvalidCsis) { /* Make sure Group has not knowledge about the device */ ON_CALL(mock_groups_module_, GetGroupId(_, _)) - .WillByDefault([](const RawAddress& addr, bluetooth::Uuid uuid) { + .WillByDefault([](const RawAddress& /*addr*/, bluetooth::Uuid /*uuid*/) { return bluetooth::groups::kGroupUnknown; }); @@ -3242,7 +3245,7 @@ TEST_F(UnicastTestHealthStatus, ConnectOneEarbudWithInvalidCsis_withHealthStatus /* Make sure Group has not knowledge about the device */ ON_CALL(mock_groups_module_, GetGroupId(_, _)) - .WillByDefault([](const RawAddress& addr, bluetooth::Uuid uuid) { + .WillByDefault([](const RawAddress& /*addr*/, bluetooth::Uuid /*uuid*/) { return bluetooth::groups::kGroupUnknown; }); @@ -5089,7 +5092,7 @@ TEST_F(UnicastTest, TestUpdateConfigurationCallbackWhileStreaming) { do_in_main_thread(base::BindOnce( [](int group_id, bluetooth::le_audio::LeAudioGroupStateMachine::Callbacks* state_machine_callbacks, - LeAudioDeviceGroup* group) { + LeAudioDeviceGroup* /*group*/) { state_machine_callbacks->StatusReportCb(group_id, GroupStreamStatus::STREAMING); }, group_id, base::Unretained(this->state_machine_callbacks_), std::move(group))); @@ -5128,7 +5131,7 @@ TEST_F(UnicastTest, TestDeactivateWhileStartingStream) { do_in_main_thread(base::BindOnce( [](int group_id, bluetooth::le_audio::LeAudioGroupStateMachine::Callbacks* state_machine_callbacks, - LeAudioDeviceGroup* group) { + LeAudioDeviceGroup* /*group*/) { state_machine_callbacks->StatusReportCb(group_id, GroupStreamStatus::STREAMING); }, group_id, base::Unretained(this->state_machine_callbacks_), std::move(group))); @@ -6411,7 +6414,7 @@ TEST_F(UnicastTest, TwoEarbudsStreaming) { // Report working CSIS ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -7822,7 +7825,7 @@ TEST_F(UnicastTest, StreamingVxAospSampleSound) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -7873,7 +7876,7 @@ TEST_F(UnicastTest, UpdateActiveAudioConfigForLocalSinkSource) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -7899,7 +7902,7 @@ TEST_F(UnicastTest, UpdateActiveAudioConfigForLocalSinkSource) { EXPECT_CALL(*mock_le_audio_source_hal_client_, UpdateAudioConfigToHal(_)).Times(1); EXPECT_CALL(*mock_codec_manager_, UpdateActiveAudioConfig(_, _, _)) .Times(1) - .WillOnce([](const types::BidirectionalPair<stream_parameters>& stream_params, + .WillOnce([](const types::BidirectionalPair<stream_parameters>& /*stream_params*/, types::BidirectionalPair<uint16_t> delays_ms, std::function<void(const offload_config& config, uint8_t direction)> update_receiver) { @@ -7936,7 +7939,7 @@ TEST_F(UnicastTest, UpdateActiveAudioConfigForLocalSource) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -7961,7 +7964,7 @@ TEST_F(UnicastTest, UpdateActiveAudioConfigForLocalSource) { EXPECT_CALL(*mock_le_audio_sink_hal_client_, UpdateAudioConfigToHal(_)).Times(0); EXPECT_CALL(*mock_codec_manager_, UpdateActiveAudioConfig(_, _, _)) .Times(1) - .WillOnce([](const types::BidirectionalPair<stream_parameters>& stream_params, + .WillOnce([](const types::BidirectionalPair<stream_parameters>& /*stream_params*/, types::BidirectionalPair<uint16_t> delays_ms, std::function<void(const offload_config& config, uint8_t direction)> update_receiver) { @@ -7997,7 +8000,7 @@ TEST_F(UnicastTest, TwoEarbudsStreamingContextSwitchNoReconfigure) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -8085,7 +8088,7 @@ TEST_F(UnicastTest, TwoEarbudsStopConversational_StartStreamSonification) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -8169,7 +8172,7 @@ TEST_F(UnicastTest, TwoEarbudsStreamingContextSwitchReconfigure) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -8267,7 +8270,7 @@ TEST_F(UnicastTest, TwoEarbudsStreamingContextSwitchReconfigure_SpeedUpReconfigF ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -8398,7 +8401,7 @@ TEST_F(UnicastTest, TwoEarbudsVoipStreamingVerifyMetadataUpdate) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -8467,7 +8470,7 @@ TEST_F(UnicastTest, TwoReconfigureAndVerifyEnableContextType) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -8550,7 +8553,7 @@ TEST_F(UnicastTest, TwoEarbuds2ndLateConnect) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -8608,7 +8611,7 @@ TEST_F(UnicastTest, LateStreamConnectBasedOnContextType) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -8685,7 +8688,7 @@ TEST_F(UnicastTest, LateStreamConnectBasedOnContextTypeNotFullyConnected) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -8746,7 +8749,7 @@ TEST_F(UnicastTest, CheckDeviceIsNotAttachedToStreamWhenNotNeeded) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -8821,7 +8824,7 @@ TEST_F(UnicastTest, ReconnectedDeviceAndAttachedToStreamBecauseOfAvailableContex ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -8919,7 +8922,7 @@ TEST_F(UnicastTest, ReconnectedDeviceNotAttachedToStreamBecauseOfNotAvailableCon ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -9019,7 +9022,7 @@ TEST_F(UnicastTest, TwoEarbuds2ndReleaseAseRemoveAvailableContextAndBack) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -9107,7 +9110,7 @@ TEST_F(UnicastTest, StartStream_AvailableContextTypeNotifiedLater) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -9168,7 +9171,7 @@ TEST_F(UnicastTest, ModifyContextTypeOnDeviceA_WhileDeviceB_IsDisconnected) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -9258,7 +9261,7 @@ TEST_F(UnicastTest, StartStreamToUnsupportedContextTypeUsingUnspecified) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -9327,7 +9330,7 @@ TEST_F(UnicastTest, StartStreamToUnsupportedContextTypeUnspecifiedNotAvailable) ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -9406,7 +9409,7 @@ TEST_F(UnicastTest, StartStreamToSupportedContextTypeThenMixUnavailable) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); const RawAddress test_address0 = GetTestAddress(0); const RawAddress test_address1 = GetTestAddress(1); @@ -9529,7 +9532,7 @@ TEST_F(UnicastTest, TwoEarbuds2ndDisconnected) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -9580,7 +9583,7 @@ TEST_F(UnicastTest, TwoEarbuds2ndDisconnected) { int num_of_connected = 0; ON_CALL(mock_state_machine_, ProcessHciNotifAclDisconnected(_, _)) .WillByDefault( - [&num_of_connected](LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice) { + [&num_of_connected](LeAudioDeviceGroup* group, LeAudioDevice* /*leAudioDevice*/) { num_of_connected = group->NumOfConnected(); }); @@ -9616,7 +9619,7 @@ TEST_F(UnicastTest, TwoEarbudsStreamingProfileDisconnect) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -9675,7 +9678,7 @@ TEST_F(UnicastTest, TwoEarbudsStreamingProfileDisconnectStreamStopTimeout) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -11195,7 +11198,7 @@ TEST_F(UnicastTest, AddMemberToAllowListWhenOneDeviceConnected) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -11252,7 +11255,7 @@ TEST_F(UnicastTest, ResetToDefaultReconnectionMode) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -11674,7 +11677,7 @@ TEST_F(UnicastTestHandoverMode, SetSinkMonitorModeWhileUnicastIsActive) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -11820,7 +11823,7 @@ TEST_F(UnicastTestHandoverMode, SetSinkMonitorModeWhileUnicastIsInactive) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -11914,7 +11917,7 @@ TEST_F(UnicastTestHandoverMode, ClearSinkMonitorModeWhileUnicastIsActive) { ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return group_size; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return group_size; })); // First earbud const RawAddress test_address0 = GetTestAddress(0); @@ -12075,7 +12078,7 @@ TEST_F(UnicastTestHandoverMode, SetSourceMonitorModeWhileUnicastIsActive) { true /*connect_through_csis*/); ON_CALL(mock_csis_client_module_, GetDesiredSize(group_id)) - .WillByDefault(Invoke([&](int group_id) { return 2; })); + .WillByDefault(Invoke([&](int /*group_id*/) { return 2; })); // Start streaming EXPECT_CALL(*mock_le_audio_source_hal_client_, Start(_, _, _)).Times(1); @@ -12395,9 +12398,9 @@ TEST_F(UnicastTest, CodecFrameBlocks2) { ON_CALL(*mock_codec_manager_, UpdateActiveAudioConfig) .WillByDefault( Invoke([&](const types::BidirectionalPair<stream_parameters>& stream_params, - types::BidirectionalPair<uint16_t> delays_ms, + types::BidirectionalPair<uint16_t> /*delays_ms*/, std::function<void(const offload_config& config, uint8_t direction)> - updater) { codec_manager_stream_params = stream_params; })); + /*updater*/) { codec_manager_stream_params = stream_params; })); const RawAddress test_address0 = GetTestAddress(0); int group_id = bluetooth::groups::kGroupUnknown; diff --git a/system/bta/le_audio/metrics_collector_linux.cc b/system/bta/le_audio/metrics_collector_linux.cc index e505ce0e1a..de2c267b8e 100644 --- a/system/bta/le_audio/metrics_collector_linux.cc +++ b/system/bta/le_audio/metrics_collector_linux.cc @@ -28,18 +28,18 @@ MetricsCollector* MetricsCollector::Get() { return MetricsCollector::instance; } -void MetricsCollector::OnGroupSizeUpdate(int32_t group_id, int32_t group_size) {} +void MetricsCollector::OnGroupSizeUpdate(int32_t /*group_id*/, int32_t /*group_size*/) {} -void MetricsCollector::OnConnectionStateChanged(int32_t group_id, const RawAddress& address, - bluetooth::le_audio::ConnectionState state, - ConnectionStatus status) {} +void MetricsCollector::OnConnectionStateChanged(int32_t /*group_id*/, const RawAddress& /*address*/, + bluetooth::le_audio::ConnectionState /*state*/, + ConnectionStatus /*status*/) {} void MetricsCollector::OnStreamStarted( - int32_t group_id, bluetooth::le_audio::types::LeAudioContextType context_type) {} + int32_t /*group_id*/, bluetooth::le_audio::types::LeAudioContextType /*context_type*/) {} -void MetricsCollector::OnStreamEnded(int32_t group_id) {} +void MetricsCollector::OnStreamEnded(int32_t /*group_id*/) {} -void MetricsCollector::OnBroadcastStateChanged(bool started) {} +void MetricsCollector::OnBroadcastStateChanged(bool /*started*/) {} void MetricsCollector::Flush() {} diff --git a/system/bta/le_audio/mock_codec_interface.cc b/system/bta/le_audio/mock_codec_interface.cc index 67c88d136d..fb1655af43 100644 --- a/system/bta/le_audio/mock_codec_interface.cc +++ b/system/bta/le_audio/mock_codec_interface.cc @@ -24,7 +24,7 @@ namespace bluetooth::le_audio { struct CodecInterface::Impl : public MockCodecInterface { public: - Impl(const types::LeAudioCodecId& codec_id) { output_channel_data_.resize(1); } + Impl(const types::LeAudioCodecId& /*codec_id*/) { output_channel_data_.resize(1); } ~Impl() = default; std::vector<int16_t>& GetDecodedSamples() { return output_channel_data_; } diff --git a/system/bta/le_audio/state_machine.cc b/system/bta/le_audio/state_machine.cc index d21b831ba3..e3e3b9c481 100644 --- a/system/bta/le_audio/state_machine.cc +++ b/system/bta/le_audio/state_machine.cc @@ -481,7 +481,7 @@ public: } } - void ProcessHciNotifOnCigCreate(LeAudioDeviceGroup* group, uint8_t status, uint8_t cig_id, + void ProcessHciNotifOnCigCreate(LeAudioDeviceGroup* group, uint8_t status, uint8_t /*cig_id*/, std::vector<uint16_t> conn_handles) override { /* TODO: What if not all cises will be configured ? * conn_handle.size() != active ases in group @@ -717,9 +717,10 @@ public: } } - void ProcessHciNotifIsoLinkQualityRead(LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice, - uint8_t conn_handle, uint32_t txUnackedPackets, - uint32_t txFlushedPackets, uint32_t txLastSubeventPackets, + void ProcessHciNotifIsoLinkQualityRead(LeAudioDeviceGroup* /*group*/, + LeAudioDevice* /*leAudioDevice*/, uint8_t conn_handle, + uint32_t txUnackedPackets, uint32_t txFlushedPackets, + uint32_t txLastSubeventPackets, uint32_t retransmittedPackets, uint32_t crcErrorPackets, uint32_t rxUnreceivedPackets, uint32_t duplicatePackets) { log::info( @@ -1766,9 +1767,9 @@ private: return nullptr; } - void AseStateMachineProcessIdle(struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& arh, - struct ase* ase, LeAudioDeviceGroup* group, - LeAudioDevice* leAudioDevice) { + void AseStateMachineProcessIdle( + struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& /*arh*/, struct ase* ase, + LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice) { switch (ase->state) { case AseState::BTA_LE_AUDIO_ASE_STATE_IDLE: case AseState::BTA_LE_AUDIO_ASE_STATE_CODEC_CONFIGURED: @@ -1913,7 +1914,7 @@ private: } void AseStateMachineProcessCodecConfigured( - struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& arh, struct ase* ase, + struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& /*arh*/, struct ase* ase, uint8_t* data, uint16_t len, LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice) { if (!group) { log::error("leAudioDevice doesn't belong to any group"); @@ -2225,7 +2226,7 @@ private: } void AseStateMachineProcessQosConfigured( - struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& arh, struct ase* ase, + struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& /*arh*/, struct ase* ase, LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice) { if (!group) { log::error("leAudioDevice doesn't belong to any group"); @@ -2711,7 +2712,7 @@ private: } void AseStateMachineProcessEnabling( - struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& arh, struct ase* ase, + struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& /*arh*/, struct ase* ase, LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice) { if (!group) { log::error("leAudioDevice doesn't belong to any group"); @@ -2779,7 +2780,7 @@ private: } void AseStateMachineProcessStreaming( - struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& arh, struct ase* ase, + struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& /*arh*/, struct ase* ase, uint8_t* data, uint16_t len, LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice) { if (!group) { log::error("leAudioDevice doesn't belong to any group"); @@ -2866,7 +2867,7 @@ private: } void AseStateMachineProcessDisabling( - struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& arh, struct ase* ase, + struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& /*arh*/, struct ase* ase, LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice) { if (!group) { log::error("leAudioDevice doesn't belong to any group"); @@ -2953,7 +2954,7 @@ private: } void AseStateMachineProcessReleasing( - struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& arh, struct ase* ase, + struct bluetooth::le_audio::client_parser::ascs::ase_rsp_hdr& /*arh*/, struct ase* ase, LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice) { if (!group) { log::error("leAudioDevice doesn't belong to any group"); diff --git a/system/bta/le_audio/state_machine_test.cc b/system/bta/le_audio/state_machine_test.cc index 02212d6dbf..ed44a5003f 100644 --- a/system/bta/le_audio/state_machine_test.cc +++ b/system/bta/le_audio/state_machine_test.cc @@ -283,17 +283,15 @@ protected: MockCsisClient::SetMockInstanceForTesting(&mock_csis_client_module_); ON_CALL(mock_csis_client_module_, Get()).WillByDefault(Return(&mock_csis_client_module_)); ON_CALL(mock_csis_client_module_, IsCsisClientRunning()).WillByDefault(Return(true)); - ON_CALL(mock_csis_client_module_, GetDeviceList(_)).WillByDefault(Invoke([this](int group_id) { - return addresses_; - })); - ON_CALL(mock_csis_client_module_, GetDesiredSize(_)).WillByDefault(Invoke([this](int group_id) { - return (int)(addresses_.size()); - })); + ON_CALL(mock_csis_client_module_, GetDeviceList(_)) + .WillByDefault(Invoke([this](int /*group_id*/) { return addresses_; })); + ON_CALL(mock_csis_client_module_, GetDesiredSize(_)) + .WillByDefault(Invoke([this](int /*group_id*/) { return (int)(addresses_.size()); })); // Support 2M Phy ON_CALL(btm_interface, IsPhy2mSupported(_, _)).WillByDefault(Return(true)); ON_CALL(btm_interface, GetHCIConnHandle(_, _)) - .WillByDefault(Invoke([](RawAddress const& remote_bda, tBT_TRANSPORT transport) { + .WillByDefault(Invoke([](RawAddress const& remote_bda, tBT_TRANSPORT /*transport*/) { return remote_bda.IsEmpty() ? HCI_INVALID_HANDLE : ((uint16_t)(remote_bda.address[0] ^ remote_bda.address[1] ^ @@ -304,9 +302,9 @@ protected: })); ON_CALL(gatt_queue, WriteCharacteristic(_, _, _, GATT_WRITE_NO_RSP, _, _)) - .WillByDefault( - Invoke([this](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, void* cb_data) { + .WillByDefault(Invoke( + [this](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, void* cb_data) { for (auto& dev : le_audio_devices_) { if (dev->conn_id_ == conn_id) { // Control point write handler @@ -396,7 +394,7 @@ protected: } }); - ON_CALL(*mock_iso_manager_, RemoveCig).WillByDefault([this](uint8_t cig_id, bool force) { + ON_CALL(*mock_iso_manager_, RemoveCig).WillByDefault([this](uint8_t cig_id, bool /*force*/) { log::debug("CreateRemove"); auto& group = le_audio_device_groups_[cig_id]; @@ -408,7 +406,7 @@ protected: ON_CALL(*mock_iso_manager_, SetupIsoDataPath) .WillByDefault([this](uint16_t conn_handle, - bluetooth::hci::iso_manager::iso_data_path_params p) { + bluetooth::hci::iso_manager::iso_data_path_params /*p*/) { log::debug("SetupIsoDataPath"); ASSERT_NE(conn_handle, kInvalidCisConnHandle); @@ -434,7 +432,7 @@ protected: }); ON_CALL(*mock_iso_manager_, RemoveIsoDataPath) - .WillByDefault([this](uint16_t conn_handle, uint8_t iso_direction) { + .WillByDefault([this](uint16_t conn_handle, uint8_t /*iso_direction*/) { log::debug("RemoveIsoDataPath"); ASSERT_NE(conn_handle, kInvalidCisConnHandle); @@ -1204,7 +1202,7 @@ protected: ON_CALL(ase_ctp_handler, AseCtpConfigureCodecHandler) .WillByDefault(Invoke([group, verify_ase_count, caching, inject_configured, this]( LeAudioDevice* device, std::vector<uint8_t> value, - GATT_WRITE_OP_CB cb, void* cb_data) { + GATT_WRITE_OP_CB /*cb*/, void* /*cb_data*/) { auto num_ase = value[1]; // Verify ase count if needed @@ -1275,7 +1273,7 @@ protected: ON_CALL(ase_ctp_handler, AseCtpConfigureQosHandler) .WillByDefault(Invoke([group, verify_ase_count, caching, inject_qos_configured, this]( LeAudioDevice* device, std::vector<uint8_t> value, - GATT_WRITE_OP_CB cb, void* cb_data) { + GATT_WRITE_OP_CB /*cb*/, void* /*cb_data*/) { auto num_ase = value[1]; // Verify ase count if needed @@ -1347,7 +1345,7 @@ protected: uint8_t reason) { auto foo = [group, opcode, response_code, reason](LeAudioDevice* device, std::vector<uint8_t> value, - GATT_WRITE_OP_CB cb, void* cb_data) { + GATT_WRITE_OP_CB /*cb*/, void* /*cb_data*/) { auto num_ase = value[1]; std::vector<uint8_t> notif_value(2 + num_ase * sizeof(struct client_parser::ascs::ctp_ase_entry)); @@ -1417,7 +1415,7 @@ protected: ON_CALL(ase_ctp_handler, AseCtpEnableHandler) .WillByDefault(Invoke([group, verify_ase_count, inject_enabling, incject_streaming, this](LeAudioDevice* device, std::vector<uint8_t> value, - GATT_WRITE_OP_CB cb, void* cb_data) { + GATT_WRITE_OP_CB /*cb*/, void* /*cb_data*/) { auto num_ase = value[1]; // Verify ase count if needed @@ -1469,7 +1467,7 @@ protected: ON_CALL(ase_ctp_handler, AseCtpDisableHandler) .WillByDefault(Invoke([group, verify_ase_count, this]( LeAudioDevice* device, std::vector<uint8_t> value, - GATT_WRITE_OP_CB cb, void* cb_data) { + GATT_WRITE_OP_CB /*cb*/, void* /*cb_data*/) { auto num_ase = value[1]; // Verify ase count if needed @@ -1512,7 +1510,7 @@ protected: ON_CALL(ase_ctp_handler, AseCtpReceiverStartReadyHandler) .WillByDefault(Invoke([group, verify_ase_count, this]( LeAudioDevice* device, std::vector<uint8_t> value, - GATT_WRITE_OP_CB cb, void* cb_data) { + GATT_WRITE_OP_CB /*cb*/, void* /*cb_data*/) { auto num_ase = value[1]; // Verify ase count if needed @@ -1544,7 +1542,7 @@ protected: ON_CALL(ase_ctp_handler, AseCtpReceiverStopReadyHandler) .WillByDefault(Invoke([group, verify_ase_count, this]( LeAudioDevice* device, std::vector<uint8_t> value, - GATT_WRITE_OP_CB cb, void* cb_data) { + GATT_WRITE_OP_CB /*cb*/, void* /*cb_data*/) { auto num_ase = value[1]; // Verify ase count if needed @@ -1577,7 +1575,7 @@ protected: ON_CALL(ase_ctp_handler, AseCtpReleaseHandler) .WillByDefault(Invoke([group, verify_ase_count, inject_disconnect_device, dev, this]( LeAudioDevice* device, std::vector<uint8_t> value, - GATT_WRITE_OP_CB cb, void* cb_data) { + GATT_WRITE_OP_CB /*cb*/, void* /*cb_data*/) { if (dev != nullptr && device != dev) { log::info("Do nothing for {}", dev->address_); return; diff --git a/system/bta/ras/ras_client.cc b/system/bta/ras/ras_client.cc index a2d3ab8478..093dfe0265 100644 --- a/system/bta/ras/ras_client.cc +++ b/system/bta/ras/ras_client.cc @@ -438,7 +438,7 @@ public: } void GattWriteCallbackForVendorSpecificData(tCONN_ID conn_id, tGATT_STATUS status, - uint16_t handle, const uint8_t* value, + uint16_t handle, const uint8_t* /*value*/, GattWriteCallbackData* data) { if (data != nullptr) { GattWriteCallbackData* structPtr = static_cast<GattWriteCallbackData*>(data); @@ -473,7 +473,7 @@ public: } void GattWriteCallback(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, - const uint8_t* value) { + const uint8_t* /*value*/) { if (status != GATT_SUCCESS) { log::error("Fail to write conn_id {}, status {}, handle {}", conn_id, gatt_status_text(status), handle); @@ -497,7 +497,7 @@ public: } static void GattWriteCallback(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, const uint8_t* value, void* data) { + uint16_t /*len*/, const uint8_t* value, void* data) { if (instance != nullptr) { if (data != nullptr) { GattWriteCallbackData* structPtr = static_cast<GattWriteCallbackData*>(data); @@ -549,8 +549,8 @@ public: nullptr); } - void OnDescriptorWrite(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* data) { + void OnDescriptorWrite(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, uint16_t /*len*/, + const uint8_t* /*value*/, void* /*data*/) { log::info("conn_id:{}, handle:{}, status:{}", conn_id, handle, gatt_status_text(status)); } diff --git a/system/bta/test/bta_ag_sco_test.cc b/system/bta/test/bta_ag_sco_test.cc index 16da383021..bbd5bd2430 100644 --- a/system/bta/test/bta_ag_sco_test.cc +++ b/system/bta/test/bta_ag_sco_test.cc @@ -30,7 +30,7 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" -bool btm_peer_supports_esco_ev3(const RawAddress& remote_bda) { return true; } +bool btm_peer_supports_esco_ev3(const RawAddress& /*remote_bda*/) { return true; } tBTM_CB btm_cb; LeAudioClient* LeAudioClient::Get() { return nullptr; } bool LeAudioClient::IsLeAudioClientInStreaming() { return false; } diff --git a/system/bta/test/bta_ag_test.cc b/system/bta/test/bta_ag_test.cc index 45549aeb9b..f7b6d4d21e 100644 --- a/system/bta/test/bta_ag_test.cc +++ b/system/bta/test/bta_ag_test.cc @@ -46,7 +46,7 @@ using namespace bluetooth; namespace { -bool bta_ag_hdl_event(const BT_HDR_RIGID* p_msg) { return true; } +bool bta_ag_hdl_event(const BT_HDR_RIGID* /*p_msg*/) { return true; } void BTA_AgDisable() { bta_sys_deregister(BTA_ID_AG); } const tBTA_SYS_REG bta_ag_reg = {bta_ag_hdl_event, BTA_AgDisable}; @@ -72,7 +72,7 @@ protected: bta_sys_register(BTA_ID_AG, &bta_ag_reg); - bta_ag_cb.p_cback = [](tBTA_AG_EVT event, tBTA_AG* p_data) {}; + bta_ag_cb.p_cback = [](tBTA_AG_EVT /*event*/, tBTA_AG* /*p_data*/) {}; RawAddress::FromString("00:11:22:33:44:55", addr); test::mock::device_esco_parameters::esco_parameters_for_codec.body = [this](esco_codec_t codec) { @@ -145,7 +145,7 @@ TEST_F(BtaAgActTest, set_codec_q0_success) { tBTA_AG_SCB* p_scb = &bta_ag_cb.scb[0]; const tBTA_AG_DATA data = {.api_setcodec.codec = BTA_AG_SCO_APTX_SWB_SETTINGS_Q0}; - bta_ag_cb.p_cback = [](tBTA_AG_EVT event, tBTA_AG* p_data) { + bta_ag_cb.p_cback = [](tBTA_AG_EVT /*event*/, tBTA_AG* p_data) { tBTA_AG_VAL* val = (tBTA_AG_VAL*)p_data; ASSERT_EQ(val->num, BTA_AG_SCO_APTX_SWB_SETTINGS_Q0); ASSERT_EQ(val->hdr.status, BTA_AG_SUCCESS); @@ -165,7 +165,7 @@ TEST_F(BtaAgActTest, set_codec_q1_fail_unsupported) { ASSERT_TRUE(enable_aptx_voice_property(true)); - bta_ag_cb.p_cback = [](tBTA_AG_EVT event, tBTA_AG* p_data) { + bta_ag_cb.p_cback = [](tBTA_AG_EVT /*event*/, tBTA_AG* p_data) { tBTA_AG_VAL* val = (tBTA_AG_VAL*)p_data; ASSERT_EQ(val->num, BTA_AG_SCO_APTX_SWB_SETTINGS_Q1); ASSERT_EQ(val->hdr.status, BTA_AG_FAIL_RESOURCES); @@ -280,7 +280,8 @@ TEST_F(BtaAgCmdTest, at_hfp_cback__qcs_ev_codec_q0_enabled) { TEST_F(BtaAgCmdTest, handle_swb_at_event__qcs_ev_codec_q1_fallback_to_q0) { reset_mock_btm_client_interface(); - mock_btm_client_interface.sco.BTM_SetEScoMode = [](enh_esco_params_t* p_params) -> tBTM_STATUS { + mock_btm_client_interface.sco.BTM_SetEScoMode = + [](enh_esco_params_t* /*p_params*/) -> tBTM_STATUS { inc_func_call_count("BTM_SetEScoMode"); return tBTM_STATUS::BTM_SUCCESS; }; @@ -327,7 +328,7 @@ protected: void SetUp() override { BtaAgTest::SetUp(); reset_mock_btm_client_interface(); - mock_btm_client_interface.peer.BTM_ReadRemoteFeatures = [](const RawAddress& addr) { + mock_btm_client_interface.peer.BTM_ReadRemoteFeatures = [](const RawAddress& /*addr*/) { inc_func_call_count("BTM_ReadRemoteFeatures"); return data; }; diff --git a/system/bta/test/bta_av_test.cc b/system/bta/test/bta_av_test.cc index 0775b7c54b..97bcbca6cb 100644 --- a/system/bta/test/bta_av_test.cc +++ b/system/bta/test/bta_av_test.cc @@ -36,7 +36,7 @@ const RawAddress kRawAddress({0x11, 0x22, 0x33, 0x44, 0x55, 0x66}); } // namespace struct alarm_t { - alarm_t(const char* name) {} + alarm_t(const char* /*name*/) {} int any_value; }; diff --git a/system/bta/test/bta_dip_test.cc b/system/bta/test/bta_dip_test.cc index 61ccc5080f..ab3b620d02 100644 --- a/system/bta/test/bta_dip_test.cc +++ b/system/bta/test/bta_dip_test.cc @@ -42,7 +42,9 @@ static tSDP_DISC_ATTR g_attr_vendor_product_version; static tSDP_DISC_ATTR g_attr_vendor_product_primary_record; static tSDP_DISC_REC g_rec; -static void sdp_dm_cback(tBTA_SDP_EVT event, tBTA_SDP* p_data, void* user_data) { return; } +static void sdp_dm_cback(tBTA_SDP_EVT /*event*/, tBTA_SDP* /*p_data*/, void* /*user_data*/) { + return; +} class BtaDipTest : public ::testing::Test { protected: diff --git a/system/bta/test/bta_disc_test.cc b/system/bta/test/bta_disc_test.cc index f9db1733f1..6a9aa3b005 100644 --- a/system/bta/test/bta_disc_test.cc +++ b/system/bta/test/bta_disc_test.cc @@ -167,7 +167,8 @@ TEST_F(BtaInitializedTest, bta_dm_start_scan) { } TEST_F(BtaInitializedTest, bta_dm_disc_start_device_discovery) { - bta_dm_disc_start_device_discovery([](tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) {}); + bta_dm_disc_start_device_discovery( + [](tBTA_DM_SEARCH_EVT /*event*/, tBTA_DM_SEARCH* /*p_data*/) {}); } TEST_F(BtaInitializedTest, bta_dm_disc_stop_device_discovery) { @@ -197,7 +198,7 @@ TEST_F(BtaInitializedTest, bta_dm_disc_start_service_discovery__BT_TRANSPORT_BR_ service_cb_call_cnt = 0; bta_dm_disc_start_service_discovery({nullptr, nullptr, - [](RawAddress addr, const std::vector<bluetooth::Uuid>&, + [](RawAddress /*addr*/, const std::vector<bluetooth::Uuid>&, tBTA_STATUS) { service_cb_call_cnt++; }}, kRawAddress, BT_TRANSPORT_BR_EDR); @@ -246,7 +247,7 @@ TEST_F_WITH_FLAGS(BtaInitializedTest, bta_dm_disc_both_transports_flag_disabled, std::promise<void> gatt_triggered; int gatt_call_cnt = 0; base::RepeatingCallback<void(const RawAddress&)> gatt_performer = - base::BindLambdaForTesting([&](const RawAddress& bd_addr) { + base::BindLambdaForTesting([&](const RawAddress& /*bd_addr*/) { gatt_call_cnt++; gatt_triggered.set_value(); }); @@ -254,7 +255,7 @@ TEST_F_WITH_FLAGS(BtaInitializedTest, bta_dm_disc_both_transports_flag_disabled, int sdp_call_cnt = 0; base::RepeatingCallback<void(tBTA_DM_SDP_STATE*)> sdp_performer = - base::BindLambdaForTesting([&](tBTA_DM_SDP_STATE* sdp_state) { sdp_call_cnt++; }); + base::BindLambdaForTesting([&](tBTA_DM_SDP_STATE* /*sdp_state*/) { sdp_call_cnt++; }); bta_dm_disc_override_sdp_performer_for_testing(sdp_performer); gatt_service_cb_both_call_cnt = 0; @@ -262,18 +263,15 @@ TEST_F_WITH_FLAGS(BtaInitializedTest, bta_dm_disc_both_transports_flag_disabled, bta_dm_disc_start_service_discovery( {[](RawAddress, std::vector<bluetooth::Uuid>&, bool) {}, nullptr, - [](RawAddress addr, const std::vector<bluetooth::Uuid>&, tBTA_STATUS) { + [](RawAddress /*addr*/, const std::vector<bluetooth::Uuid>&, tBTA_STATUS) { service_cb_both_call_cnt++; }}, kRawAddress, BT_TRANSPORT_BR_EDR); EXPECT_EQ(sdp_call_cnt, 1); bta_dm_disc_start_service_discovery( - {[](RawAddress, std::vector<bluetooth::Uuid>&, bool) { - gatt_service_cb_both_call_cnt++; - }, - nullptr, - [](RawAddress addr, const std::vector<bluetooth::Uuid>&, tBTA_STATUS) {}}, + {[](RawAddress, std::vector<bluetooth::Uuid>&, bool) { gatt_service_cb_both_call_cnt++; }, + nullptr, [](RawAddress /*addr*/, const std::vector<bluetooth::Uuid>&, tBTA_STATUS) {}}, kRawAddress, BT_TRANSPORT_LE); // GATT discovery is queued, until SDP finishes @@ -301,31 +299,33 @@ TEST_F_WITH_FLAGS(BtaInitializedTest, bta_dm_disc_both_transports_flag_enabled, int gatt_call_cnt = 0; base::RepeatingCallback<void(const RawAddress&)> gatt_performer = - base::BindLambdaForTesting([&](const RawAddress& bd_addr) { gatt_call_cnt++; }); + base::BindLambdaForTesting([&](const RawAddress& /*bd_addr*/) { gatt_call_cnt++; }); bta_dm_disc_override_gatt_performer_for_testing(gatt_performer); int sdp_call_cnt = 0; base::RepeatingCallback<void(tBTA_DM_SDP_STATE*)> sdp_performer = - base::BindLambdaForTesting([&](tBTA_DM_SDP_STATE* sdp_state) { sdp_call_cnt++; }); + base::BindLambdaForTesting([&](tBTA_DM_SDP_STATE* /*sdp_state*/) { sdp_call_cnt++; }); bta_dm_disc_override_sdp_performer_for_testing(sdp_performer); gatt_service_cb_both_call_cnt = 0; service_cb_both_call_cnt = 0; - bta_dm_disc_start_service_discovery({[](RawAddress, std::vector<bluetooth::Uuid>&, - bool) { gatt_service_cb_both_call_cnt++; }, - nullptr, - [](RawAddress addr, const std::vector<bluetooth::Uuid>&, - tBTA_STATUS) { service_cb_both_call_cnt++; }}, - kRawAddress, BT_TRANSPORT_BR_EDR); + bta_dm_disc_start_service_discovery( + {[](RawAddress, std::vector<bluetooth::Uuid>&, bool) { gatt_service_cb_both_call_cnt++; }, + nullptr, + [](RawAddress /*addr*/, const std::vector<bluetooth::Uuid>&, tBTA_STATUS) { + service_cb_both_call_cnt++; + }}, + kRawAddress, BT_TRANSPORT_BR_EDR); EXPECT_EQ(sdp_call_cnt, 1); - bta_dm_disc_start_service_discovery({[](RawAddress, std::vector<bluetooth::Uuid>&, - bool) { gatt_service_cb_both_call_cnt++; }, - nullptr, - [](RawAddress addr, const std::vector<bluetooth::Uuid>&, - tBTA_STATUS) { service_cb_both_call_cnt++; }}, - kRawAddress, BT_TRANSPORT_LE); + bta_dm_disc_start_service_discovery( + {[](RawAddress, std::vector<bluetooth::Uuid>&, bool) { gatt_service_cb_both_call_cnt++; }, + nullptr, + [](RawAddress /*addr*/, const std::vector<bluetooth::Uuid>&, tBTA_STATUS) { + service_cb_both_call_cnt++; + }}, + kRawAddress, BT_TRANSPORT_LE); // GATT discovery on same device is immediately started EXPECT_EQ(gatt_call_cnt, 1); diff --git a/system/bta/test/bta_dm_test.cc b/system/bta/test/bta_dm_test.cc index b9a75340c3..4f91d74e29 100644 --- a/system/bta/test/bta_dm_test.cc +++ b/system/bta/test/bta_dm_test.cc @@ -97,12 +97,12 @@ class BtaDmCustomAlarmTest : public BtaDmTest { protected: void SetUp() override { BtaDmTest::SetUp(); - test::mock::osi_alarm::alarm_set_on_mloop.body = [this](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) { - ASSERT_TRUE(alarm != nullptr); - this->alarm_callback = cb; - this->alarm_data = data; - }; + test::mock::osi_alarm::alarm_set_on_mloop.body = + [this](alarm_t* alarm, uint64_t /*interval_ms*/, alarm_callback_t cb, void* data) { + ASSERT_TRUE(alarm != nullptr); + this->alarm_callback = cb; + this->alarm_data = data; + }; } void TearDown() override { test::mock::osi_alarm::alarm_set_on_mloop = {}; @@ -238,8 +238,9 @@ TEST_F(BtaDmTest, bta_dm_set_encryption) { // Setup a device that fails encryption mock_btm_client_interface.security.BTM_SetEncryption = - [](const RawAddress& bd_addr, tBT_TRANSPORT transport, tBTM_SEC_CALLBACK* p_callback, - void* p_ref_data, tBTM_BLE_SEC_ACT sec_act) -> tBTM_STATUS { + [](const RawAddress& /*bd_addr*/, tBT_TRANSPORT /*transport*/, + tBTM_SEC_CALLBACK* /*p_callback*/, void* /*p_ref_data*/, + tBTM_BLE_SEC_ACT /*sec_act*/) -> tBTM_STATUS { inc_func_call_count("BTM_SetEncryption"); return tBTM_STATUS::BTM_MODE_UNSUPPORTED; }; @@ -251,8 +252,9 @@ TEST_F(BtaDmTest, bta_dm_set_encryption) { // Setup a device that successfully starts encryption mock_btm_client_interface.security.BTM_SetEncryption = - [](const RawAddress& bd_addr, tBT_TRANSPORT transport, tBTM_SEC_CALLBACK* p_callback, - void* p_ref_data, tBTM_BLE_SEC_ACT sec_act) -> tBTM_STATUS { + [](const RawAddress& /*bd_addr*/, tBT_TRANSPORT /*transport*/, + tBTM_SEC_CALLBACK* /*p_callback*/, void* /*p_ref_data*/, + tBTM_BLE_SEC_ACT /*sec_act*/) -> tBTM_STATUS { inc_func_call_count("BTM_SetEncryption"); return tBTM_STATUS::BTM_CMD_STARTED; }; @@ -374,7 +376,7 @@ TEST_F(BtaDmTest, bta_dm_remname_cback__HCI_ERR_CONNECTION_EXISTS) { TEST_F(BtaDmTest, bta_dm_determine_discovery_transport__BR_EDR) { tBTA_DM_SEARCH_CB& search_cb = bluetooth::legacy::testing::bta_dm_disc_search_cb(); - mock_btm_client_interface.peer.BTM_ReadDevInfo = [](const RawAddress& remote_bda, + mock_btm_client_interface.peer.BTM_ReadDevInfo = [](const RawAddress& /*remote_bda*/, tBT_DEVICE_TYPE* p_dev_type, tBLE_ADDR_TYPE* p_addr_type) { *p_dev_type = BT_DEVICE_TYPE_BREDR; @@ -388,7 +390,7 @@ TEST_F(BtaDmTest, bta_dm_determine_discovery_transport__BR_EDR) { TEST_F(BtaDmTest, bta_dm_determine_discovery_transport__BLE__PUBLIC) { tBTA_DM_SEARCH_CB& search_cb = bluetooth::legacy::testing::bta_dm_disc_search_cb(); - mock_btm_client_interface.peer.BTM_ReadDevInfo = [](const RawAddress& remote_bda, + mock_btm_client_interface.peer.BTM_ReadDevInfo = [](const RawAddress& /*remote_bda*/, tBT_DEVICE_TYPE* p_dev_type, tBLE_ADDR_TYPE* p_addr_type) { *p_dev_type = BT_DEVICE_TYPE_BLE; @@ -402,7 +404,7 @@ TEST_F(BtaDmTest, bta_dm_determine_discovery_transport__BLE__PUBLIC) { TEST_F(BtaDmTest, bta_dm_determine_discovery_transport__DUMO) { tBTA_DM_SEARCH_CB& search_cb = bluetooth::legacy::testing::bta_dm_disc_search_cb(); - mock_btm_client_interface.peer.BTM_ReadDevInfo = [](const RawAddress& remote_bda, + mock_btm_client_interface.peer.BTM_ReadDevInfo = [](const RawAddress& /*remote_bda*/, tBT_DEVICE_TYPE* p_dev_type, tBLE_ADDR_TYPE* p_addr_type) { *p_dev_type = BT_DEVICE_TYPE_DUMO; @@ -432,7 +434,7 @@ TEST_F(BtaDmTest, bta_dm_search_evt_text) { TEST_F(BtaDmTest, bta_dm_remote_name_cmpl) { reset_mock_btm_client_interface(); - mock_btm_client_interface.db.BTM_InqDbRead = [](const RawAddress& bd_addr) -> tBTM_INQ_INFO* { + mock_btm_client_interface.db.BTM_InqDbRead = [](const RawAddress& /*bd_addr*/) -> tBTM_INQ_INFO* { inc_func_call_count("BTM_InqDbRead"); return nullptr; }; @@ -473,7 +475,7 @@ TEST_F(BtaDmCustomAlarmTest, bta_dm_sniff_cback) { TEST_F(BtaDmCustomAlarmTest, sniff_offload_feature__test_sysprop) { bool is_property_enabled = true; test::mock::osi_properties::osi_property_get_bool.body = - [&](const char* key, bool default_value) -> int { return is_property_enabled; }; + [&](const char* /*key*/, bool /*default_value*/) -> int { return is_property_enabled; }; // Expect not to trigger bta_dm_init_pm due to sysprop enabled // and reset the value of .srvc_id. diff --git a/system/bta/test/bta_sec_test.cc b/system/bta/test/bta_sec_test.cc index 0db6800c29..bee1852628 100644 --- a/system/bta/test/bta_sec_test.cc +++ b/system/bta/test/bta_sec_test.cc @@ -70,7 +70,7 @@ TEST_F(BtaSecTest, bta_dm_sp_cback__BTM_SP_CFM_REQ_EVT_WithName) { static bool callback_sent = false; static tBTA_DM_SP_CFM_REQ cfm_req{}; - bta_dm_sec_enable([](tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data) { + bta_dm_sec_enable([](tBTA_DM_SEC_EVT /*event*/, tBTA_DM_SEC* p_data) { callback_sent = true; cfm_req = p_data->cfm_req; }); @@ -119,7 +119,7 @@ TEST_F(BtaSecTest, bta_dm_sp_cback__BTM_SP_CFM_REQ_EVT_WithoutName_RNRSuccess) { .WillOnce(Return(tBTM_STATUS::BTM_CMD_STARTED)); static tBTA_DM_SP_CFM_REQ cfm_req{}; - bta_dm_sec_enable([](tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data) { + bta_dm_sec_enable([](tBTA_DM_SEC_EVT /*event*/, tBTA_DM_SEC* p_data) { callback_sent = true; cfm_req = p_data->cfm_req; }); @@ -156,7 +156,7 @@ TEST_F(BtaSecTest, bta_dm_sp_cback__BTM_SP_CFM_REQ_EVT_WithoutName_RNRFail) { .WillOnce(Return(tBTM_STATUS::BTM_SUCCESS)); static tBTA_DM_SP_CFM_REQ cfm_req{}; - bta_dm_sec_enable([](tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data) { + bta_dm_sec_enable([](tBTA_DM_SEC_EVT /*event*/, tBTA_DM_SEC* p_data) { callback_sent = true; cfm_req = p_data->cfm_req; }); @@ -202,7 +202,7 @@ TEST_F(BtaSecTest, bta_dm_sp_cback__BTM_SP_KEY_NOTIF_EVT) { .WillByDefault(Return(tBTM_STATUS::BTM_CMD_STARTED)); static tBTA_DM_SP_KEY_NOTIF key_notif{}; - bta_dm_sec_enable([](tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data) { + bta_dm_sec_enable([](tBTA_DM_SEC_EVT /*event*/, tBTA_DM_SEC* p_data) { callback_sent = true; key_notif = p_data->key_notif; }); diff --git a/system/bta/test/bta_test_fixtures.h b/system/bta/test/bta_test_fixtures.h index 47ca24b8db..373b846122 100644 --- a/system/bta/test/bta_test_fixtures.h +++ b/system/bta/test/bta_test_fixtures.h @@ -67,17 +67,18 @@ protected: bluetooth::testing::stack::rnr::set_interface(&mock_stack_rnr_interface_); test::mock::stack_gatt_api::GATT_Register.body = - [](const bluetooth::Uuid& p_app_uuid128, const std::string name, tGATT_CBACK* p_cb_info, - bool eatt_support) -> tGATT_IF { return kGattRegisteredIf; }; + [](const bluetooth::Uuid& /*p_app_uuid128*/, const std::string /*name*/, + tGATT_CBACK* /*p_cb_info*/, + bool /*eatt_support*/) -> tGATT_IF { return kGattRegisteredIf; }; mock_btm_client_interface.eir.BTM_GetEirSupportedServices = - [](uint32_t* p_eir_uuid, uint8_t** p, uint8_t max_num_uuid16, - uint8_t* p_num_uuid16) -> uint8_t { return 0; }; + [](uint32_t* /*p_eir_uuid*/, uint8_t** /*p*/, uint8_t /*max_num_uuid16*/, + uint8_t* /*p_num_uuid16*/) -> uint8_t { return 0; }; mock_btm_client_interface.eir.BTM_WriteEIR = [](BT_HDR* p_buf) -> tBTM_STATUS { osi_free(p_buf); return tBTM_STATUS::BTM_SUCCESS; }; mock_btm_client_interface.security.BTM_SecRegister = - [](const tBTM_APPL_INFO* p_cb_info) -> bool { return true; }; + [](const tBTM_APPL_INFO* /*p_cb_info*/) -> bool { return true; }; } void TearDown() override { diff --git a/system/bta/test/common/btm_api_mock.cc b/system/bta/test/common/btm_api_mock.cc index 6c2f30797e..b7208803a3 100644 --- a/system/bta/test/common/btm_api_mock.cc +++ b/system/bta/test/common/btm_api_mock.cc @@ -86,7 +86,7 @@ tBTM_SEC_DEV_REC* btm_find_dev(const RawAddress& bd_addr) { return btm_interface->FindDevice(bd_addr); } -void acl_disconnect_from_handle(uint16_t handle, tHCI_STATUS reason, std::string comment) { +void acl_disconnect_from_handle(uint16_t handle, tHCI_STATUS reason, std::string /*comment*/) { log::assert_that(btm_interface != nullptr, "Mock btm interface not set!"); return btm_interface->AclDisconnectFromHandle(handle, reason); } diff --git a/system/bta/vc/device.cc b/system/bta/vc/device.cc index a022bf2d30..ec2088981e 100644 --- a/system/bta/vc/device.cc +++ b/system/bta/vc/device.cc @@ -399,9 +399,10 @@ bool VolumeControlDevice::EnqueueInitialRequests(tGATT_IF gatt_if, GATT_READ_OP_ * This includes characteristics read and subscription. * In each case we subscribe first to be sure we do not miss any value change. */ -void VolumeControlDevice::EnqueueRemainingRequests(tGATT_IF gatt_if, GATT_READ_OP_CB chrc_read_cb, +void VolumeControlDevice::EnqueueRemainingRequests(tGATT_IF /*gatt_if*/, + GATT_READ_OP_CB chrc_read_cb, GATT_READ_MULTI_OP_CB chrc_multi_read_cb, - GATT_WRITE_OP_CB cccd_write_cb) { + GATT_WRITE_OP_CB /*cccd_write_cb*/) { std::vector<uint16_t> handles_to_read; for (auto const& input : audio_inputs.volume_audio_inputs) { diff --git a/system/bta/vc/devices_test.cc b/system/bta/vc/devices_test.cc index 8d951ea7fb..d2f389a864 100644 --- a/system/bta/vc/devices_test.cc +++ b/system/bta/vc/devices_test.cc @@ -229,8 +229,8 @@ protected: bluetooth::manager::SetMockBtmInterface(&btm_interface); ON_CALL(gatt_interface, GetCharacteristic(_, _)) - .WillByDefault( - Invoke([&](uint16_t conn_id, uint16_t handle) -> const gatt::Characteristic* { + .WillByDefault(Invoke( + [&](uint16_t /*conn_id*/, uint16_t handle) -> const gatt::Characteristic* { for (auto const& service : services) { for (auto const& characteristic : service.characteristics) { if (characteristic.value_handle == handle) { @@ -243,15 +243,16 @@ protected: })); ON_CALL(gatt_interface, GetOwningService(_, _)) - .WillByDefault(Invoke([&](uint16_t conn_id, uint16_t handle) -> const gatt::Service* { - for (auto const& service : services) { - if (service.handle <= handle && service.end_handle >= handle) { - return &service; - } - } + .WillByDefault( + Invoke([&](uint16_t /*conn_id*/, uint16_t handle) -> const gatt::Service* { + for (auto const& service : services) { + if (service.handle <= handle && service.end_handle >= handle) { + return &service; + } + } - return nullptr; - })); + return nullptr; + })); ON_CALL(gatt_interface, GetServices(_)).WillByDefault(Return(&services)); @@ -600,10 +601,10 @@ TEST_F(VolumeControlDeviceTest, test_enqueue_initial_requests) { EXPECT_CALL(gatt_interface, RegisterForNotifications(gatt_if, _, handle_pair.first)); } - auto chrc_read_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) {}; - auto cccd_write_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* data) {}; + auto chrc_read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, uint8_t* /*value*/, void* /*data*/) {}; + auto cccd_write_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, const uint8_t* /*value*/, void* /*data*/) {}; ASSERT_EQ(true, device->EnqueueInitialRequests(gatt_if, chrc_read_cb, cccd_write_cb)); Mock::VerifyAndClearExpectations(&gatt_queue); Mock::VerifyAndClearExpectations(&gatt_interface); @@ -615,21 +616,22 @@ TEST_F(VolumeControlDeviceTest, test_device_ready) { // grab all the handles requested std::vector<uint16_t> requested_handles; ON_CALL(gatt_queue, WriteDescriptor(_, _, _, _, _, _)) - .WillByDefault( - Invoke([&requested_handles]( - uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, - void* cb_data) -> void { requested_handles.push_back(handle); })); + .WillByDefault(Invoke( + [&requested_handles]( + uint16_t /*conn_id*/, uint16_t handle, std::vector<uint8_t> /*value*/, + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB /*cb*/, + void* /*cb_data*/) -> void { requested_handles.push_back(handle); })); ON_CALL(gatt_queue, ReadCharacteristic(_, _, _, _)) - .WillByDefault(Invoke([&requested_handles](uint16_t conn_id, uint16_t handle, - GATT_READ_OP_CB cb, void* cb_data) -> void { - requested_handles.push_back(handle); - })); - - auto chrc_read_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) {}; - auto cccd_write_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* data) {}; + .WillByDefault( + Invoke([&requested_handles](uint16_t /*conn_id*/, uint16_t handle, + GATT_READ_OP_CB /*cb*/, void* /*cb_data*/) -> void { + requested_handles.push_back(handle); + })); + + auto chrc_read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, uint8_t* /*value*/, void* /*data*/) {}; + auto cccd_write_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, const uint8_t* /*value*/, void* /*data*/) {}; ASSERT_EQ(true, device->EnqueueInitialRequests(0x0001, chrc_read_cb, cccd_write_cb)); ASSERT_NE((size_t)0, requested_handles.size()); @@ -669,12 +671,13 @@ TEST_F(VolumeControlDeviceTest, test_enqueue_remaining_requests) { EXPECT_CALL(gatt_queue, WriteDescriptor(_, _, _, GATT_WRITE, _, _)).Times(0); EXPECT_CALL(gatt_interface, RegisterForNotifications(_, _, _)).Times(0); - auto chrc_read_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) {}; - auto chrc_multi_read_cb = [](uint16_t conn_id, tGATT_STATUS status, tBTA_GATTC_MULTI& handles, - uint16_t len, uint8_t* value, void* data) {}; - auto cccd_write_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* data) {}; + auto chrc_read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, uint8_t* /*value*/, void* /*data*/) {}; + auto chrc_multi_read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, + tBTA_GATTC_MULTI& /*handles*/, uint16_t /*len*/, uint8_t* /*value*/, + void* /*data*/) {}; + auto cccd_write_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, const uint8_t* /*value*/, void* /*data*/) {}; device->EnqueueRemainingRequests(gatt_if, chrc_read_cb, chrc_multi_read_cb, cccd_write_cb); Mock::VerifyAndClearExpectations(&gatt_queue); Mock::VerifyAndClearExpectations(&gatt_interface); @@ -719,12 +722,13 @@ TEST_F(VolumeControlDeviceTest, test_enqueue_remaining_requests_multiread) { EXPECT_CALL(gatt_queue, WriteDescriptor(_, _, _, GATT_WRITE, _, _)).Times(0); EXPECT_CALL(gatt_interface, RegisterForNotifications(_, _, _)).Times(0); - auto chrc_read_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) {}; - auto chrc_multi_read_cb = [](uint16_t conn_id, tGATT_STATUS status, tBTA_GATTC_MULTI& handles, - uint16_t len, uint8_t* value, void* data) {}; - auto cccd_write_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* data) {}; + auto chrc_read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, uint8_t* /*value*/, void* /*data*/) {}; + auto chrc_multi_read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, + tBTA_GATTC_MULTI& /*handles*/, uint16_t /*len*/, uint8_t* /*value*/, + void* /*data*/) {}; + auto cccd_write_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, const uint8_t* /*value*/, void* /*data*/) {}; device->EnqueueRemainingRequests(gatt_if, chrc_read_cb, chrc_multi_read_cb, cccd_write_cb); @@ -744,8 +748,8 @@ TEST_F(VolumeControlDeviceTest, test_check_link_encrypted) { } TEST_F(VolumeControlDeviceTest, test_control_point_operation) { - GATT_WRITE_OP_CB write_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, const uint8_t* value, void* data) {}; + GATT_WRITE_OP_CB write_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, const uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); device->change_counter = 0x01; std::vector<uint8_t> expected_data({0x03, 0x01}); @@ -755,8 +759,8 @@ TEST_F(VolumeControlDeviceTest, test_control_point_operation) { } TEST_F(VolumeControlDeviceTest, test_control_point_operation_arg) { - GATT_WRITE_OP_CB write_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, const uint8_t* value, void* data) {}; + GATT_WRITE_OP_CB write_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, const uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); device->change_counter = 0x55; std::vector<uint8_t> expected_data({0x01, 0x55, 0x02, 0x03}); @@ -767,16 +771,16 @@ TEST_F(VolumeControlDeviceTest, test_control_point_operation_arg) { } TEST_F(VolumeControlDeviceTest, test_get_ext_audio_out_volume_offset) { - GATT_READ_OP_CB read_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) {}; + GATT_READ_OP_CB read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); EXPECT_CALL(gatt_queue, ReadCharacteristic(_, 0x0062, read_cb, nullptr)); device->GetExtAudioOutVolumeOffset(1, read_cb, nullptr); } TEST_F(VolumeControlDeviceTest, test_get_ext_audio_out_location) { - GATT_READ_OP_CB read_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) {}; + GATT_READ_OP_CB read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); EXPECT_CALL(gatt_queue, ReadCharacteristic(_, 0x0085, read_cb, nullptr)); device->GetExtAudioOutLocation(2, read_cb, nullptr); @@ -797,8 +801,8 @@ TEST_F(VolumeControlDeviceTest, test_set_ext_audio_out_location_non_writable) { } TEST_F(VolumeControlDeviceTest, test_get_ext_audio_out_description) { - GATT_READ_OP_CB read_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) {}; + GATT_READ_OP_CB read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); EXPECT_CALL(gatt_queue, ReadCharacteristic(_, 0x008a, read_cb, nullptr)); device->GetExtAudioOutDescription(2, read_cb, nullptr); @@ -821,8 +825,8 @@ TEST_F(VolumeControlDeviceTest, test_set_ext_audio_out_description_non_writable) } TEST_F(VolumeControlDeviceTest, test_ext_audio_out_control_point_operation) { - GATT_WRITE_OP_CB write_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, const uint8_t* value, void* data) {}; + GATT_WRITE_OP_CB write_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, const uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); VolumeOffset* offset = device->audio_offsets.FindById(1); ASSERT_NE(nullptr, offset); @@ -834,8 +838,8 @@ TEST_F(VolumeControlDeviceTest, test_ext_audio_out_control_point_operation) { } TEST_F(VolumeControlDeviceTest, test_ext_audio_out_control_point_operation_arg) { - GATT_WRITE_OP_CB write_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, const uint8_t* value, void* data) {}; + GATT_WRITE_OP_CB write_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, const uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); VolumeOffset* offset = device->audio_offsets.FindById(1); ASSERT_NE(nullptr, offset); @@ -848,32 +852,32 @@ TEST_F(VolumeControlDeviceTest, test_ext_audio_out_control_point_operation_arg) } TEST_F(VolumeControlDeviceTest, test_get_ext_audio_in_state) { - GATT_READ_OP_CB read_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) {}; + GATT_READ_OP_CB read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); EXPECT_CALL(gatt_queue, ReadCharacteristic(_, 0x0022, read_cb, nullptr)); device->GetExtAudioInState(1, read_cb, nullptr); } TEST_F(VolumeControlDeviceTest, test_get_ext_audio_in_status) { - GATT_READ_OP_CB read_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) {}; + GATT_READ_OP_CB read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); EXPECT_CALL(gatt_queue, ReadCharacteristic(_, 0x0049, read_cb, nullptr)); device->GetExtAudioInStatus(2, read_cb, nullptr); } TEST_F(VolumeControlDeviceTest, test_get_ext_audio_in_gain_props) { - GATT_READ_OP_CB read_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) {}; + GATT_READ_OP_CB read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); EXPECT_CALL(gatt_queue, ReadCharacteristic(_, 0x0025, read_cb, nullptr)); device->GetExtAudioInGainProps(1, read_cb, nullptr); } TEST_F(VolumeControlDeviceTest, test_get_ext_audio_in_description) { - GATT_READ_OP_CB read_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - uint8_t* value, void* data) {}; + GATT_READ_OP_CB read_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); EXPECT_CALL(gatt_queue, ReadCharacteristic(_, 0x002e, read_cb, nullptr)); device->GetExtAudioInDescription(1, read_cb, nullptr); @@ -897,8 +901,8 @@ TEST_F(VolumeControlDeviceTest, test_set_ext_audio_in_description_non_writable) } TEST_F(VolumeControlDeviceTest, test_ext_audio_in_control_point_operation) { - GATT_WRITE_OP_CB write_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, const uint8_t* value, void* data) {}; + GATT_WRITE_OP_CB write_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, const uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); VolumeAudioInput* input = device->audio_inputs.FindById(2); ASSERT_NE(nullptr, input); @@ -910,8 +914,8 @@ TEST_F(VolumeControlDeviceTest, test_ext_audio_in_control_point_operation) { } TEST_F(VolumeControlDeviceTest, test_ext_audio_in_control_point_operation_arg) { - GATT_WRITE_OP_CB write_cb = [](uint16_t conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, const uint8_t* value, void* data) {}; + GATT_WRITE_OP_CB write_cb = [](uint16_t /*conn_id*/, tGATT_STATUS /*status*/, uint16_t /*handle*/, + uint16_t /*len*/, const uint8_t* /*value*/, void* /*data*/) {}; SetSampleDatabase1(); VolumeAudioInput* input = device->audio_inputs.FindById(2); ASSERT_NE(nullptr, input); diff --git a/system/bta/vc/vc.cc b/system/bta/vc/vc.cc index c00fa87293..6a449c74c3 100644 --- a/system/bta/vc/vc.cc +++ b/system/bta/vc/vc.cc @@ -311,7 +311,7 @@ public: } void OnCharacteristicValueChanged(tCONN_ID conn_id, tGATT_STATUS status, uint16_t handle, - uint16_t len, uint8_t* value, void* data, + uint16_t len, uint8_t* value, void* /*data*/, bool is_notification) { VolumeControlDevice* device = volume_control_devices_.FindByConnId(conn_id); if (!device) { @@ -522,7 +522,7 @@ public: StartQueueOperation(); } - void OnVolumeControlFlagsChanged(VolumeControlDevice* device, uint16_t len, uint8_t* value) { + void OnVolumeControlFlagsChanged(VolumeControlDevice* device, uint16_t /*len*/, uint8_t* value) { device->flags = *value; bluetooth::log::info("{}, flags {:#x}", device->address, device->flags); @@ -740,8 +740,8 @@ public: callbacks_->OnExtAudioOutDescriptionChanged(device->address, offset->id, offset->description); } - void OnGattWriteCcc(tCONN_ID connection_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* /*data*/) { + void OnGattWriteCcc(tCONN_ID connection_id, tGATT_STATUS status, uint16_t handle, + uint16_t /*len*/, const uint8_t* /*value*/, void* /*data*/) { VolumeControlDevice* device = volume_control_devices_.FindByConnId(connection_id); if (!device) { bluetooth::log::error("unknown connection_id={:#x}", connection_id); @@ -1364,8 +1364,8 @@ private: const std::vector<uint8_t>* arg, int operation_id = -1) { volume_control_devices_.ControlPointOperation( devices, opcode, arg, - [](tCONN_ID connection_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* data) { + [](tCONN_ID connection_id, tGATT_STATUS status, uint16_t handle, uint16_t /*len*/, + const uint8_t* /*value*/, void* data) { if (instance) { instance->OnWriteControlResponse(connection_id, status, handle, data); } @@ -1385,8 +1385,8 @@ private: device->ExtAudioInControlPointOperation( ext_input_id, opcode, arg, - [](uint16_t connection_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* data) { + [](uint16_t connection_id, tGATT_STATUS status, uint16_t handle, uint16_t /*len*/, + const uint8_t* /*value*/, void* /*data*/) { if (instance) { instance->OnExtAudioInCPWrite(connection_id, status, handle); } @@ -1404,8 +1404,8 @@ private: } device->ExtAudioOutControlPointOperation( ext_output_id, opcode, arg, - [](tCONN_ID connection_id, tGATT_STATUS status, uint16_t handle, uint16_t len, - const uint8_t* value, void* data) { + [](tCONN_ID connection_id, tGATT_STATUS status, uint16_t handle, uint16_t /*len*/, + const uint8_t* /*value*/, void* data) { if (instance) { instance->OnExtAudioOutCPWrite(connection_id, status, handle, data); } diff --git a/system/bta/vc/vc_test.cc b/system/bta/vc/vc_test.cc index af4ae2bb27..b0f203bc82 100644 --- a/system/bta/vc/vc_test.cc +++ b/system/bta/vc/vc_test.cc @@ -40,7 +40,7 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" -void btif_storage_add_volume_control(const RawAddress& addr, bool auto_conn) {} +void btif_storage_add_volume_control(const RawAddress& /*addr*/, bool /*auto_conn*/) {} struct alarm_t { alarm_callback_t cb = nullptr; @@ -485,14 +485,14 @@ protected: // default action for WriteDescriptor function call ON_CALL(gatt_queue, WriteDescriptor(_, _, _, _, _, _)) .WillByDefault(Invoke([](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, void* cb_data) -> void { if (cb) { cb(conn_id, GATT_SUCCESS, handle, value.size(), value.data(), cb_data); } })); auto mock_alarm = AlarmMock::Get(); - ON_CALL(*mock_alarm, AlarmNew(_)).WillByDefault(Invoke([](const char* name) { + ON_CALL(*mock_alarm, AlarmNew(_)).WillByDefault(Invoke([](const char* /*name*/) { return new alarm_t(); })); ON_CALL(*mock_alarm, AlarmFree(_)).WillByDefault(Invoke([](alarm_t* alarm) { @@ -515,7 +515,7 @@ protected: })); ON_CALL(*mock_alarm, AlarmSet(_, _, _, _)) .WillByDefault(Invoke( - [](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, void* data) { + [](alarm_t* alarm, uint64_t /*interval_ms*/, alarm_callback_t cb, void* data) { if (alarm) { alarm->data = data; alarm->cb = cb; @@ -523,7 +523,7 @@ protected: })); ON_CALL(*mock_alarm, AlarmSetOnMloop(_, _, _, _)) .WillByDefault(Invoke( - [](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, void* data) { + [](alarm_t* alarm, uint64_t /*interval_ms*/, alarm_callback_t cb, void* data) { if (alarm) { alarm->on_main_loop = true; alarm->data = data; @@ -694,7 +694,7 @@ protected: .WillByDefault( Invoke([&success, this](const RawAddress& bd_addr, tBT_TRANSPORT transport, tBTM_SEC_CALLBACK* p_callback, void* p_ref_data, - tBTM_BLE_SEC_ACT sec_act) -> tBTM_STATUS { + tBTM_BLE_SEC_ACT /*sec_act*/) -> tBTM_STATUS { if (p_callback) { p_callback(bd_addr, transport, p_ref_data, success ? tBTM_STATUS::BTM_SUCCESS @@ -1264,19 +1264,19 @@ TEST_F(VolumeControlTest, test_read_vcs_database_out_of_sync) { /* Simulate database change on the remote side. */ ON_CALL(gatt_queue, WriteCharacteristic(_, _, _, _, _, _)) - .WillByDefault( - Invoke([this](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, void* cb_data) { - auto* svc = gatt::FindService(services_map[conn_id], handle); - if (svc == nullptr) { - return; - } - - tGATT_STATUS status = GATT_DATABASE_OUT_OF_SYNC; - if (cb) { - cb(conn_id, status, handle, value.size(), value.data(), cb_data); - } - })); + .WillByDefault(Invoke([this](uint16_t conn_id, uint16_t handle, + std::vector<uint8_t> value, tGATT_WRITE_TYPE /*write_type*/, + GATT_WRITE_OP_CB cb, void* cb_data) { + auto* svc = gatt::FindService(services_map[conn_id], handle); + if (svc == nullptr) { + return; + } + + tGATT_STATUS status = GATT_DATABASE_OUT_OF_SYNC; + if (cb) { + cb(conn_id, status, handle, value.size(), value.data(), cb_data); + } + })); ON_CALL(gatt_interface, ServiceSearchRequest(_, _)).WillByDefault(Return()); EXPECT_CALL(gatt_interface, ServiceSearchRequest(_, _)); @@ -1527,8 +1527,9 @@ protected: GetSearchCompleteEvent(conn_id); ON_CALL(gatt_queue, WriteCharacteristic(conn_id, 0x0024, _, GATT_WRITE, _, _)) - .WillByDefault([this](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, void* cb_data) { + .WillByDefault([this](uint16_t conn_id, uint16_t /*handle*/, std::vector<uint8_t> value, + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, + void* cb_data) { uint8_t write_rsp; std::vector<uint8_t> ntf_value({value[0], 0, static_cast<uint8_t>(value[1] + 1)}); @@ -1581,19 +1582,19 @@ TEST_F(VolumeControlValueSetTest, test_volume_operation_failed) { const std::vector<uint8_t> vol_x10({0x04, 0x00, 0x10}); EXPECT_CALL(gatt_queue, WriteCharacteristic(conn_id, 0x0024, vol_x10, GATT_WRITE, _, _)).Times(1); ON_CALL(gatt_queue, WriteCharacteristic(_, _, _, _, _, _)) - .WillByDefault( - Invoke([this](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, void* cb_data) { - auto* svc = gatt::FindService(services_map[conn_id], handle); - if (svc == nullptr) { - return; - } - - tGATT_STATUS status = GATT_ERROR; - if (cb) { - cb(conn_id, status, handle, value.size(), value.data(), cb_data); - } - })); + .WillByDefault(Invoke([this](uint16_t conn_id, uint16_t handle, + std::vector<uint8_t> value, tGATT_WRITE_TYPE /*write_type*/, + GATT_WRITE_OP_CB cb, void* cb_data) { + auto* svc = gatt::FindService(services_map[conn_id], handle); + if (svc == nullptr) { + return; + } + + tGATT_STATUS status = GATT_ERROR; + if (cb) { + cb(conn_id, status, handle, value.size(), value.data(), cb_data); + } + })); EXPECT_CALL(*AlarmMock::Get(), AlarmSetOnMloop(_, _, _, _)).Times(1); EXPECT_CALL(*AlarmMock::Get(), AlarmCancel(_)).Times(1); @@ -1607,24 +1608,24 @@ TEST_F(VolumeControlValueSetTest, test_volume_operation_failed_due_to_device_dis const std::vector<uint8_t> vol_x10({0x04, 0x00, 0x10}); EXPECT_CALL(gatt_queue, WriteCharacteristic(conn_id, 0x0024, vol_x10, GATT_WRITE, _, _)).Times(1); ON_CALL(gatt_queue, WriteCharacteristic(_, _, _, _, _, _)) - .WillByDefault( - Invoke([](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, void* cb_data) { - /* Do nothing */ - })); + .WillByDefault(Invoke([](uint16_t /*conn_id*/, uint16_t /*handle*/, + std::vector<uint8_t> /*value*/, tGATT_WRITE_TYPE /*write_type*/, + GATT_WRITE_OP_CB /*cb*/, void* /*cb_data*/) { + /* Do nothing */ + })); EXPECT_CALL(*AlarmMock::Get(), AlarmSetOnMloop(_, _, _, _)).Times(0); alarm_callback_t active_alarm_cb = nullptr; EXPECT_CALL(*AlarmMock::Get(), AlarmSetOnMloop(_, _, _, _)) - .WillOnce(Invoke( - [&](alarm_t* alarm, uint64_t interval_ms, alarm_callback_t cb, void* data) { - if (alarm) { - alarm->on_main_loop = true; - alarm->cb = cb; - active_alarm_cb = cb; - } - })); + .WillOnce(Invoke([&](alarm_t* alarm, uint64_t /*interval_ms*/, alarm_callback_t cb, + void* /*data*/) { + if (alarm) { + alarm->on_main_loop = true; + alarm->cb = cb; + active_alarm_cb = cb; + } + })); ON_CALL(*AlarmMock::Get(), AlarmCancel(_)).WillByDefault(Invoke([&](alarm_t* alarm) { if (alarm) { alarm->cb = nullptr; @@ -1687,7 +1688,7 @@ TEST_F(VolumeControlValueSetTest, test_set_volume_stress_2) { // queued ON_CALL(gatt_queue, WriteCharacteristic(conn_id, 0x0024, _, GATT_WRITE, _, _)) .WillByDefault([](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, void* cb_data) { + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, void* cb_data) { uint8_t write_rsp; switch (value[0]) { @@ -1734,7 +1735,7 @@ TEST_F(VolumeControlValueSetTest, test_set_volume_stress_3) { */ ON_CALL(gatt_queue, WriteCharacteristic(conn_id, 0x0024, _, GATT_WRITE, _, _)) .WillByDefault([](uint16_t conn_id, uint16_t handle, std::vector<uint8_t> value, - tGATT_WRITE_TYPE write_type, GATT_WRITE_OP_CB cb, void* cb_data) { + tGATT_WRITE_TYPE /*write_type*/, GATT_WRITE_OP_CB cb, void* cb_data) { uint8_t write_rsp; switch (value[0]) { diff --git a/system/btif/Android.bp b/system/btif/Android.bp index eb4ee993d5..7eb2952524 100644 --- a/system/btif/Android.bp +++ b/system/btif/Android.bp @@ -165,9 +165,6 @@ cc_library_static { "libbtif-core", "libflatbuffers-cpp", ], - cflags: [ - "-Wno-unused-parameter", - ], apex_available: [ "com.android.btservices", ], @@ -391,9 +388,6 @@ cc_test { "libchrome", "libosi", ], - cflags: [ - "-Wno-unused-parameter", - ], shared_libs: [ "libbase", "liblog", @@ -432,9 +426,6 @@ cc_test { "libbase", "liblog", ], - cflags: [ - "-Wno-unused-parameter", - ], } // btif rc unit tests for target @@ -480,9 +471,6 @@ cc_test { shared_libs: ["libstatssocket"], }, }, - cflags: [ - "-Wno-unused-parameter", - ], sanitize: { address: true, cfi: true, @@ -520,9 +508,6 @@ cc_test { "libcom.android.sysprop.bluetooth.wrapped", "libgmock", ], - cflags: [ - "-Wno-unused-parameter", - ], } cc_test { diff --git a/system/btif/avrcp/avrcp_service.cc b/system/btif/avrcp/avrcp_service.cc index c76c281c63..871177bff3 100644 --- a/system/btif/avrcp/avrcp_service.cc +++ b/system/btif/avrcp/avrcp_service.cc @@ -579,7 +579,7 @@ void AvrcpService::SendFolderUpdate(bool available_players, bool addressed_playe } // Send out the track changed info to update the playback state for each device -void AvrcpService::SendActiveDeviceChanged(const RawAddress& address) { +void AvrcpService::SendActiveDeviceChanged(const RawAddress& /*address*/) { SendMediaUpdate(false, true, false); } diff --git a/system/btif/co/bta_av_co_peer.cc b/system/btif/co/bta_av_co_peer.cc index 966f91add4..de3f41e10f 100644 --- a/system/btif/co/bta_av_co_peer.cc +++ b/system/btif/co/bta_av_co_peer.cc @@ -98,7 +98,7 @@ void BtaAvCoPeer::setCodecConfig(const uint8_t* new_codec_config) { } void BtaAvCoPeerCache::Init(const std::vector<btav_a2dp_codec_config_t>& codec_priorities, - std::vector<btav_a2dp_codec_info_t>* supported_codecs) { + std::vector<btav_a2dp_codec_info_t>* /*supported_codecs*/) { std::lock_guard<std::recursive_mutex> lock(codec_lock_); codec_priorities_ = codec_priorities; diff --git a/system/btif/co/bta_hh_co.cc b/system/btif/co/bta_hh_co.cc index 5b2bffb4e7..086ad11551 100644 --- a/system/btif/co/bta_hh_co.cc +++ b/system/btif/co/bta_hh_co.cc @@ -1037,7 +1037,7 @@ void bta_hh_co_send_hid_info(btif_hh_device_t* p_dev, const char* dev_name, uint * Returns void. * ******************************************************************************/ -void bta_hh_co_set_rpt_rsp(uint8_t dev_handle, uint8_t status) { +void bta_hh_co_set_rpt_rsp([[maybe_unused]] uint8_t dev_handle, [[maybe_unused]] uint8_t status) { #if ENABLE_UHID_SET_REPORT log::verbose("dev_handle = {}", dev_handle); diff --git a/system/btif/src/btif_a2dp.cc b/system/btif/src/btif_a2dp.cc index d99b6c1e17..f8036bf8c8 100644 --- a/system/btif/src/btif_a2dp.cc +++ b/system/btif/src/btif_a2dp.cc @@ -39,7 +39,7 @@ using namespace bluetooth; using bluetooth::audio::a2dp::BluetoothAudioStatus; -void btif_a2dp_on_idle(const RawAddress& peer_addr, const A2dpType local_a2dp_type) { +void btif_a2dp_on_idle(const RawAddress& /*peer_addr*/, const A2dpType local_a2dp_type) { log::verbose("Peer stream endpoint type:{}", peer_stream_endpoint_text(btif_av_get_peer_sep(local_a2dp_type))); if (btif_av_get_peer_sep(local_a2dp_type) == AVDT_TSEP_SNK) { diff --git a/system/btif/src/btif_a2dp_sink.cc b/system/btif/src/btif_a2dp_sink.cc index 0aba99e201..ec9365a1b4 100644 --- a/system/btif/src/btif_a2dp_sink.cc +++ b/system/btif/src/btif_a2dp_sink.cc @@ -222,7 +222,8 @@ static void btif_a2dp_sink_startup_delayed() { // Nothing to do } -static void btif_a2dp_sink_on_decode_complete(uint8_t* data, uint32_t len) { +static void btif_a2dp_sink_on_decode_complete([[maybe_unused]] uint8_t* data, + [[maybe_unused]] uint32_t len) { #ifdef __ANDROID__ BtifAvrcpAudioTrackWriteData(btif_a2dp_sink_cb.audio_track, reinterpret_cast<void*>(data), len); #endif diff --git a/system/btif/src/btif_av.cc b/system/btif/src/btif_av.cc index 277dc493e1..c62d54c281 100644 --- a/system/btif/src/btif_av.cc +++ b/system/btif/src/btif_av.cc @@ -3662,7 +3662,7 @@ bool btif_av_is_sink_enabled(void) { return btif_av_sink.Enabled(); } bool btif_av_is_source_enabled(void) { return btif_av_source.Enabled(); } -void btif_av_stream_start(const A2dpType local_a2dp_type) { +void btif_av_stream_start(const A2dpType /*local_a2dp_type*/) { log::info(""); btif_av_source_dispatch_sm_event(btif_av_source_active_peer(), BTIF_AV_START_STREAM_REQ_EVT); diff --git a/system/btif/src/btif_hf.cc b/system/btif/src/btif_hf.cc index 317c00e2f3..372bdf4262 100644 --- a/system/btif/src/btif_hf.cc +++ b/system/btif/src/btif_hf.cc @@ -754,7 +754,7 @@ static void bte_hf_evt(tBTA_AG_EVT event, tBTA_AG* p_data) { * Returns bt_status_t * ******************************************************************************/ -static bt_status_t connect_int(RawAddress* bd_addr, uint16_t uuid) { +static bt_status_t connect_int(RawAddress* bd_addr, uint16_t /*uuid*/) { CHECK_BTHF_INIT(); if (is_connected(bd_addr)) { log::warn("device {} is already connected", *bd_addr); @@ -1500,7 +1500,7 @@ bt_status_t HeadsetInterface::PhoneStateChange(int num_active, int num_held, return status; } -bt_status_t HeadsetInterface::EnableSwb(bthf_swb_codec_t swb_codec, bool enable, +bt_status_t HeadsetInterface::EnableSwb(bthf_swb_codec_t /*swb_codec*/, bool enable, RawAddress* bd_addr) { return enable_aptx_swb_codec(enable, bd_addr); } diff --git a/system/btif/src/btif_hf_client.cc b/system/btif/src/btif_hf_client.cc index 79b9b54361..08e06e19e8 100644 --- a/system/btif/src/btif_hf_client.cc +++ b/system/btif/src/btif_hf_client.cc @@ -268,7 +268,7 @@ static bt_status_t init(bthf_client_callbacks_t* callbacks) { * Returns bt_status_t * ******************************************************************************/ -static bt_status_t connect_int(RawAddress* bd_addr, uint16_t uuid) { +static bt_status_t connect_int(RawAddress* bd_addr, uint16_t /*uuid*/) { btif_hf_client_cb_t* cb = btif_hf_client_allocate_cb(); if (cb == NULL) { log::error("could not allocate block!"); diff --git a/system/btif/src/btif_hh.cc b/system/btif/src/btif_hh.cc index 4a4bddd266..49d13d28d0 100644 --- a/system/btif/src/btif_hh.cc +++ b/system/btif/src/btif_hh.cc @@ -1299,7 +1299,7 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) { * ******************************************************************************/ -static void btif_hh_hsdata_rpt_copy_cb(uint16_t event, char* p_dest, const char* p_src) { +static void btif_hh_hsdata_rpt_copy_cb(uint16_t /*event*/, char* p_dest, const char* p_src) { tBTA_HH_HSDATA* p_dst_data = (tBTA_HH_HSDATA*)p_dest; tBTA_HH_HSDATA* p_src_data = (tBTA_HH_HSDATA*)p_src; BT_HDR* hdr; diff --git a/system/btif/src/btif_pan.cc b/system/btif/src/btif_pan.cc index f4705f99eb..527c6ae683 100644 --- a/system/btif/src/btif_pan.cc +++ b/system/btif/src/btif_pan.cc @@ -758,7 +758,7 @@ static void btif_pan_close_all_conns() { } } -static void btpan_tap_fd_signaled(int fd, int type, int flags, uint32_t user_id) { +static void btpan_tap_fd_signaled(int fd, int /*type*/, int flags, uint32_t /*user_id*/) { log::assert_that(btpan_cb.tap_fd == INVALID_FD || btpan_cb.tap_fd == fd, "assert failed: btpan_cb.tap_fd == INVALID_FD || btpan_cb.tap_fd == fd"); diff --git a/system/btif/src/btif_rc.cc b/system/btif/src/btif_rc.cc index 5c82b54280..50ecb6a140 100644 --- a/system/btif/src/btif_rc.cc +++ b/system/btif/src/btif_rc.cc @@ -513,7 +513,7 @@ void fill_avrc_attr_entry(tAVRC_ATTR_ENTRY* attr_vals, int num_attrs, } } -void rc_cleanup_sent_cmd(void* p_data) { log::verbose(""); } +void rc_cleanup_sent_cmd(void* /*p_data*/) { log::verbose(""); } void handle_rc_ctrl_features_all(btif_rc_device_cb_t* p_dev) { if (!(p_dev->peer_tg_features & BTA_AV_FEAT_RCTG) && @@ -3615,7 +3615,7 @@ static void cleanup_app_attr_val_txt_response(btif_rc_player_app_settings_t* p_a * Returns None * **************************************************************************/ -static void handle_set_app_attr_val_response(tBTA_AV_META_MSG* pmeta_msg, tAVRC_RSP* p_rsp) { +static void handle_set_app_attr_val_response(tBTA_AV_META_MSG* pmeta_msg, tAVRC_RSP* /*p_rsp*/) { uint8_t accepted = 0; btif_rc_device_cb_t* p_dev = btif_rc_get_device_by_handle(pmeta_msg->rc_handle); @@ -4441,8 +4441,9 @@ static bt_status_t get_now_playing_list_cmd(const RawAddress& bd_addr, uint32_t * otherwise BT_STATUS_FAIL * **************************************************************************/ -static bt_status_t get_item_attribute_cmd(uint64_t uid, int scope, uint8_t num_attribute, - const uint32_t* p_attr_ids, btif_rc_device_cb_t* p_dev) { +static bt_status_t get_item_attribute_cmd(uint64_t uid, int scope, uint8_t /*num_attribute*/, + const uint32_t* /*p_attr_ids*/, + btif_rc_device_cb_t* p_dev) { tAVRC_COMMAND avrc_cmd = {0}; avrc_cmd.pdu = AVRC_PDU_GET_ITEM_ATTRIBUTES; avrc_cmd.get_attrs.scope = scope; diff --git a/system/btif/test/btif_hf_client_service_test.cc b/system/btif/test/btif_hf_client_service_test.cc index cfba41ff87..7b2e0456e8 100644 --- a/system/btif/test/btif_hf_client_service_test.cc +++ b/system/btif/test/btif_hf_client_service_test.cc @@ -22,18 +22,18 @@ int get_default_hf_client_features() { DEFAULT_BTIF_HF_CLIENT_FEATURES); } -tBTA_STATUS BTA_HfClientEnable(tBTA_HF_CLIENT_CBACK* p_cback, tBTA_HF_CLIENT_FEAT features, - const char* p_service_name) { +tBTA_STATUS BTA_HfClientEnable(tBTA_HF_CLIENT_CBACK* /*p_cback*/, tBTA_HF_CLIENT_FEAT features, + const char* /*p_service_name*/) { gFeatures = features; return BTA_SUCCESS; } void BTA_HfClientDisable(void) {} -bt_status_t btif_transfer_context(tBTIF_CBACK* p_cback, uint16_t event, char* p_params, - int param_len, tBTIF_COPY_CBACK* p_copy_cback) { +bt_status_t btif_transfer_context(tBTIF_CBACK* /*p_cback*/, uint16_t /*event*/, char* /*p_params*/, + int /*param_len*/, tBTIF_COPY_CBACK* /*p_copy_cback*/) { return BT_STATUS_SUCCESS; } void btif_queue_advance() {} -std::string dump_hf_client_event(uint16_t event) { return "UNKNOWN MSG ID"; } +std::string dump_hf_client_event(uint16_t /*event*/) { return "UNKNOWN MSG ID"; } class BtifHfClientTest : public ::testing::Test { protected: diff --git a/system/btif/test/btif_rc_test.cc b/system/btif/test/btif_rc_test.cc index bcd03e6851..7ac956920c 100644 --- a/system/btif/test/btif_rc_test.cc +++ b/system/btif/test/btif_rc_test.cc @@ -40,20 +40,25 @@ namespace avrcp { int VolChanged = 0; AvrcpService* AvrcpService::instance_ = nullptr; -void AvrcpService::SendMediaUpdate(bool track_changed, bool play_state, bool queue) {} -void AvrcpService::SendFolderUpdate(bool available_players, bool addressed_players, bool uids) {} -void AvrcpService::SendActiveDeviceChanged(const RawAddress& address) {} -void AvrcpService::SendPlayerSettingsChanged(std::vector<PlayerAttribute> attributes, - std::vector<uint8_t> values) {} -void AvrcpService::ServiceInterfaceImpl::Init(MediaInterface* media_interface, - VolumeInterface* volume_interface, - PlayerSettingsInterface* player_settings_interface) {} -void AvrcpService::ServiceInterfaceImpl::RegisterBipServer(int psm) {} +void AvrcpService::SendMediaUpdate(bool /*track_changed*/, bool /*play_state*/, bool /*queue*/) {} +void AvrcpService::SendFolderUpdate(bool /*available_players*/, bool /*addressed_players*/, + bool /*uids*/) {} +void AvrcpService::SendActiveDeviceChanged(const RawAddress& /*address*/) {} +void AvrcpService::SendPlayerSettingsChanged(std::vector<PlayerAttribute> /*attributes*/, + std::vector<uint8_t> /*values*/) {} +void AvrcpService::ServiceInterfaceImpl::Init( + MediaInterface* /*media_interface*/, VolumeInterface* /*volume_interface*/, + PlayerSettingsInterface* /*player_settings_interface*/) {} +void AvrcpService::ServiceInterfaceImpl::RegisterBipServer(int /*psm*/) {} void AvrcpService::ServiceInterfaceImpl::UnregisterBipServer() {} -bool AvrcpService::ServiceInterfaceImpl::ConnectDevice(const RawAddress& bdaddr) { return true; } -bool AvrcpService::ServiceInterfaceImpl::DisconnectDevice(const RawAddress& bdaddr) { return true; } -void AvrcpService::ServiceInterfaceImpl::SetBipClientStatus(const RawAddress& bdaddr, - bool connected) {} +bool AvrcpService::ServiceInterfaceImpl::ConnectDevice(const RawAddress& /*bdaddr*/) { + return true; +} +bool AvrcpService::ServiceInterfaceImpl::DisconnectDevice(const RawAddress& /*bdaddr*/) { + return true; +} +void AvrcpService::ServiceInterfaceImpl::SetBipClientStatus(const RawAddress& /*bdaddr*/, + bool /*connected*/) {} bool AvrcpService::ServiceInterfaceImpl::Cleanup() { return true; } AvrcpService* AvrcpService::Get() { @@ -62,7 +67,7 @@ AvrcpService* AvrcpService::Get() { return instance_; } -void AvrcpService::RegisterVolChanged(const RawAddress& bdaddr) { VolChanged++; } +void AvrcpService::RegisterVolChanged(const RawAddress& /*bdaddr*/) { VolChanged++; } } // namespace avrcp } // namespace bluetooth @@ -71,24 +76,25 @@ const RawAddress kDeviceAddress({0x11, 0x22, 0x33, 0x44, 0x55, 0x66}); const uint8_t kRcHandle = 123; } // namespace -void btif_av_clear_remote_suspend_flag(const A2dpType local_a2dp_type) {} -bool btif_av_is_connected(const A2dpType local_a2dp_type) { return true; } +void btif_av_clear_remote_suspend_flag(const A2dpType /*local_a2dp_type*/) {} +bool btif_av_is_connected(const A2dpType /*local_a2dp_type*/) { return true; } bool btif_av_is_sink_enabled(void) { return true; } RawAddress btif_av_sink_active_peer(void) { return RawAddress(); } RawAddress btif_av_source_active_peer(void) { return RawAddress(); } -bool btif_av_stream_started_ready(const A2dpType local_a2dp_type) { return false; } -bt_status_t btif_transfer_context(tBTIF_CBACK* p_cback, uint16_t event, char* p_params, - int param_len, tBTIF_COPY_CBACK* p_copy_cback) { +bool btif_av_stream_started_ready(const A2dpType /*local_a2dp_type*/) { return false; } +bt_status_t btif_transfer_context(tBTIF_CBACK* /*p_cback*/, uint16_t /*event*/, char* /*p_params*/, + int /*param_len*/, tBTIF_COPY_CBACK* /*p_copy_cback*/) { return BT_STATUS_SUCCESS; } bool btif_av_src_sink_coexist_enabled() { return true; } -bool btif_av_is_connected_addr(const RawAddress& peer_address, const A2dpType local_a2dp_type) { +bool btif_av_is_connected_addr(const RawAddress& /*peer_address*/, + const A2dpType /*local_a2dp_type*/) { return true; } -bool btif_av_peer_is_connected_sink(const RawAddress& peer_address) { return false; } -bool btif_av_peer_is_connected_source(const RawAddress& peer_address) { return true; } -bool btif_av_peer_is_sink(const RawAddress& peer_address) { return false; } -bool btif_av_peer_is_source(const RawAddress& peer_address) { return true; } +bool btif_av_peer_is_connected_sink(const RawAddress& /*peer_address*/) { return false; } +bool btif_av_peer_is_connected_source(const RawAddress& /*peer_address*/) { return true; } +bool btif_av_peer_is_sink(const RawAddress& /*peer_address*/) { return false; } +bool btif_av_peer_is_source(const RawAddress& /*peer_address*/) { return true; } bool btif_av_both_enable(void) { return true; } static bluetooth::common::MessageLoopThread jni_thread("bt_jni_thread"); @@ -100,7 +106,9 @@ bt_status_t do_in_jni_thread(base::OnceClosure task) { return BT_STATUS_SUCCESS; } bluetooth::common::MessageLoopThread* get_main_thread() { return nullptr; } -bool interop_match_addr(const interop_feature_t feature, const RawAddress* addr) { return false; } +bool interop_match_addr(const interop_feature_t /*feature*/, const RawAddress* /*addr*/) { + return false; +} /** * Test class to test selected functionality in hci/src/hci_layer.cc @@ -213,7 +221,7 @@ protected: void TearDown() override { jni_thread.ShutDown(); - bt_rc_ctrl_callbacks->getrcfeatures_cb = [](const RawAddress& bd_addr, int features) {}; + bt_rc_ctrl_callbacks->getrcfeatures_cb = [](const RawAddress& /*bd_addr*/, int /*features*/) {}; btrc_ctrl_callbacks = default_btrc_ctrl_callbacks; BtifRcTest::TearDown(); } @@ -258,8 +266,8 @@ protected: void TearDown() override { jni_thread.ShutDown(); - bt_rc_ctrl_callbacks->connection_state_cb = [](bool rc_state, bool bt_state, - const RawAddress& bd_addr) {}; + bt_rc_ctrl_callbacks->connection_state_cb = [](bool /*rc_state*/, bool /*bt_state*/, + const RawAddress& /*bd_addr*/) {}; BtifRcTest::TearDown(); } }; @@ -307,8 +315,8 @@ protected: void TearDown() override { jni_thread.ShutDown(); - bt_rc_ctrl_callbacks->connection_state_cb = [](bool rc_state, bool bt_state, - const RawAddress& bd_addr) {}; + bt_rc_ctrl_callbacks->connection_state_cb = [](bool /*rc_state*/, bool /*bt_state*/, + const RawAddress& /*bd_addr*/) {}; BtifRcTest::TearDown(); } std::future<rc_connection_state_cb_t> g_btrc_connection_state_future; @@ -395,16 +403,16 @@ protected: BtifRcTest::SetUp(); init_ctrl(&btrc_ctrl_callbacks); jni_thread.StartUp(); - btrc_ctrl_callbacks.track_changed_cb = [](const RawAddress& bd_addr, uint8_t num_attr, - btrc_element_attr_val_t* p_attrs) { + btrc_ctrl_callbacks.track_changed_cb = [](const RawAddress& bd_addr, uint8_t /*num_attr*/, + btrc_element_attr_val_t* /*p_attrs*/) { btif_rc_cb.rc_multi_cb[0].rc_addr = bd_addr; }; } void TearDown() override { jni_thread.ShutDown(); - btrc_ctrl_callbacks.track_changed_cb = [](const RawAddress& bd_addr, uint8_t num_attr, - btrc_element_attr_val_t* p_attrs) {}; + btrc_ctrl_callbacks.track_changed_cb = [](const RawAddress& /*bd_addr*/, uint8_t /*num_attr*/, + btrc_element_attr_val_t* /*p_attrs*/) {}; BtifRcTest::TearDown(); } }; diff --git a/system/device/Android.bp b/system/device/Android.bp index f4b06790fc..4753441a66 100644 --- a/system/device/Android.bp +++ b/system/device/Android.bp @@ -111,5 +111,4 @@ cc_test { "server_configurable_flags", ], header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } diff --git a/system/device/test/device_iot_config_test.cc b/system/device/test/device_iot_config_test.cc index 676fad4888..58bc3a3425 100644 --- a/system/device/test/device_iot_config_test.cc +++ b/system/device/test/device_iot_config_test.cc @@ -41,19 +41,19 @@ using namespace testing; extern module_t device_iot_config_module; -bt_status_t btif_transfer_context(tBTIF_CBACK* p_cback, uint16_t event, char* p_params, - int param_len, tBTIF_COPY_CBACK* p_copy_cback) { +bt_status_t btif_transfer_context(tBTIF_CBACK* /*p_cback*/, uint16_t /*event*/, char* /*p_params*/, + int /*param_len*/, tBTIF_COPY_CBACK* /*p_copy_cback*/) { inc_func_call_count(__func__); return BT_STATUS_SUCCESS; } struct alarm_t { - alarm_t(const char* name) {} + alarm_t(const char* /*name*/) {} int any_value; }; struct future_t { - future_t(void* value) {} + future_t(void* /*value*/) {} void* value; }; @@ -64,23 +64,24 @@ std::string true_val = "true"; class DeviceIotConfigModuleTest : public testing::Test { protected: void SetUp() override { - test::mock::osi_alarm::alarm_new.body = [&](const char* name) -> alarm_t* { + test::mock::osi_alarm::alarm_new.body = [&](const char* /*name*/) -> alarm_t* { return &placeholder_alarm; }; test::mock::osi_properties::osi_property_get_bool.body = - [&](const char* key, bool default_value) -> int { return false; }; + [&](const char* /*key*/, bool /*default_value*/) -> int { return false; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) { return; }; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, + void* /*data*/) { return; }; - test::mock::osi_alarm::alarm_free.body = [](alarm_t* alarm) {}; + test::mock::osi_alarm::alarm_free.body = [](alarm_t* /*alarm*/) {}; - test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* alarm) -> bool { + test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* /*alarm*/) -> bool { return false; }; - test::mock::osi_future::future_new_immediate.body = [&](void* value) -> future_t* { + test::mock::osi_future::future_new_immediate.body = [&](void* /*value*/) -> future_t* { return &placeholder_future; }; @@ -89,27 +90,27 @@ protected: }; test::mock::osi_config::config_new.body = - [&](const char* filename) -> std::unique_ptr<config_t> { + [&](const char* /*filename*/) -> std::unique_ptr<config_t> { return std::make_unique<config_t>(); }; test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return def_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, int def_value) { return def_value; }; - test::mock::osi_config::config_set_int.body = [&](config_t* config, const std::string& section, - const std::string& key, - int value) { return; }; + test::mock::osi_config::config_set_int.body = + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, + int /*value*/) { return; }; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { return def_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, const std::string* def_value) { return def_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, - const std::string& value) { return; }; + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, + const std::string& /*value*/) { return; }; - test::mock::osi_allocator::osi_free.body = [&](void* ptr) {}; + test::mock::osi_allocator::osi_free.body = [&](void* /*ptr*/) {}; reset_mock_function_count_map(); } @@ -138,9 +139,9 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_ config_t* config_new_empty_return_value = NULL; test::mock::osi_properties::osi_property_get_bool.body = - [&](const char* key, bool default_value) -> int { return is_factory_reset; }; + [&](const char* /*key*/, bool /*default_value*/) -> int { return is_factory_reset; }; - test::mock::osi_config::config_new.body = [&](const char* filename) { + test::mock::osi_config::config_new.body = [&](const char* /*filename*/) { return std::unique_ptr<config_t>(config_new_return_value); }; @@ -193,7 +194,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_no_config, REQUIRES_FLAGS_ENABLED(ACONFIG_FLAG(TEST_BT, device_iot_config_logging))) { - test::mock::osi_config::config_new.body = [&](const char* filename) { + test::mock::osi_config::config_new.body = [&](const char* /*filename*/) { return std::unique_ptr<config_t>(nullptr); }; @@ -223,7 +224,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_ config_t* config_new_return_value = NULL; config_t* config_new_empty_return_value = NULL; - test::mock::osi_config::config_new.body = [&](const char* filename) { + test::mock::osi_config::config_new.body = [&](const char* /*filename*/) { return std::unique_ptr<config_t>(config_new_return_value); }; @@ -242,12 +243,14 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_ std::string config_get_string_return_value(TIME_STRING_FORMAT); test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return config_get_int_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + int /*def_value*/) { return config_get_int_return_value; }; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { return &config_get_string_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + const std::string* /*def_value*/) { return &config_get_string_return_value; }; device_iot_config_module_init(); @@ -294,12 +297,14 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_ std::string config_get_string_return_value(TIME_STRING_FORMAT); test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return config_get_int_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + int /*def_value*/) { return config_get_int_return_value; }; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { return &config_get_string_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + const std::string* /*def_value*/) { return &config_get_string_return_value; }; device_iot_config_module_init(); @@ -324,7 +329,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_ config_t* config_new_return_value = NULL; config_t* config_new_empty_return_value = NULL; - test::mock::osi_config::config_new.body = [&](const char* filename) { + test::mock::osi_config::config_new.body = [&](const char* /*filename*/) { return std::unique_ptr<config_t>(config_new_return_value); }; @@ -342,8 +347,9 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_ std::string config_get_string_return_value(TIME_STRING_FORMAT); test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { return &config_get_string_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + const std::string* /*def_value*/) { return &config_get_string_return_value; }; device_iot_config_module_init(); @@ -368,7 +374,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_ config_t* config_new_return_value = NULL; config_t* config_new_empty_return_value = NULL; - test::mock::osi_config::config_new.body = [&](const char* filename) { + test::mock::osi_config::config_new.body = [&](const char* /*filename*/) { return std::unique_ptr<config_t>(config_new_return_value); }; @@ -387,12 +393,14 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_ std::string config_get_string_return_value(TIME_STRING_FORMAT); test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return config_get_int_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + int /*def_value*/) { return config_get_int_return_value; }; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { return &config_get_string_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + const std::string* /*def_value*/) { return &config_get_string_return_value; }; device_iot_config_module_init(); @@ -418,7 +426,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, config_t* config_new_return_value = NULL; config_t* config_new_empty_return_value = NULL; - test::mock::osi_config::config_new.body = [&](const char* filename) { + test::mock::osi_config::config_new.body = [&](const char* /*filename*/) { return std::unique_ptr<config_t>(config_new_return_value); }; @@ -437,12 +445,14 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, std::string config_get_string_return_value(TIME_STRING_FORMAT); test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return config_get_int_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + int /*def_value*/) { return config_get_int_return_value; }; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { return &config_get_string_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + const std::string* /*def_value*/) { return &config_get_string_return_value; }; int file_fd = -1; int backup_fd = -1; @@ -493,7 +503,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, config_t* config_new_return_value = NULL; config_t* config_new_empty_return_value = NULL; - test::mock::osi_config::config_new.body = [&](const char* filename) { + test::mock::osi_config::config_new.body = [&](const char* /*filename*/) { return std::unique_ptr<config_t>(config_new_return_value); }; @@ -512,12 +522,14 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, std::string config_get_string_return_value(TIME_STRING_FORMAT); test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return config_get_int_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + int /*def_value*/) { return config_get_int_return_value; }; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { return &config_get_string_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + const std::string* /*def_value*/) { return &config_get_string_return_value; }; int file_fd = -1; int backup_fd = -1; @@ -568,7 +580,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, config_t* config_new_return_value = NULL; config_t* config_new_empty_return_value = NULL; - test::mock::osi_config::config_new.body = [&](const char* filename) { + test::mock::osi_config::config_new.body = [&](const char* /*filename*/) { return std::unique_ptr<config_t>(config_new_return_value); }; @@ -586,12 +598,13 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, int config_get_int_return_value = DEVICE_IOT_INFO_CURRENT_VERSION; test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return config_get_int_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + int /*def_value*/) { return config_get_int_return_value; }; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { return nullptr; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, const std::string* /*def_value*/) { return nullptr; }; device_iot_config_module_init(); @@ -616,7 +629,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_ config_t* config_new_return_value = NULL; config_t* config_new_empty_return_value = NULL; - test::mock::osi_config::config_new.body = [&](const char* filename) { + test::mock::osi_config::config_new.body = [&](const char* /*filename*/) { return std::unique_ptr<config_t>(config_new_return_value); }; @@ -635,14 +648,16 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_init_ std::string config_get_string_return_value(TIME_STRING_FORMAT); test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return config_get_int_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + int /*def_value*/) { return config_get_int_return_value; }; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { return &config_get_string_return_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, + const std::string* /*def_value*/) { return &config_get_string_return_value; }; - test::mock::osi_alarm::alarm_new.body = [&](const char* name) { return nullptr; }; + test::mock::osi_alarm::alarm_new.body = [&](const char* /*name*/) { return nullptr; }; device_iot_config_module_init(); @@ -690,7 +705,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_shutd std::string enable_logging_property_get_value; std::string factory_reset_property_get_value; - test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* alarm) -> bool { + test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* /*alarm*/) -> bool { return return_value; }; @@ -736,7 +751,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_clean std::string enable_logging_property_get_value; std::string factory_reset_property_get_value; - test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* alarm) -> bool { + test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* /*alarm*/) -> bool { return return_value; }; @@ -781,23 +796,24 @@ TEST_F_WITH_FLAGS(DeviceIotConfigModuleTest, test_device_iot_config_module_clean class DeviceIotConfigTest : public testing::Test { protected: void SetUp() override { - test::mock::osi_alarm::alarm_new.body = [&](const char* name) -> alarm_t* { + test::mock::osi_alarm::alarm_new.body = [&](const char* /*name*/) -> alarm_t* { return &placeholder_alarm; }; test::mock::osi_properties::osi_property_get_bool.body = - [&](const char* key, bool default_value) -> int { return false; }; + [&](const char* /*key*/, bool /*default_value*/) -> int { return false; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) { return; }; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, + void* /*data*/) { return; }; - test::mock::osi_alarm::alarm_free.body = [](alarm_t* alarm) {}; + test::mock::osi_alarm::alarm_free.body = [](alarm_t* /*alarm*/) {}; - test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* alarm) -> bool { + test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* /*alarm*/) -> bool { return false; }; - test::mock::osi_future::future_new_immediate.body = [&](void* value) -> future_t* { + test::mock::osi_future::future_new_immediate.body = [&](void* /*value*/) -> future_t* { return &placeholder_future; }; @@ -806,27 +822,27 @@ protected: }; test::mock::osi_config::config_new.body = - [&](const char* filename) -> std::unique_ptr<config_t> { + [&](const char* /*filename*/) -> std::unique_ptr<config_t> { return std::make_unique<config_t>(); }; test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return def_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, int def_value) { return def_value; }; - test::mock::osi_config::config_set_int.body = [&](config_t* config, const std::string& section, - const std::string& key, - int value) { return; }; + test::mock::osi_config::config_set_int.body = + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, + int /*value*/) { return; }; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { return def_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, const std::string* def_value) { return def_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, - const std::string& value) { return; }; + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, + const std::string& /*value*/) { return; }; - test::mock::osi_allocator::osi_free.body = [&](void* ptr) {}; + test::mock::osi_allocator::osi_free.body = [&](void* /*ptr*/) {}; device_iot_config_module_init(); device_iot_config_module_start_up(); @@ -915,7 +931,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_has_section, std::string actual_section, expected_section = "abc"; bool return_value = false; - test::mock::osi_config::config_has_section.body = [&](const config_t& config, + test::mock::osi_config::config_has_section.body = [&](const config_t& /*config*/, const std::string& section) { actual_section = section; return return_value; @@ -949,7 +965,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_exist, bool return_value = false; test::mock::osi_config::config_has_key.body = - [&](const config_t& config, const std::string& section, const std::string& key) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key) { actual_section = section; actual_key = key; return return_value; @@ -986,7 +1002,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_has_key_value, const std::string* return_value = NULL; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, + [&](const config_t& /*config*/, const std::string& section, const std::string& key, const std::string* def_value) { actual_section = section; actual_key = key; @@ -1072,15 +1088,15 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_get_int, int int_value = 0, new_value = 0xff; test::mock::osi_config::config_has_key.body = - [&](const config_t& config, const std::string& section, const std::string& key) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key) { actual_section = section; actual_key = key; return return_value; }; test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return new_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, int /*def_value*/) { return new_value; }; { reset_mock_function_count_map(); @@ -1120,15 +1136,15 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_addr_get_int, int int_value = 0, new_value = 0xff; test::mock::osi_config::config_has_key.body = - [&](const config_t& config, const std::string& section, const std::string& key) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key) { actual_section = section; actual_key = key; return return_value; }; test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return new_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, int /*def_value*/) { return new_value; }; { reset_mock_function_count_map(); @@ -1168,19 +1184,19 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_set_int, int int_value = 123456789; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key, + const std::string* /*def_value*/) { actual_section = section; actual_key = key; return &string_return_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, const std::string& value) { new_string_value = value; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) {}; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, void* /*data*/) {}; { reset_mock_function_count_map(); @@ -1225,19 +1241,19 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_addr_set_int, int int_value = 123456789; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key, + const std::string* /*def_value*/) { actual_section = section; actual_key = key; return &string_return_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, const std::string& value) { new_string_value = value; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) {}; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, void* /*data*/) {}; { reset_mock_function_count_map(); @@ -1276,7 +1292,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_int_add_one, std::string actual_section, actual_key, expected_section = "abc", expected_key = "def"; int int_value = 0, get_default_value, set_value; - test::mock::osi_config::config_get_int.body = [&](const config_t& config, + test::mock::osi_config::config_get_int.body = [&](const config_t& /*config*/, const std::string& section, const std::string& key, int def_value) { actual_section = section; @@ -1285,12 +1301,12 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_int_add_one, return int_value; }; - test::mock::osi_config::config_set_int.body = [&](config_t* config, const std::string& section, - const std::string& key, - int val) { set_value = val; }; + test::mock::osi_config::config_set_int.body = + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, + int val) { set_value = val; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) {}; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, void* /*data*/) {}; { reset_mock_function_count_map(); @@ -1385,7 +1401,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_addr_int_add_one, expected_key = "def"; int int_value = 0, get_default_value, set_value; - test::mock::osi_config::config_get_int.body = [&](const config_t& config, + test::mock::osi_config::config_get_int.body = [&](const config_t& /*config*/, const std::string& section, const std::string& key, int def_value) { actual_section = section; @@ -1394,12 +1410,12 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_addr_int_add_one, return int_value; }; - test::mock::osi_config::config_set_int.body = [&](config_t* config, const std::string& section, - const std::string& key, - int val) { set_value = val; }; + test::mock::osi_config::config_set_int.body = + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, + int val) { set_value = val; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) {}; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, void* /*data*/) {}; { reset_mock_function_count_map(); @@ -1495,8 +1511,8 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_get_hex, std::string* get_string_return_value = NULL; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key, + const std::string* /*def_value*/) { actual_section = section; actual_key = key; return get_string_return_value; @@ -1656,8 +1672,8 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_addr_get_hex, std::string* get_string_return_value = NULL; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key, + const std::string* /*def_value*/) { actual_section = section; actual_key = key; return get_string_return_value; @@ -1813,19 +1829,19 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_set_hex, int int_value, byte_num; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key, + const std::string* /*def_value*/) { actual_section = section; actual_key = key; return get_string_return_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, const std::string& value) { new_string_value = value; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) {}; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, void* /*data*/) {}; { reset_mock_function_count_map(); @@ -1964,19 +1980,19 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_addr_set_hex, int byte_num = 1; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key, + const std::string* /*def_value*/) { actual_section = section; actual_key = key; return get_string_return_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, const std::string& value) { new_string_value = value; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) {}; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, void* /*data*/) {}; { reset_mock_function_count_map(); @@ -2117,19 +2133,19 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_addr_set_hex_if_gr int byte_num = 1; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key, + const std::string* /*def_value*/) { actual_section = section; actual_key = key; return get_string_return_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, const std::string& value) { new_string_value = value; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) {}; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, void* /*data*/) {}; { reset_mock_function_count_map(); @@ -2198,7 +2214,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_get_str, const std::string* return_value = NULL; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, + [&](const config_t& /*config*/, const std::string& section, const std::string& key, const std::string* def_value) { actual_section = section; actual_key = key; @@ -2257,19 +2273,19 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_set_str, std::string str_value; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key, + const std::string* /*def_value*/) { actual_section = section; actual_key = key; return get_string_return_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, const std::string& value) { new_string_value = value; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) {}; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, void* /*data*/) {}; { reset_mock_function_count_map(); @@ -2322,19 +2338,19 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_addr_set_str, std::string str_value; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key, + const std::string* /*def_value*/) { actual_section = section; actual_key = key; return get_string_return_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, const std::string& value) { new_string_value = value; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) {}; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, void* /*data*/) {}; { reset_mock_function_count_map(); @@ -2382,7 +2398,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_get_bin, const std::string* return_value = NULL; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, + [&](const config_t& /*config*/, const std::string& section, const std::string& key, const std::string* def_value) { actual_section = section; actual_key = key; @@ -2489,7 +2505,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_get_bin_length, const std::string* return_value = NULL; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, + [&](const config_t& /*config*/, const std::string& section, const std::string& key, const std::string* def_value) { actual_section = section; actual_key = key; @@ -2569,19 +2585,19 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_set_bin, std::string str_value; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key, + const std::string* /*def_value*/) { actual_section = section; actual_key = key; return get_string_return_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, const std::string& value) { new_string_value = value; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) {}; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, void* /*data*/) {}; test::mock::osi_allocator::osi_calloc.body = [&](size_t size) { return new char[size]; }; @@ -2644,7 +2660,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_set_bin, { reset_mock_function_count_map(); - test::mock::osi_allocator::osi_calloc.body = [&](size_t size) { return nullptr; }; + test::mock::osi_allocator::osi_calloc.body = [&](size_t /*size*/) { return nullptr; }; uint8_t input_value[] = {0x01, 0x02, 0x03}; size_t length = sizeof(input_value); @@ -2677,19 +2693,19 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_addr_set_bin, std::string str_value; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { + [&](const config_t& /*config*/, const std::string& section, const std::string& key, + const std::string* /*def_value*/) { actual_section = section; actual_key = key; return get_string_return_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, const std::string& value) { new_string_value = value; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) {}; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, void* /*data*/) {}; test::mock::osi_allocator::osi_calloc.body = [&](size_t size) { return new char[size]; }; @@ -2752,7 +2768,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_addr_set_bin, { reset_mock_function_count_map(); - test::mock::osi_allocator::osi_calloc.body = [&](size_t size) { return nullptr; }; + test::mock::osi_allocator::osi_calloc.body = [&](size_t /*size*/) { return nullptr; }; uint8_t input_value[] = {0x01, 0x02, 0x03}; size_t length = sizeof(input_value); @@ -2779,12 +2795,12 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_remove, std::string actual_section, expected_section = "00:00:00:00:00:00"; bool return_value; - test::mock::osi_config::config_remove_key.body = [&](config_t* config, const std::string& section, - const std::string& key) { - actual_section = section; - actual_key = key; - return return_value; - }; + test::mock::osi_config::config_remove_key.body = + [&](config_t* /*config*/, const std::string& section, const std::string& key) { + actual_section = section; + actual_key = key; + return return_value; + }; { reset_mock_function_count_map(); @@ -2828,7 +2844,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_flush, REQUIRES_FLAGS_ENABLED(ACONFIG_FLAG(TEST_BT, device_iot_config_logging))) { bool return_value; - test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* alarm) -> bool { + test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* /*alarm*/) -> bool { return return_value; }; @@ -2866,14 +2882,14 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_clear, config_t* config_new_empty_return_value; bool config_save_return_value; - test::mock::osi_alarm::alarm_cancel.body = [&](alarm_t* alarm) {}; + test::mock::osi_alarm::alarm_cancel.body = [&](alarm_t* /*alarm*/) {}; test::mock::osi_config::config_new_empty.body = [&]() { return std::unique_ptr<config_t>(config_new_empty_return_value); }; - test::mock::osi_config::config_save.body = [&](const config_t& config, - const std::string& filename) -> bool { + test::mock::osi_config::config_save.body = [&](const config_t& /*config*/, + const std::string& /*filename*/) -> bool { return config_save_return_value; }; @@ -3083,7 +3099,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_compare_key, TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_write, REQUIRES_FLAGS_ENABLED(ACONFIG_FLAG(TEST_BT, device_iot_config_logging))) { test::mock::osi_config::config_save.body = - [&](const config_t& config, const std::string& filename) -> bool { return true; }; + [&](const config_t& /*config*/, const std::string& /*filename*/) -> bool { return true; }; { reset_mock_function_count_map(); @@ -3141,7 +3157,7 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_iot_config_is_factory_reset, REQUIRES_FLAGS_ENABLED(ACONFIG_FLAG(TEST_BT, device_iot_config_logging))) { bool return_value; test::mock::osi_properties::osi_property_get_bool.body = - [&](const char* key, bool default_value) -> bool { return return_value; }; + [&](const char* /*key*/, bool /*default_value*/) -> bool { return return_value; }; { return_value = false; @@ -3187,20 +3203,21 @@ TEST_F_WITH_FLAGS(DeviceIotConfigTest, test_device_debug_iot_config_delete_files class DeviceIotConfigDisabledTest : public testing::Test { protected: void SetUp() override { - test::mock::osi_alarm::alarm_new.body = [&](const char* name) -> alarm_t* { + test::mock::osi_alarm::alarm_new.body = [&](const char* /*name*/) -> alarm_t* { return &placeholder_alarm; }; - test::mock::osi_alarm::alarm_set.body = [&](alarm_t* alarm, uint64_t interval_ms, - alarm_callback_t cb, void* data) { return; }; + test::mock::osi_alarm::alarm_set.body = [&](alarm_t* /*alarm*/, uint64_t /*interval_ms*/, + alarm_callback_t /*cb*/, + void* /*data*/) { return; }; - test::mock::osi_alarm::alarm_free.body = [](alarm_t* alarm) {}; + test::mock::osi_alarm::alarm_free.body = [](alarm_t* /*alarm*/) {}; - test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* alarm) -> bool { + test::mock::osi_alarm::alarm_is_scheduled.body = [&](const alarm_t* /*alarm*/) -> bool { return false; }; - test::mock::osi_future::future_new_immediate.body = [&](void* value) -> future_t* { + test::mock::osi_future::future_new_immediate.body = [&](void* /*value*/) -> future_t* { return &placeholder_future; }; @@ -3209,27 +3226,27 @@ protected: }; test::mock::osi_config::config_new.body = - [&](const char* filename) -> std::unique_ptr<config_t> { + [&](const char* /*filename*/) -> std::unique_ptr<config_t> { return std::make_unique<config_t>(); }; test::mock::osi_config::config_get_int.body = - [&](const config_t& config, const std::string& section, const std::string& key, - int def_value) { return def_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, int def_value) { return def_value; }; - test::mock::osi_config::config_set_int.body = [&](config_t* config, const std::string& section, - const std::string& key, - int value) { return; }; + test::mock::osi_config::config_set_int.body = + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, + int /*value*/) { return; }; test::mock::osi_config::config_get_string.body = - [&](const config_t& config, const std::string& section, const std::string& key, - const std::string* def_value) { return def_value; }; + [&](const config_t& /*config*/, const std::string& /*section*/, + const std::string& /*key*/, const std::string* def_value) { return def_value; }; test::mock::osi_config::config_set_string.body = - [&](config_t* config, const std::string& section, const std::string& key, - const std::string& value) { return; }; + [&](config_t* /*config*/, const std::string& /*section*/, const std::string& /*key*/, + const std::string& /*value*/) { return; }; - test::mock::osi_allocator::osi_free.body = [&](void* ptr) {}; + test::mock::osi_allocator::osi_free.body = [&](void* /*ptr*/) {}; device_iot_config_module_init(); device_iot_config_module_start_up(); diff --git a/system/gd/Android.bp b/system/gd/Android.bp index d09e184f92..9501a6e696 100644 --- a/system/gd/Android.bp +++ b/system/gd/Android.bp @@ -244,7 +244,6 @@ cc_library { cflags: [ "-DFUZZ_TARGET", "-DUSE_FAKE_TIMERS", - "-Wno-unused-parameter", ], static_libs: [ "bluetooth_flags_c_lib", @@ -686,7 +685,6 @@ cc_fuzz { cc: ["android-bluetooth-security@google.com"], componentid: 27441, }, - cflags: ["-Wno-unused-parameter"], } cc_fuzz { @@ -696,7 +694,6 @@ cc_fuzz { ":BluetoothHalFuzzSources", "hci/fuzz/hci_layer_fuzz_test.cc", ], - cflags: ["-Wno-unused-parameter"], } cc_fuzz { @@ -709,7 +706,6 @@ cc_fuzz { cc: ["android-bluetooth-security@google.com"], componentid: 27441, }, - cflags: ["-Wno-unused-parameter"], } cc_benchmark { diff --git a/system/gd/BUILD.gn b/system/gd/BUILD.gn index 4e14df9a25..5786a5b700 100644 --- a/system/gd/BUILD.gn +++ b/system/gd/BUILD.gn @@ -20,7 +20,6 @@ import("//common-mk/flatbuffer.gni") config("gd_defaults") { cflags_cc = [ "-DGOOGLE_PROTOBUF_NO_RTTI", - "-Wno-unused-parameter", "-Wno-unused-result", "-Wno-tautological-overlap-compare", ] diff --git a/system/gd/dumpsys/bundler/Android.bp b/system/gd/dumpsys/bundler/Android.bp index bda314154b..301346ec6c 100644 --- a/system/gd/dumpsys/bundler/Android.bp +++ b/system/gd/dumpsys/bundler/Android.bp @@ -72,7 +72,6 @@ cc_binary_host { defaults: [ "bluetooth_flatbuffer_bundler_defaults", ], - cflags: ["-Wno-unused-parameter"], } cc_test_host { @@ -89,5 +88,4 @@ cc_test_host { test_options: { unit_test: true, }, - cflags: ["-Wno-unused-parameter"], } diff --git a/system/gd/dumpsys/bundler/BUILD.gn b/system/gd/dumpsys/bundler/BUILD.gn index 4be41331c2..324afbb4f1 100644 --- a/system/gd/dumpsys/bundler/BUILD.gn +++ b/system/gd/dumpsys/bundler/BUILD.gn @@ -31,7 +31,6 @@ config("bundler_defaults") { cflags_cc = [ "-std=c++17", - "-Wno-unused-parameter", "-Wno-unused-variable", "-Wno-poison-system-directories", ] diff --git a/system/gd/dumpsys/bundler/bundler.cc b/system/gd/dumpsys/bundler/bundler.cc index a88da57466..72097ac101 100644 --- a/system/gd/dumpsys/bundler/bundler.cc +++ b/system/gd/dumpsys/bundler/bundler.cc @@ -261,7 +261,7 @@ int WriteBundledSchema() { return EXIT_SUCCESS; } -int Usage(int argc, char** argv) { +int Usage(int /*argc*/, char** argv) { fprintf(stderr, "Usage: %s [-r | -w] [-f <filename>] [-g <gen_out_path>] [-n <namespace> ] [-v] -m " "<main_root_name> <file.bfbs " diff --git a/system/main/Android.bp b/system/main/Android.bp index a01052cace..629735a233 100644 --- a/system/main/Android.bp +++ b/system/main/Android.bp @@ -58,7 +58,6 @@ cc_library_static { "libcom.android.sysprop.bluetooth.wrapped", ], header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_library { @@ -134,11 +133,6 @@ cc_library_static { "BluetoothGeneratedBundlerSchema_h_bfbs", "BluetoothGeneratedDumpsysDataSchema_h", ], - cflags: [ - "-Wno-unused-parameter", - ], - shared_libs: [ - ], whole_static_libs: [ "libbluetooth_gd", // Gabeldorsche ], @@ -245,7 +239,6 @@ cc_test { ], min_sdk_version: "Tiramisu", header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { diff --git a/system/main/test/main_shim_stack_lifecycle_test.cc b/system/main/test/main_shim_stack_lifecycle_test.cc index 7acf5f7078..1720574218 100644 --- a/system/main/test/main_shim_stack_lifecycle_test.cc +++ b/system/main/test/main_shim_stack_lifecycle_test.cc @@ -157,7 +157,7 @@ public: } protected: - void ListDependencies(ModuleList* list) const override {} + void ListDependencies(ModuleList* /*list*/) const override {} void Start() override { log::error("Started TestStackModuleBase"); } void Stop() override { log::error("Stopped TestStackModuleBase"); } std::string ToString() const override { return std::string("TestFunction"); } @@ -503,29 +503,29 @@ TEST_F(StackLifecycleWithDefaultModulesUnitTest, client_using_stack_manager) { for (int i = 0; i < kNumIters; i++) { for (auto& c : client_group.clients_) { c->Post(base::BindOnce( - [](int id, int iter, std::shared_ptr<TestStackManager> stack_manager) { + [](int /*id*/, int iter, std::shared_ptr<TestStackManager> stack_manager) { stack_manager->GetUnsafeModule<TestStackModule1>()->TestMethod({ .iter = iter, .tag = std::string(kTestDataTag), - .callback = [](TestCallbackData data) {}, + .callback = [](TestCallbackData /*data*/) {}, }); }, c->Id(), i, StackManager())); c->Post(base::BindOnce( - [](int id, int iter, std::shared_ptr<TestStackManager> stack_manager) { + [](int /*id*/, int iter, std::shared_ptr<TestStackManager> stack_manager) { stack_manager->GetUnsafeModule<TestStackModule2>()->TestMethod({ .iter = iter, .tag = std::string(kTestDataTag), - .callback = [](TestCallbackData data) {}, + .callback = [](TestCallbackData /*data*/) {}, }); }, c->Id(), i, StackManager())); c->Post(base::BindOnce( - [](int id, int iter, std::shared_ptr<TestStackManager> stack_manager) { + [](int /*id*/, int iter, std::shared_ptr<TestStackManager> stack_manager) { stack_manager->GetUnsafeModule<TestStackModule3>()->TestMethod({ .iter = iter, .tag = std::string(kTestDataTag), - .callback = [](TestCallbackData data) {}, + .callback = [](TestCallbackData /*data*/) {}, }); }, c->Id(), i, StackManager())); @@ -554,12 +554,12 @@ TEST_F(StackLifecycleWithDefaultModulesUnitTest, client_using_stack_manager_when for (int i = 0; i < kNumIters; i++) { for (auto& c : client_group.clients_) { c->Post(base::BindOnce( - [](int id, int iter, Counters* counters, - std::shared_ptr<TestStackManager> stack_manager) { + [](int /*id*/, int iter, Counters* counters, + std::shared_ptr<TestStackManager> /*stack_manager*/) { TestData test_data = { .iter = iter, .tag = std::string(kTestDataTag), - .callback = [](TestCallbackData data) {}, + .callback = [](TestCallbackData /*data*/) {}, }; if (bluetooth::shim::Stack::GetInstance()->CallOnModule<TestStackModule1>( [test_data](TestStackModule1* mod) { mod->TestMethod(test_data); })) { @@ -570,12 +570,12 @@ TEST_F(StackLifecycleWithDefaultModulesUnitTest, client_using_stack_manager_when }, c->Id(), i, &counters, StackManager())); c->Post(base::BindOnce( - [](int id, int iter, Counters* counters, - std::shared_ptr<TestStackManager> stack_manager) { + [](int /*id*/, int iter, Counters* counters, + std::shared_ptr<TestStackManager> /*stack_manager*/) { TestData test_data = { .iter = iter, .tag = std::string(kTestDataTag), - .callback = [](TestCallbackData data) {}, + .callback = [](TestCallbackData /*data*/) {}, }; if (bluetooth::shim::Stack::GetInstance()->CallOnModule<TestStackModule2>( [test_data](TestStackModule2* mod) { mod->TestMethod(test_data); })) { @@ -586,12 +586,12 @@ TEST_F(StackLifecycleWithDefaultModulesUnitTest, client_using_stack_manager_when }, c->Id(), i, &counters, StackManager())); c->Post(base::BindOnce( - [](int id, int iter, Counters* counters, - std::shared_ptr<TestStackManager> stack_manager) { + [](int /*id*/, int iter, Counters* counters, + std::shared_ptr<TestStackManager> /*stack_manager*/) { TestData test_data = { .iter = iter, .tag = std::string(kTestDataTag), - .callback = [](TestCallbackData data) {}, + .callback = [](TestCallbackData /*data*/) {}, }; if (bluetooth::shim::Stack::GetInstance()->CallOnModule<TestStackModule3>( [test_data](TestStackModule3* mod) { mod->TestMethod(test_data); })) { diff --git a/system/main/test/main_shim_test.cc b/system/main/test/main_shim_test.cc index 43d40bc799..7dbbedd607 100644 --- a/system/main/test/main_shim_test.cc +++ b/system/main/test/main_shim_test.cc @@ -123,36 +123,39 @@ bluetooth::common::TimestamperInMilliseconds timestamper_in_milliseconds; void mock_on_send_data_upwards(BT_HDR*) {} -void mock_on_packets_completed(uint16_t handle, uint16_t num_packets) {} +void mock_on_packets_completed(uint16_t /*handle*/, uint16_t /*num_packets*/) {} -void mock_connection_classic_on_connected(const RawAddress& bda, uint16_t handle, uint8_t enc_mode, - bool locally_initiated) {} +void mock_connection_classic_on_connected(const RawAddress& /*bda*/, uint16_t /*handle*/, + uint8_t /*enc_mode*/, bool /*locally_initiated*/) {} -void mock_connection_classic_on_failed(const RawAddress& bda, tHCI_STATUS status, - bool locally_initiated) {} +void mock_connection_classic_on_failed(const RawAddress& /*bda*/, tHCI_STATUS /*status*/, + bool /*locally_initiated*/) {} -void mock_connection_classic_on_disconnected(tHCI_STATUS status, uint16_t handle, - tHCI_STATUS reason) { +void mock_connection_classic_on_disconnected(tHCI_STATUS /*status*/, uint16_t handle, + tHCI_STATUS /*reason*/) { ASSERT_TRUE(mock_function_handle_promise_map.find(__func__) != mock_function_handle_promise_map.end()); mock_function_handle_promise_map[__func__].set_value(handle); } -void mock_connection_le_on_connected(const tBLE_BD_ADDR& address_with_type, uint16_t handle, - tHCI_ROLE role, uint16_t conn_interval, uint16_t conn_latency, - uint16_t conn_timeout, const RawAddress& local_rpa, - const RawAddress& peer_rpa, tBLE_ADDR_TYPE peer_addr_type, - bool can_read_discoverable_characteristics) {} -void mock_connection_le_on_failed(const tBLE_BD_ADDR& address_with_type, uint16_t handle, - bool enhanced, tHCI_STATUS status) {} +void mock_connection_le_on_connected(const tBLE_BD_ADDR& /*address_with_type*/, uint16_t /*handle*/, + tHCI_ROLE /*role*/, uint16_t /*conn_interval*/, + uint16_t /*conn_latency*/, uint16_t /*conn_timeout*/, + const RawAddress& /*local_rpa*/, + const RawAddress& /*peer_rpa*/, + tBLE_ADDR_TYPE /*peer_addr_type*/, + bool /*can_read_discoverable_characteristics*/) {} +void mock_connection_le_on_failed(const tBLE_BD_ADDR& /*address_with_type*/, uint16_t /*handle*/, + bool /*enhanced*/, tHCI_STATUS /*status*/) {} static std::promise<uint16_t> mock_connection_le_on_disconnected_promise; -void mock_connection_le_on_disconnected(tHCI_STATUS status, uint16_t handle, tHCI_STATUS reason) { +void mock_connection_le_on_disconnected(tHCI_STATUS /*status*/, uint16_t handle, + tHCI_STATUS /*reason*/) { mock_connection_le_on_disconnected_promise.set_value(handle); } -void mock_link_classic_on_read_remote_extended_features_complete(uint16_t handle, - uint8_t current_page_number, - uint8_t max_page_number, - uint64_t features) {} +void mock_link_classic_on_read_remote_extended_features_complete(uint16_t /*handle*/, + uint8_t /*current_page_number*/, + uint8_t /*max_page_number*/, + uint64_t /*features*/) {} shim::acl_interface_t acl_interface{ .on_send_data_upwards = mock_on_send_data_upwards, @@ -211,7 +214,7 @@ template <typename T> class MockEnQueue : public os::IQueueEnqueue<T> { using EnqueueCallback = base::Callback<std::unique_ptr<T>()>; - void RegisterEnqueue(os::Handler* handler, EnqueueCallback callback) override {} + void RegisterEnqueue(os::Handler* /*handler*/, EnqueueCallback /*callback*/) override {} void UnregisterEnqueue() override {} }; @@ -219,7 +222,7 @@ template <typename T> class MockDeQueue : public os::IQueueDequeue<T> { using DequeueCallback = base::Callback<void()>; - void RegisterDequeue(os::Handler* handler, DequeueCallback callback) override {} + void RegisterDequeue(os::Handler* /*handler*/, DequeueCallback /*callback*/) override {} void UnregisterDequeue() override {} std::unique_ptr<T> TryDequeue() override { return nullptr; } }; @@ -258,7 +261,7 @@ public: return true; } - bool Disconnect(hci::DisconnectReason reason) override { + bool Disconnect(hci::DisconnectReason /*reason*/) override { disconnect_cnt_++; disconnect_promise_.set_value(handle_); return true; @@ -299,7 +302,7 @@ public: bool ReadRemoteVersionInformation() override { return true; } bool LeReadRemoteFeatures() override { return true; } - void Disconnect(hci::DisconnectReason reason) override { + void Disconnect(hci::DisconnectReason /*reason*/) override { disconnect_cnt_++; disconnect_promise_.set_value(handle_); } @@ -546,24 +549,27 @@ TEST_F(MainShimTest, BleScannerInterfaceImpl_nop) { class TestScanningCallbacks : public ::ScanningCallbacks { public: ~TestScanningCallbacks() {} - void OnScannerRegistered(const bluetooth::Uuid app_uuid, uint8_t scannerId, - uint8_t status) override {} - void OnSetScannerParameterComplete(uint8_t scannerId, uint8_t status) override {} - void OnScanResult(uint16_t event_type, uint8_t addr_type, RawAddress bda, uint8_t primary_phy, - uint8_t secondary_phy, uint8_t advertising_sid, int8_t tx_power, int8_t rssi, - uint16_t periodic_adv_int, std::vector<uint8_t> adv_data) override {} - void OnTrackAdvFoundLost(AdvertisingTrackInfo advertising_track_info) override {} - void OnBatchScanReports(int client_if, int status, int report_format, int num_records, - std::vector<uint8_t> data) override {} - void OnBatchScanThresholdCrossed(int client_if) override {} - void OnPeriodicSyncStarted(int reg_id, uint8_t status, uint16_t sync_handle, - uint8_t advertising_sid, uint8_t address_type, RawAddress address, - uint8_t phy, uint16_t interval) override {} - void OnPeriodicSyncReport(uint16_t sync_handle, int8_t tx_power, int8_t rssi, uint8_t status, - std::vector<uint8_t> data) override {} - void OnPeriodicSyncLost(uint16_t sync_handle) override {} - void OnPeriodicSyncTransferred(int pa_source, uint8_t status, RawAddress address) override {} - void OnBigInfoReport(uint16_t sync_handle, bool encrypted) override {} + void OnScannerRegistered(const bluetooth::Uuid /*app_uuid*/, uint8_t /*scannerId*/, + uint8_t /*status*/) override {} + void OnSetScannerParameterComplete(uint8_t /*scannerId*/, uint8_t /*status*/) override {} + void OnScanResult(uint16_t /*event_type*/, uint8_t /*addr_type*/, RawAddress /*bda*/, + uint8_t /*primary_phy*/, uint8_t /*secondary_phy*/, uint8_t /*advertising_sid*/, + int8_t /*tx_power*/, int8_t /*rssi*/, uint16_t /*periodic_adv_int*/, + std::vector<uint8_t> /*adv_data*/) override {} + void OnTrackAdvFoundLost(AdvertisingTrackInfo /*advertising_track_info*/) override {} + void OnBatchScanReports(int /*client_if*/, int /*status*/, int /*report_format*/, + int /*num_records*/, std::vector<uint8_t> /*data*/) override {} + void OnBatchScanThresholdCrossed(int /*client_if*/) override {} + void OnPeriodicSyncStarted(int /*reg_id*/, uint8_t /*status*/, uint16_t /*sync_handle*/, + uint8_t /*advertising_sid*/, uint8_t /*address_type*/, + RawAddress /*address*/, uint8_t /*phy*/, + uint16_t /*interval*/) override {} + void OnPeriodicSyncReport(uint16_t /*sync_handle*/, int8_t /*tx_power*/, int8_t /*rssi*/, + uint8_t /*status*/, std::vector<uint8_t> /*data*/) override {} + void OnPeriodicSyncLost(uint16_t /*sync_handle*/) override {} + void OnPeriodicSyncTransferred(int /*pa_source*/, uint8_t /*status*/, + RawAddress /*address*/) override {} + void OnBigInfoReport(uint16_t /*sync_handle*/, bool /*encrypted*/) override {} }; TEST_F(MainShimTest, DISABLED_BleScannerInterfaceImpl_OnScanResult) { @@ -646,7 +652,7 @@ TEST_F(MainShimTestWithClassicConnection, nop) {} TEST_F(MainShimTestWithClassicConnection, read_extended_feature) { int read_remote_extended_feature_call_count = 0; raw_connection_->read_remote_extended_features_function_ = - [&read_remote_extended_feature_call_count](uint8_t page_number) { + [&read_remote_extended_feature_call_count](uint8_t /*page_number*/) { read_remote_extended_feature_call_count++; }; diff --git a/system/osi/Android.bp b/system/osi/Android.bp index 04e9a1f839..aeabc7ad18 100644 --- a/system/osi/Android.bp +++ b/system/osi/Android.bp @@ -104,6 +104,9 @@ cc_test { "fluoride_osi_defaults", "mts_defaults", ], + cflags: [ + "-DLIB_OSI_INTERNAL", + ], host_supported: true, srcs: [ "test/alarm_test.cc", @@ -155,10 +158,6 @@ cc_test { ], }, }, - cflags: [ - "-DLIB_OSI_INTERNAL", - "-Wno-unused-parameter", - ], sanitize: { address: true, cfi: false, diff --git a/system/osi/test/alarm_test.cc b/system/osi/test/alarm_test.cc index a7538a9904..cf98d2dcdc 100644 --- a/system/osi/test/alarm_test.cc +++ b/system/osi/test/alarm_test.cc @@ -50,12 +50,12 @@ extern int64_t TIMER_INTERVAL_FOR_WAKELOCK_IN_MS; static bool is_wake_lock_acquired = false; -static int acquire_wake_lock_cb(const char* lock_name) { +static int acquire_wake_lock_cb(const char* /*lock_name*/) { is_wake_lock_acquired = true; return BT_STATUS_SUCCESS; } -static int release_wake_lock_cb(const char* lock_name) { +static int release_wake_lock_cb(const char* /*lock_name*/) { is_wake_lock_acquired = false; return BT_STATUS_SUCCESS; } diff --git a/system/osi/test/fixed_queue_test.cc b/system/osi/test/fixed_queue_test.cc index 2efd7a3dc0..867b8e5d28 100644 --- a/system/osi/test/fixed_queue_test.cc +++ b/system/osi/test/fixed_queue_test.cc @@ -41,7 +41,7 @@ static void fixed_queue_ready(fixed_queue_t* queue, void* /* context */) { future_ready(received_message_future, msg); } -static void test_queue_entry_free_cb(void* data) { +static void test_queue_entry_free_cb(void* /*data*/) { // Don't free the data, because we are testing only whether the callback // is called. test_queue_entry_free_counter++; diff --git a/system/osi/test/fuzzers/alarm/Android.bp b/system/osi/test/fuzzers/alarm/Android.bp index 47c499a8a1..e1108e8731 100644 --- a/system/osi/test/fuzzers/alarm/Android.bp +++ b/system/osi/test/fuzzers/alarm/Android.bp @@ -30,7 +30,6 @@ cc_fuzz { ], cflags: [ "-Wno-unused-function", - "-Wno-unused-parameter", ], header_libs: ["libbluetooth_headers"], fuzz_config: { diff --git a/system/osi/test/fuzzers/alarm/fuzz_alarm.cc b/system/osi/test/fuzzers/alarm/fuzz_alarm.cc index 5bf587fcfd..bc69bf855c 100644 --- a/system/osi/test/fuzzers/alarm/fuzz_alarm.cc +++ b/system/osi/test/fuzzers/alarm/fuzz_alarm.cc @@ -63,7 +63,7 @@ static MessageLoopThread* thread = new MessageLoopThread("fake main thread"); bluetooth::common::MessageLoopThread* get_main_thread() { return thread; } -static void cb(void* data) { +static void cb(void* /*data*/) { ++cb_counter; semaphore.post(); } diff --git a/system/osi/test/fuzzers/compat/Android.bp b/system/osi/test/fuzzers/compat/Android.bp index 33cb80a605..2f7ac4aab0 100644 --- a/system/osi/test/fuzzers/compat/Android.bp +++ b/system/osi/test/fuzzers/compat/Android.bp @@ -23,5 +23,4 @@ cc_fuzz { "libbluetooth_log", "libosi", ], - cflags: ["-Wno-unused-parameter"], } diff --git a/system/osi/test/fuzzers/compat/fuzz_compat.cc b/system/osi/test/fuzzers/compat/fuzz_compat.cc index 84d986ef64..cf209ccbc9 100644 --- a/system/osi/test/fuzzers/compat/fuzz_compat.cc +++ b/system/osi/test/fuzzers/compat/fuzz_compat.cc @@ -19,7 +19,8 @@ #define MAX_BUFFER_SIZE 4096 -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) { +extern "C" int LLVMFuzzerTestOneInput([[maybe_unused]] const uint8_t* Data, + [[maybe_unused]] size_t Size) { // Our functions are only defined with __GLIBC__ #if __GLIBC__ // Init our wrapper diff --git a/system/osi/test/fuzzers/fixed_queue/Android.bp b/system/osi/test/fuzzers/fixed_queue/Android.bp index 8bb68f41f8..8758597a55 100644 --- a/system/osi/test/fuzzers/fixed_queue/Android.bp +++ b/system/osi/test/fuzzers/fixed_queue/Android.bp @@ -24,5 +24,4 @@ cc_fuzz { "libchrome", "libosi", ], - cflags: ["-Wno-unused-parameter"], } diff --git a/system/osi/test/fuzzers/fixed_queue/fuzz_fixed_queue.cc b/system/osi/test/fuzzers/fixed_queue/fuzz_fixed_queue.cc index 30c163390c..e5671f0828 100644 --- a/system/osi/test/fuzzers/fixed_queue/fuzz_fixed_queue.cc +++ b/system/osi/test/fuzzers/fixed_queue/fuzz_fixed_queue.cc @@ -29,8 +29,8 @@ static future_t* received_message_future = nullptr; // Empty callback function -void fqFreeCb(void* data) {} -void fqCb(fixed_queue_t* queue, void* data) { +void fqFreeCb(void* /*data*/) {} +void fqCb(fixed_queue_t* queue, void* /*data*/) { void* msg = fixed_queue_try_dequeue(queue); future_ready(received_message_future, msg); } @@ -72,7 +72,7 @@ void createNewFuture() { } void callArbitraryFunction(fixed_queue_t* fixed_queue, std::vector<void*>* live_buffer_vector, - std::vector<thread_t*>* live_thread_vector, + std::vector<thread_t*>* /*live_thread_vector*/, FuzzedDataProvider* dataProvider) { void* buf_ptr = nullptr; size_t index = 0; diff --git a/system/osi/test/fuzzers/list/Android.bp b/system/osi/test/fuzzers/list/Android.bp index 65f4fcbecd..5c8f15e81e 100644 --- a/system/osi/test/fuzzers/list/Android.bp +++ b/system/osi/test/fuzzers/list/Android.bp @@ -21,5 +21,4 @@ cc_fuzz { "liblog", "libosi", ], - cflags: ["-Wno-unused-parameter"], } diff --git a/system/osi/test/fuzzers/list/fuzz_list.cc b/system/osi/test/fuzzers/list/fuzz_list.cc index e0e74165d2..b4ae8c5e0b 100644 --- a/system/osi/test/fuzzers/list/fuzz_list.cc +++ b/system/osi/test/fuzzers/list/fuzz_list.cc @@ -27,9 +27,9 @@ struct list_node_t { void* data; }; -void cb(void* data) {} +void cb(void* /*data*/) {} // Pass a ptr to FuzzedDataProvider in context -bool list_iter_cb_impl(void* data, void* context) { +bool list_iter_cb_impl(void* /*data*/, void* context) { FuzzedDataProvider* dataProvider = reinterpret_cast<FuzzedDataProvider*>(context); return dataProvider->ConsumeBool(); } diff --git a/system/osi/test/wakelock_test.cc b/system/osi/test/wakelock_test.cc index 2596553d66..6fb00990e6 100644 --- a/system/osi/test/wakelock_test.cc +++ b/system/osi/test/wakelock_test.cc @@ -26,12 +26,12 @@ static bool is_wake_lock_acquired = false; -static int acquire_wake_lock_cb(const char* lock_name) { +static int acquire_wake_lock_cb(const char* /*lock_name*/) { is_wake_lock_acquired = true; return BT_STATUS_SUCCESS; } -static int release_wake_lock_cb(const char* lock_name) { +static int release_wake_lock_cb(const char* /*lock_name*/) { is_wake_lock_acquired = false; return BT_STATUS_SUCCESS; } diff --git a/system/packet/Android.bp b/system/packet/Android.bp index b5257108d2..d3ba6dfd71 100644 --- a/system/packet/Android.bp +++ b/system/packet/Android.bp @@ -83,9 +83,6 @@ cc_test { "libchrome", "libgmock", ], - cflags: [ - "-Wno-unused-parameter", - ], target: { android: { static_libs: [ diff --git a/system/packet/tests/packet_test_helper.h b/system/packet/tests/packet_test_helper.h index e91979317e..a9956cc6a2 100644 --- a/system/packet/tests/packet_test_helper.h +++ b/system/packet/tests/packet_test_helper.h @@ -195,7 +195,7 @@ public: } private: - void wholeEntry(size_t f, AttributeEntry&& entry) { + void wholeEntry(size_t /*f*/, AttributeEntry&& entry) { _control_set.insert(entry); _order_control.push_back(entry); if (_builder->size() != expected_size()) { diff --git a/system/profile/avrcp/Android.bp b/system/profile/avrcp/Android.bp index 7420ac5607..133d2a4712 100644 --- a/system/profile/avrcp/Android.bp +++ b/system/profile/avrcp/Android.bp @@ -43,7 +43,6 @@ cc_library_static { ], min_sdk_version: "Tiramisu", header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -91,10 +90,6 @@ cc_test { sanitize: { cfi: false, }, - - cflags: [ - "-Wno-unused-parameter", - ], header_libs: ["libbluetooth_headers"], } @@ -143,5 +138,4 @@ cc_fuzz { enabled: false, }, }, - cflags: ["-Wno-unused-parameter"], } diff --git a/system/profile/avrcp/avrcp_sdp_records.cc b/system/profile/avrcp/avrcp_sdp_records.cc index b58f047422..57d90ce60b 100644 --- a/system/profile/avrcp/avrcp_sdp_records.cc +++ b/system/profile/avrcp/avrcp_sdp_records.cc @@ -178,8 +178,8 @@ uint16_t ControlAvrcSdpRecordHelper::UpdateRecord(const uint16_t new_categories) return result ? AVRC_SUCCESS : AVRC_FAIL; } -uint16_t ControlAvrcSdpRecordHelper::EnableCovertArt(uint16_t cover_art_psm, - const uint16_t request_id) { +uint16_t ControlAvrcSdpRecordHelper::EnableCovertArt(uint16_t /*cover_art_psm*/, + const uint16_t /*request_id*/) { log::warn( "Enabling cover art support dynamically is not supported for service " "UUID {:x}", @@ -187,7 +187,7 @@ uint16_t ControlAvrcSdpRecordHelper::EnableCovertArt(uint16_t cover_art_psm, return AVRC_FAIL; } -uint16_t ControlAvrcSdpRecordHelper::DisableCovertArt(const uint16_t request_id) { +uint16_t ControlAvrcSdpRecordHelper::DisableCovertArt(const uint16_t /*request_id*/) { log::warn( "Disabling cover art support dynamically is not supported for service " "UUID {:x}", diff --git a/system/profile/avrcp/connection_handler.cc b/system/profile/avrcp/connection_handler.cc index 3d6a67c964..b25e7938a5 100644 --- a/system/profile/avrcp/connection_handler.cc +++ b/system/profile/avrcp/connection_handler.cc @@ -138,7 +138,7 @@ bool ConnectionHandler::ConnectDevice(const RawAddress& bdaddr) { } auto connection_lambda = [](ConnectionHandler* instance_, const RawAddress& bdaddr, - tSDP_STATUS status, uint16_t version, uint16_t features) { + tSDP_STATUS status, uint16_t /*version*/, uint16_t features) { log::info("SDP Completed features=0x{:x}", features); if (status != tSDP_STATUS::SDP_SUCCESS || !(features & BTA_AV_FEAT_RCCT)) { log::error( @@ -371,8 +371,8 @@ void ConnectionHandler::AcceptorControlCb(uint8_t handle, uint8_t event, uint16_ connection_cb_.Run(newDevice); log::info("Performing SDP on connected device. address={}", *peer_addr); - auto sdp_lambda = [](ConnectionHandler* instance_, uint8_t handle, tSDP_STATUS status, - uint16_t version, uint16_t features) { + auto sdp_lambda = [](ConnectionHandler* instance_, uint8_t handle, tSDP_STATUS /*status*/, + uint16_t /*version*/, uint16_t features) { if (instance_->device_map_.find(handle) == instance_->device_map_.end()) { log::warn("No device found for handle: 0x{:x}", handle); return; @@ -652,8 +652,9 @@ bool ConnectionHandler::SdpLookupAudioRole(uint16_t handle) { weak_ptr_factory_.GetWeakPtr(), handle)); } -void ConnectionHandler::SdpLookupAudioRoleCb(uint16_t handle, bool found, tA2DP_Service* p_service, - const RawAddress& peer_address) { +void ConnectionHandler::SdpLookupAudioRoleCb(uint16_t handle, bool found, + tA2DP_Service* /*p_service*/, + const RawAddress& /*peer_address*/) { if (device_map_.find(handle) == device_map_.end()) { log::warn("No device found for handle: {}", loghex(handle)); return; diff --git a/system/profile/avrcp/device.cc b/system/profile/avrcp/device.cc index 1851e88d34..f334ab659d 100644 --- a/system/profile/avrcp/device.cc +++ b/system/profile/avrcp/device.cc @@ -1114,7 +1114,7 @@ void Device::HandleGetTotalNumberOfItems(uint8_t label, } } -void Device::GetTotalNumberOfItemsMediaPlayersResponse(uint8_t label, uint16_t curr_player, +void Device::GetTotalNumberOfItemsMediaPlayersResponse(uint8_t label, uint16_t /*curr_player*/, std::vector<MediaPlayerInfo> list) { log::verbose("num_items={}", list.size()); @@ -1131,7 +1131,7 @@ void Device::GetTotalNumberOfItemsVFSResponse(uint8_t label, std::vector<ListIte send_message(label, true, std::move(builder)); } -void Device::GetTotalNumberOfItemsNowPlayingResponse(uint8_t label, std::string curr_song_id, +void Device::GetTotalNumberOfItemsNowPlayingResponse(uint8_t label, std::string /*curr_song_id*/, std::vector<SongInfo> list) { log::verbose("num_items={}", list.size()); @@ -1179,7 +1179,7 @@ void Device::HandleChangePath(uint8_t label, std::shared_ptr<ChangePathRequest> base::Bind(&Device::ChangePathResponse, weak_ptr_factory_.GetWeakPtr(), label, pkt)); } -void Device::ChangePathResponse(uint8_t label, std::shared_ptr<ChangePathRequest> pkt, +void Device::ChangePathResponse(uint8_t label, std::shared_ptr<ChangePathRequest> /*pkt*/, std::vector<ListItem> list) { // TODO (apanicke): Reconstruct the VFS ID's here. Right now it gets // reconstructed in GetFolderItemsVFS @@ -1557,7 +1557,7 @@ void Device::SendMediaUpdate(bool metadata, bool play_status, bool queue) { } } -void Device::SendFolderUpdate(bool available_players, bool addressed_player, bool uids) { +void Device::SendFolderUpdate(bool available_players, bool addressed_player, bool /*uids*/) { log::assert_that(media_interface_ != nullptr, "assert failed: media_interface_ != nullptr"); log::verbose(""); @@ -1664,7 +1664,7 @@ void Device::PlayerSettingChangedNotificationResponse(uint8_t label, bool interi } void Device::HandleNowPlayingNotificationResponse(uint8_t label, bool interim, - std::string curr_song_id, + std::string /*curr_song_id*/, std::vector<SongInfo> song_list) { if (interim) { now_playing_changed_ = Notification(true, label); diff --git a/system/profile/avrcp/tests/avrcp_connection_handler_test.cc b/system/profile/avrcp/tests/avrcp_connection_handler_test.cc index cd1ecbae75..73334576f1 100644 --- a/system/profile/avrcp/tests/avrcp_connection_handler_test.cc +++ b/system/profile/avrcp/tests/avrcp_connection_handler_test.cc @@ -41,8 +41,8 @@ using ::testing::SaveArgPointee; using ::testing::SetArgPointee; using ::testing::StrictMock; -bool btif_av_peer_is_connected_sink(const RawAddress& peer_address) { return true; } -bool btif_av_peer_is_connected_source(const RawAddress& peer_address) { return false; } +bool btif_av_peer_is_connected_sink(const RawAddress& /*peer_address*/) { return true; } +bool btif_av_peer_is_connected_source(const RawAddress& /*peer_address*/) { return false; } bool btif_av_both_enable(void) { return false; } namespace bluetooth { diff --git a/system/stack/Android.bp b/system/stack/Android.bp index 20f12e4c23..f106a3c455 100644 --- a/system/stack/Android.bp +++ b/system/stack/Android.bp @@ -364,9 +364,6 @@ cc_defaults { "bluetooth_cflags", "bluetooth_flatbuffer_bundler_defaults", ], - cflags: [ - "-Wno-unused-parameter", - ], include_dirs: [ "packages/modules/Bluetooth/system", "packages/modules/Bluetooth/system/gd", @@ -957,7 +954,6 @@ cc_test { cfi: false, }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } // Bluetooth stack smp unit tests for target @@ -1041,8 +1037,6 @@ cc_test { ], }, }, - // header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } // Bluetooth stack advertise data parsing unit tests for target @@ -1115,7 +1109,6 @@ cc_test { cfi: false, }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -1183,7 +1176,6 @@ cc_test { misc_undefined: ["bounds"], }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -1254,7 +1246,6 @@ cc_test { misc_undefined: ["bounds"], }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -1265,7 +1256,6 @@ cc_test { ], cflags: [ "-DUNIT_TESTS", - "-Wno-unused-parameter", ], test_suites: ["general-tests"], host_supported: true, @@ -1407,7 +1397,6 @@ cc_test { misc_undefined: ["bounds"], }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } // gatt sr hash test @@ -1474,7 +1463,6 @@ cc_test { }, }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } // Iso manager unit tests @@ -1614,7 +1602,6 @@ cc_test { cfi: false, }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -1870,7 +1857,6 @@ cc_test { }, }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -1943,7 +1929,6 @@ cc_test { }, }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -2044,7 +2029,6 @@ cc_test { }, }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -2139,7 +2123,6 @@ cc_test { }, }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { @@ -2229,7 +2212,6 @@ cc_test { }, }, header_libs: ["libbluetooth_headers"], - cflags: ["-Wno-unused-parameter"], } cc_test { diff --git a/system/stack/fuzzers/avrc_fuzzer.cc b/system/stack/fuzzers/avrc_fuzzer.cc index 03267249fd..1592b707fd 100644 --- a/system/stack/fuzzers/avrc_fuzzer.cc +++ b/system/stack/fuzzers/avrc_fuzzer.cc @@ -36,6 +36,7 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wunused-parameter" using bluetooth::Uuid; using namespace bluetooth; diff --git a/system/stack/fuzzers/bnep_fuzzer.cc b/system/stack/fuzzers/bnep_fuzzer.cc index 4ad6bffb0b..79a70556e4 100644 --- a/system/stack/fuzzers/bnep_fuzzer.cc +++ b/system/stack/fuzzers/bnep_fuzzer.cc @@ -33,6 +33,7 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wunused-parameter" using bluetooth::Uuid; diff --git a/system/stack/fuzzers/gatt_fuzzer.cc b/system/stack/fuzzers/gatt_fuzzer.cc index 3aa0f8ce01..3a9fb81276 100644 --- a/system/stack/fuzzers/gatt_fuzzer.cc +++ b/system/stack/fuzzers/gatt_fuzzer.cc @@ -35,6 +35,7 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wunused-parameter" using bluetooth::Uuid; bt_status_t do_in_main_thread(base::OnceCallback<void()>) { diff --git a/system/stack/fuzzers/l2cap_fuzzer.cc b/system/stack/fuzzers/l2cap_fuzzer.cc index f9fff7ff80..74b3590a45 100644 --- a/system/stack/fuzzers/l2cap_fuzzer.cc +++ b/system/stack/fuzzers/l2cap_fuzzer.cc @@ -73,8 +73,8 @@ bluetooth::common::PostableContext* get_main() { return nullptr; } namespace bluetooth { namespace os { -uint32_t GetSystemPropertyUint32Base(const std::string& property, uint32_t default_value, - int base) { +uint32_t GetSystemPropertyUint32Base(const std::string& /*property*/, uint32_t default_value, + int /*base*/) { return default_value; } } // namespace os @@ -100,15 +100,15 @@ namespace { class FakeBtStack { public: FakeBtStack() { - test::mock::stack_acl::acl_create_le_connection.body = [](const RawAddress& bd_addr) { + test::mock::stack_acl::acl_create_le_connection.body = [](const RawAddress& /*bd_addr*/) { return true; }; - test::mock::stack_acl::acl_send_data_packet_br_edr.body = [](const RawAddress& bd_addr, + test::mock::stack_acl::acl_send_data_packet_br_edr.body = [](const RawAddress& /*bd_addr*/, BT_HDR* hdr) { ConsumeData((const uint8_t*)hdr, hdr->offset + hdr->len); osi_free(hdr); }; - test::mock::stack_acl::acl_send_data_packet_ble.body = [](const RawAddress& bd_addr, + test::mock::stack_acl::acl_send_data_packet_ble.body = [](const RawAddress& /*bd_addr*/, BT_HDR* hdr) { ConsumeData((const uint8_t*)hdr, hdr->offset + hdr->len); osi_free(hdr); diff --git a/system/stack/fuzzers/rfcomm_fuzzer.cc b/system/stack/fuzzers/rfcomm_fuzzer.cc index 238354d642..3f3afbfe40 100644 --- a/system/stack/fuzzers/rfcomm_fuzzer.cc +++ b/system/stack/fuzzers/rfcomm_fuzzer.cc @@ -40,6 +40,7 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wunused-parameter" namespace bluetooth { namespace hal { diff --git a/system/stack/fuzzers/sdp_fuzzer.cc b/system/stack/fuzzers/sdp_fuzzer.cc index 8fbcb8f7d8..bd5b6f77c2 100644 --- a/system/stack/fuzzers/sdp_fuzzer.cc +++ b/system/stack/fuzzers/sdp_fuzzer.cc @@ -33,6 +33,7 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wunused-parameter" namespace { diff --git a/system/stack/fuzzers/smp_fuzzer.cc b/system/stack/fuzzers/smp_fuzzer.cc index e8f3ba8d91..a99010254a 100644 --- a/system/stack/fuzzers/smp_fuzzer.cc +++ b/system/stack/fuzzers/smp_fuzzer.cc @@ -35,6 +35,7 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wunused-parameter" bluetooth::common::MessageLoopThread* main_thread_ptr = nullptr; diff --git a/system/stack/test/a2dp/a2dp_aac_unittest.cc b/system/stack/test/a2dp/a2dp_aac_unittest.cc index 4ad50da241..7c35eaeb37 100644 --- a/system/stack/test/a2dp/a2dp_aac_unittest.cc +++ b/system/stack/test/a2dp/a2dp_aac_unittest.cc @@ -142,9 +142,9 @@ protected: TEST_F(A2dpAacTest, a2dp_source_read_underflow) { static int enqueue_cb_invoked = 0; - auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { return 0; }; + auto read_cb = +[](uint8_t* /*p_buf*/, uint32_t /*len*/) -> uint32_t { return 0; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t /*frames_n*/, uint32_t /*len*/) -> bool { enqueue_cb_invoked += 1; osi_free(p_buf); return false; @@ -161,9 +161,9 @@ TEST_F(A2dpAacTest, a2dp_source_read_underflow) { TEST_F(A2dpAacTest, a2dp_enqueue_cb_is_invoked) { static int enqueue_cb_invoked = 0; - auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { return len; }; + auto read_cb = +[](uint8_t* /*p_buf*/, uint32_t len) -> uint32_t { return len; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t /*frames_n*/, uint32_t /*len*/) -> bool { enqueue_cb_invoked += 1; osi_free(p_buf); return false; @@ -178,7 +178,7 @@ TEST_F(A2dpAacTest, a2dp_enqueue_cb_is_invoked) { } TEST_F(A2dpAacTest, decoded_data_cb_not_invoked_when_empty_packet) { - auto data_cb = +[](uint8_t* p_buf, uint32_t len) { FAIL(); }; + auto data_cb = +[](uint8_t* /*p_buf*/, uint32_t /*len*/) { FAIL(); }; InitializeDecoder(data_cb); std::vector<uint8_t> data; BT_HDR* packet = AllocateL2capPacket(data); @@ -190,7 +190,7 @@ TEST_F(A2dpAacTest, decoded_data_cb_invoked) { static int data_cb_invoked = 0; static int enqueue_cb_invoked = 0; - auto data_cb = +[](uint8_t* p_buf, uint32_t len) { data_cb_invoked += 1; }; + auto data_cb = +[](uint8_t* /*p_buf*/, uint32_t /*len*/) { data_cb_invoked += 1; }; InitializeDecoder(data_cb); @@ -201,7 +201,7 @@ TEST_F(A2dpAacTest, decoded_data_cb_invoked) { return len; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t /*frames_n*/, uint32_t /*len*/) -> bool { enqueue_cb_invoked += 1; packet = p_buf; return false; @@ -234,11 +234,11 @@ TEST_F(A2dpAacTest, sink_supports_aac) { } TEST_F(A2dpAacTest, effective_mtu_when_peer_supports_3mbps) { - auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { + auto read_cb = +[](uint8_t* /*p_buf*/, uint32_t len) -> uint32_t { log::assert_that(kAacReadSize == len, "assert failed: kAacReadSize == len"); return len; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t /*frames_n*/, uint32_t /*len*/) -> bool { osi_free(p_buf); return false; }; @@ -247,11 +247,11 @@ TEST_F(A2dpAacTest, effective_mtu_when_peer_supports_3mbps) { } TEST_F(A2dpAacTest, effective_mtu_when_peer_does_not_support_3mbps) { - auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { + auto read_cb = +[](uint8_t* /*p_buf*/, uint32_t len) -> uint32_t { log::assert_that(kAacReadSize == len, "assert failed: kAacReadSize == len"); return len; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t /*frames_n*/, uint32_t /*len*/) -> bool { osi_free(p_buf); return false; }; diff --git a/system/stack/test/a2dp/a2dp_opus_unittest.cc b/system/stack/test/a2dp/a2dp_opus_unittest.cc index b0d79f3ecc..eb517fd9a8 100644 --- a/system/stack/test/a2dp/a2dp_opus_unittest.cc +++ b/system/stack/test/a2dp/a2dp_opus_unittest.cc @@ -133,11 +133,11 @@ protected: TEST_F(A2dpOpusTest, a2dp_source_read_underflow) { promise = {}; - auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { + auto read_cb = +[](uint8_t* /*p_buf*/, uint32_t /*len*/) -> uint32_t { // underflow return 0; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t /*frames_n*/, uint32_t /*len*/) -> bool { promise.set_value(); osi_free(p_buf); return false; @@ -154,11 +154,11 @@ TEST_F(A2dpOpusTest, a2dp_source_read_underflow) { TEST_F(A2dpOpusTest, a2dp_enqueue_cb_is_invoked) { promise = {}; - auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { + auto read_cb = +[](uint8_t* /*p_buf*/, uint32_t len) -> uint32_t { log::assert_that(GetReadSize() == len, "assert failed: GetReadSize() == len"); return len; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t /*frames_n*/, uint32_t /*len*/) -> bool { static bool first_invocation = true; if (first_invocation) { promise.set_value(); @@ -177,7 +177,7 @@ TEST_F(A2dpOpusTest, a2dp_enqueue_cb_is_invoked) { } TEST_F(A2dpOpusTest, decoded_data_cb_not_invoked_when_empty_packet) { - auto data_cb = +[](uint8_t* p_buf, uint32_t len) { FAIL(); }; + auto data_cb = +[](uint8_t* /*p_buf*/, uint32_t /*len*/) { FAIL(); }; InitializeDecoder(data_cb); std::vector<uint8_t> data; BT_HDR* packet = AllocateL2capPacket(data); @@ -187,7 +187,7 @@ TEST_F(A2dpOpusTest, decoded_data_cb_not_invoked_when_empty_packet) { TEST_F(A2dpOpusTest, decoded_data_cb_invoked) { promise = {}; - auto data_cb = +[](uint8_t* p_buf, uint32_t len) {}; + auto data_cb = +[](uint8_t* /*p_buf*/, uint32_t /*len*/) {}; InitializeDecoder(data_cb); auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { @@ -196,7 +196,7 @@ TEST_F(A2dpOpusTest, decoded_data_cb_invoked) { counter += len; return len; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t /*len*/) -> bool { static bool first_invocation = true; if (first_invocation) { packet = reinterpret_cast<BT_HDR*>(osi_malloc(sizeof(*p_buf) + p_buf->len + 1)); diff --git a/system/stack/test/a2dp/a2dp_sbc_unittest.cc b/system/stack/test/a2dp/a2dp_sbc_unittest.cc index 89e76bd7a3..950a6100dd 100644 --- a/system/stack/test/a2dp/a2dp_sbc_unittest.cc +++ b/system/stack/test/a2dp/a2dp_sbc_unittest.cc @@ -141,11 +141,11 @@ protected: TEST_F(A2dpSbcTest, a2dp_source_read_underflow) { promise = {}; - auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { + auto read_cb = +[](uint8_t* /*p_buf*/, uint32_t /*len*/) -> uint32_t { // underflow return 0; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t /*frames_n*/, uint32_t /*len*/) -> bool { promise.set_value(); osi_free(p_buf); return false; @@ -162,11 +162,11 @@ TEST_F(A2dpSbcTest, a2dp_source_read_underflow) { TEST_F(A2dpSbcTest, a2dp_enqueue_cb_is_invoked) { promise = {}; - auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { + auto read_cb = +[](uint8_t* /*p_buf*/, uint32_t len) -> uint32_t { log::assert_that(kSbcReadSize == len, "assert failed: kSbcReadSize == len"); return len; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t /*frames_n*/, uint32_t /*len*/) -> bool { static bool first_invocation = true; if (first_invocation) { promise.set_value(); @@ -185,7 +185,7 @@ TEST_F(A2dpSbcTest, a2dp_enqueue_cb_is_invoked) { } TEST_F(A2dpSbcTest, decoded_data_cb_not_invoked_when_empty_packet) { - auto data_cb = +[](uint8_t* p_buf, uint32_t len) { FAIL(); }; + auto data_cb = +[](uint8_t* /*p_buf*/, uint32_t /*len*/) { FAIL(); }; InitializeDecoder(data_cb); std::vector<uint8_t> data; BT_HDR* packet = AllocateL2capPacket(data); @@ -195,7 +195,7 @@ TEST_F(A2dpSbcTest, decoded_data_cb_not_invoked_when_empty_packet) { TEST_F(A2dpSbcTest, decoded_data_cb_invoked) { promise = {}; - auto data_cb = +[](uint8_t* p_buf, uint32_t len) {}; + auto data_cb = +[](uint8_t* /*p_buf*/, uint32_t /*len*/) {}; InitializeDecoder(data_cb); auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { @@ -204,7 +204,7 @@ TEST_F(A2dpSbcTest, decoded_data_cb_invoked) { counter += len; return len; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t /*len*/) -> bool { static bool first_invocation = true; if (first_invocation) { packet = reinterpret_cast<BT_HDR*>(osi_malloc(sizeof(*p_buf) + p_buf->len + 1)); @@ -244,11 +244,11 @@ TEST_F(A2dpSbcTest, sink_supports_sbc) { } TEST_F(A2dpSbcTest, effective_mtu_when_peer_supports_3mbps) { - auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { + auto read_cb = +[](uint8_t* /*p_buf*/, uint32_t len) -> uint32_t { log::assert_that(kSbcReadSize == len, "assert failed: kSbcReadSize == len"); return len; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t /*frames_n*/, uint32_t /*len*/) -> bool { osi_free(p_buf); return false; }; @@ -257,11 +257,11 @@ TEST_F(A2dpSbcTest, effective_mtu_when_peer_supports_3mbps) { } TEST_F(A2dpSbcTest, effective_mtu_when_peer_does_not_support_3mbps) { - auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { + auto read_cb = +[](uint8_t* /*p_buf*/, uint32_t len) -> uint32_t { log::assert_that(kSbcReadSize == len, "assert failed: kSbcReadSize == len"); return len; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* p_buf, size_t /*frames_n*/, uint32_t /*len*/) -> bool { osi_free(p_buf); return false; }; diff --git a/system/stack/test/a2dp/a2dp_vendor_ldac_unittest.cc b/system/stack/test/a2dp/a2dp_vendor_ldac_unittest.cc index 90b00507f1..d446d808ac 100644 --- a/system/stack/test/a2dp/a2dp_vendor_ldac_unittest.cc +++ b/system/stack/test/a2dp/a2dp_vendor_ldac_unittest.cc @@ -124,9 +124,9 @@ protected: TEST_F(A2dpLdacTest, a2dp_source_read_underflow) { static int enqueue_cb_invoked = 0; - auto read_cb = +[](uint8_t* p_buf, uint32_t len) -> uint32_t { return 0; }; + auto read_cb = +[](uint8_t* /*p_buf*/, uint32_t /*len*/) -> uint32_t { return 0; }; - auto enqueue_cb = +[](BT_HDR* p_buf, size_t frames_n, uint32_t len) -> bool { + auto enqueue_cb = +[](BT_HDR* /*p_buf*/, size_t /*frames_n*/, uint32_t /*len*/) -> bool { enqueue_cb_invoked += 1; return false; }; diff --git a/system/stack/test/a2dp/misc_fake.cc b/system/stack/test/a2dp/misc_fake.cc index 4c583807f0..ee82394629 100644 --- a/system/stack/test/a2dp/misc_fake.cc +++ b/system/stack/test/a2dp/misc_fake.cc @@ -16,6 +16,6 @@ #include "stack/include/a2dp_vendor_ldac.h" -int A2DP_VendorGetTrackSampleRateLdac(const uint8_t* p_codec_info) { return 0; } -int A2DP_VendorGetTrackBitsPerSampleLdac(const uint8_t* p_codec_info) { return 0; } -int A2DP_VendorGetChannelModeCodeLdac(const uint8_t* p_codec_info) { return 0; } +int A2DP_VendorGetTrackSampleRateLdac(const uint8_t* /*p_codec_info*/) { return 0; } +int A2DP_VendorGetTrackBitsPerSampleLdac(const uint8_t* /*p_codec_info*/) { return 0; } +int A2DP_VendorGetChannelModeCodeLdac(const uint8_t* /*p_codec_info*/) { return 0; } diff --git a/system/stack/test/common/mock_btm_layer.cc b/system/stack/test/common/mock_btm_layer.cc index acfb6357a6..129b58ce18 100644 --- a/system/stack/test/common/mock_btm_layer.cc +++ b/system/stack/test/common/mock_btm_layer.cc @@ -33,9 +33,11 @@ void bluetooth::manager::SetMockSecurityInternalInterface( btm_security_internal_interface = mock_btm_security_internal_interface; } -uint16_t BTM_GetMaxPacketSize(const RawAddress& addr) { return RFCOMM_DEFAULT_MTU; } +uint16_t BTM_GetMaxPacketSize(const RawAddress& /*addr*/) { return RFCOMM_DEFAULT_MTU; } -bool BTM_IsAclConnectionUp(const RawAddress& remote_bda, tBT_TRANSPORT transport) { return true; } +bool BTM_IsAclConnectionUp(const RawAddress& /*remote_bda*/, tBT_TRANSPORT /*transport*/) { + return true; +} struct btm_client_interface_t btm_client_interface = { .peer = diff --git a/system/stack/test/common/mock_l2cap_layer.cc b/system/stack/test/common/mock_l2cap_layer.cc index c2c6ab18a0..b61b80c567 100644 --- a/system/stack/test/common/mock_l2cap_layer.cc +++ b/system/stack/test/common/mock_l2cap_layer.cc @@ -32,11 +32,11 @@ void bluetooth::l2cap::SetMockInterface(MockL2capInterface* mock_l2cap_interface l2cap_interface = mock_l2cap_interface; } -tL2C_CCB* l2cu_find_ccb_by_cid(tL2C_LCB* p_lcb, uint16_t local_cid) { return nullptr; } +tL2C_CCB* l2cu_find_ccb_by_cid(tL2C_LCB* /*p_lcb*/, uint16_t /*local_cid*/) { return nullptr; } uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info, bool enable_snoop, - tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu, uint16_t required_remote_mtu, - uint16_t sec_level) { + tL2CAP_ERTM_INFO* p_ertm_info, uint16_t /*my_mtu*/, + uint16_t /*required_remote_mtu*/, uint16_t /*sec_level*/) { bluetooth::log::verbose("psm={}, enable_snoop={}", psm, enable_snoop); return l2cap_interface->Register(psm, p_cb_info, enable_snoop, p_ertm_info); } @@ -62,7 +62,7 @@ tL2CAP_DW_RESULT L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) { } uint16_t L2CA_RegisterLECoc(uint16_t psm, const tL2CAP_APPL_INFO& cb_info, uint16_t sec_level, - tL2CAP_LE_CFG_INFO cfg) { + tL2CAP_LE_CFG_INFO /*cfg*/) { return l2cap_interface->RegisterLECoc(psm, cb_info, sec_level); } diff --git a/system/stack/test/common/mock_stack_avdt_msg.cc b/system/stack/test/common/mock_stack_avdt_msg.cc index 76ff6ac8c4..22a5afce90 100644 --- a/system/stack/test/common/mock_stack_avdt_msg.cc +++ b/system/stack/test/common/mock_stack_avdt_msg.cc @@ -30,7 +30,7 @@ static std::vector<uint8_t> _rsp_sig_ids{}; -void avdt_msg_send_rsp(AvdtpCcb* p_ccb, uint8_t sig_id, tAVDT_MSG* p_params) { +void avdt_msg_send_rsp(AvdtpCcb* /*p_ccb*/, uint8_t sig_id, tAVDT_MSG* /*p_params*/) { inc_func_call_count(__func__); _rsp_sig_ids.push_back(sig_id); } @@ -41,15 +41,16 @@ void mock_avdt_msg_send_rsp_clear_history(void) { _rsp_sig_ids.clear(); } uint8_t mock_avdt_msg_send_rsp_get_sig_id_at(size_t nth) { return _rsp_sig_ids[nth]; } -void avdt_msg_ind(AvdtpCcb* p_ccb, BT_HDR* p_buf) { inc_func_call_count(__func__); } +void avdt_msg_ind(AvdtpCcb* /*p_ccb*/, BT_HDR* /*p_buf*/) { inc_func_call_count(__func__); } -void avdt_msg_send_rej(AvdtpCcb* p_ccb, uint8_t sig_id, tAVDT_MSG* p_params) { +void avdt_msg_send_rej(AvdtpCcb* /*p_ccb*/, uint8_t /*sig_id*/, tAVDT_MSG* /*p_params*/) { inc_func_call_count(__func__); } static std::vector<uint8_t> _cmd_sig_ids{}; -void avdt_msg_send_cmd(AvdtpCcb* p_ccb, void* p_scb, uint8_t sig_id, tAVDT_MSG* p_params) { +void avdt_msg_send_cmd(AvdtpCcb* /*p_ccb*/, void* /*p_scb*/, uint8_t sig_id, + tAVDT_MSG* /*p_params*/) { inc_func_call_count(__func__); _cmd_sig_ids.push_back(sig_id); } @@ -60,7 +61,7 @@ void mock_avdt_msg_send_cmd_clear_history(void) { _cmd_sig_ids.clear(); } uint8_t mock_avdt_msg_send_cmd_get_sig_id_at(size_t nth) { return _cmd_sig_ids[nth]; } -bool avdt_msg_send(AvdtpCcb* p_ccb, BT_HDR* p_msg) { +bool avdt_msg_send(AvdtpCcb* /*p_ccb*/, BT_HDR* /*p_msg*/) { inc_func_call_count(__func__); return true; } diff --git a/system/stack/test/eatt/eatt_test.cc b/system/stack/test/eatt/eatt_test.cc index 0965fc5987..437a2f13ef 100644 --- a/system/stack/test/eatt/eatt_test.cc +++ b/system/stack/test/eatt/eatt_test.cc @@ -59,10 +59,10 @@ extern struct fake_osi_alarm_set_on_mloop fake_osi_alarm_set_on_mloop_; /* Needed for testing context */ static tGATT_TCB test_tcb; -void btif_storage_add_eatt_supported(const RawAddress& addr) { return; } -void gatt_consolidate(const RawAddress& identity_addr, const RawAddress& rpa) {} -void gatt_data_process(tGATT_TCB& tcb, uint16_t cid, BT_HDR* p_buf) { return; } -tGATT_TCB* gatt_find_tcb_by_addr(const RawAddress& bda, tBT_TRANSPORT transport) { +void btif_storage_add_eatt_supported(const RawAddress& /*addr*/) { return; } +void gatt_consolidate(const RawAddress& /*identity_addr*/, const RawAddress& /*rpa*/) {} +void gatt_data_process(tGATT_TCB& /*tcb*/, uint16_t /*cid*/, BT_HDR* /*p_buf*/) { return; } +tGATT_TCB* gatt_find_tcb_by_addr(const RawAddress& /*bda*/, tBT_TRANSPORT /*transport*/) { log::info(""); return &test_tcb; } @@ -80,7 +80,7 @@ protected: std::move(cb).Run(addr, BLE_GATT_SVR_SUP_FEAT_EATT_BITMASK); return true; }); - EXPECT_CALL(gatt_interface_, GetEattSupport).WillRepeatedly([](const RawAddress& addr) { + EXPECT_CALL(gatt_interface_, GetEattSupport).WillRepeatedly([](const RawAddress& /*addr*/) { return true; }); @@ -137,14 +137,14 @@ protected: ON_CALL(gatt_interface_, ClientReadSupportedFeatures) .WillByDefault( - [&eatt_supp_feat_cb](const RawAddress& addr, + [&eatt_supp_feat_cb](const RawAddress& /*addr*/, base::OnceCallback<void(const RawAddress&, uint8_t)> cb) { eatt_supp_feat_cb = std::move(cb); return true; }); // Return false to trigger supported features request - ON_CALL(gatt_interface_, GetEattSupport).WillByDefault([](const RawAddress& addr) { + ON_CALL(gatt_interface_, GetEattSupport).WillByDefault([](const RawAddress& /*addr*/) { return false; }); @@ -297,7 +297,8 @@ TEST_F(EattTest, IncomingEattConnectionByUnknownDevice) { std::vector<uint16_t> incoming_cids{71, 72, 73, 74, 75}; ON_CALL(btm_api_interface_, IsEncrypted) - .WillByDefault([](const RawAddress& addr, tBT_TRANSPORT transport) { return true; }); + .WillByDefault( + [](const RawAddress& /*addr*/, tBT_TRANSPORT /*transport*/) { return true; }); EXPECT_CALL(mock_stack_l2cap_interface_, L2CA_ConnectCreditBasedRsp(test_address, 1, incoming_cids, tL2CAP_LE_RESULT_CODE::L2CAP_LE_RESULT_CONN_OK, _)) @@ -312,14 +313,15 @@ TEST_F(EattTest, IncomingEattConnectionByUnknownDevice) { TEST_F(EattTest, IncomingEattConnectionByKnownDevice) { hci_role_ = HCI_ROLE_PERIPHERAL; ON_CALL(btm_api_interface_, IsEncrypted) - .WillByDefault([](const RawAddress& addr, tBT_TRANSPORT transport) { return true; }); + .WillByDefault( + [](const RawAddress& /*addr*/, tBT_TRANSPORT /*transport*/) { return true; }); ON_CALL(gatt_interface_, ClientReadSupportedFeatures) .WillByDefault([](const RawAddress& addr, base::OnceCallback<void(const RawAddress&, uint8_t)> cb) { std::move(cb).Run(addr, BLE_GATT_SVR_SUP_FEAT_EATT_BITMASK); return true; }); - ON_CALL(gatt_interface_, GetEattSupport).WillByDefault([](const RawAddress& addr) { + ON_CALL(gatt_interface_, GetEattSupport).WillByDefault([](const RawAddress& /*addr*/) { return true; }); @@ -342,16 +344,18 @@ TEST_F(EattTest, IncomingEattConnectionByKnownDevice) { TEST_F(EattTest, IncomingEattConnectionByKnownDeviceEncryptionOff) { hci_role_ = HCI_ROLE_PERIPHERAL; ON_CALL(btm_api_interface_, IsEncrypted) - .WillByDefault([](const RawAddress& addr, tBT_TRANSPORT transport) { return false; }); + .WillByDefault( + [](const RawAddress& /*addr*/, tBT_TRANSPORT /*transport*/) { return false; }); ON_CALL(btm_api_interface_, IsLinkKeyKnown) - .WillByDefault([](const RawAddress& addr, tBT_TRANSPORT transport) { return true; }); + .WillByDefault( + [](const RawAddress& /*addr*/, tBT_TRANSPORT /*transport*/) { return true; }); ON_CALL(gatt_interface_, ClientReadSupportedFeatures) .WillByDefault([](const RawAddress& addr, base::OnceCallback<void(const RawAddress&, uint8_t)> cb) { std::move(cb).Run(addr, BLE_GATT_SVR_SUP_FEAT_EATT_BITMASK); return true; }); - ON_CALL(gatt_interface_, GetEattSupport).WillByDefault([](const RawAddress& addr) { + ON_CALL(gatt_interface_, GetEattSupport).WillByDefault([](const RawAddress& /*addr*/) { return true; }); @@ -374,9 +378,11 @@ TEST_F(EattTest, IncomingEattConnectionByUnknownDeviceEncryptionOff) { std::vector<uint16_t> incoming_cids{71, 72, 73, 74, 75}; ON_CALL(btm_api_interface_, IsEncrypted) - .WillByDefault([](const RawAddress& addr, tBT_TRANSPORT transport) { return false; }); + .WillByDefault( + [](const RawAddress& /*addr*/, tBT_TRANSPORT /*transport*/) { return false; }); ON_CALL(btm_api_interface_, IsLinkKeyKnown) - .WillByDefault([](const RawAddress& addr, tBT_TRANSPORT transport) { return false; }); + .WillByDefault( + [](const RawAddress& /*addr*/, tBT_TRANSPORT /*transport*/) { return false; }); EXPECT_CALL(mock_stack_l2cap_interface_, L2CA_ConnectCreditBasedRsp( test_address, 1, _, @@ -393,7 +399,8 @@ TEST_F(EattTest, ReconnectInitiatedByRemoteSucceed) { std::vector<uint16_t> incoming_cids{71, 72, 73, 74, 75}; ON_CALL(btm_api_interface_, IsEncrypted) - .WillByDefault([](const RawAddress& addr, tBT_TRANSPORT transport) { return true; }); + .WillByDefault( + [](const RawAddress& /*addr*/, tBT_TRANSPORT /*transport*/) { return true; }); EXPECT_CALL(mock_stack_l2cap_interface_, L2CA_ConnectCreditBasedRsp(test_address, 1, incoming_cids, @@ -408,7 +415,8 @@ TEST_F(EattTest, ReconnectInitiatedByRemoteSucceed) { TEST_F(EattTest, ConnectInitiatedWhenRemoteConnects) { ON_CALL(btm_api_interface_, IsEncrypted) - .WillByDefault([](const RawAddress& addr, tBT_TRANSPORT transport) { return true; }); + .WillByDefault( + [](const RawAddress& /*addr*/, tBT_TRANSPORT /*transport*/) { return true; }); std::vector<uint16_t> incoming_cids{71, 72, 73, 74}; ConnectDeviceBothSides(1, incoming_cids); @@ -432,7 +440,7 @@ TEST_F(EattTest, ConnectFailedEattNotSupported) { std::move(cb).Run(addr, 0); return true; }); - ON_CALL(gatt_interface_, GetEattSupport).WillByDefault([](const RawAddress& addr) { + ON_CALL(gatt_interface_, GetEattSupport).WillByDefault([](const RawAddress& /*addr*/) { return false; }); diff --git a/system/stack/test/fuzzers/a2dp/Android.bp b/system/stack/test/fuzzers/a2dp/Android.bp index debbf061b0..65b56b4895 100644 --- a/system/stack/test/fuzzers/a2dp/Android.bp +++ b/system/stack/test/fuzzers/a2dp/Android.bp @@ -14,5 +14,4 @@ cc_fuzz { srcs: [ "fuzz_a2dp.cc", ], - cflags: ["-Wno-unused-parameter"], } diff --git a/system/stack/test/fuzzers/a2dp/a2dpFuzzHelpers.h b/system/stack/test/fuzzers/a2dp/a2dpFuzzHelpers.h index 0580e2070c..d17606a037 100644 --- a/system/stack/test/fuzzers/a2dp/a2dpFuzzHelpers.h +++ b/system/stack/test/fuzzers/a2dp/a2dpFuzzHelpers.h @@ -44,7 +44,8 @@ tA2DP_SDP_DB_PARAMS generateDBParams(FuzzedDataProvider* fdp, std::vector<uint16 } // Define our empty callback function -void a2dp_find_callback(bool found, tA2DP_Service* p_service, const RawAddress& peer_address) { +void a2dp_find_callback(bool /*found*/, tA2DP_Service* /*p_service*/, + const RawAddress& peer_address) { // Free the RawAddress we created in the generate function delete &peer_address; } diff --git a/system/stack/test/fuzzers/a2dp/codec/Android.bp b/system/stack/test/fuzzers/a2dp/codec/Android.bp index 8ae2c8590b..7c7825db3d 100644 --- a/system/stack/test/fuzzers/a2dp/codec/Android.bp +++ b/system/stack/test/fuzzers/a2dp/codec/Android.bp @@ -24,7 +24,6 @@ cc_fuzz { srcs: [ "fuzz_a2dp_codec.cc", ], - cflags: ["-Wno-unused-parameter"], } cc_fuzz { @@ -34,7 +33,6 @@ cc_fuzz { srcs: [ "fuzz_a2dp_codec_info.cc", ], - cflags: ["-Wno-unused-parameter"], } cc_fuzz { @@ -44,5 +42,4 @@ cc_fuzz { srcs: [ "fuzz_a2dp_codec_config.cc", ], - cflags: ["-Wno-unused-parameter"], } diff --git a/system/stack/test/fuzzers/a2dp/codec/a2dpCodecInfoFuzzFunctions.h b/system/stack/test/fuzzers/a2dp/codec/a2dpCodecInfoFuzzFunctions.h index 81d84c99b7..118eb11926 100644 --- a/system/stack/test/fuzzers/a2dp/codec/a2dpCodecInfoFuzzFunctions.h +++ b/system/stack/test/fuzzers/a2dp/codec/a2dpCodecInfoFuzzFunctions.h @@ -36,7 +36,7 @@ */ std::vector<std::function<void(FuzzedDataProvider*, uint8_t*)>> a2dp_codec_info_operations = { // A2DP_InitDefaultCodec - [](FuzzedDataProvider* fdp, uint8_t*) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t*) -> void { // Allocate space for a new codec & add it to our tracking vector uint8_t* codec_info = new uint8_t[AVDT_CODEC_SIZE]; a2dp_codec_info_vect.push_back(codec_info); @@ -58,25 +58,27 @@ std::vector<std::function<void(FuzzedDataProvider*, uint8_t*)>> a2dp_codec_info_ }, // A2DP_GetCodecType - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { A2DP_GetCodecType(codec_info); }, + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { + A2DP_GetCodecType(codec_info); + }, // A2DP_IsSourceCodecValid - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_IsSourceCodecValid(codec_info); }, // A2DP_IsPeerSourceCodecValid - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_IsPeerSourceCodecValid(codec_info); }, // A2DP_IsPeerSinkCodecValid - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_IsPeerSinkCodecValid(codec_info); }, // A2DP_IsSinkCodecSupported - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_IsSinkCodecSupported(codec_info); }, @@ -86,10 +88,14 @@ std::vector<std::function<void(FuzzedDataProvider*, uint8_t*)>> a2dp_codec_info_ }, // A2DP_GetMediaType - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { A2DP_GetMediaType(codec_info); }, + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { + A2DP_GetMediaType(codec_info); + }, // A2DP_CodecName - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { A2DP_CodecName(codec_info); }, + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { + A2DP_CodecName(codec_info); + }, // A2DP_CodecTypeEquals [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { @@ -108,22 +114,22 @@ std::vector<std::function<void(FuzzedDataProvider*, uint8_t*)>> a2dp_codec_info_ }, // A2DP_GetTrackSampleRate - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_GetTrackSampleRate(codec_info); }, // A2DP_GetTrackBitsPerSample - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_GetTrackBitsPerSample(codec_info); }, // A2DP_GetTrackChannelCount - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_GetTrackChannelCount(codec_info); }, // A2DP_GetSinkTrackChannelType - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_GetSinkTrackChannelType(codec_info); }, @@ -152,25 +158,27 @@ std::vector<std::function<void(FuzzedDataProvider*, uint8_t*)>> a2dp_codec_info_ }, // A2DP_GetEncoderInterface - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_GetEncoderInterface(codec_info); }, // A2DP_GetDecoderInterface - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_GetDecoderInterface(codec_info); }, // A2DP_AdjustCodec - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { A2DP_AdjustCodec(codec_info); }, + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { + A2DP_AdjustCodec(codec_info); + }, // A2DP_SourceCodecIndex - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_SourceCodecIndex(codec_info); }, // A2DP_SinkCodecIndex - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_SinkCodecIndex(codec_info); }, @@ -186,12 +194,12 @@ std::vector<std::function<void(FuzzedDataProvider*, uint8_t*)>> a2dp_codec_info_ }, // A2DP_GetEecoderEffectiveFrameSize - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_GetEecoderEffectiveFrameSize(codec_info); }, // A2DP_CodecInfoString - [](FuzzedDataProvider* fdp, uint8_t* codec_info) -> void { + [](FuzzedDataProvider* /*fdp*/, uint8_t* codec_info) -> void { A2DP_CodecInfoString(codec_info); }}; diff --git a/system/stack/test/fuzzers/sdp/Android.bp b/system/stack/test/fuzzers/sdp/Android.bp index 86a8c11fdd..bc5aaa702b 100644 --- a/system/stack/test/fuzzers/sdp/Android.bp +++ b/system/stack/test/fuzzers/sdp/Android.bp @@ -14,5 +14,4 @@ cc_fuzz { srcs: [ "fuzz_sdp.cc", ], - cflags: ["-Wno-unused-parameter"], } diff --git a/system/stack/test/fuzzers/sdp/sdpFuzzFunctions.h b/system/stack/test/fuzzers/sdp/sdpFuzzFunctions.h index 411c878fe9..3b39ea06a7 100644 --- a/system/stack/test/fuzzers/sdp/sdpFuzzFunctions.h +++ b/system/stack/test/fuzzers/sdp/sdpFuzzFunctions.h @@ -164,7 +164,7 @@ static const std::vector<std::function<void(FuzzedDataProvider*)>> sdp_operation }, // ::SDP_CreateRecord - [](FuzzedDataProvider* fdp) -> void { + [](FuzzedDataProvider* /*fdp*/) -> void { uint32_t handle = get_legacy_stack_sdp_api()->handle.SDP_CreateRecord(); if (handle) { sdp_record_handles.push_back(handle); diff --git a/system/stack/test/fuzzers/sdp/sdpFuzzHelpers.h b/system/stack/test/fuzzers/sdp/sdpFuzzHelpers.h index a22accbf74..2647e3f844 100644 --- a/system/stack/test/fuzzers/sdp/sdpFuzzHelpers.h +++ b/system/stack/test/fuzzers/sdp/sdpFuzzHelpers.h @@ -265,7 +265,8 @@ SDP_Sequence_Helper generateArbitrarySdpElemSequence(FuzzedDataProvider* fdp) { } // Define our callback functions we'll be using within our functions -void sdp_disc_cmpl_cb(const RawAddress& bd_addr, tSDP_STATUS result) {} -void sdp_disc_cmpl_cb2(std::vector<uint8_t> data, const RawAddress& bd_addr, tSDP_STATUS result) {} +void sdp_disc_cmpl_cb(const RawAddress& /*bd_addr*/, tSDP_STATUS /*result*/) {} +void sdp_disc_cmpl_cb2(std::vector<uint8_t> /*data*/, const RawAddress& /*bd_addr*/, + tSDP_STATUS /*result*/) {} #endif // FUZZER_SDP_HELPERS_H_ diff --git a/system/stack/test/gatt/gatt_sr_test.cc b/system/stack/test/gatt/gatt_sr_test.cc index 72707e1900..7992f876ea 100644 --- a/system/stack/test/gatt/gatt_sr_test.cc +++ b/system/stack/test/gatt/gatt_sr_test.cc @@ -53,67 +53,77 @@ TestMutables test_state_; } // namespace namespace connection_manager { -bool background_connect_remove(uint8_t app_id, const RawAddress& address) { return false; } -bool direct_connect_remove(uint8_t app_id, const RawAddress& address, bool connection_timeout) { +bool background_connect_remove(uint8_t /*app_id*/, const RawAddress& /*address*/) { return false; } +bool direct_connect_remove(uint8_t /*app_id*/, const RawAddress& /*address*/, + bool /*connection_timeout*/) { return false; } -bool is_background_connection(const RawAddress& address) { return false; } +bool is_background_connection(const RawAddress& /*address*/) { return false; } } // namespace connection_manager -BT_HDR* attp_build_sr_msg(tGATT_TCB& tcb, uint8_t op_code, tGATT_SR_MSG* p_msg, - uint16_t payload_size) { +BT_HDR* attp_build_sr_msg(tGATT_TCB& /*tcb*/, uint8_t op_code, tGATT_SR_MSG* /*p_msg*/, + uint16_t /*payload_size*/) { test_state_.attp_build_sr_msg.op_code_ = op_code; return nullptr; } -tGATT_STATUS attp_send_cl_confirmation_msg(tGATT_TCB& tcb, uint16_t cid) { return GATT_SUCCESS; } -tGATT_STATUS attp_send_cl_msg(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, uint8_t op_code, - tGATT_CL_MSG* p_msg) { +tGATT_STATUS attp_send_cl_confirmation_msg(tGATT_TCB& /*tcb*/, uint16_t /*cid*/) { return GATT_SUCCESS; } -tGATT_STATUS attp_send_sr_msg(tGATT_TCB& tcb, uint16_t cid, BT_HDR* p_msg) { return GATT_SUCCESS; } - -void gatt_act_discovery(tGATT_CLCB* p_clcb) {} -bool gatt_disconnect(tGATT_TCB* p_tcb) { return false; } -void gatt_cancel_connect(const RawAddress& bd_addr, tBT_TRANSPORT transport) {} -tGATT_CH_STATE gatt_get_ch_state(tGATT_TCB* p_tcb) { return GATT_CH_CLOSE; } -tGATT_STATUS gatts_db_read_attr_value_by_type(tGATT_TCB& tcb, uint16_t cid, tGATT_SVC_DB* p_db, - uint8_t op_code, BT_HDR* p_rsp, uint16_t s_handle, - uint16_t e_handle, const Uuid& type, uint16_t* p_len, - tGATT_SEC_FLAG sec_flag, uint8_t key_size, - uint32_t trans_id, uint16_t* p_cur_handle) { +tGATT_STATUS attp_send_cl_msg(tGATT_TCB& /*tcb*/, tGATT_CLCB* /*p_clcb*/, uint8_t /*op_code*/, + tGATT_CL_MSG* /*p_msg*/) { return GATT_SUCCESS; } -void gatt_set_ch_state(tGATT_TCB* p_tcb, tGATT_CH_STATE ch_state) {} -Uuid* gatts_get_service_uuid(tGATT_SVC_DB* p_db) { return nullptr; } -tGATT_STATUS GATTS_HandleValueIndication(uint16_t conn_id, uint16_t attr_handle, uint16_t val_len, - uint8_t* p_val) { +tGATT_STATUS attp_send_sr_msg(tGATT_TCB& /*tcb*/, uint16_t /*cid*/, BT_HDR* /*p_msg*/) { return GATT_SUCCESS; } -tGATT_STATUS gatts_read_attr_perm_check(tGATT_SVC_DB* p_db, bool is_long, uint16_t handle, - tGATT_SEC_FLAG sec_flag, uint8_t key_size) { + +void gatt_act_discovery(tGATT_CLCB* /*p_clcb*/) {} +bool gatt_disconnect(tGATT_TCB* /*p_tcb*/) { return false; } +void gatt_cancel_connect(const RawAddress& /*bd_addr*/, tBT_TRANSPORT /*transport*/) {} +tGATT_CH_STATE gatt_get_ch_state(tGATT_TCB* /*p_tcb*/) { return GATT_CH_CLOSE; } +tGATT_STATUS gatts_db_read_attr_value_by_type(tGATT_TCB& /*tcb*/, uint16_t /*cid*/, + tGATT_SVC_DB* /*p_db*/, uint8_t /*op_code*/, + BT_HDR* /*p_rsp*/, uint16_t /*s_handle*/, + uint16_t /*e_handle*/, const Uuid& /*type*/, + uint16_t* /*p_len*/, tGATT_SEC_FLAG /*sec_flag*/, + uint8_t /*key_size*/, uint32_t /*trans_id*/, + uint16_t* /*p_cur_handle*/) { + return GATT_SUCCESS; +} +void gatt_set_ch_state(tGATT_TCB* /*p_tcb*/, tGATT_CH_STATE /*ch_state*/) {} +Uuid* gatts_get_service_uuid(tGATT_SVC_DB* /*p_db*/) { return nullptr; } +tGATT_STATUS GATTS_HandleValueIndication(uint16_t /*conn_id*/, uint16_t /*attr_handle*/, + uint16_t /*val_len*/, uint8_t* /*p_val*/) { + return GATT_SUCCESS; +} +tGATT_STATUS gatts_read_attr_perm_check(tGATT_SVC_DB* /*p_db*/, bool /*is_long*/, + uint16_t /*handle*/, tGATT_SEC_FLAG /*sec_flag*/, + uint8_t /*key_size*/) { return GATT_SUCCESS; } -tGATT_STATUS gatts_read_attr_value_by_handle(tGATT_TCB& tcb, uint16_t cid, tGATT_SVC_DB* p_db, - uint8_t op_code, uint16_t handle, uint16_t offset, - uint8_t* p_value, uint16_t* p_len, uint16_t mtu, - tGATT_SEC_FLAG sec_flag, uint8_t key_size, - uint32_t trans_id) { +tGATT_STATUS gatts_read_attr_value_by_handle(tGATT_TCB& /*tcb*/, uint16_t /*cid*/, + tGATT_SVC_DB* /*p_db*/, uint8_t /*op_code*/, + uint16_t /*handle*/, uint16_t /*offset*/, + uint8_t* /*p_value*/, uint16_t* /*p_len*/, + uint16_t /*mtu*/, tGATT_SEC_FLAG /*sec_flag*/, + uint8_t /*key_size*/, uint32_t /*trans_id*/) { return GATT_SUCCESS; } -tGATT_STATUS gatts_write_attr_perm_check(tGATT_SVC_DB* p_db, uint8_t op_code, uint16_t handle, - uint16_t offset, uint8_t* p_data, uint16_t len, - tGATT_SEC_FLAG sec_flag, uint8_t key_size) { +tGATT_STATUS gatts_write_attr_perm_check(tGATT_SVC_DB* /*p_db*/, uint8_t /*op_code*/, + uint16_t /*handle*/, uint16_t /*offset*/, + uint8_t* /*p_data*/, uint16_t /*len*/, + tGATT_SEC_FLAG /*sec_flag*/, uint8_t /*key_size*/) { test_state_.gatts_write_attr_perm_check.access_count_++; return test_state_.gatts_write_attr_perm_check.return_status_; } -void gatt_update_app_use_link_flag(tGATT_IF gatt_if, tGATT_TCB* p_tcb, bool is_add, - bool check_acl_link) {} +void gatt_update_app_use_link_flag(tGATT_IF /*gatt_if*/, tGATT_TCB* /*p_tcb*/, bool /*is_add*/, + bool /*check_acl_link*/) {} bluetooth::common::MessageLoopThread* get_main_thread() { return nullptr; } -void l2cble_set_fixed_channel_tx_data_length(const RawAddress& remote_bda, uint16_t fix_cid, - uint16_t tx_mtu) {} -void L2CA_SetLeFixedChannelTxDataLength(const RawAddress& remote_bda, uint16_t fix_cid, - uint16_t tx_mtu) {} +void l2cble_set_fixed_channel_tx_data_length(const RawAddress& /*remote_bda*/, uint16_t /*fix_cid*/, + uint16_t /*tx_mtu*/) {} +void L2CA_SetLeFixedChannelTxDataLength(const RawAddress& /*remote_bda*/, uint16_t /*fix_cid*/, + uint16_t /*tx_mtu*/) {} void ApplicationRequestCallback(uint16_t conn_id, uint32_t trans_id, tGATTS_REQ_TYPE type, tGATTS_DATA* p_data) { test_state_.application_request_callback.conn_id_ = conn_id; @@ -122,8 +132,8 @@ void ApplicationRequestCallback(uint16_t conn_id, uint32_t trans_id, tGATTS_REQ_ test_state_.application_request_callback.data_ = *p_data; } -bool gatt_sr_is_cl_change_aware(tGATT_TCB& tcb) { return false; } -void gatt_sr_init_cl_status(tGATT_TCB& p_tcb) {} +bool gatt_sr_is_cl_change_aware(tGATT_TCB& /*tcb*/) { return false; } +void gatt_sr_init_cl_status(tGATT_TCB& /*p_tcb*/) {} void gatt_sr_update_cl_status(tGATT_TCB& p_tcb, bool chg_aware) { p_tcb.is_robust_cache_change_aware = chg_aware; } diff --git a/system/stack/test/gatt/mock_gatt_utils_ref.cc b/system/stack/test/gatt/mock_gatt_utils_ref.cc index 564a2e555a..f79db0ac3d 100644 --- a/system/stack/test/gatt/mock_gatt_utils_ref.cc +++ b/system/stack/test/gatt/mock_gatt_utils_ref.cc @@ -20,6 +20,7 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wunused-parameter" /** stack/gatt/connection_manager.cc */ namespace connection_manager { diff --git a/system/stack/test/gatt/stack_gatt_test.cc b/system/stack/test/gatt/stack_gatt_test.cc index 2a6b243d43..0a5c40d920 100644 --- a/system/stack/test/gatt/stack_gatt_test.cc +++ b/system/stack/test/gatt/stack_gatt_test.cc @@ -68,20 +68,23 @@ size_t actual_sizeof_tGATT_REG() { sizeof(uint8_t) + sizeof(bool); } -void tGATT_DISC_RES_CB(uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_DISC_RES* p_data) {} -void tGATT_DISC_CMPL_CB(uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_STATUS status) {} -void tGATT_CMPL_CBACK(uint16_t conn_id, tGATTC_OPTYPE op, tGATT_STATUS status, - tGATT_CL_COMPLETE* p_data) {} -void tGATT_CONN_CBACK(tGATT_IF gatt_if, const RawAddress& bda, uint16_t conn_id, bool connected, - tGATT_DISCONN_REASON reason, tBT_TRANSPORT transport) {} -void tGATT_REQ_CBACK(uint16_t conn_id, uint32_t trans_id, tGATTS_REQ_TYPE type, - tGATTS_DATA* p_data) {} -void tGATT_CONGESTION_CBACK(uint16_t conn_id, bool congested) {} -void tGATT_ENC_CMPL_CB(tGATT_IF gatt_if, const RawAddress& bda) {} -void tGATT_PHY_UPDATE_CB(tGATT_IF gatt_if, uint16_t conn_id, uint8_t tx_phy, uint8_t rx_phy, - tGATT_STATUS status) {} -void tGATT_CONN_UPDATE_CB(tGATT_IF gatt_if, uint16_t conn_id, uint16_t interval, uint16_t latency, - uint16_t timeout, tGATT_STATUS status) {} +void tGATT_DISC_RES_CB(uint16_t /*conn_id*/, tGATT_DISC_TYPE /*disc_type*/, + tGATT_DISC_RES* /*p_data*/) {} +void tGATT_DISC_CMPL_CB(uint16_t /*conn_id*/, tGATT_DISC_TYPE /*disc_type*/, + tGATT_STATUS /*status*/) {} +void tGATT_CMPL_CBACK(uint16_t /*conn_id*/, tGATTC_OPTYPE /*op*/, tGATT_STATUS /*status*/, + tGATT_CL_COMPLETE* /*p_data*/) {} +void tGATT_CONN_CBACK(tGATT_IF /*gatt_if*/, const RawAddress& /*bda*/, uint16_t /*conn_id*/, + bool /*connected*/, tGATT_DISCONN_REASON /*reason*/, + tBT_TRANSPORT /*transport*/) {} +void tGATT_REQ_CBACK(uint16_t /*conn_id*/, uint32_t /*trans_id*/, tGATTS_REQ_TYPE /*type*/, + tGATTS_DATA* /*p_data*/) {} +void tGATT_CONGESTION_CBACK(uint16_t /*conn_id*/, bool /*congested*/) {} +void tGATT_ENC_CMPL_CB(tGATT_IF /*gatt_if*/, const RawAddress& /*bda*/) {} +void tGATT_PHY_UPDATE_CB(tGATT_IF /*gatt_if*/, uint16_t /*conn_id*/, uint8_t /*tx_phy*/, + uint8_t /*rx_phy*/, tGATT_STATUS /*status*/) {} +void tGATT_CONN_UPDATE_CB(tGATT_IF /*gatt_if*/, uint16_t /*conn_id*/, uint16_t /*interval*/, + uint16_t /*latency*/, uint16_t /*timeout*/, tGATT_STATUS /*status*/) {} tGATT_CBACK gatt_callbacks = { .p_conn_cb = tGATT_CONN_CBACK, diff --git a/system/stack/test/gatt_connection_manager_test.cc b/system/stack/test/gatt_connection_manager_test.cc index e791210608..e5a8596710 100644 --- a/system/stack/test/gatt_connection_manager_test.cc +++ b/system/stack/test/gatt_connection_manager_test.cc @@ -69,15 +69,16 @@ void BTM_BleTargetAnnouncementObserve(bool enable, tBTM_INQ_RESULTS_CB* p_result localAcceptlistMock->EnableTargetedAnnouncements(enable, p_results_cb); } -void BTM_LogHistory(const std::string& tag, const RawAddress& bd_addr, const std::string& msg) {} +void BTM_LogHistory(const std::string& /*tag*/, const RawAddress& /*bd_addr*/, + const std::string& /*msg*/) {} namespace bluetooth { namespace shim { -void set_target_announcements_filter(bool enable) {} +void set_target_announcements_filter(bool /*enable*/) {} } // namespace shim } // namespace bluetooth -bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& bd_addr) { return false; } +bool L2CA_ConnectFixedChnl(uint16_t /*fixed_cid*/, const RawAddress& /*bd_addr*/) { return false; } uint16_t BTM_GetHCIConnHandle(RawAddress const&, unsigned char) { return 0xFFFF; } namespace connection_manager { @@ -85,7 +86,7 @@ class BleConnectionManager : public testing::Test { void SetUp() override { localAcceptlistMock = std::make_unique<AcceptlistMock>(); auto alarm_mock = AlarmMock::Get(); - ON_CALL(*alarm_mock, AlarmNew(_)).WillByDefault(testing::Invoke([](const char* name) { + ON_CALL(*alarm_mock, AlarmNew(_)).WillByDefault(testing::Invoke([](const char* /*name*/) { // We must return something from alarm_new in tests, if we just return // null, unique_ptr will misbehave. return (alarm_t*)new uint8_t[30]; diff --git a/system/stack/test/stack_avdtp_test.cc b/system/stack/test/stack_avdtp_test.cc index 3ecc82f050..8c9372ec93 100644 --- a/system/stack/test/stack_avdtp_test.cc +++ b/system/stack/test/stack_avdtp_test.cc @@ -40,19 +40,20 @@ protected: static uint8_t scb_handle_; protected: - static void AvdtConnCallback(uint8_t handle, const RawAddress& bd_addr, uint8_t event, - tAVDT_CTRL* p_data, uint8_t scb_index) { + static void AvdtConnCallback(uint8_t /*handle*/, const RawAddress& /*bd_addr*/, uint8_t event, + tAVDT_CTRL* /*p_data*/, uint8_t /*scb_index*/) { inc_func_call_count(__func__); callback_event_ = event; } - static void StreamCtrlCallback(uint8_t handle, const RawAddress& bd_addr, uint8_t event, - tAVDT_CTRL* p_data, uint8_t scb_index) { + static void StreamCtrlCallback(uint8_t /*handle*/, const RawAddress& /*bd_addr*/, uint8_t event, + tAVDT_CTRL* /*p_data*/, uint8_t /*scb_index*/) { inc_func_call_count(__func__); callback_event_ = event; } - static void AvdtReportCallback(uint8_t handle, AVDT_REPORT_TYPE type, tAVDT_REPORT_DATA* p_data) { + static void AvdtReportCallback(uint8_t /*handle*/, AVDT_REPORT_TYPE /*type*/, + tAVDT_REPORT_DATA* /*p_data*/) { inc_func_call_count(__func__); } diff --git a/system/stack/test/stack_smp_test.cc b/system/stack/test/stack_smp_test.cc index 31a006d249..c7de45814c 100644 --- a/system/stack/test/stack_smp_test.cc +++ b/system/stack/test/stack_smp_test.cc @@ -201,16 +201,16 @@ public: TEST_F(SmpCalculateConfirmTest, test_smp_gen_p2_4_confirm_as_central) { // Set local_bda to 0xA1A2A3A4A5A6 test::mock::stack_acl::BTM_ReadConnectionAddr.body = - [](const RawAddress& remote_bda, RawAddress& local_conn_addr, tBLE_ADDR_TYPE* p_addr_type, - bool ota_address) { + [](const RawAddress& /*remote_bda*/, RawAddress& local_conn_addr, + tBLE_ADDR_TYPE* p_addr_type, bool /*ota_address*/) { local_conn_addr = RawAddress({0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6}); *p_addr_type = BLE_ADDR_RANDOM; }; // Set remote bda to 0xB1B2B3B4B5B6 test::mock::stack_acl::BTM_ReadRemoteConnectionAddr.body = - [](const RawAddress& pseudo_addr, RawAddress& conn_addr, tBLE_ADDR_TYPE* p_addr_type, - bool ota_address) { + [](const RawAddress& /*pseudo_addr*/, RawAddress& conn_addr, tBLE_ADDR_TYPE* p_addr_type, + bool /*ota_address*/) { conn_addr = RawAddress({0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6}); *p_addr_type = BLE_ADDR_PUBLIC; return true; @@ -235,16 +235,16 @@ TEST_F(SmpCalculateConfirmTest, test_smp_gen_p2_4_confirm_as_central) { TEST_F(SmpCalculateConfirmTest, test_aes_128_as_central) { // Set local_bda to 0xA1A2A3A4A5A6 test::mock::stack_acl::BTM_ReadConnectionAddr.body = - [](const RawAddress& remote_bda, RawAddress& local_conn_addr, tBLE_ADDR_TYPE* p_addr_type, - bool ota_address) { + [](const RawAddress& /*remote_bda*/, RawAddress& local_conn_addr, + tBLE_ADDR_TYPE* p_addr_type, bool /*ota_address*/) { local_conn_addr = RawAddress({0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6}); *p_addr_type = BLE_ADDR_RANDOM; }; // Set remote bda to 0xB1B2B3B4B5B6 test::mock::stack_acl::BTM_ReadRemoteConnectionAddr.body = - [](const RawAddress& pseudo_addr, RawAddress& conn_addr, tBLE_ADDR_TYPE* p_addr_type, - bool ota_address) { + [](const RawAddress& /*pseudo_addr*/, RawAddress& conn_addr, tBLE_ADDR_TYPE* p_addr_type, + bool /*ota_address*/) { conn_addr = RawAddress({0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6}); *p_addr_type = BLE_ADDR_PUBLIC; return true; @@ -280,16 +280,16 @@ TEST_F(SmpCalculateConfirmTest, test_aes_128_as_central) { TEST_F(SmpCalculateConfirmTest, test_smp_calculate_confirm_as_central) { // Set local_bda to 0xA1A2A3A4A5A6 test::mock::stack_acl::BTM_ReadConnectionAddr.body = - [](const RawAddress& remote_bda, RawAddress& local_conn_addr, tBLE_ADDR_TYPE* p_addr_type, - bool ota_address) { + [](const RawAddress& /*remote_bda*/, RawAddress& local_conn_addr, + tBLE_ADDR_TYPE* p_addr_type, bool /*ota_address*/) { local_conn_addr = RawAddress({0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6}); *p_addr_type = BLE_ADDR_RANDOM; }; // Set remote bda to 0xB1B2B3B4B5B6 test::mock::stack_acl::BTM_ReadRemoteConnectionAddr.body = - [](const RawAddress& pseudo_addr, RawAddress& conn_addr, tBLE_ADDR_TYPE* p_addr_type, - bool ota_address) { + [](const RawAddress& /*pseudo_addr*/, RawAddress& conn_addr, tBLE_ADDR_TYPE* p_addr_type, + bool /*ota_address*/) { conn_addr = RawAddress({0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6}); *p_addr_type = BLE_ADDR_PUBLIC; return true; diff --git a/system/test/stub/osi.cc b/system/test/stub/osi.cc index cae495f2ca..fcfa858a91 100644 --- a/system/test/stub/osi.cc +++ b/system/test/stub/osi.cc @@ -44,6 +44,7 @@ // TODO(b/369381361) Enfore -Wmissing-prototypes #pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wunused-parameter" OsiObject::OsiObject(void* ptr) : ptr_(ptr) {} diff --git a/system/test/suite/Android.bp b/system/test/suite/Android.bp index 6729fa6712..4ce6367d5b 100644 --- a/system/test/suite/Android.bp +++ b/system/test/suite/Android.bp @@ -153,5 +153,4 @@ cc_test { }, host: {}, }, - cflags: ["-Wno-unused-parameter"], } diff --git a/system/test/suite/adapter/bluetooth_test.cc b/system/test/suite/adapter/bluetooth_test.cc index ebed328849..4855b7a72d 100644 --- a/system/test/suite/adapter/bluetooth_test.cc +++ b/system/test/suite/adapter/bluetooth_test.cc @@ -40,7 +40,7 @@ void AdapterStateChangedCallback(bt_state_t new_state) { semaphore_post(instance->adapter_state_changed_callback_sem_); } -void AdapterPropertiesCallback(bt_status_t status, int num_properties, +void AdapterPropertiesCallback(bt_status_t /*status*/, int num_properties, bt_property_t* new_properties) { property_free_array(instance->last_changed_properties_, instance->properties_changed_count_); instance->last_changed_properties_ = property_copy_array(new_properties, num_properties); @@ -48,7 +48,7 @@ void AdapterPropertiesCallback(bt_status_t status, int num_properties, semaphore_post(instance->adapter_properties_callback_sem_); } -void RemoteDevicePropertiesCallback(bt_status_t status, RawAddress* remote_bd_addr, +void RemoteDevicePropertiesCallback(bt_status_t /*status*/, RawAddress* remote_bd_addr, int num_properties, bt_property_t* properties) { instance->curr_remote_device_ = *remote_bd_addr; property_free_array(instance->remote_device_last_changed_properties_, diff --git a/system/test/suite/gatt/gatt_test.cc b/system/test/suite/gatt/gatt_test.cc index f297e78f2f..b99dbf77f8 100644 --- a/system/test/suite/gatt/gatt_test.cc +++ b/system/test/suite/gatt/gatt_test.cc @@ -26,29 +26,29 @@ namespace bttest { static GattTest* instance = nullptr; -void RegisterClientCallback(int status, int clientIf, const bluetooth::Uuid& app_uuid) { +void RegisterClientCallback(int status, int clientIf, const bluetooth::Uuid& /*app_uuid*/) { instance->status_ = status; instance->client_interface_id_ = clientIf; semaphore_post(instance->register_client_callback_sem_); } -void ScanResultCallback(uint16_t ble_evt_type, uint8_t addr_type, RawAddress* bda, - uint8_t ble_primary_phy, uint8_t ble_secondary_phy, - uint8_t ble_advertising_sid, int8_t ble_tx_power, int8_t rssi, - uint16_t ble_periodic_adv_int, std::vector<uint8_t> adv_data, - RawAddress* original_bda) { +void ScanResultCallback(uint16_t /*ble_evt_type*/, uint8_t /*addr_type*/, RawAddress* /*bda*/, + uint8_t /*ble_primary_phy*/, uint8_t /*ble_secondary_phy*/, + uint8_t /*ble_advertising_sid*/, int8_t /*ble_tx_power*/, int8_t /*rssi*/, + uint16_t /*ble_periodic_adv_int*/, std::vector<uint8_t> /*adv_data*/, + RawAddress* /*original_bda*/) { semaphore_post(instance->scan_result_callback_sem_); } // GATT server callbacks -void RegisterServerCallback(int status, int server_if, const bluetooth::Uuid& uuid) { +void RegisterServerCallback(int status, int server_if, const bluetooth::Uuid& /*uuid*/) { instance->status_ = status; instance->server_interface_id_ = server_if; semaphore_post(instance->register_server_callback_sem_); } void ServiceAddedCallback(int status, int server_if, const btgatt_db_element_t* service, - size_t service_count) { + size_t /*service_count*/) { instance->status_ = status; instance->server_interface_id_ = server_if; instance->service_handle_ = service[0].attribute_handle; |