[zeromq-dev] Compilation fails when NDEBUG is enabled.
Chernyshev Vyacheslav
astellar at ro.ru
Tue Aug 14 22:39:35 CEST 2012
Hello.
In recent git master tree there are 2 tests with issues that cause
compilation errors if warnings are treated as errors and NDEBUG is
defined during compilation.
First is in test_hwm.cpp, at line 54. Local rc variable shadows
previously declared one, and asserts are no-op, so this rc variable
becomes unused. Fix is easy, this line should look like:
rc = zmq_send (sc, NULL, 0, ZMQ_DONTWAIT);
Second error is in test_monitor.cpp. Variable addr at line 33 is unused,
as assert (memcmp (...)) turns into no-op and memcmp is never called.
memcmp calls must be moved outside asserts in all cases. I'm also
confused a bit by usage of memcmp, why does it compare 22 bytes, when
length of addr is only 20? But probably I just don't understand something.
As a side note, I really think that NDEBUG _must_ be ignored for all
test cases, so probably there should be some file that is included on
top of all tests and contains something like:
#if defined(NDEBUG)
# undef NDEBUG
#endif
More information about the zeromq-dev
mailing list