__BUG_WARN_MSG is a simple helper to enable call with and without varargs. I couldn't find a way to otherwise do this without getting gcc warnings.
Signed-off-by: Peter Hutterer <[email protected]> --- include/misc.h | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/include/misc.h b/include/misc.h index 0584f08..2b8ea2e 100644 --- a/include/misc.h +++ b/include/misc.h @@ -359,11 +359,18 @@ typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */ extern _X_EXPORT unsigned long globalSerialNumber; extern _X_EXPORT unsigned long serverGeneration; -#define BUG_WARN(cond) \ +/* Don't use this directly, use BUG_WARN or BUG_WARN_MSG instead */ +#define __BUG_WARN_MSG(cond, with_msg, ...) \ do { if (cond) { \ ErrorF("BUG: triggered 'if (" #cond ")'\nBUG: %s:%d in %s()\n", \ __FILE__, __LINE__, __func__); \ + if (with_msg) ErrorF(__VA_ARGS__); \ xorg_backtrace(); \ } } while(0) +#define BUG_WARN_MSG(cond, msg, ...) \ + __BUG_WARN_MSG(cond, 1, msg, __VA_ARGS__) + +#define BUG_WARN(cond) __BUG_WARN_MSG(cond, 0, NULL) + #endif /* MISC_H */ -- 1.7.7.1 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
