shared: add weston-assert
Add yet another flavor of assertion macros. Unlike libc assert.h assert(), these cannot be easily disabled by the build. They also print both the implied expression and the compared values. Unlike ZUC macros, there is much less framework code and it can handle also floating-point types. The function custom_assert_fail_ can be redefined, meaning that different compilation units can do different things on failure. Also the 'compositor' parameter was added to the new macros because we plan to use these asserts in our log infrastructure, and we want to print the "failure" messages in the right log scopes. Having the compositor already in the macros will avoid double work. Another future possibility is to write specific asserts for the test suite. So we would be able to write a test suite failure function that just print what "failed" without aborting. There is also limited support for custom types. These are actually pretty similar to libinput's litest macros. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com> Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Loading
Please register or sign in to comment