[libev] Fix C++ function definitions

Mathieu Bridon bochecha at fedoraproject.org
Tue Sep 23 08:41:46 UTC 2014


commit 35397acbbc877a92414ad6a308ac31d6c9d41282
Author: Mathieu Bridon <bochecha at fedoraproject.org>
Date:   Tue Sep 23 10:41:18 2014 +0200

    Fix C++ function definitions
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1145190

 libev-4.18-Fix-C-function-definitions.patch |   80 +++++++++++++++++++++++++++
 libev.spec                                  |    8 ++-
 2 files changed, 87 insertions(+), 1 deletions(-)
---
diff --git a/libev-4.18-Fix-C-function-definitions.patch b/libev-4.18-Fix-C-function-definitions.patch
new file mode 100644
index 0000000..7f8f996
--- /dev/null
+++ b/libev-4.18-Fix-C-function-definitions.patch
@@ -0,0 +1,80 @@
+From f5f182421a3a00f429b9041008a96988b7485157 Mon Sep 17 00:00:00 2001
+From: Mathieu Bridon <bochecha at 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
+
diff --git a/libev.spec b/libev.spec
index 4236cd8..f63ea21 100644
--- a/libev.spec
+++ b/libev.spec
@@ -4,7 +4,7 @@
 Name:             libev
 Summary:          High-performance event loop/event model with lots of features
 Version:          4.18
-Release:          1%{?dist}
+Release:          2%{?dist}
 License:          BSD or GPLv2+
 URL:              http://software.schmorp.de/pkg/libev.html
 Source0:          http://dist.schmorp.de/libev/Attic/%{name}-%{version}.tar.gz
@@ -13,6 +13,7 @@ BuildRequires:    autoconf automake libtool
 
 Patch0:           libev-4.18-Modernize-the-configure.ac.patch
 Patch1:           libev-4.18-Respect-the-CFLAGS-if-defined.patch
+Patch2:           libev-4.18-Fix-C-function-definitions.patch
 
 %description
 Libev is modeled (very loosely) after libevent and the Event Perl
@@ -55,6 +56,7 @@ This package contains the source code for libev.
 
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 autoreconf -i
 
@@ -104,6 +106,10 @@ install -p -m 0644 Changes ev.pod LICENSE README %{inst_srcdir}
 
 
 %changelog
+* Tue Sep 23 2014 Mathieu Bridon <bochecha at fedoraproject.org> - 4.18-2
+- Fix C++ function definitions
+  https://bugzilla.redhat.com/show_bug.cgi?id=1145190
+
 * Mon Sep 08 2014 Mathieu Bridon <bochecha at fedoraproject.org> - 4.18-1
 - Update to 4.18.
 


More information about the scm-commits mailing list