Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
node: make ev-emul.h compile with -Wextra -Werror
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bnoordhuis committed Jul 18, 2012
1 parent e8af340 commit f6f2d42
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/ev-emul.h
Expand Up @@ -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)))

Expand Down Expand Up @@ -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));
}


Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit f6f2d42

Please sign in to comment.