Bug#947145: libucommon-dev: #include <ucommon/ucommon.h> unexpectedly defines NDEBUG

Frédéric Brière fbriere at fbriere.net
Sat Dec 21 21:54:44 GMT 2019


Package: libucommon-dev
Version: 7.0.0-16
Severity: normal

When included, ucommon/ucommon.h (via platform.h) unexpectedly defines
NDEBUG without any warning, unless DEBUG has already been defined.

That led to a lot of head-scratching, trying to figure out why assert()
was sometimes, but not always, not doing its job while working on a
project that uses uCommon in some places.


 $ cat ucommon-ndebug.cpp
     #ifdef NDEBUG
     #warning "NDEBUG was already defined before including <ucommon/ucommon.h>"
     #endif
     
     #include <ucommon/ucommon.h>
     
     #ifdef NDEBUG
     #error "NDEBUG is defined after including <ucommon/ucommon.h>"
     #endif

 $ g++ -E ucommon-ndebug.cpp >/dev/null && echo OK
 ucommon-ndebug.cpp:8:2: error: #error "NDEBUG is defined after including <ucommon/ucommon.h>"
  #error "NDEBUG is defined after including <ucommon/ucommon.h>"
   ^~~~~

 $ g++ -E -DDEBUG ucommon-ndebug.cpp >/dev/null && echo OK
 OK


-- System Information:
Debian Release: 10.2
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-debug'), (500, 'testing'), (500, 'oldstable'), (100, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-11-amd64 (SMP w/3 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), LANGUAGE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages libucommon-dev depends on:
ii  libgnutls28-dev  3.6.7-4
ii  libucommon8      7.0.0-16

Versions of packages libucommon-dev recommends:
ii  pkg-config  0.29-6

Versions of packages libucommon-dev suggests:
pn  ucommon-doc  <none>
-------------- next part --------------
#ifdef NDEBUG
#warning "NDEBUG was already defined before including <ucommon/ucommon.h>"
#endif

#include <ucommon/ucommon.h>

#ifdef NDEBUG
#error "NDEBUG is defined after including <ucommon/ucommon.h>"
#endif


More information about the Pkg-voip-maintainers mailing list