lib: add post condition assertions for current thread error after user functions
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 7 Nov 2019 23:18:06 +0000 (18:18 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 14 Nov 2019 22:49:46 +0000 (17:49 -0500)
commitd6f6a5aa1207fc66091bb6cc8d6fe376d89328ac
tree1e599763071fdf45ad1dc1c9a5b6bb383f1deff2
parent80b0f1c7211cd8fcc164caaf429eac878bcb9946
lib: add post condition assertions for current thread error after user functions

It is a logic error and a post condition breach for a user function to
return a non-error status code (>= 0) but leave an error set on the
current thread.  Add some assertions after each point where we call a
user function to catch this kind of mistake.

The macro BT_ASSERT_POST_DEV_NO_ERROR_IF_NO_ERROR_STATUS is meant to be
used in the very fast path (consume/next callbacks).  The macro
BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS is used elsewhere.

The macros are written in such a way that if they cause an abort, the
error will still be present in thread_error, so accessible to a
debugger.

Change-Id: I4c6127c0b0258dac5be1e3bae63c2d9e6baa2d1f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
src/lib/assert-post.h
src/lib/graph/component.c
src/lib/graph/graph.c
src/lib/graph/graph.h
src/lib/graph/iterator.c
src/lib/graph/mip.c
src/lib/graph/query-executor.c
src/lib/trace-ir/trace-class.c
src/lib/trace-ir/trace.c
This page took 0.025342 seconds and 4 git commands to generate.