summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-10-21 15:28:24 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-10-21 15:28:24 +0200
commitd5a52f3951fff7ee272bd0d4cd95cd122d07fa64 (patch)
treed32f6d89550a7b8606c78c241b73b23a39ae8bed /src
parent482c44232d4deda3f89a7d85fbad99c1c64e80ec (diff)
downloadouroboros-d5a52f3951fff7ee272bd0d4cd95cd122d07fa64.tar.gz
ouroboros-d5a52f3951fff7ee272bd0d4cd95cd122d07fa64.zip
build: Comply with -Wextra compiler flag
This reduces the risk for some bugs, for instance due to signed/unsigned mismatches and unused variables.
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/ipcp.c2
-rw-r--r--src/ipcpd/local/main.c7
-rw-r--r--src/ipcpd/normal/fmgr.c7
-rw-r--r--src/ipcpd/normal/main.c2
-rw-r--r--src/ipcpd/normal/ribmgr.c18
-rw-r--r--src/ipcpd/shim-eth-llc/main.c14
-rw-r--r--src/ipcpd/shim-udp/main.c4
-rw-r--r--src/irmd/main.c8
-rw-r--r--src/lib/bitmap.c4
-rw-r--r--src/lib/dev.c7
-rw-r--r--src/lib/nsm.c10
-rw-r--r--src/lib/shm_rdrbuff.c2
-rw-r--r--src/lib/tests/bitmap_test.c3
-rw-r--r--src/tools/cbr/cbr_server.c7
-rw-r--r--src/tools/echo/echo_server.c2
-rw-r--r--src/tools/irm/irm.c3
-rw-r--r--src/tools/irm/irm_bind.c3
-rw-r--r--src/tools/irm/irm_ipcp.c3
-rw-r--r--src/tools/irm/irm_unbind.c3
-rw-r--r--src/tools/irm/irm_utils.c2
-rw-r--r--src/tools/oping/oping_client.c7
-rw-r--r--src/tools/oping/oping_server.c9
22 files changed, 114 insertions, 13 deletions
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(&eth_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(&eth_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(&eth_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(&eth_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:
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 8d9d04ac..12da81aa 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -729,7 +729,7 @@ static ssize_t list_ipcps(char * name, pid_t ** apis)
static int name_reg(char * name, char ** difs, size_t len)
{
- int i;
+ size_t i;
int ret = 0;
struct list_head * p = NULL;
@@ -829,7 +829,7 @@ static int name_reg(char * name, char ** difs, size_t len)
static int name_unreg(char * name, char ** difs, size_t len)
{
- int i;
+ size_t i;
int ret = 0;
struct list_head * pos = NULL;
@@ -1127,6 +1127,7 @@ static struct irm_flow * flow_alloc(pid_t api,
int port_id;
/* FIXME: Map qos_spec to qos_cube */
+ (void) qos;
pthread_rwlock_rdlock(&irmd->state_lock);
@@ -1630,6 +1631,9 @@ static void irm_destroy()
void irmd_sig_handler(int sig, siginfo_t * info, void * c)
{
+ (void) info;
+ (void) c;
+
switch(sig) {
case SIGINT:
case SIGTERM:
diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c
index e84145b2..916ab2ee 100644
--- a/src/lib/bitmap.c
+++ b/src/lib/bitmap.c
@@ -158,7 +158,7 @@ ssize_t bmp_allocate(struct bmp * b)
id = (ssize_t) find_next_zero_bit(b->bitmap,
b->size);
- if (id >= b->size)
+ if (id >= (ssize_t) b->size)
return bad_id(b);
bitmap_set(b->bitmap, id);
@@ -171,7 +171,7 @@ static bool is_id_valid(struct bmp * b,
{
assert(b);
- if ((id < b->offset) || (id > (b->offset + b->size)))
+ if ((id < b->offset) || (id > (ssize_t) (b->offset + b->size)))
return false;
return true;
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 146070b7..c349846f 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -467,6 +467,9 @@ int flow_alloc(char * dst_name, char * src_ae_name, struct qos_spec * qos)
irm_msg_t * recv_msg = NULL;
int fd = -1;
+ /* FIXME: add qos support */
+ (void) qos;
+
if (dst_name == NULL)
return -EINVAL;
@@ -756,7 +759,7 @@ ssize_t flow_write(int fd, void * buf, size_t count)
ssize_t flow_read(int fd, void * buf, size_t count)
{
int idx = -1;
- int n;
+ ssize_t n;
uint8_t * sdu;
if (fd < 0 || fd >= AP_MAX_FLOWS)
@@ -794,7 +797,7 @@ ssize_t flow_read(int fd, void * buf, size_t count)
return -1;
}
- memcpy(buf, sdu, MIN(n, count));
+ memcpy(buf, sdu, MIN(n, (ssize_t) count));
shm_rdrbuff_remove(ai.rdrb, idx);
diff --git a/src/lib/nsm.c b/src/lib/nsm.c
index 069db139..654b526b 100644
--- a/src/lib/nsm.c
+++ b/src/lib/nsm.c
@@ -26,6 +26,9 @@ int nsm_reg(char * name,
char ** dafs,
size_t dafs_size)
{
+ (void) name;
+ (void) dafs;
+ (void) dafs_size;
return -1;
}
@@ -34,6 +37,10 @@ int nsm_unreg(char * name,
char ** dafs,
size_t dafs_size)
{
+ (void) name;
+ (void) dafs;
+ (void) dafs_size;
+
return -1;
}
@@ -41,5 +48,8 @@ int nsm_unreg(char * name,
ssize_t nsm_resolve(char * name,
char ** dafs)
{
+ (void) name;
+ (void) dafs;
+
return -1;
}
diff --git a/src/lib/shm_rdrbuff.c b/src/lib/shm_rdrbuff.c
index e5a37577..1f93f1c7 100644
--- a/src/lib/shm_rdrbuff.c
+++ b/src/lib/shm_rdrbuff.c
@@ -689,7 +689,7 @@ int shm_rdrbuff_remove(struct shm_rdrbuff * rdrb, ssize_t idx)
idx_to_du_buff_ptr(rdrb, idx)->dst_api = -1;
- if (idx != *rdrb->ptr_tail) {
+ if (idx != (ssize_t) *rdrb->ptr_tail) {
pthread_mutex_unlock(rdrb->lock);
return 0;
}
diff --git a/src/lib/tests/bitmap_test.c b/src/lib/tests/bitmap_test.c
index 4d2d0c73..7eb72fe7 100644
--- a/src/lib/tests/bitmap_test.c
+++ b/src/lib/tests/bitmap_test.c
@@ -35,6 +35,9 @@ int bitmap_test(int argc, char ** argv)
ssize_t r;
ssize_t offset = 100;
+ (void) argc;
+ (void) argv;
+
srand(time(NULL));
bmp = bmp_create(bits, offset);
diff --git a/src/tools/cbr/cbr_server.c b/src/tools/cbr/cbr_server.c
index c5664d8b..d40ae2cb 100644
--- a/src/tools/cbr/cbr_server.c
+++ b/src/tools/cbr/cbr_server.c
@@ -48,6 +48,9 @@ pthread_cond_t fds_signal;
void shutdown_server(int signo, siginfo_t * info, void * c)
{
+ (void) info;
+ (void) c;
+
switch(signo) {
case SIGINT:
case SIGTERM:
@@ -124,6 +127,8 @@ void * worker(void * o)
{
int cli_fd;
+ (void) o;
+
while (true) {
pthread_mutex_lock(&fds_lock);
pthread_cleanup_push((void(*)(void *)) pthread_mutex_unlock,
@@ -151,6 +156,8 @@ void * listener(void * o)
int client_fd = 0;
int response = 0;
+ (void) o;
+
printf("Server started, interval is %ld s, timeout is %ld s.\n",
server_settings.interval, server_settings.timeout);
diff --git a/src/tools/echo/echo_server.c b/src/tools/echo/echo_server.c
index e6ab9cfd..acf691b3 100644
--- a/src/tools/echo/echo_server.c
+++ b/src/tools/echo/echo_server.c
@@ -29,6 +29,8 @@
void shutdown_server(int signo)
{
+ (void) signo;
+
ap_fini();
exit(EXIT_SUCCESS);
}
diff --git a/src/tools/irm/irm.c b/src/tools/irm/irm.c
index a674c7ba..1c75a7a5 100644
--- a/src/tools/irm/irm.c
+++ b/src/tools/irm/irm.c
@@ -36,6 +36,9 @@ static void usage()
static int do_help(int argc, char **argv)
{
+ (void) argc;
+ (void) argv;
+
usage();
return 0;
}
diff --git a/src/tools/irm/irm_bind.c b/src/tools/irm/irm_bind.c
index 9b37e800..a12a812b 100644
--- a/src/tools/irm/irm_bind.c
+++ b/src/tools/irm/irm_bind.c
@@ -36,6 +36,9 @@ static void usage()
static int do_help(int argc, char **argv)
{
+ (void) argc;
+ (void) argv;
+
usage();
return 0;
}
diff --git a/src/tools/irm/irm_ipcp.c b/src/tools/irm/irm_ipcp.c
index 1b523feb..9d7d9532 100644
--- a/src/tools/irm/irm_ipcp.c
+++ b/src/tools/irm/irm_ipcp.c
@@ -34,6 +34,9 @@ static void usage()
static int do_help(int argc, char **argv)
{
+ (void) argc;
+ (void) argv;
+
usage();
return 0;
}
diff --git a/src/tools/irm/irm_unbind.c b/src/tools/irm/irm_unbind.c
index 0290e678..7f2d0d7d 100644
--- a/src/tools/irm/irm_unbind.c
+++ b/src/tools/irm/irm_unbind.c
@@ -36,6 +36,9 @@ static void usage()
static int do_help(int argc, char **argv)
{
+ (void) argc;
+ (void) argv;
+
usage();
return 0;
}
diff --git a/src/tools/irm/irm_utils.c b/src/tools/irm/irm_utils.c
index 41a1e811..151d1869 100644
--- a/src/tools/irm/irm_utils.c
+++ b/src/tools/irm/irm_utils.c
@@ -28,7 +28,7 @@
int matches(const char * cmd, const char * pattern)
{
- int len = strlen(cmd);
+ size_t len = strlen(cmd);
if (len > strlen(pattern))
return -1;
diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c
index 40f75785..c2471b46 100644
--- a/src/tools/oping/oping_client.c
+++ b/src/tools/oping/oping_client.c
@@ -39,6 +39,9 @@
void shutdown_client(int signo, siginfo_t * info, void * c)
{
+ (void) info;
+ (void) c;
+
switch(signo) {
case SIGINT:
case SIGTERM:
@@ -65,6 +68,8 @@ void * reader(void * o)
if (fq == NULL)
return (void *) 1;
+ (void) o;
+
/* FIXME: use flow timeout option once we have it */
while (client.rcvd != client.count
&& flow_event_wait(client.flows, fq, &timeout) != -ETIMEDOUT) {
@@ -78,7 +83,7 @@ void * reader(void * o)
continue;
}
- if (ntohl(msg->id) >= client.count) {
+ if ((int) ntohl(msg->id) >= client.count) {
printf("Invalid id.\n");
continue;
}
diff --git a/src/tools/oping/oping_server.c b/src/tools/oping/oping_server.c
index 8a5a3512..8680b11b 100644
--- a/src/tools/oping/oping_server.c
+++ b/src/tools/oping/oping_server.c
@@ -31,6 +31,9 @@
void shutdown_server(int signo, siginfo_t * info, void * c)
{
+ (void) info;
+ (void) c;
+
switch(signo) {
case SIGINT:
case SIGTERM:
@@ -47,6 +50,8 @@ void * cleaner_thread(void * o)
struct timespec now = {0, 0};
int deadline_ms = 10000;
+ (void) o;
+
while (true) {
clock_gettime(CLOCK_REALTIME, &now);
pthread_mutex_lock(&server.lock);
@@ -74,6 +79,8 @@ void * server_thread(void *o)
if (fq == NULL)
return (void *) 1;
+ (void) o;
+
while (true) {
int ret = flow_event_wait(server.flows, fq, &timeout);
if (ret == -ETIMEDOUT)
@@ -117,6 +124,8 @@ void * accept_thread(void * o)
int fd = 0;
struct timespec now = {0, 0};
+ (void) o;
+
printf("Ouroboros ping server started.\n");
while (true) {