Skip to content

Commit

Permalink
gn-build: Remove all -Wno-unused-* flags from build files
Browse files Browse the repository at this point in the history
This CL removes the -Wno-unused-variable, -Wno-unused-value, and
-Wno-unused-function flags from all GN build and Android.mk files
(except in test/ & tools/, which are not built using GN yet). Compile
warnings, caused by the newly enabled flags, have been fixed throughout
the code base.

Bug: 21570302

Change-Id: I1c128b62256faa17668124798341005bcd0f7315
  • Loading branch information
armansito committed Jun 12, 2015
1 parent 1ab6fd7 commit cab5fc1
Show file tree
Hide file tree
Showing 32 changed files with 22 additions and 283 deletions.
1 change: 0 additions & 1 deletion Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ bdroid_CFLAGS += -DEXPORT_SYMBOL="__attribute__((visibility(\"default\")))"
bdroid_CFLAGS += \
-fvisibility=hidden \
-Wall \
-Wno-unused-parameter \
-Wunused-but-set-variable \
-UNDEBUG \
-DLOG_NDEBUG=1
Expand Down
5 changes: 0 additions & 5 deletions audio_a2dp_hw/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,4 @@ shared_library("audio.a2dp.default") {
"//",
"//utils/include",
]

# TODO(armansito): Fix the warnings and remove the flag below.
cflags = [
"-Wno-unused-variable",
]
}
16 changes: 4 additions & 12 deletions audio_a2dp_hw/audio_a2dp_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ static int skt_connect(char *path, size_t buffer_sz)
{
int ret;
int skt_fd;
struct sockaddr_un remote;
int len;

INFO("connect to %s (sz %zu)", path, buffer_sz);
Expand Down Expand Up @@ -235,8 +234,6 @@ static int skt_connect(char *path, size_t buffer_sz)
static int skt_read(int fd, void *p, size_t len)
{
int read;
struct pollfd pfd;
struct timespec ts;

FNLOG();

Expand Down Expand Up @@ -366,7 +363,6 @@ static int check_a2dp_ready(struct a2dp_stream_common *common)

static int a2dp_read_audio_config(struct a2dp_stream_common *common)
{
char cmd = A2DP_CTRL_GET_AUDIO_CONFIG;
uint32_t sample_rate;
uint8_t channel_count;

Expand Down Expand Up @@ -648,8 +644,8 @@ static audio_format_t out_get_format(const struct audio_stream *stream)

static int out_set_format(struct audio_stream *stream, audio_format_t format)
{
UNUSED(stream);
UNUSED(format);
struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream;
DEBUG("setting format not yet supported (0x%x)", format);
return -ENOSYS;
}
Expand All @@ -674,8 +670,8 @@ static int out_standby(struct audio_stream *stream)

static int out_dump(const struct audio_stream *stream, int fd)
{
UNUSED(stream);
UNUSED(fd);
struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream;
FNLOG();
return 0;
}
Expand Down Expand Up @@ -736,9 +732,8 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)

static char * out_get_parameters(const struct audio_stream *stream, const char *keys)
{
UNUSED(stream);
UNUSED(keys);
struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream;

FNLOG();

/* add populating param here */
Expand Down Expand Up @@ -1009,7 +1004,6 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
struct a2dp_audio_device *a2dp_dev = (struct a2dp_audio_device *)dev;
struct a2dp_stream_out *out;
int ret = 0;
int i;
UNUSED(address);
UNUSED(handle);
UNUSED(devices);
Expand Down Expand Up @@ -1130,8 +1124,7 @@ static char * adev_get_parameters(const struct audio_hw_device *dev,

static int adev_init_check(const struct audio_hw_device *dev)
{
struct a2dp_audio_device *a2dp_dev = (struct a2dp_audio_device*)dev;

UNUSED(dev);
FNLOG();

return 0;
Expand Down Expand Up @@ -1312,7 +1305,6 @@ static int adev_open(const hw_module_t* module, const char* name,
hw_device_t** device)
{
struct a2dp_audio_device *adev;
int ret;

INFO(" adev_open in A2dp_hw module");
FNLOG();
Expand Down
3 changes: 0 additions & 3 deletions bta/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ static_library("bta") {
# TODO(armansito): Remove all of the flags below, since we want to enable all
# warnings.
cflags = [
"-Wno-unused-variable",
"-Wno-unused-value",
"-Wno-unused-function",
"-Wno-int-to-pointer-cast",
]

Expand Down
19 changes: 0 additions & 19 deletions bta/av/bta_av_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,25 +396,6 @@ static tBTA_AV_SCB * bta_av_alloc_scb(tBTA_AV_CHNL chnl)
return p_ret;
}

/*******************************************************************************
**
** Function bta_av_free_scb
**
** Description free stream control block,
**
**
** Returns void
**
*******************************************************************************/
static void bta_av_free_scb(tBTA_AV_SCB *p_scb)
{
// NOTE(google) This free currently is not called
assert(p_scb != NULL);

list_free(p_scb->a2d_list);
GKI_freebuf(p_scb);
}

/*******************************************************************************
*******************************************************************************/
void bta_av_conn_cback(UINT8 handle, BD_ADDR bd_addr, UINT8 event, tAVDT_CTRL *p_data)
Expand Down
3 changes: 0 additions & 3 deletions bta/dm/bta_dm_act.c
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,6 @@ static void bta_dm_find_services ( BD_ADDR bd_addr)
{

tSDP_UUID uuid;
UINT16 num_attrs = 1;
tBTA_DM_MSG *p_msg;

memset (&uuid, 0, sizeof(tSDP_UUID));
Expand Down Expand Up @@ -4366,8 +4365,6 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
tBTM_STATUS status = BTM_SUCCESS;
tBTA_DM_SEC sec_event;
char *p_name = NULL;
UINT8 i;
tBT_DEVICE_TYPE dev_type;

if (!bta_dm_cb.p_sec_cback)
return BTM_NOT_AUTHORIZED;
Expand Down
1 change: 0 additions & 1 deletion bta/dm/bta_dm_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, UINT8 id, UINT8 app_id,
{

UINT8 i,j;
UINT16 policy_setting;
UINT8 *p = NULL;
#if (BTM_SSR_INCLUDED == TRUE)
int index = BTA_DM_PM_SSR0;
Expand Down
2 changes: 1 addition & 1 deletion bta/hl/bta_hl_sdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ BOOLEAN bta_hl_fill_sup_feature_list( const tSDP_DISC_ATTR *p_attr,
{
return(FALSE);
}
SDP_DISC_ATTR_LEN(p_attr->attr_len_type);

item_cnt=0;

for (p_sattr = p_attr->attr_value.v.p_sub_attr; p_sattr && (item_cnt < 4) ; p_sattr = p_sattr->p_next_attr)
Expand Down
2 changes: 0 additions & 2 deletions bta/hl/bta_hl_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,8 +1170,6 @@ BOOLEAN bta_hl_find_mcl_idx(UINT8 app_idx, BD_ADDR p_bd_addr, UINT8 *p_mcl_idx)

for (i=0; i < BTA_HL_NUM_MCLS ; i ++)
{
BTA_HL_GET_MCL_CB_PTR(app_idx, i);

if (bta_hl_cb.acb[app_idx].mcb[i].in_use &&
(!memcmp (bta_hl_cb.acb[app_idx].mcb[i].bd_addr, p_bd_addr, BD_ADDR_LEN)))
{
Expand Down
54 changes: 0 additions & 54 deletions bta/jv/bta_jv_act.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,6 @@ struct fc_channel {
static struct fc_client *fc_clients;
static struct fc_channel *fc_channels;
static uint32_t fc_next_id;
static pthread_once_t fc_init_once = PTHREAD_ONCE_INIT;


static void fc_init_work(void)
{
fc_clients = NULL;
fc_channels = NULL;
fc_next_id = 0;

//more init here if needed...
}

static void fc_init(void)
{
pthread_once(&fc_init_once, fc_init_work);
}


static void fcchan_conn_chng_cbk(UINT16 chan, BD_ADDR bd_addr, BOOLEAN connected,
Expand Down Expand Up @@ -543,8 +527,6 @@ static tBTA_JV_PM_CB *bta_jv_alloc_set_pm_profile_cb(UINT32 jv_handle, tBTA_JV_P
/* rfc handle bd addr retrieval requires core stack handle */
if (bRfcHandle)
{
UINT32 hi = ((jv_handle & BTA_JV_RFC_HDL_MASK) & ~BTA_JV_RFCOMM_MASK) - 1;
UINT32 si = BTA_JV_RFC_HDL_TO_SIDX(jv_handle);
for (j = 0; j < BTA_JV_MAX_RFC_CONN; j++)
{
if (jv_handle == bta_jv_cb.port_cb[j].handle)
Expand Down Expand Up @@ -869,7 +851,6 @@ static inline tBT_UUID shorten_sdp_uuid(const tBT_UUID* u)
static void bta_jv_start_discovery_cback(UINT16 result, void * user_data)
{
tBTA_JV_STATUS status;
UINT8 old_sdp_act = bta_jv_cb.sdp_active;

APPL_TRACE_DEBUG("bta_jv_start_discovery_cback res: 0x%x", result);

Expand Down Expand Up @@ -1229,7 +1210,6 @@ void bta_jv_l2cap_start_server(tBTA_JV_MSG *p_data)
tL2CAP_CFG_INFO cfg;
tBTA_JV_L2CAP_START evt_data;
tBTA_JV_API_L2CAP_SERVER *ls = &(p_data->l2cap_server);
INT32 use_etm = FALSE;
UINT8 chan_mode_mask = GAP_FCR_CHAN_OPT_BASIC;
tL2CAP_ERTM_INFO *ertm_info = NULL;

Expand Down Expand Up @@ -1703,38 +1683,6 @@ void bta_jv_rfcomm_close(tBTA_JV_MSG *p_data)
get_sec_id_used(), get_rfc_cb_used());
}

/*******************************************************************************
**
** Function bta_jv_get_num_rfc_listen
**
** Description when a RFCOMM connection goes down, make sure that there's only
** one port stays listening on this scn.
**
** Returns
**
*******************************************************************************/
static UINT8 bta_jv_get_num_rfc_listen(tBTA_JV_RFC_CB *p_cb)
{
UINT8 listen=1;

if (p_cb->max_sess > 1)
{
listen = 0;
for (UINT8 i=0; i<p_cb->max_sess; i++)
{
if (p_cb->rfc_hdl[i] != 0)
{
const tBTA_JV_PCB *p_pcb = &bta_jv_cb.port_cb[p_cb->rfc_hdl[i] - 1];
if (BTA_JV_ST_SR_LISTEN == p_pcb->state)
{
listen++;
}
}
}
}
return listen;
}

/*******************************************************************************
**
** Function bta_jv_port_mgmt_sr_cback
Expand Down Expand Up @@ -2555,7 +2503,6 @@ static void fcchan_conn_chng_cbk(UINT16 chan, BD_ADDR bd_addr, BOOLEAN connected
static void fcchan_data_cbk(UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf)
{
tBTA_JV evt_data;
tBTA_JV evt_open;
struct fc_channel *tc;
struct fc_client *t = NULL;
tBTA_JV_L2CAP_CBACK *sock_cback = NULL;
Expand Down Expand Up @@ -2686,7 +2633,6 @@ void bta_jv_l2cap_start_server_le(tBTA_JV_MSG *p_data)
tBTA_JV_API_L2CAP_SERVER *ss = &(p_data->l2cap_server);
tBTA_JV_L2CAP_START evt_data;
struct fc_client *t;
uint16_t handle;

evt_data.handle = GAP_INVALID_HANDLE;
evt_data.status = BTA_JV_FAILURE;
Expand Down
8 changes: 0 additions & 8 deletions bta/sdp/bta_sdp_act.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,9 @@ static inline tBT_UUID shorten_sdp_uuid(const tBT_UUID* u)

static void bta_create_mns_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_REC *p_rec)
{
tSDP_DISCOVERY_DB *db = p_bta_sdp_cfg->p_sdp_db;
tSDP_DISC_ATTR *p_attr;
tSDP_PROTOCOL_ELEM pe;
UINT16 pversion = 0;
UINT8 offset = 0;
record->mns.hdr.type = SDP_TYPE_MAP_MNS;
record->mns.hdr.service_name_length = 0;
record->mns.hdr.service_name = NULL;
Expand Down Expand Up @@ -140,7 +138,6 @@ static void bta_create_mns_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE

static void bta_create_mas_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_REC *p_rec)
{
tSDP_DISCOVERY_DB *db = p_bta_sdp_cfg->p_sdp_db;
tSDP_DISC_ATTR *p_attr;
tSDP_PROTOCOL_ELEM pe;
UINT16 pversion = -1;
Expand Down Expand Up @@ -202,7 +199,6 @@ static void bta_create_mas_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE

static void bta_create_pse_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_REC *p_rec)
{
tSDP_DISCOVERY_DB *db = p_bta_sdp_cfg->p_sdp_db;
tSDP_DISC_ATTR *p_attr;
UINT16 pversion;
tSDP_PROTOCOL_ELEM pe;
Expand Down Expand Up @@ -256,7 +252,6 @@ static void bta_create_pse_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE

static void bta_create_ops_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_REC *p_rec)
{
tSDP_DISCOVERY_DB *db = p_bta_sdp_cfg->p_sdp_db;
tSDP_DISC_ATTR *p_attr, *p_sattr;
tSDP_PROTOCOL_ELEM pe;
UINT16 pversion = -1;
Expand Down Expand Up @@ -346,9 +341,7 @@ static void bta_create_ops_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE

static void bta_create_raw_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_REC *p_rec)
{
tSDP_DISCOVERY_DB *db = p_bta_sdp_cfg->p_sdp_db;
tSDP_DISC_ATTR *p_attr;
UINT16 pversion;
tSDP_PROTOCOL_ELEM pe;

record->hdr.type = SDP_TYPE_RAW;
Expand Down Expand Up @@ -391,7 +384,6 @@ static void bta_sdp_search_cback(UINT16 result, void * user_data)
tSDP_DISC_REC *p_rec = NULL;
tBTA_SDP_SEARCH_COMP evt_data = {0}; // We need to zero-initialize
tBTA_SDP_STATUS status = BTA_SDP_FAILURE;
UINT16 uuid16 = 0;
int count = 0;
tBT_UUID su;
APPL_TRACE_DEBUG("bta_sdp_search_cback res: 0x%x", result);
Expand Down
3 changes: 0 additions & 3 deletions btif/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ static_library("btif") {
# TODO(armansito): Remove all of these flags below. We want to enable all
# warnings that we can.
cflags = [
"-Wno-unused-variable",
"-Wno-unused-value",
"-Wno-unused-function",
"-Wno-int-to-pointer-cast",
]

Expand Down
2 changes: 0 additions & 2 deletions btif/co/bta_hh_co.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,6 @@ tBTA_HH_RPT_CACHE_ENTRY * bta_hh_le_co_cache_load (BD_ADDR remote_bda,
{
UNUSED(app_id);

unsigned idx = 0;

bdstr_t bdstr;
sprintf(bdstr, "%02x:%02x:%02x:%02x:%02x:%02x",
remote_bda[0], remote_bda[1], remote_bda[2],
Expand Down
Loading

0 comments on commit cab5fc1

Please sign in to comment.