From 441f9a7d6d68ff8f36893ce3b4346adb7cb74605 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Fri, 7 Dec 2012 11:30:04 +0100 Subject: [PATCH] infra: add CHECK_ASPECT() macro --- brick_checking.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/brick_checking.h b/brick_checking.h index a19bb657..2ef09117 100644 --- a/brick_checking.h +++ b/brick_checking.h @@ -60,6 +60,14 @@ do { \ } \ } while (0) +#define CHECK_ASPECT(a_ptr, o_ptr,label) \ + do { \ + if (BRICK_CHECKING && unlikely((a_ptr)->object != o_ptr)) { \ + BRICK_FAT("%d: aspect pointer '" #a_ptr "' (%p) belongs to object %p, not to " #o_ptr " (%p)\n", __LINE__, a_ptr, (a_ptr)->object, o_ptr); \ + goto label; \ + } \ +} while (0) + #define _CHECK(ptr,label) \ do { \ if (BRICK_CHECKING && unlikely(!(ptr))) { \