Hi Marc,
On Mon, Jan 23, 2012 at 5:44 PM, Marc Lehmann <[email protected]> wrote:
> I tested EV before release and it seems to compile fine, but I cannot test
> on os x 10.7.
I just did and there are two issues. First, it seems llvm is
deliberately excluded from ecb.h, but after this patch:
--- a/libev/ev.c
+++ b/libev/ev.c
@@ -541,7 +541,7 @@ struct signalfd_siginfo
#endif
#ifndef ECB_MEMORY_FENCE
- #if ECB_GCC_VERSION(2,5) || defined(__INTEL_COMPILER) ||
defined(__clang__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110
+ #if ECB_GCC_VERSION(2,5) || defined(__INTEL_COMPILER) ||
defined(__clang__) || defined(__llvm__) || __SUNPRO_C >= 0x5110 ||
__SUNPRO_CC >= 0x5110
#if __i386 || __i386__
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock;
orb $0, -1(%%esp)" : : : "memory")
#define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE /* non-lock
xchg might be enough */
Everything seems to work:
$ perl Makefile.PL && make test
[...]
All tests successful.
Files=11, Tests=6875, 6 wallclock secs ( 0.87 usr 0.07 sys + 0.50
cusr 0.13 csys = 1.57 CPU)
Result: PASS
Now I know that llvm-gcc was very broken in the past (and maybe even
today), but it seems that all tests pass in my case (Mac OS X 10.7.2,
XCode 4.2.1), is there anything else I could test to make sure it
works?
Second, clang is a more strict C compiler and when I try to use it, it
gives lots of warnings, but there's one error:
$ perl Makefile.PL CC=clang && make
[...]
/libev/ev.c:1237:31: error: static declaration of
'ev_default_loop_ptr' follows non-static declaration
EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be
initialised to make it a definition despite extern */
^
libev/ev.h:552:26: note: previous definition is here
extern struct ev_loop *ev_default_loop_ptr;
^
Which is actually pretty strange on part of libev, why is
ev_default_loop_ptr extern, when 5 lines above it is already defined
as EV_API_DECL? Anyway, a simple patch:
--- a/libev/ev.h
+++ b/libev/ev.h
@@ -549,8 +549,6 @@ EV_API_DECL struct ev_loop *ev_default_loop_ptr;
EV_INLINE struct ev_loop *
ev_default_loop_uc_ (void)
{
- extern struct ev_loop *ev_default_loop_ptr;
-
return ev_default_loop_ptr;
}
And good results:
$ perl Makefile.PL CC=clang && make test
[...]
All tests successful.
Files=11, Tests=6875, 7 wallclock secs ( 0.88 usr 0.07 sys + 0.49
cusr 0.13 csys = 1.57 CPU)
Result: PASS
I hope this helps.
P.S. This is EV 4.10
P.P.S. About clang warnings, there 27 total:
1 is about nested /* in a C comment (/*#define MIN_INTERVAL
0.00000095367431640625 /* 1/2**20, good till 2200 */)
1 is about lack of parentheses in bit operations (fd_change (EV_A_ fd,
w->events & EV__IOFDSET | EV_ANFD_REIFY))
The rest are about unused values in assert (technically, all those
strings are actually unused, but it's quite a common idiom for
asserts, so clang is too pedantic here).
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev