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)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
commit4ee4117810e51dba802348ab17b2e0b1cc264b69
tree916310c51a211b2dace6371df765aee7db98adf6
parent1de6a2b0fd2c33173d249d639203fa1ceada1f9b
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.024613 seconds and 4 git commands to generate.