diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d8023318..aa8721e64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,8 +40,8 @@ configure_file(${CMAKE_SOURCE_DIR}/server/test/maxscale_test.h.in ${CMAKE_BINARY configure_file(${CMAKE_SOURCE_DIR}/etc/postinst.in ${CMAKE_BINARY_DIR}/postinst) configure_file(${CMAKE_SOURCE_DIR}/etc/postrm.in ${CMAKE_BINARY_DIR}/postrm) -set(CMAKE_C_FLAGS "-Wall -fPIC") -set(CMAKE_CXX_FLAGS "-Wall -fPIC") +set(CMAKE_C_FLAGS "-Wall -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function -fPIC") +set(CMAKE_CXX_FLAGS "-Wall -Wno-unused-variable -Wno-unused-but-set-variable -fPIC") set(DEBUG_FLAGS "-ggdb -pthread -pipe -Wformat -fstack-protector --param=ssp-buffer-size=4") if(CMAKE_VERSION VERSION_GREATER 2.6) diff --git a/log_manager/log_manager.cc b/log_manager/log_manager.cc index ff2b3e695..1171414df 100644 --- a/log_manager/log_manager.cc +++ b/log_manager/log_manager.cc @@ -167,7 +167,7 @@ struct logfile_st { size_t lf_file_size; /** list of block-sized log buffers */ mlist_t lf_blockbuf_list; - int lf_buf_size; + size_t lf_buf_size; bool lf_flushflag; bool lf_rotateflag; int lf_spinlock; /**< lf_flushflag & lf_rotateflag */ @@ -633,7 +633,7 @@ static int logmanager_write_log( int err = 0; blockbuf_t* bb; blockbuf_t* bb_c; - int timestamp_len; + size_t timestamp_len; int i; CHK_LOGMANAGER(lm); @@ -680,9 +680,9 @@ static int logmanager_write_log( else { /** Length of string that will be written, limited by bufsize */ - int safe_str_len; + size_t safe_str_len; /** Length of session id */ - int sesid_str_len; + size_t sesid_str_len; /** * 2 braces, 2 spaces and terminating char diff --git a/query_classifier/query_classifier.cc b/query_classifier/query_classifier.cc index 9667193ed..f8da45567 100644 --- a/query_classifier/query_classifier.cc +++ b/query_classifier/query_classifier.cc @@ -1253,7 +1253,7 @@ char* skygw_get_affected_fields(GWBUF* buf) List_iterator ilist(lex->current_select->item_list); item = (Item*)ilist.next(); - for (item; item != NULL; item=(Item*)ilist.next()) + for (; item != NULL; item=(Item*)ilist.next()) { itype = item->type(); diff --git a/server/core/gateway.c b/server/core/gateway.c index 10dbbfc31..d7ade597a 100644 --- a/server/core/gateway.c +++ b/server/core/gateway.c @@ -1039,6 +1039,7 @@ int main(int argc, char **argv) int l; int i; int n; + intptr_t thread_id; int n_threads; /*< number of epoll listener threads */ int n_services; int eno = 0; /*< local variable for errno */ @@ -1788,9 +1789,9 @@ int main(int argc, char **argv) /*< * Start server threads. */ - for (n = 0; n < n_threads - 1; n++) + for (thread_id = 0; thread_id < n_threads - 1; thread_id++) { - threads[n] = thread_start(poll_waitevents, (void *)(n + 1)); + threads[thread_id] = thread_start(poll_waitevents, (void *)(thread_id + 1)); } LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE, "MaxScale started with %d server threads.", @@ -1803,9 +1804,9 @@ int main(int argc, char **argv) /*< * Wait server threads' completion. */ - for (n = 0; n < n_threads - 1; n++) + for (thread_id = 0; thread_id < n_threads - 1; thread_id++) { - thread_wait(threads[n]); + thread_wait(threads[thread_id]); } /*< * Wait the flush thread. diff --git a/server/core/maxkeys.c b/server/core/maxkeys.c index ad1e28f86..747e575ec 100644 --- a/server/core/maxkeys.c +++ b/server/core/maxkeys.c @@ -30,7 +30,7 @@ #include #include -main(int argc, char **argv) +int main(int argc, char **argv) { if (argc != 2) { diff --git a/server/core/memlog.c b/server/core/memlog.c index 43df8c5da..8e44e2d5c 100644 --- a/server/core/memlog.c +++ b/server/core/memlog.c @@ -28,10 +28,12 @@ * @endverbatim */ #include +#include #include +#include static MEMLOG *memlogs = NULL; -static SPINLOCK *memlock = SPINLOCK_INIT; +static SPINLOCK memlock = SPINLOCK_INIT; /** * Create a new instance of a memory logger. diff --git a/server/core/modutil.c b/server/core/modutil.c index 07ef9af85..269c66635 100644 --- a/server/core/modutil.c +++ b/server/core/modutil.c @@ -237,7 +237,7 @@ char * modutil_get_SQL(GWBUF *buf) { unsigned int len, length; -unsigned char *ptr, *dptr, *rval = NULL; +char *ptr, *dptr, *rval = NULL; if (!modutil_is_SQL(buf)) return rval; @@ -671,4 +671,4 @@ static void modutil_reply_routing_error( /** Create an incoming event for backend DCB */ poll_add_epollin_event_to_dcb(backend_dcb, buf); return; -} \ No newline at end of file +} diff --git a/server/core/poll.c b/server/core/poll.c index 2dc4c34ae..46d049592 100644 --- a/server/core/poll.c +++ b/server/core/poll.c @@ -438,7 +438,7 @@ poll_waitevents(void *arg) { struct epoll_event events[MAX_EVENTS]; int i, nfds, timeout_bias = 1; -int thread_id = (int)arg; +intptr_t thread_id = (intptr_t)arg; DCB *zombies = NULL; int poll_spins = 0; diff --git a/server/modules/filter/topfilter.c b/server/modules/filter/topfilter.c index 71a6d86ca..737dd790a 100644 --- a/server/modules/filter/topfilter.c +++ b/server/modules/filter/topfilter.c @@ -488,8 +488,11 @@ char *ptr; } static int -cmp_topn(TOPNQ **a, TOPNQ **b) +cmp_topn(const void *va, const void *vb) { + TOPNQ **a = (TOPNQ **)va; + TOPNQ **b = (TOPNQ **)vb; + if ((*b)->duration.tv_sec == (*a)->duration.tv_sec) return (*b)->duration.tv_usec - (*a)->duration.tv_usec; return (*b)->duration.tv_sec - (*a)->duration.tv_sec;