From d5a52f3951fff7ee272bd0d4cd95cd122d07fa64 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Fri, 21 Oct 2016 15:28:24 +0200 Subject: build: Comply with -Wextra compiler flag This reduces the risk for some bugs, for instance due to signed/unsigned mismatches and unused variables. --- src/ipcpd/ipcp.c | 2 ++ src/ipcpd/local/main.c | 7 +++++++ src/ipcpd/normal/fmgr.c | 7 +++++++ src/ipcpd/normal/main.c | 2 ++ src/ipcpd/normal/ribmgr.c | 18 ++++++++++++++++++ src/ipcpd/shim-eth-llc/main.c | 14 ++++++++++---- src/ipcpd/shim-udp/main.c | 4 ++++ 7 files changed, 50 insertions(+), 4 deletions(-) (limited to 'src/ipcpd') diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index f9246c7a..eab02f7d 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -189,6 +189,8 @@ void * ipcp_main_loop(void * o) struct timeval ltv = {(SOCKET_TIMEOUT / 1000), (SOCKET_TIMEOUT % 1000) * 1000}; + (void) o; + sock_path = ipcp_sock_path(getpid()); if (sock_path == NULL) return (void *) 1; diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 68c9ae8c..761577ea 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -80,6 +80,8 @@ static void * ipcp_local_sdu_loop(void * o) if (fq == NULL) return (void *) 1; + (void) o; + while (true) { int fd; int ret; @@ -121,6 +123,8 @@ static void * ipcp_local_sdu_loop(void * o) void ipcp_sig_handler(int sig, siginfo_t * info, void * c) { + (void) c; + switch(sig) { case SIGINT: case SIGTERM: @@ -204,6 +208,9 @@ static int ipcp_local_flow_alloc(int fd, { int out_fd = -1; + /* FIXME: support qos */ + (void) qos; + LOG_DBG("Allocating flow to %s on fd %d.", dst_name, fd); if (dst_name == NULL || src_ae_name == NULL) diff --git a/src/ipcpd/normal/fmgr.c b/src/ipcpd/normal/fmgr.c index 3da392c5..46c72691 100644 --- a/src/ipcpd/normal/fmgr.c +++ b/src/ipcpd/normal/fmgr.c @@ -126,6 +126,8 @@ static void * fmgr_nm1_acceptor(void * o) int fd; char * ae_name; + (void) o; + while (true) { ipcp_wait_state(IPCP_ENROLLED, NULL); @@ -190,6 +192,8 @@ static void * fmgr_np1_sdu_reader(void * o) if (fq == NULL) return (void *) 1; + (void) o; + while (true) { int ret = flow_event_wait(fmgr.np1_set, fq, &timeout); if (ret == -ETIMEDOUT) @@ -240,6 +244,9 @@ void * fmgr_nm1_sdu_reader(void * o) fqueue_t * fq = fqueue_create(); if (fq == NULL) return (void *) 1; + + (void) o; + while (true) { int ret = flow_event_wait(fmgr.nm1_set, fq, &timeout); if (ret == -ETIMEDOUT) diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 0339eaf4..32aabdf2 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -47,6 +47,8 @@ int irmd_api; void ipcp_sig_handler(int sig, siginfo_t * info, void * c) { + (void) c; + switch(sig) { case SIGINT: case SIGTERM: diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c index c69a59ce..cd12bcc6 100644 --- a/src/ipcpd/normal/ribmgr.c +++ b/src/ipcpd/normal/ribmgr.c @@ -167,6 +167,9 @@ int ribmgr_cdap_reply(struct cdap * instance, { struct list_head * pos, * n = NULL; + (void) data; + (void) len; + pthread_mutex_lock(&rib.cdap_reqs_lock); list_for_each_safe(pos, n, &rib.cdap_reqs) { @@ -202,6 +205,9 @@ int ribmgr_cdap_read(struct cdap * instance, char * name) { LOG_MISSING; + (void) instance; + (void) invoke_id; + (void) name; return -1; } @@ -216,6 +222,8 @@ int ribmgr_cdap_write(struct cdap * instance, static_info_msg_t * msg; int ret = 0; + (void) flags; + pthread_rwlock_wrlock(&ipcpi.state_lock); if (ipcp_get_state() == IPCP_PENDING_ENROLL && strcmp(name, STATIC_INFO) == 0) { @@ -272,6 +280,11 @@ int ribmgr_cdap_create(struct cdap * instance, size_t len) { LOG_MISSING; + (void) instance; + (void) invoke_id; + (void) name; + (void) data; + (void) len; return -1; } @@ -283,6 +296,11 @@ int ribmgr_cdap_delete(struct cdap * instance, size_t len) { LOG_MISSING; + (void) instance; + (void) invoke_id; + (void) name; + (void) data; + (void) len; return -1; } diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index db258c8b..dfb6e21c 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -415,7 +415,7 @@ static int eth_llc_ipcp_sap_alloc_reply(uint8_t ssap, } -static int eth_llc_ipcp_flow_dealloc_req(uint8_t ssap, uint8_t * r_addr) +static int eth_llc_ipcp_flow_dealloc_req(uint8_t ssap) { int fd = -1; @@ -462,7 +462,7 @@ static int eth_llc_ipcp_mgmt_frame(uint8_t * buf, size_t len, uint8_t * r_addr) msg->response); break; case SHIM_ETH_LLC_MSG_CODE__FLOW_DEALLOC: - eth_llc_ipcp_flow_dealloc_req(msg->ssap, r_addr); + eth_llc_ipcp_flow_dealloc_req(msg->ssap); break; default: LOG_ERR("Unknown message received %d.", msg->code); @@ -492,6 +492,8 @@ static void * eth_llc_ipcp_sdu_reader(void * o) #endif struct eth_llc_frame * llc_frame; + (void) o; + memset(br_addr, 0xff, MAC_SIZE * sizeof(uint8_t)); while (true) { @@ -608,6 +610,8 @@ static void * eth_llc_ipcp_sdu_writer(void * o) if (fq == NULL) return (void *) 1; + (void) o; + while (true) { int ret = flow_event_wait(eth_llc_data.np1_flows, fq, &timeout); if (ret == -ETIMEDOUT) @@ -648,6 +652,8 @@ static void * eth_llc_ipcp_sdu_writer(void * o) void ipcp_sig_handler(int sig, siginfo_t * info, void * c) { + (void) c; + switch(sig) { case SIGINT: case SIGTERM: @@ -903,7 +909,7 @@ static int eth_llc_ipcp_flow_alloc(int fd, pthread_rwlock_wrlock(ð_llc_data.flows_lock); ssap = bmp_allocate(eth_llc_data.saps); - if (ssap < 0) { + if (!bmp_is_id_valid(eth_llc_data.saps, ssap)) { pthread_rwlock_unlock(ð_llc_data.flows_lock); pthread_rwlock_unlock(&ipcpi.state_lock); return -1; @@ -945,7 +951,7 @@ static int eth_llc_ipcp_flow_alloc_resp(int fd, int response) pthread_rwlock_wrlock(ð_llc_data.flows_lock); ssap = bmp_allocate(eth_llc_data.saps); - if (ssap < 0) { + if (!bmp_is_id_valid(eth_llc_data.saps, ssap)) { pthread_rwlock_unlock(ð_llc_data.flows_lock); pthread_rwlock_unlock(&ipcpi.state_lock); return -1; diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index 050623e4..f97a6bc1 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -524,6 +524,8 @@ static void * ipcp_udp_sdu_loop(void * o) if (fq == NULL) return (void *) 1; + (void) o; + while (true) { int ret = flow_event_wait(udp_data.np1_flows, fq, &timeout); if (ret == -ETIMEDOUT) @@ -563,6 +565,8 @@ static void * ipcp_udp_sdu_loop(void * o) void ipcp_sig_handler(int sig, siginfo_t * info, void * c) { + (void) c; + switch(sig) { case SIGINT: case SIGTERM: -- cgit v1.2.3