include: add BUG_WARN macro for internal bug cases.
There are plenty of cases that can only be triggered by a real bug in the server and doing the ErrorF dance manually everywhere is a tad painful and the error message is usually used only to find the spot in the file anyway. Plus, reading BUG_WARN somewhere is a good indicator to the casual reader that this isn't intended behaviour. Note that this is intentionally different to the BUG_ON behaviour on the kernel, we do not FatalError the server. It's just a warning + stacktrace. If the bug is really fatal, call FatalError. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
61ef4daf64
commit
9c38422fc4
|
@ -359,4 +359,11 @@ 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) \
|
||||
do { if (cond) { \
|
||||
ErrorF("BUG: triggered 'if (" #cond ")'\nBUG: %s:%d in %s()\n", \
|
||||
__FILE__, __LINE__, __func__); \
|
||||
xorg_backtrace(); \
|
||||
} } while(0)
|
||||
|
||||
#endif /* MISC_H */
|
||||
|
|
Loading…
Reference in New Issue
Block a user