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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 04:09:19 +0000 (00:09 -0400)
commit13401173f09f46c4003aa950706f35dfdadca17e
tree916310c51a211b2dace6371df765aee7db98adf6
parentcd20813f2d221faf229f522cba89b9b028438050
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.024317 seconds and 5 git commands to generate.