summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-01-07 14:16:27 -0700
committerBrian Paul <[email protected]>2012-01-07 14:16:27 -0700
commit94bf2d48e19b86a4cfa4ff3bf3da97967f8a2793 (patch)
treedb0d75a4d8950564402f748e3c254a68214d8ec1 /src/gallium/auxiliary/util
parent994c33db875c6af2f5b535a7a173ff3bfa24fc32 (diff)
util: add debug_warn_once() macro
Emits a warning message, but only once to avoid tons of repeated warnings.
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_debug.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index cbea3583037..ed19cda05a2 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -215,6 +215,25 @@ void _debug_assert_fail(const char *expr,
/**
+ * Emit a warning message, but only once.
+ */
+#ifdef DEBUG
+#define debug_warn_once(__msg) \
+ do { \
+ static bool warned = FALSE; \
+ if (!warned) { \
+ _debug_printf("%s:%u:%s: one time warning: %s\n", \
+ __FILE__, __LINE__, __FUNCTION__, __msg); \
+ warned = TRUE; \
+ } \
+ } while (0)
+#else
+#define debug_warn_once(__msg) \
+ ((void)0)
+#endif
+
+
+/**
* Output an error message. Not muted on release version.
*/
#ifdef DEBUG