From eaa92ea4224e161075db3fef3fc12a5d3c72d020 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 20 Feb 2024 11:12:38 +1000 Subject: [PATCH] Revert "include: move BUG_*() macros to separate header" This breaks the xf86-input-synaptics driver: synaptics.c: In function 'clickpad_guess_clickfingers': synaptics.c:2638:5: error: implicit declaration of function 'BUG_RETURN_VAL' [-Werror=implicit-function-declaration] 2638 | BUG_RETURN_VAL(hw->num_mt_mask > sizeof(close_point) * 8, 0); This reverts commit 442aec2219e0aba5482f96e1047748416237ffaa. Part-of: --- Xext/sync.c | 1 - Xi/exevents.c | 2 -- Xi/xibarriers.c | 1 - dix/cursor.c | 2 -- dix/devices.c | 1 - dix/enterleave.c | 2 -- dix/events.c | 2 -- dix/gestures.c | 1 - dix/getevents.c | 1 - dix/grabs.c | 1 - dix/inpututils.c | 1 - dix/ptrveloc.c | 1 - dix/touch.c | 1 - hw/xwayland/xwayland-input.c | 1 - include/bug.h | 33 --------------------------------- include/misc.h | 27 +++++++++++++++++++++++++++ mi/mieq.c | 2 -- miext/shadow/c2p_core.h | 2 -- os/io.c | 2 -- os/log.c | 1 - os/utils.c | 1 - xkb/xkbInit.c | 1 - 22 files changed, 27 insertions(+), 60 deletions(-) delete mode 100644 include/bug.h diff --git a/Xext/sync.c b/Xext/sync.c index 37436b829..fd2ceb042 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -60,7 +60,6 @@ PERFORMANCE OF THIS SOFTWARE. #include #include "scrnintstr.h" #include "os.h" -#include "bug.h" #include "extnsionst.h" #include "dixstruct.h" #include "pixmapstr.h" diff --git a/Xi/exevents.c b/Xi/exevents.c index cff5a2ae5..e16171468 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -89,8 +89,6 @@ SOFTWARE. #include #include #include - -#include "bug.h" #include "windowstr.h" #include "miscstruct.h" #include "region.h" diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c index 7261964cb..1926762ad 100644 --- a/Xi/xibarriers.c +++ b/Xi/xibarriers.c @@ -45,7 +45,6 @@ #include #endif -#include "bug.h" #include "xibarriers.h" #include "scrnintstr.h" #include "cursorstr.h" diff --git a/dix/cursor.c b/dix/cursor.c index 4405e8d55..a9ad34467 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -50,8 +50,6 @@ SOFTWARE. #include #include - -#include "bug.h" #include "servermd.h" #include "scrnintstr.h" #include "dixstruct.h" diff --git a/dix/devices.c b/dix/devices.c index 3b9791361..84a6406d1 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -53,7 +53,6 @@ SOFTWARE. #include "resource.h" #include #include -#include "bug.h" #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" diff --git a/dix/enterleave.c b/dix/enterleave.c index 223182aac..c1e6ac600 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -32,8 +32,6 @@ #include #include #include - -#include "bug.h" #include "inputstr.h" #include "windowstr.h" #include "scrnintstr.h" diff --git a/dix/events.c b/dix/events.c index 3e504e1c3..2a5c2683a 100644 --- a/dix/events.c +++ b/dix/events.c @@ -106,8 +106,6 @@ Equipment Corporation. #endif #include - -#include "bug.h" #include "misc.h" #include "resource.h" #include diff --git a/dix/gestures.c b/dix/gestures.c index d95909ea6..43672ace5 100644 --- a/dix/gestures.c +++ b/dix/gestures.c @@ -38,7 +38,6 @@ #include "eventconvert.h" #include "windowstr.h" #include "mi.h" -#include "bug.h" #define GESTURE_HISTORY_SIZE 100 diff --git a/dix/getevents.c b/dix/getevents.c index 40b303a0b..c39ef3371 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -37,7 +37,6 @@ #include #include -#include "bug.h" #include "misc.h" #include "resource.h" #include "inputstr.h" diff --git a/dix/grabs.c b/dix/grabs.c index ed3721363..53ba1d6b9 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -62,7 +62,6 @@ SOFTWARE. #include "exglobals.h" #include "inpututils.h" #include "client.h" -#include "bug.h" #define BITMASK(i) (((Mask)1) << ((i) & 31)) #define MASKIDX(i) ((i) >> 5) diff --git a/dix/inpututils.c b/dix/inpututils.c index 2c77ecf04..9026f651b 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -27,7 +27,6 @@ #include "dix-config.h" #endif -#include "bug.h" #include "exevents.h" #include "exglobals.h" #include "misc.h" diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index ded8ca13b..632971ed9 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -31,7 +31,6 @@ #include #include #include -#include "bug.h" #include diff --git a/dix/touch.c b/dix/touch.c index 235596e99..d0d286f80 100644 --- a/dix/touch.c +++ b/dix/touch.c @@ -39,7 +39,6 @@ #include "eventconvert.h" #include "windowstr.h" #include "mi.h" -#include "bug.h" #define TOUCH_HISTORY_SIZE 100 diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index f3ce3d291..078e7c2d3 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -29,7 +29,6 @@ #include #include -#include "bug.h" #include #include #include diff --git a/include/bug.h b/include/bug.h deleted file mode 100644 index 5988dd576..000000000 --- a/include/bug.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _XSERVER_OS_BUG_H -#define _XSERVER_OS_BUG_H - -#include "os.h" - -/* Don't use this directly, use BUG_WARN or BUG_WARN_MSG instead */ -#define __BUG_WARN_MSG(cond, with_msg, ...) \ - do { if (cond) { \ - ErrorFSigSafe("BUG: triggered 'if (" #cond ")'\n"); \ - ErrorFSigSafe("BUG: %s:%u in %s()\n", \ - __FILE__, __LINE__, __func__); \ - if (with_msg) ErrorFSigSafe(__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 /* _XSERVER_OS_BUG_H */ diff --git a/include/misc.h b/include/misc.h index 14c645b4b..3e1834f54 100644 --- a/include/misc.h +++ b/include/misc.h @@ -416,4 +416,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) { \ + ErrorFSigSafe("BUG: triggered 'if (" #cond ")'\n"); \ + ErrorFSigSafe("BUG: %s:%u in %s()\n", \ + __FILE__, __LINE__, __func__); \ + if (with_msg) ErrorFSigSafe(__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 */ diff --git a/mi/mieq.c b/mi/mieq.c index e15d9edab..c98d46862 100644 --- a/mi/mieq.c +++ b/mi/mieq.c @@ -39,8 +39,6 @@ in this Software without prior written authorization from The Open Group. #include #include #include - -#include "bug.h" #include "misc.h" #include "windowstr.h" #include "pixmapstr.h" diff --git a/miext/shadow/c2p_core.h b/miext/shadow/c2p_core.h index c1f9050a3..5b9ea066c 100644 --- a/miext/shadow/c2p_core.h +++ b/miext/shadow/c2p_core.h @@ -32,8 +32,6 @@ * Basic transpose step */ -#include "bug.h" - static inline void _transp(CARD32 d[], unsigned int i1, unsigned int i2, unsigned int shift, CARD32 mask) { diff --git a/os/io.c b/os/io.c index 9901b00d8..83b01111f 100644 --- a/os/io.c +++ b/os/io.c @@ -72,8 +72,6 @@ SOFTWARE. #endif #include #include - -#include "bug.h" #include "os.h" #include "osdep.h" #include "opaque.h" diff --git a/os/log.c b/os/log.c index dff6d68de..e15823046 100644 --- a/os/log.c +++ b/os/log.c @@ -89,7 +89,6 @@ OR PERFORMANCE OF THIS SOFTWARE. #include "input.h" #include "opaque.h" -#include "bug.h" #ifdef WIN32 #include diff --git a/os/utils.c b/os/utils.c index ddcfb629f..184b045f0 100644 --- a/os/utils.c +++ b/os/utils.c @@ -82,7 +82,6 @@ __stdcall unsigned long GetTickCount(void); #include "dixfont.h" #include #include "osdep.h" -#include "bug.h" #include "xdmcp.h" #include "extension.h" #include diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 189cd7c80..186e0f453 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -48,7 +48,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "xkbgeom.h" #include #include "xkbfile.h" -#include "bug.h" #define CREATE_ATOM(s) MakeAtom(s,sizeof(s)-1,1)