[PATCH]: libev-3.8; ev++.h bug and warning fixes.

Konstantin Lepa konstantin.lepa at gmail.com
Fri Aug 28 12:33:00 CEST 2009

On Aug 28, 2009, at 12:42 PM, Marc Lehmann wrote:

> On Fri, Aug 28, 2009 at 12:11:39PM +0400, Konstantin Lepa <konstantin.lepa at gmail.com 
> > wrote:
>> 1. Fixed warnings for compilation with -pedantic flag.
> ev++.h is written in C++, not in any other language. If you compile  
> ev++.h
> with any othe rlanguage, that's your problem and doesn't make ev++.h
> unusable as you claim.

I use C++ only (freebsd 7.2). I'd prefer to compile my source code  
with -pedantic and -Wextra
flag. But when i'm using ev++.h, then g++ throws warnings for unused  
function parameters and the error for a comma after a last enum element.
It annoys and disturbs me to find real problems.

[14:18] bsdman:build {164} uname -a
FreeBSD bsdman.virtualworld.com 7.2-RELEASE FreeBSD 7.2-RELEASE #0:  
Fri May  1 08:49:13 UTC 2009     root at walker.cse.buffalo.edu:/usr/obj/ 
usr/src/sys/GENERIC  i386

[14:18] bsdman:build {165} g++ --version
g++ (GCC) 4.2.1 20070719  [FreeBSD]

Enum problem:
/usr/local/include/ev++.h:79: error: comma at end of enumerator list

>> 2. Fixed errors in template member functions.
>   -    static void method_thunk (EV_P_ ev_watcher *w, int revents)
>   +    static void method_thunk (struct ev_loop *, ev_watcher *w, int
>        revents)
> sorry, your patch is completely bogus. you need to explain why  
> warnings
> make ev++.h unusable, or why your compiler doesn't support macro
> expansion.

Warnings generated by -Wextra:
--g++ output--
/usr/local/include/ev++.h: At global scope:
/usr/local/include/ev++.h:481: warning: unused parameter 'loop'
/usr/local/include/ev++.h:481: warning: unused parameter 'revents'
--end output--
C++ permits to declare function without parameter names for disabling  
the warning. For example:
int Example(int a, int /*unused*/) {
   std::cout << a << std::endl;

EV_P_ is "struct ev_loop *loop,". And it generates warning of unused  
loop variable.

My code "cleanupTimer_.set<IOEventManager,  
&IOEventManager::Cleanup>(this);" generated next error:
--g++ output--
/usr/local/include/ev++.h: In static member function 'static void  
ev::base<ev_watcher, watcher>::method_noargs_thunk(ev_loop*,  
ev_watcher*, int) [with K = mimic::IOEventManager, void (K::* method) 
() = &mimic::IOEventManager::Cleanup, ev_watcher = ev_timer, watcher =  
/usr/local/include/ev++.h:477:   instantiated from 'void  
ev::base<ev_watcher, watcher>::set(K*) [with K =  
mimic::IOEventManager, void (K::* method)() =  
&mimic::IOEventManager::Cleanup, ev_watcher = ev_timer, watcher =  
instantiated from here
/usr/local/include/ev++.h:483: error: must use '.*' or '->*' to call  
pointer-to-member function in '&mimic::IOEventManager::Cleanup (...)'
---end output--

Prototype of IOEventManager::Cleanup is "void  

P.S. Sorry for my bad english.

More information about the libev mailing list