Mesa (master): gallium,util: undef ALIGN on FreeBSD to prevent name clash

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 2 01:22:41 UTC 2020


Module: Mesa
Branch: master
Commit: 29e2a3b8f5e75508202cd651d16648256f303779
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=29e2a3b8f5e75508202cd651d16648256f303779

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>

---

 src/gallium/winsys/sw/dri/dri_sw_winsys.c | 6 ++++++
 src/util/u_thread.h                       | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
index c889e968534..f9ff6d25d73 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