The compiler upgrade in b/
139945549 can now check C code for
-Wimplicit-fallthrough. In b/
143713277, were moving the cflags for
projects that disable this warning to cppflags. For this subsystem, just
address the warnings and remove disabling it.
These cases should be carefully reviewed; modifications that weren't
additions of fallthrough attributes were likely existing bugs.
Bug:
139945549
Bug:
143713277
Test: mm
Change-Id: Icafeed1d18991e83f42e5efd13e8ab8d15068d79
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
cc_library_static {
name: "libbt-bta",
defaults: ["fluoride_bta_defaults"],
- cflags: ["-Wno-implicit-fallthrough"],
srcs: [
"ag/bta_ag_act.cc",
"ag/bta_ag_api.cc",
sec_event.cfm_req.loc_io_caps = p_data->cfm_req.loc_io_caps;
sec_event.cfm_req.rmt_io_caps = p_data->cfm_req.rmt_io_caps;
- /* continue to next case */
+ [[fallthrough]];
/* Passkey entry mode, mobile device with output capability is very
unlikely to receive key request, so skip this event */
/*case BTM_SP_KEY_REQ_EVT: */
case 0x85: // Report ID
*has_report_id = TRUE;
-
+ [[fallthrough]];
default:
ptr += (item & 0x03);
break;
case BTA_HF_CLIENT_SCO_LISTEN_E:
/* create SCO listen connection */
bta_hf_client_sco_create(client_cb, false);
+ /* TODO(b/143901894): Is this correct? */
+ [[fallthrough]];
case BTA_HF_CLIENT_SCO_OPEN_E:
/* remove listening connection */
],
cflags: [
"-DBUILDCFG",
- "-Wno-implicit-fallthrough",
],
}
case HCI_ERR_AUTH_FAILURE:
case HCI_ERR_KEY_MISSING:
btif_storage_remove_bonded_device(&bd_addr);
+ [[fallthrough]];
case HCI_ERR_HOST_REJECT_SECURITY:
case HCI_ERR_ENCRY_MODE_NOT_ACCEPTABLE:
case HCI_ERR_UNIT_KEY_USED:
break;
case BTIF_DM_LE_KEY_LID:
name = "LE_KEY_LID";
+ break;
default:
return BT_STATUS_FAIL;
}
"-DLOG_NDEBUG=1",
"-DGOOGLE_PROTOBUF_NO_RTTI",
"-Wno-unused-parameter",
- "-Wno-implicit-fallthrough",
"-Wno-unused-result",
],
conlyflags: [
break;
}
}
+ break;
}
default:
return;
OnConfigurationResponse(configuration_response_view.GetIdentifier(), configuration_response_view.GetSourceCid(),
configuration_response_view.GetContinuation(), configuration_response_view.GetResult(),
configuration_response_view.GetConfig());
+ return;
}
case CommandCode::DISCONNECTION_REQUEST: {
DisconnectionRequestView disconnection_request_view = DisconnectionRequestView::Create(control_packet_view);
"libc++fs",
],
cppflags: [
- "-Wno-implicit-fallthrough",
"-fno-exceptions",
"-O0",
],
"system/bt/bta/sys",
"system/bt/utils/include",
],
- cflags: ["-Wno-implicit-fallthrough"],
srcs: crypto_toolbox_srcs + [
"a2dp/a2dp_aac.cc",
"a2dp/a2dp_aac_decoder.cc",
case AVRC_OP_VENDOR:
/* reserved 0, packet_type 0 */
UINT8_TO_BE_STREAM(p_data, 0);
- /* continue to the next "case to add length */
-
+ [[fallthrough]];
case AVRC_OP_BROWSE:
/* add fixed lenth - 0 */
UINT16_TO_BE_STREAM(p_data, 0);
/* Peer wants ERTM and we support it */
if ((peer_mode == L2CAP_FCR_ERTM_MODE) &&
(p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_ERTM)) {
- L2CAP_TRACE_DEBUG("l2c_fcr_renegotiate_chan(Trying ERTM)");
+ L2CAP_TRACE_DEBUG("%s(Trying ERTM)", __func__);
p_ccb->our_cfg.fcr.mode = L2CAP_FCR_ERTM_MODE;
can_renegotiate = true;
- } else /* Falls through */
-
- case L2CAP_FCR_ERTM_MODE: {
+ } else if (p_ccb->ertm_info.allowed_modes &
+ L2CAP_FCR_CHAN_OPT_BASIC) {
/* We can try basic for any other peer mode if we support it */
- if (p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_BASIC) {
- L2CAP_TRACE_DEBUG("l2c_fcr_renegotiate_chan(Trying Basic)");
- can_renegotiate = true;
- p_ccb->our_cfg.fcr.mode = L2CAP_FCR_BASIC_MODE;
- }
- } break;
+ L2CAP_TRACE_DEBUG("%s(Trying Basic)", __func__);
+ can_renegotiate = true;
+ p_ccb->our_cfg.fcr.mode = L2CAP_FCR_BASIC_MODE;
+ }
+ break;
+ case L2CAP_FCR_ERTM_MODE:
+ /* We can try basic for any other peer mode if we support it */
+ if (p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_BASIC) {
+ L2CAP_TRACE_DEBUG("%s(Trying Basic)", __func__);
+ can_renegotiate = true;
+ p_ccb->our_cfg.fcr.mode = L2CAP_FCR_BASIC_MODE;
+ }
+ break;
- default:
- /* All other scenarios cannot be renegotiated */
- break;
+ default:
+ /* All other scenarios cannot be renegotiated */
+ break;
}
if (can_renegotiate) {