Re-implement BT_ASSERT without using the assert macro
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 1 Apr 2019 15:55:33 +0000 (11:55 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:39 +0000 (18:19 -0400)
commit1bf777d7a216f720d029f59689f2062949d4dbe3
treecf9adbbe3385add41c127a070fab2650720946bd
parent6e29bb17ffb23756e100ca7c75cdd1e0e00d4f27
Re-implement BT_ASSERT without using the assert macro

BT_ASSERT is currently defined using the assert macro.  If NDEBUG is
inadvertently defined, BT_ASSERT has no effect.  This is quite
unfortunate, since a user who has defined BABELTRACE_DEBUG_MODE to 1
probably wants BT_ASSERT to be effective.

This problem was encountered while building the Python bindings, where
the distutils native code builder is passing -DNDEBUG to the compiler.
The BT_ASSERT macro usages in these files were found to be ineffective.

This patch avoids this situation by making BT_ASSERT call our own
handler if the assertion fails.  This also has the advantage of letting
us personalize the behavior on assertion failures.  The presence of the
so-called Lenny Face having absolutely no regards for the furniture is a
good example of this (and was a requirement coming from Philippe
Proulx).

Removing the inclusion of assert.h in assert-internal.h revealed a few
spots that use the assert macro without including assert.h, so they were
adjusted accordingly.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
cli/Makefile.am
common/Makefile.am
common/assert.c [new file with mode: 0644]
include/babeltrace/assert-internal.h
logging/log.c
plugins/ctf/common/metadata/ctf-meta-update-in-ir.c
tests/utils/tap/tap.c
This page took 0.025992 seconds and 4 git commands to generate.