xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 17 19:40:33 UTC 2025


 Xext/sync.c                  |    1 +
 Xi/exevents.c                |    1 +
 Xi/xibarriers.c              |    1 +
 Xi/xichangehierarchy.c       |    1 +
 dix/cursor.c                 |    1 +
 dix/devices.c                |    1 +
 dix/enterleave.c             |    1 +
 dix/events.c                 |    1 +
 dix/gestures.c               |    1 +
 dix/getevents.c              |    2 +-
 dix/inpututils.c             |    1 +
 dix/ptrveloc.c               |    1 +
 dix/touch.c                  |    1 +
 hw/xwayland/xwayland-input.c |    1 +
 include/misc.h               |   27 ---------------------------
 mi/mieq.c                    |    1 +
 miext/shadow/c2p_core.h      |    1 +
 os/bug_priv.h                |   33 +++++++++++++++++++++++++++++++++
 os/io.c                      |    1 +
 os/log.c                     |    1 +
 os/utils.c                   |    1 +
 render/glyph.c               |    1 +
 xkb/xkbInit.c                |    1 +
 23 files changed, 54 insertions(+), 28 deletions(-)

New commits:
commit 346d5f5c352146879c749b2177b3671a374b6503
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date:   Mon Feb 17 17:32:15 2025 +0100

    os: move BUG_*() macros to own private header
    
    These macros aren't used by any external modules, so no need
    to keep them public. Moving them into private header.
    
    Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1804>

diff --git a/Xext/sync.c b/Xext/sync.c
index b6417b3b0..b0eae0488 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -59,6 +59,7 @@ PERFORMANCE OF THIS SOFTWARE.
 #include <X11/extensions/syncproto.h>
 
 #include "dix/dix_priv.h"
+#include "os/bug_priv.h"
 #include "os/osdep.h"
 
 #include "scrnintstr.h"
diff --git a/Xi/exevents.c b/Xi/exevents.c
index a9c2300cc..753172c0e 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -81,6 +81,7 @@ SOFTWARE.
 #include <dix-config.h>
 
 #include "dix/cursor_priv.h"
+#include "os/bug_priv.h"
 
 #include <X11/X.h>
 #include <X11/Xproto.h>
diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
index 80c4b5981..700b2b8c5 100644
--- a/Xi/xibarriers.c
+++ b/Xi/xibarriers.c
@@ -47,6 +47,7 @@
 #include "dix/dix_priv.h"
 #include "dix/input_priv.h"
 #include "mi/mi_priv.h"
+#include "os/bug_priv.h"
 
 #include "xibarriers.h"
 #include "scrnintstr.h"
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index a6e3171ee..bc0a4c4db 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -41,6 +41,7 @@
 #include "dix/dix_priv.h"
 #include "dix/exevents_priv.h"
 #include "dix/input_priv.h"
+#include "os/bug_priv.h"
 
 #include "inputstr.h"           /* DeviceIntPtr      */
 #include "windowstr.h"          /* window structure  */
diff --git a/dix/cursor.c b/dix/cursor.c
index e3774f7be..f12c50971 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -51,6 +51,7 @@ SOFTWARE.
 
 #include "dix/cursor_priv.h"
 #include "dix/dix_priv.h"
+#include "os/bug_priv.h"
 
 #include "servermd.h"
 #include "scrnintstr.h"
diff --git a/dix/devices.c b/dix/devices.c
index 969819534..3074662a6 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -61,6 +61,7 @@ SOFTWARE.
 #include "dix/input_priv.h"
 #include "dix/ptrveloc_priv.h"
 #include "mi/mi_priv.h"
+#include "os/bug_priv.h"
 #include "os/osdep.h"
 #include "xkb/xkbsrv_priv.h"
 
diff --git a/dix/enterleave.c b/dix/enterleave.c
index 48a7222d7..c735e8807 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -34,6 +34,7 @@
 #include "dix/dix_priv.h"
 #include "dix/eventconvert.h"
 #include "dix/input_priv.h"
+#include "os/bug_priv.h"
 
 #include "inputstr.h"
 #include "windowstr.h"
diff --git a/dix/events.c b/dix/events.c
index 7323b75ac..6903258d6 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -124,6 +124,7 @@ Equipment Corporation.
 #include "dix/input_priv.h"
 #include "dix/eventconvert.h"
 #include "dix/exevents_priv.h"
+#include "os/bug_priv.h"
 #include "xkb/xkbsrv_priv.h"
 
 #include "misc.h"
diff --git a/dix/gestures.c b/dix/gestures.c
index 6b0f24728..038bc357c 100644
--- a/dix/gestures.c
+++ b/dix/gestures.c
@@ -30,6 +30,7 @@
 #include "dix/eventconvert.h"
 #include "dix/input_priv.h"
 #include "mi/mi_priv.h"
+#include "os/bug_priv.h"
 
 #include "inputstr.h"
 #include "scrnintstr.h"
diff --git a/dix/getevents.c b/dix/getevents.c
index 18a78fac5..34014ffbb 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -41,8 +41,8 @@
 #include <X11/extensions/XKBproto.h>
 
 #include "dix/input_priv.h"
-
 #include "mi/mi_priv.h"
+#include "os/bug_priv.h"
 
 #include "misc.h"
 #include "resource.h"
diff --git a/dix/inpututils.c b/dix/inpututils.c
index f6b383ebc..863e78cbc 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -27,6 +27,7 @@
 
 #include "dix/exevents_priv.h"
 #include "dix/input_priv.h"
+#include "os/bug_priv.h"
 
 #include "exglobals.h"
 #include "misc.h"
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index 63fe07b10..cae377333 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -27,6 +27,7 @@
 #include <math.h>
 
 #include "dix/ptrveloc_priv.h"
+#include "os/bug_priv.h"
 
 #include <ptrveloc.h>
 #include <exevents.h>
diff --git a/dix/touch.c b/dix/touch.c
index 7c509fb26..9365fc70e 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -32,6 +32,7 @@
 #include "dix/exevents_priv.h"
 #include "dix/input_priv.h"
 #include "mi/mi_priv.h"
+#include "os/bug_priv.h"
 
 #include "inputstr.h"
 #include "scrnintstr.h"
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index e354dd8e8..35905829e 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -34,6 +34,7 @@
 #include "dix/input_priv.h"
 #include "mi/mi_priv.h"
 #include "mi/mipointer_priv.h"
+#include "os/bug_priv.h"
 
 #include <inputstr.h>
 #include <xkbsrv.h>
diff --git a/include/misc.h b/include/misc.h
index f65f5b436..d83ab8a32 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -394,31 +394,4 @@ 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 */
diff --git a/mi/mieq.c b/mi/mieq.c
index 6d9e3eb87..dea7761da 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -44,6 +44,7 @@ in this Software without prior written authorization from The Open Group.
 #include   "dix/cursor_priv.h"
 #include   "mi/mi_priv.h"
 #include   "mi/mipointer_priv.h"
+#include   "os/bug_priv.h"
 #include   "os/screensaver.h"
 
 #include   "misc.h"
diff --git a/miext/shadow/c2p_core.h b/miext/shadow/c2p_core.h
index 5b9ea066c..d0db2b5f3 100644
--- a/miext/shadow/c2p_core.h
+++ b/miext/shadow/c2p_core.h
@@ -27,6 +27,7 @@
  *  DEALINGS IN THE SOFTWARE.
  */
 
+#include "os/bug_priv.h"
 
     /*
      *  Basic transpose step
diff --git a/os/bug_priv.h b/os/bug_priv.h
new file mode 100644
index 000000000..7fc8b307a
--- /dev/null
+++ b/os/bug_priv.h
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: MIT OR X11
+ *
+ * Copyright © 2024 Enrico Weigelt, metux IT consult <info at metux.net>
+ */
+#ifndef _XSERVER_OS_BUG_H_
+#define _XSERVER_OS_BUG_H_
+
+/* 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: '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 /* _XSERVER_OS_BUG_H_ */
diff --git a/os/io.c b/os/io.c
index b0c314a4d..521c852e4 100644
--- a/os/io.c
+++ b/os/io.c
@@ -74,6 +74,7 @@ SOFTWARE.
 #include <X11/Xproto.h>
 
 #include "dix/dix_priv.h"
+#include "os/bug_priv.h"
 
 #include "os.h"
 #include "osdep.h"
diff --git a/os/log.c b/os/log.c
index 178f7e47b..3301c4b58 100644
--- a/os/log.c
+++ b/os/log.c
@@ -91,6 +91,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
 #include "dix/dix_priv.h"
 #include "dix/input_priv.h"
 #include "os/audit.h"
+#include "os/bug_priv.h"
 #include "os/ddx_priv.h"
 #include "os/fmt.h"
 #include "os/osdep.h"
diff --git a/os/utils.c b/os/utils.c
index 1d4c2865d..4f74e2d64 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -106,6 +106,7 @@ __stdcall unsigned long GetTickCount(void);
 #include "dix/dix_priv.h"
 #include "dix/input_priv.h"
 #include "os/auth.h"
+#include "os/bug_priv.h"
 #include "os/cmdline.h"
 #include "os/ddx_priv.h"
 #include "os/osdep.h"
diff --git a/render/glyph.c b/render/glyph.c
index 30f423742..cc982a038 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -24,6 +24,7 @@
 
 #include <dix-config.h>
 
+#include "os/bug_priv.h"
 #include "os/xsha1.h"
 
 #include "misc.h"
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index edd4de4b5..fd9c113ab 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -39,6 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include <X11/Xatom.h>
 #include <X11/extensions/XKMformat.h>
 
+#include "os/bug_priv.h"
 #include "os/cmdline.h"
 #include "xkb/xkbsrv_priv.h"
 


More information about the xorg-commit mailing list