libev/libev-4.18-Fix-C-function-definitions.patch

81 lines
3.2 KiB
Diff

From f5f182421a3a00f429b9041008a96988b7485157 Mon Sep 17 00:00:00 2001
From: Mathieu Bridon <bochecha@fedoraproject.org>
Date: Tue, 23 Sep 2014 10:20:51 +0200
Subject: [PATCH] Fix C++ function definitions
This is a backport of the fix in upstream CVS.
http://lists.schmorp.de/pipermail/libev/2014q3/002441.html
https://bugzilla.redhat.com/show_bug.cgi?id=1145190
---
Changes | 5 +++++
ev.c | 2 +-
ev.h | 4 ++--
ev_vars.h | 5 +++--
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/Changes b/Changes
index 6efc4a7..4c8377c 100644
--- a/Changes
+++ b/Changes
@@ -15,6 +15,11 @@ TODO: document portability requirements for atomic pointer access
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). Unfortunately,
+ C++ doesn't support typedefs for function pointers fully, so the affected
+ declarations have to spell out the types each time.
+
4.18 Fri Sep 5 17:55:26 CEST 2014
- events on files were not always generated properly with the
epoll backend (testcase by Assaf Inbal).
diff --git a/ev.c b/ev.c
index f94fbf5..d1ebdea 100644
--- a/ev.c
+++ b/ev.c
@@ -2606,7 +2606,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_nothrow release, ev_loop_callback_nothrow 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 13d22ed..0600586 100644
--- a/ev.h
+++ b/ev.h
@@ -660,8 +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;
-typedef void (*ev_loop_callback_nothrow)(EV_P) EV_THROW;
-EV_API_DECL void ev_set_loop_release_cb (EV_P_ ev_loop_callback_nothrow release, ev_loop_callback_nothrow 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 98f7718..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_nothrow release_cb)
-VAR (acquire_cb, ev_loop_callback_nothrow 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
--
2.1.0