Taken from the X server's misc.h, these macros just print nasty warnings for
bugs.

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 libwacom/libwacomint.h |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libwacom/libwacomint.h b/libwacom/libwacomint.h
index 60644ce..66202b0 100644
--- a/libwacom/libwacomint.h
+++ b/libwacom/libwacomint.h
@@ -38,6 +38,21 @@
 #define DBG(...) \
        printf(__VA_ARGS__)
 
+/* Don't use this directly, use BUG_WARN or BUG_WARN_MSG instead */
+#define __BUG_WARN_MSG(cond, with_msg, ...)                                \
+                 do { if (cond) {                                         \
+                         fprintf(stderr, "BUG: triggered 'if (" #cond ")'\n"); 
 \
+                         fprintf(stderr, "BUG: %s:%d in %s()\n",               
\
+                                         __FILE__, __LINE__, __func__);        
 \
+                         if (with_msg) fprintf(stderr, __VA_ARGS__);           
         \
+                 } } while(0)
+
+#define BUG_WARN_MSG(cond, ...)                                           \
+                 __BUG_WARN_MSG(cond, 1, __VA_ARGS__)
+
+#define BUG_WARN(cond)  __BUG_WARN_MSG(cond, 0, " ")
+
+
 #define GENERIC_DEVICE_MATCH "generic"
 #define STYLUS_DATA_FILE "libwacom.stylus"
 
-- 
1.7.10


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to