From 0587bef25eb23f58aad1cd0b39d6bcb2dd074578 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 18 Mar 2014 16:56:06 +0100 Subject: Compile options, -Wextra fixes --- src/CMakeLists.txt | 3 ++- src/babel.c | 6 +++--- src/route.c | 2 +- src/tlv_types.c | 2 +- src/types.h | 3 +++ 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 64cda12..f8c0a8a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,5 @@ include_directories(${GMRF_INCLUDE_DIR}) +set_directory_properties(PROPERTIES COMPILE_DEFINITIONS _GNU_SOURCE) add_library(mmss_proto_babel MODULE babel.c @@ -9,4 +10,4 @@ add_library(mmss_proto_babel MODULE tlv_types.c ) target_link_libraries(mmss_proto_babel ${MMSS_PROTOCOL_LIB}) -set_target_properties(mmss_proto_babel PROPERTIES LINK_FLAGS "-Wl,--undefined=mmss_protocol_info") +set_target_properties(mmss_proto_babel PROPERTIES COMPILE_FLAGS "-std=c99 -Wall" LINK_FLAGS "-Wl,--undefined=mmss_protocol_info") diff --git a/src/babel.c b/src/babel.c index 7842428..4a2de19 100644 --- a/src/babel.c +++ b/src/babel.c @@ -35,13 +35,13 @@ const char *gmrf_protocol_name = "babel"; const char *gmrf_protocol_version = "experimental"; -static void send_hellos(gmrf_context_t *ctx, void *arg) { +static void send_hellos(gmrf_context_t *ctx, void *arg UNUSED) { gmrf_schedule(ctx->gmrf, send_hellos, NULL, GP_BABEL_HELLO_INTERVAL*10); gp_babel_send_hellos(ctx); } -static void send_updates(gmrf_context_t *ctx, void *arg) { +static void send_updates(gmrf_context_t *ctx, void *arg UNUSED) { gmrf_schedule(ctx->gmrf, send_updates, NULL, GP_BABEL_UPDATE_INTERVAL*10); gmrf_logf(ctx->gmrf, LOG_DEBUG, "sending periodic updates."); @@ -128,7 +128,7 @@ static void maintain_routes(gmrf_context_t *ctx) { } } -static void maintenance(gmrf_context_t *ctx, void *arg) { +static void maintenance(gmrf_context_t *ctx, void *arg UNUSED) { gmrf_schedule(ctx->gmrf, maintenance, NULL, GP_BABEL_MAINTENANCE_INTERVAL*10); maintain_neighbours(ctx); diff --git a/src/route.c b/src/route.c index 3d54d35..f8a16d5 100644 --- a/src/route.c +++ b/src/route.c @@ -64,7 +64,7 @@ gp_babel_route_t* gp_babel_route_get(gmrf_context_t *ctx, const gp_babel_node_id return route; } -void gp_babel_route_free(gmrf_context_t *ctx, gp_babel_route_t *route) { +void gp_babel_route_free(gmrf_context_t *ctx UNUSED, gp_babel_route_t *route) { free(route); } diff --git a/src/tlv_types.c b/src/tlv_types.c index fd96e98..850acfb 100644 --- a/src/tlv_types.c +++ b/src/tlv_types.c @@ -54,7 +54,7 @@ static void handle_tlv_ack_req(gmrf_context_t *ctx, const gp_babel_tlv_ack_req_t gp_babel_send_ack(ctx, get_tlv_neigh(ctx, arg), ntohs(tlv->nonce)); } -static void handle_tlv_ack(gmrf_context_t *ctx, const gp_babel_tlv_ack_t *tlv, size_t len, handle_tlv_arg_t *arg) { +static void handle_tlv_ack(gmrf_context_t *ctx, const gp_babel_tlv_ack_t *tlv UNUSED, size_t len, handle_tlv_arg_t *arg UNUSED) { if (len < sizeof(gp_babel_tlv_ack_t)) { gmrf_logf(ctx->gmrf, LOG_WARNING, "received short acknowledement TLV."); return; diff --git a/src/types.h b/src/types.h index 0907232..db4f573 100644 --- a/src/types.h +++ b/src/types.h @@ -30,6 +30,9 @@ #include +#define UNUSED __attribute__((unused)) + + #define GP_BABEL_NODE_ID_LENGTH 8 typedef struct __attribute__((packed)) gp_gabel_node_id { -- cgit v1.2.3