ev.h:560: warning: nested extern declaration of 'ev_default_loop_ptr'

Jann Horn jann+libev at thejh.net
Thu Apr 4 21:35:29 CEST 2013


On Thu, Apr 04, 2013 at 12:54:24PM -0400, Mikhail T. wrote:
> Trying to compile a simple test-program against libev-4.15 using
> gcc-4.2.1 (the base compiler on FreeBSD), I get the following compiler
> warning:
> 
>     cc -O2 -pipe -march=nocona -fno-strict-aliasing -I/opt/include -Werror -std=gnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wno-unused-function -c libev-test.c
>     In file included from libev-test.c:10:
>     /opt/include/ev.h: In function 'ev_default_loop_uc_':
>     /opt/include/ev.h:560: warning: nested extern declaration of 'ev_default_loop_ptr'
> 
> Switching to gcc-4.8 triggers:
> 
>     libev-test.c: In function 'main':
>     libev-test.c:43:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
>       ev_io_init(&e, handler, dd, EV_WRITE|EV_READ);
> 
> which necessitates adding "-fno-strict-aliasing" to CFLAGS. Please,
> advise. Thank you!

You can't really compile libev stuff with compiler warnings activated. You'll have to
avoid using libev macros or turn the warnings off.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20130404/42b45e40/attachment.pgp>


More information about the libev mailing list