diff options
-rw-r--r-- | test/btree_test.c | 4 | ||||
-rw-r--r-- | test/hash_test.c | 2 | ||||
-rw-r--r-- | test/ring_test.c | 4 | ||||
-rw-r--r-- | test/sem_test.c | 4 | ||||
-rw-r--r-- | test/sorted_array_test.c | 2 | ||||
-rw-r--r-- | test/tree_bench.c | 3 | ||||
-rw-r--r-- | test/tree_test.c | 2 | ||||
-rw-r--r-- | wscript | 2 | ||||
-rw-r--r-- | zix/common.h | 9 | ||||
-rw-r--r-- | zix/thread.h | 2 | ||||
-rw-r--r-- | zix/tree.c | 4 | ||||
-rw-r--r-- | zix/trie.c | 8 |
12 files changed, 25 insertions, 21 deletions
diff --git a/test/btree_test.c b/test/btree_test.c index 5ffcd87..f9d45a0 100644 --- a/test/btree_test.c +++ b/test/btree_test.c @@ -52,7 +52,7 @@ unique_rand(size_t i) } static int -int_cmp(const void* a, const void* b, ZIX_UNUSED const void* user_data) +int_cmp(const void* a, const void* b, const void* ZIX_UNUSED(user_data)) { const uintptr_t ia = (uintptr_t)a; const uintptr_t ib = (uintptr_t)b; @@ -76,7 +76,7 @@ ith_elem(const unsigned test_num, const size_t n_elems, const size_t i) } } -static void destroy(ZIX_UNUSED void* ptr) +static void destroy(void* ZIX_UNUSED(ptr)) { } diff --git a/test/hash_test.c b/test/hash_test.c index f4ebdfe..b2143eb 100644 --- a/test/hash_test.c +++ b/test/hash_test.c @@ -61,7 +61,7 @@ test_fail(const char* fmt, ...) static unsigned n_checked = 0; static void -check(void* value, ZIX_UNUSED void* user_data) +check(void* value, void* ZIX_UNUSED(user_data)) { if (strlen(*(const char*const*)value) >= 3) { ++n_checked; diff --git a/test/ring_test.c b/test/ring_test.c index 9e11690..6fa9589 100644 --- a/test/ring_test.c +++ b/test/ring_test.c @@ -63,7 +63,7 @@ cmp_msg(int* msg1, int* msg2) } static void* -reader(ZIX_UNUSED void* arg) +reader(void* ZIX_UNUSED(arg)) { printf("Reader starting\n"); @@ -90,7 +90,7 @@ reader(ZIX_UNUSED void* arg) } static void* -writer(ZIX_UNUSED void* arg) +writer(void* ZIX_UNUSED(arg)) { printf("Writer starting\n"); diff --git a/test/sem_test.c b/test/sem_test.c index a3485d8..7ff9b08 100644 --- a/test/sem_test.c +++ b/test/sem_test.c @@ -24,7 +24,7 @@ static ZixSem sem; static unsigned n_signals = 1024; static void* -reader(ZIX_UNUSED void* arg) +reader(void* ZIX_UNUSED(arg)) { printf("Reader starting\n"); @@ -37,7 +37,7 @@ reader(ZIX_UNUSED void* arg) } static void* -writer(ZIX_UNUSED void* arg) +writer(void* ZIX_UNUSED(arg)) { printf("Writer starting\n"); diff --git a/test/sorted_array_test.c b/test/sorted_array_test.c index ad52db5..a90f1e7 100644 --- a/test/sorted_array_test.c +++ b/test/sorted_array_test.c @@ -32,7 +32,7 @@ static unsigned seed = 1; static int -int_cmp(const void* a, const void* b, ZIX_UNUSED const void* user_data) +int_cmp(const void* a, const void* b, const void* ZIX_UNUSED(user_data)) { const intptr_t ia = *(const intptr_t*)a; const intptr_t ib = *(const intptr_t*)b; diff --git a/test/tree_bench.c b/test/tree_bench.c index df7d703..b966252 100644 --- a/test/tree_bench.c +++ b/test/tree_bench.c @@ -16,6 +16,7 @@ #include "bench.h" +#include "zix/common.h" #include "zix/zix.h" #include <glib.h> @@ -45,7 +46,7 @@ unique_rand(uint32_t i) } static int -int_cmp(const void* a, const void* b, const void* user_data) +int_cmp(const void* a, const void* b, const void* ZIX_UNUSED(user_data)) { const intptr_t ia = (intptr_t)a; const intptr_t ib = (intptr_t)b; diff --git a/test/tree_test.c b/test/tree_test.c index 1389359..0748142 100644 --- a/test/tree_test.c +++ b/test/tree_test.c @@ -33,7 +33,7 @@ static unsigned seed = 1; static int -int_cmp(const void* a, const void* b, ZIX_UNUSED const void* user_data) +int_cmp(const void* a, const void* b, const void* ZIX_UNUSED(user_data)) { const intptr_t ia = (intptr_t)a; const intptr_t ib = (intptr_t)b; @@ -51,7 +51,6 @@ def configure(conf): '-Wno-reserved-id-macro', '-Wno-shorten-64-to-32', '-Wno-sign-conversion', - '-Wno-unused-parameter', '-Wno-unused-variable', ], 'gcc': [ @@ -67,7 +66,6 @@ def configure(conf): '-Wno-suggest-attribute=const', '-Wno-suggest-attribute=format', '-Wno-suggest-attribute=pure', - '-Wno-unused-parameter', '-Wno-unused-variable', ], 'msvc': [ diff --git a/zix/common.h b/zix/common.h index a59c033..f0737eb 100644 --- a/zix/common.h +++ b/zix/common.h @@ -52,10 +52,13 @@ extern "C" { # include <stdbool.h> #endif -#ifdef __GNUC__ -#define ZIX_UNUSED __attribute__((__unused__)) +// Unused parameter macro to suppresses warnings and make it impossible to use +#if defined(__cplusplus) +# define ZIX_UNUSED(name) +#elif defined(__GNUC__) +# define ZIX_UNUSED(name) name##_unused __attribute__((__unused__)) #else -#define ZIX_UNUSED +# define ZIX_UNUSED(name) name #endif typedef enum { diff --git a/zix/thread.h b/zix/thread.h index 9f05b10..2af0c5e 100644 --- a/zix/thread.h +++ b/zix/thread.h @@ -80,6 +80,8 @@ zix_thread_create(ZixThread* thread, static inline ZixStatus zix_thread_join(ZixThread thread, void** retval) { + (void)retval; + return WaitForSingleObject(thread, INFINITE) ? ZIX_STATUS_SUCCESS : ZIX_STATUS_ERROR; } @@ -632,7 +632,7 @@ zix_tree_begin(ZixTree* t) } ZIX_API ZixTreeIter* -zix_tree_end(ZIX_UNUSED ZixTree* t) +zix_tree_end(ZixTree* ZIX_UNUSED(t)) { return NULL; } @@ -652,7 +652,7 @@ zix_tree_rbegin(ZixTree* t) } ZIX_API ZixTreeIter* -zix_tree_rend(ZIX_UNUSED ZixTree* t) +zix_tree_rend(ZixTree* ZIX_UNUSED(t)) { return NULL; } @@ -205,10 +205,10 @@ zix_trie_add_child(ZixTrieNode** n_ptr, } ZIX_PRIVATE ZixTrieNode** -trie_insert_tail(ZixTrieNode** n_ptr, - const uint8_t* str, - const uint8_t* first, - ZIX_UNUSED const size_t len) +trie_insert_tail(ZixTrieNode** n_ptr, + const uint8_t* str, + const uint8_t* first, + const size_t ZIX_UNUSED(len)) { assert(first[0]); ZixTrieNode* c = NULL; |