mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-26 23:25:08 +00:00
Revert "os: move BUG_*() macros to own private header"
This reverts commit 346d5f5c35.
That commit did not handle copyright/license notices correctly.
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2019>
This commit is contained in:
@@ -374,4 +374,31 @@ typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */
|
||||
extern _X_EXPORT unsigned long globalSerialNumber;
|
||||
extern _X_EXPORT unsigned long serverGeneration;
|
||||
|
||||
/* 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 ")'\n"); \
|
||||
ErrorF("BUG: %s:%u in %s()\n", \
|
||||
__FILE__, __LINE__, __func__); \
|
||||
if (with_msg) ErrorF(__VA_ARGS__); \
|
||||
xorg_backtrace(); \
|
||||
} } while(0)
|
||||
|
||||
#define BUG_WARN_MSG(cond, ...) \
|
||||
__BUG_WARN_MSG(cond, 1, __VA_ARGS__)
|
||||
|
||||
#define BUG_WARN(cond) __BUG_WARN_MSG(cond, 0, NULL)
|
||||
|
||||
#define BUG_RETURN(cond) \
|
||||
do { if (cond) { __BUG_WARN_MSG(cond, 0, NULL); return; } } while(0)
|
||||
|
||||
#define BUG_RETURN_MSG(cond, ...) \
|
||||
do { if (cond) { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return; } } while(0)
|
||||
|
||||
#define BUG_RETURN_VAL(cond, val) \
|
||||
do { if (cond) { __BUG_WARN_MSG(cond, 0, NULL); return (val); } } while(0)
|
||||
|
||||
#define BUG_RETURN_VAL_MSG(cond, val, ...) \
|
||||
do { if (cond) { __BUG_WARN_MSG(cond, 1, __VA_ARGS__); return (val); } } while(0)
|
||||
|
||||
#endif /* MISC_H */
|
||||
|
||||
Reference in New Issue
Block a user