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)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 11 Nov 2019 18:53:12 +0000 (13:53 -0500)
commit6ecdcca3de0dea694cdfb252160c7939f7dc2ef1
treecb49ea94556d9759f4a14ec074c1a252563d4cb1
parentd747e85f873b9938b3ac6cb8fdec5e292eb3a051
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.02589 seconds and 4 git commands to generate.