diff --git a/Changes b/Changes index a062cd7..8ff3954 100644 --- a/Changes +++ b/Changes @@ -16,7 +16,9 @@ TODO: possible cb aliasing? TODO: document requirements for function pointers and calling conventions. - ev.h wasn't valid C++ anymore, which tripped compilers other than - clang, msvc or gcc (analyzed by Raphael 'kena' Poss). + clang, msvc or gcc (analyzed by Raphael 'kena' Poss). Unfortunately, + C++ doesn't support typedefs for function pointers fully, so the affected + declarations have to spell out the types each time. - when not using autoconf, tighten the check for clock_gettime and related functionality. diff --git a/ev.c b/ev.c index beaf075..6f36c6d 100644 --- a/ev.c +++ b/ev.c @@ -2615,7 +2615,7 @@ ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_THROW } void -ev_set_loop_release_cb (EV_P_ ev_loop_callback EV_THROW release, ev_loop_callback EV_THROW acquire) EV_THROW +ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_THROW, void (*acquire)(EV_P) EV_THROW) EV_THROW { release_cb = release; acquire_cb = acquire; diff --git a/ev.h b/ev.h index e37edc2..0600586 100644 --- a/ev.h +++ b/ev.h @@ -48,14 +48,6 @@ #define EV_THROW EV_CPP(throw()) -/* apple's proprietary clang fork errors out with exception specifications */ -/* in all sorts of places, so let's not even bother with them */ -/* users are strongly advised to install clang or gcc */ -#if __APPLE__ && __clang__ -# undef EV_THROW -# define EV_THROW -#endif - EV_CPP(extern "C" {) /*****************************************************************************/ @@ -668,7 +660,8 @@ EV_API_DECL void ev_set_userdata (EV_P_ void *data) EV_THROW; EV_API_DECL void *ev_userdata (EV_P) EV_THROW; typedef void (*ev_loop_callback)(EV_P); EV_API_DECL void ev_set_invoke_pending_cb (EV_P_ ev_loop_callback invoke_pending_cb) EV_THROW; -EV_API_DECL void ev_set_loop_release_cb (EV_P_ ev_loop_callback EV_THROW release, ev_loop_callback EV_THROW acquire) EV_THROW; +/* C++ doesn't allow the use of the ev_loop_callback typedef here, so we need to spell it out*/ +EV_API_DECL void ev_set_loop_release_cb (EV_P_ void (*release)(EV_P) EV_THROW, void (*acquire)(EV_P) EV_THROW) EV_THROW; EV_API_DECL unsigned int ev_pending_count (EV_P) EV_THROW; /* number of pending events, if any */ EV_API_DECL void ev_invoke_pending (EV_P); /* invoke all pending watchers */ diff --git a/ev_vars.h b/ev_vars.h index ebd0b7d..04d4db1 100644 --- a/ev_vars.h +++ b/ev_vars.h @@ -194,8 +194,9 @@ VARx(unsigned int, loop_count) /* total number of loop iterations/blocks */ VARx(unsigned int, loop_depth) /* #ev_run enters - #ev_run leaves */ VARx(void *, userdata) -VAR (release_cb, ev_loop_callback EV_THROW release_cb) -VAR (acquire_cb, ev_loop_callback EV_THROW acquire_cb) +/* C++ doesn't support the ev_loop_callback typedef here. stinks. */ +VAR (release_cb, void (*release_cb)(EV_P) EV_THROW) +VAR (acquire_cb, void (*acquire_cb)(EV_P) EV_THROW) VAR (invoke_cb , ev_loop_callback invoke_cb) #endif