From 0e591368237396106e9a1cd149e03de9d2d9f5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 3 Mar 2014 21:37:22 +0100 Subject: [PATCH] test: fix compiation warning -Wunused-function would kick in because of the close_loop function, but there tests and benchmarks which actually don't use any loop. --- test/task.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/task.h b/test/task.h index d96e8252..e890c77f 100644 --- a/test/task.h +++ b/test/task.h @@ -209,13 +209,22 @@ static int snprintf(char* buf, size_t len, const char* fmt, ...) { #endif +#if defined(__clang__) || \ + defined(__GNUC__) || \ + defined(__INTEL_COMPILER) || \ + defined(__SUNPRO_C) +# define UNUSED __attribute__((unused)) +#else +# define UNUSED +#endif + /* Fully close a loop */ static void close_walk_cb(uv_handle_t* handle, void* arg) { if (!uv_is_closing(handle)) uv_close(handle, NULL); } -static void close_loop(uv_loop_t* loop) { +UNUSED static void close_loop(uv_loop_t* loop) { uv_walk(loop, close_walk_cb, NULL); uv_run(loop, UV_RUN_DEFAULT); }