summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/util/u_debug.h')
-rw-r--r--src/gallium/auxiliary/util/u_debug.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index 1380d98d7e..abd834c741 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -65,6 +65,11 @@ extern "C" {
#define __FUNCTION__ "???"
#endif
+#if defined(__GNUC__)
+#define _util_printf_format(fmt, list) __attribute__ ((format (printf, fmt, list)))
+#else
+#define _util_printf_format(fmt, list)
+#endif
void _debug_vprintf(const char *format, va_list ap);
@@ -82,14 +87,17 @@ _debug_printf(const char *format, ...)
/**
* Print debug messages.
*
- * The actual channel used to output debug message is platform specific. To
- * avoid misformating or truncation, follow these rules of thumb:
+ * The actual channel used to output debug message is platform specific. To
+ * avoid misformating or truncation, follow these rules of thumb:
* - output whole lines
- * - avoid outputing large strings (512 bytes is the current maximum length
+ * - avoid outputing large strings (512 bytes is the current maximum length
* that is guaranteed to be printed in all platforms)
*/
#if !defined(PIPE_OS_HAIKU)
static INLINE void
+debug_printf(const char *format, ...) _util_printf_format(1,2);
+
+static INLINE void
debug_printf(const char *format, ...)
{
#ifdef DEBUG
@@ -173,11 +181,14 @@ void _debug_assert_fail(const char *expr,
*
* Do not expect that the assert call terminates -- errors must be handled
* regardless of assert behavior.
+ *
+ * For non debug builds the assert macro will expand to a no-op, so do not
+ * call functions with side effects in the assert expression.
*/
#ifdef DEBUG
#define debug_assert(expr) ((expr) ? (void)0 : _debug_assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__))
#else
-#define debug_assert(expr) ((void)(expr))
+#define debug_assert(expr) ((void)0)
#endif
@@ -340,17 +351,6 @@ void
debug_memory_end(unsigned long beginning);
-#if defined(PROFILE) && defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
-
-void
-debug_profile_start(void);
-
-void
-debug_profile_stop(void);
-
-#endif
-
-
#ifdef DEBUG
struct pipe_surface;
struct pipe_transfer;