#ifndef P_DEBUG_H_
#define P_DEBUG_H_
+
+#include <stdarg.h>
+
+
#ifdef __cplusplus
extern "C" {
#endif
void debug_printf(const char *format, ...);
+
+void debug_vprintf(const char *format, va_list ap);
+
void debug_assert_fail(const char *expr, const char *file, unsigned line);
+
/** Assert macro */
#ifdef DEBUG
#define debug_assert(expr) ((expr) ? (void)0 : debug_assert_fail(#expr, __FILE__, __LINE__))
#ifdef assert
-#warning Standard C Library assert macro usage detected.
#undef assert
#endif
#define assert(expr) debug_assert(expr)
#include "pipe/p_compiler.h"
-void debug_printf(const char *format, ...)
+void debug_vprintf(const char *format, va_list ap)
{
- va_list ap;
- va_start( ap, format );
#ifdef WIN32
EngDebugPrint("Gallium3D: ", (PCHAR)format, ap);
#else
vfprintf(stderr, format, ap);
#endif
- va_end( ap );
+}
+
+
+void debug_printf(const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ debug_vprintf(format, ap);
+ va_end(ap);
}
void debug_assert_fail(const char *expr, const char *file, unsigned line)
{
- debug_printf("%s:%i: Assertion `%s' failed.");
+ debug_printf("%s:%i: Assertion `%s' failed.\n", file, line, expr);
debug_abort();
}