diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2012-07-18 13:32:26 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-07-18 13:56:09 +0200 |
commit | f6f2d42ee95e1cd0900af62a3cfe7d31c1ed8e62 (patch) | |
tree | f9ba1a45f0c0bca71d5004de584944672656dc51 /src | |
parent | e8af3405574dfee2cb8c11bf27195b774332db96 (diff) | |
download | nodejs-f6f2d42ee95e1cd0900af62a3cfe7d31c1ed8e62.tar.gz nodejs-f6f2d42ee95e1cd0900af62a3cfe7d31c1ed8e62.tar.bz2 nodejs-f6f2d42ee95e1cd0900af62a3cfe7d31c1ed8e62.zip |
node: make ev-emul.h compile with -Wextra -Werror
Explicitly cast double to int64_t, it was making add-ons that compile with
`-Wall -Wextra -Werror` fail to build.
Don't use fully variadic macros, gcc in uber-strict mode rejects them.
Diffstat (limited to 'src')
-rw-r--r-- | src/ev-emul.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/ev-emul.h b/src/ev-emul.h index cf924c744..3d0c77e91 100644 --- a/src/ev-emul.h +++ b/src/ev-emul.h @@ -75,14 +75,9 @@ extern "C" { (w)->cb = (cb_); \ while (0) -#define ev_set_priority(...) - #define ev_is_active(w) \ (uv_is_active((uv_handle_t*) &(w)->handle)) -#define ev_now(...) \ - (uv_hrtime() / 1e9) - #define __uv_container_of(ptr, type, field) \ ((type*) ((char*) (ptr) - offsetof(type, field))) @@ -194,13 +189,15 @@ inline static void __ev_timer_set(__ev_timer* w, inline static void __ev_timer_start(__ev_timer* w) { - uint64_t ms = 1000; __uv_warn_of(ev_timer, uv_timer_t); if (!(w->flags & 1)) { uv_timer_init(uv_default_loop(), &w->handle); w->flags |= 1; } - uv_timer_start(&w->handle, __uv_timer_cb, w->delay * ms, w->repeat * ms); + uv_timer_start(&w->handle, + __uv_timer_cb, + (int64_t) (w->delay * 1000), + (int64_t) (w->repeat * 1000)); } @@ -233,6 +230,15 @@ inline static void __ev_unref(void) { } +inline static double __ev_now(/* variadic */) { + return uv_hrtime() / 1e9; +} + + +inline static void __ev_set_priority(/* variadic */) { +} + + #define ev_io __ev_io #define ev_io_init __ev_io_init #define ev_io_set __ev_io_set @@ -249,6 +255,9 @@ inline static void __ev_unref(void) { #define ev_ref __ev_ref #define ev_unref __ev_unref +#define ev_now __ev_now +#define ev_set_priority __ev_set_priority + #undef __uv_container_of #undef __uv_warn_of |