Mesa (staging/20.1): gallium,util: undef ALIGN on FreeBSD to prevent name clash

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 3 23:55:14 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: bab7b977d8f0a1c7f3c5f2b07b01f48d53ada04e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bab7b977d8f0a1c7f3c5f2b07b01f48d53ada04e

Author: Greg V <greg at unrelenting.technology>
Date:   Thu Apr 23 16:15:38 2020 +0300

gallium,util: undef ALIGN on FreeBSD to prevent name clash

Some rare headers like ipc/shm and pthread_np cause
machine/param.h to be included which defines a macro called ALIGN.

Signed-off-by: Matt Turner <mattst88 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3559>
(cherry picked from commit 29e2a3b8f5e75508202cd651d16648256f303779)

---

 .pick_status.json                         | 2 +-
 src/gallium/winsys/sw/dri/dri_sw_winsys.c | 6 ++++++
 src/util/u_thread.h                       | 4 ++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index b5192460bde..3f378c35c49 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -850,7 +850,7 @@
         "description": "gallium,util: undef ALIGN on FreeBSD to prevent name clash",
         "nominated": false,
         "nomination_type": null,
-        "resolution": 4,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
index 6173147a1ff..688bda265c1 100644
--- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
+++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
@@ -29,6 +29,12 @@
 #ifdef HAVE_SYS_SHM_H
 #include <sys/ipc.h>
 #include <sys/shm.h>
+#ifdef __FreeBSD__
+/* sys/ipc.h -> sys/_types.h -> machine/param.h
+ * - defines ALIGN which clashes with our ALIGN
+ */
+#undef ALIGN
+#endif
 #endif
 
 #include "pipe/p_compiler.h"
diff --git a/src/util/u_thread.h b/src/util/u_thread.h
index 1f2a104c3fd..b91d05e4cfd 100644
--- a/src/util/u_thread.h
+++ b/src/util/u_thread.h
@@ -45,6 +45,10 @@
 #endif
 
 #ifdef __FreeBSD__
+/* pthread_np.h -> sys/param.h -> machine/param.h
+ * - defines ALIGN which clashes with our ALIGN
+ */
+#undef ALIGN
 #define cpu_set_t cpuset_t
 #endif
 



More information about the mesa-commit mailing list