[PATCH]: libev-3.8; ev++.h bug and warning fixes.
Konstantin Lepa
konstantin.lepa at gmail.com
Fri Aug 28 16:03:37 CEST 2009
>
>> Enum problem:
>> /usr/local/include/ev++.h:79: error: comma at end of enumerator list
>
> That is the single case where we indeed rely on the next c++ standard,
> and g++ (and most other compilers) support it, so this is your
> problem to
> deal with. I won't change correct code because you think you have to
> use
> compiler switches that are not recommended by the compiler vendor.
>
Ok. I can't build own C++ project with libev on FreeBSD 7.2 (gcc
4.2.1), because enum contains last comma.
It so is critical to leave the comma?
>> Warnings generated by -Wextra:
>
> Please read the libev documentation regarding this first.
>
>> EV_P_ is "struct ev_loop *loop,". And it generates warning of unused
>> loop variable.
>
> That's a problem with your compiler (more specifically your
> settings) -
> the code is valid C++.
>
> If that is indeed a real problem for you, then you are the only one
> who
> cna fix it, as the problem is outside of libev's code.
I don't understand... The header ev++.h generates warnings and errors
(standard gcc in FreeBSD 7.2). Is it my problem? :-) Do you support
this OS?
>> Prototype of IOEventManager::Cleanup is "void
>> (*IOEventManager::Cleanup)()";
>
> That is not part of libev. Since ev++.h works with a lot of toher
> packages, this is most likely a bug in your program - see for example
> rxvt-unicode for actual uses of ev++.h that are correct.
>
Example code:
--snip--
#include <ev++.h>
#include <iostream>
const double kTimeout = 1.0;
class Timer {
public:
Timer() {
timer.set<Timer, &Timer::TimerCallback>(this);
timer.set(0., kTimeout);
timer.again();
}
private:
void TimerCallback() {
std::cerr << "Timer works!" << std::endl;
}
ev::timer timer;
};
int main(int argc, char **argv) {
Timer a;
ev::default_loop loop;
loop.loop();
return 0;
}
--snip--
Ubuntu 9.04:
[17:54] devlin:build {4912} uname -a
Linux devlin 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:48:10 UTC
2009 i686 GNU/Linux
[17:55] devlin:build {4913} g++ --version
g++ (Ubuntu 4.3.3-5ubuntu4) 4.3.3
[17:55] devlin:build {4914} g++ -o test test.cc -lev -I/usr/local/
include -L/usr/local/lib
/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 = Timer, void (K::* method)() =
&Timer::TimerCallback, ev_watcher = ev_timer, watcher = ev::timer]’:
/usr/local/include/ev++.h:477: instantiated from ‘void
ev::base<ev_watcher, watcher>::set(K*) [with K = Timer, void (K::*
method)() = &Timer::TimerCallback, ev_watcher = ev_timer, watcher =
ev::timer]’
test.cc:9: instantiated from here
/usr/local/include/ev++.h:483: error: must use ‘.*’ or ‘->*’ to call
pointer-to-member function in ‘&Timer::TimerCallback (...)’
Exit 1
--snip--
FreeBSD 7.2:
--snip--
[17:53] bsdman:build {204} 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
[17:55] bsdman:build {205} g++ --version
g++ (GCC) 4.2.1 20070719 [FreeBSD]
[17:55] bsdman:build {206} g++ -o test test.cc -lev -I/usr/local/
include -L/usr/local/lib
/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 = Timer, void (K::* method)() =
&Timer::TimerCallback, ev_watcher = ev_timer, watcher = ev::timer]':
/usr/local/include/ev++.h:477: instantiated from 'void
ev::base<ev_watcher, watcher>::set(K*) [with K = Timer, void (K::*
method)() = &Timer::TimerCallback, ev_watcher = ev_timer, watcher =
ev::timer]'
test.cc:9: instantiated from here
/usr/local/include/ev++.h:483: error: must use '.*' or '->*' to call
pointer-to-member function in '&Timer::TimerCallback (...)'
Exit 1
--snip--
More information about the libev
mailing list