summaryrefslogtreecommitdiff
path: root/src/sna/xassert.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-03-13 15:44:44 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-03-13 15:53:19 +0000
commit66cb6c23d110300fff0235fd07408362e8491339 (patch)
tree0bdf27203c722ced06b346f5e74c7ac372b8f657 /src/sna/xassert.h
parent7863efebf5bee0dbdad55e5402e02413e26f7a4f (diff)
sna: Start demoting some assertions
A few assertions are there to catch less desirable behaviour rather than outright errors. For these, just grab the backtrace and continue. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/xassert.h')
-rw-r--r--src/sna/xassert.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sna/xassert.h b/src/sna/xassert.h
index 1bcfd080..bac70b8a 100644
--- a/src/sna/xassert.h
+++ b/src/sna/xassert.h
@@ -43,6 +43,17 @@
xorg_backtrace(); \
FatalError("%s:%d assertion '%s' failed\n", __func__, __LINE__, #E); \
} while (0)
+
+#define warn_unless(E) do if (unlikely(!(E))) { \
+ static int __warn_once__; \
+ if (!__warn_once__) { \
+ xorg_backtrace(); \
+ ErrorF("%s:%d assertion '%s' failed\n", __func__, __LINE__, #E); \
+ __warn_once__ = 1; \
+ } \
+} while (0)
+#else
+#define warn_unless(E)
#endif
#endif /* __XASSERT_H__ */