Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/include/drm Hackily rename enum p...



details:   https://anonhg.NetBSD.org/src/rev/a099a4ecb594
branches:  trunk
changeset: 745555:a099a4ecb594
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 05 08:36:53 2020 +0000

description:
Hackily rename enum pipe for drm, without patching.

The patch we used to maintain to do this rename doubled the pain
of merging drm updates.  But ctf gets confused if we have a struct
and an enum both called `pipe', and it's technically against C99
to do so.  So #define it in all drm code for now to fix dtrace.

diffstat:

 sys/external/bsd/drm2/dist/include/drm/drmP.h |  24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diffs (38 lines):

diff -r 0d22b28b5d9b -r a099a4ecb594 sys/external/bsd/drm2/dist/include/drm/drmP.h
--- a/sys/external/bsd/drm2/dist/include/drm/drmP.h     Thu Mar 05 08:30:58 2020 +0000
+++ b/sys/external/bsd/drm2/dist/include/drm/drmP.h     Thu Mar 05 08:36:53 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drmP.h,v 1.38 2020/03/05 07:46:59 riastradh Exp $      */
+/*     $NetBSD: drmP.h,v 1.39 2020/03/05 08:36:53 riastradh Exp $      */
 
 /*
  * Internal Header for the Direct Rendering Manager
@@ -81,6 +81,28 @@
 #include <linux/string.h>
 #include <linux/timer.h>
 #include <linux/uidgid.h>
+
+/*
+ * NetBSD already has struct pipe, and according to C99 6.2.3 there's
+ * only one namespace for struct, union, and enum tags, but the i915
+ * driver wants a type called enum pipe.
+ *
+ * So rename it to avoid conflicts which confuse tools like ctfmerge --
+ * but make sure we include <sys/file.h> first to avoid having two
+ * different versions of struct file, one with a pointer to struct pipe
+ * and another with a pointer to struct i915_pipe.
+ *
+ * This will cause trouble if we ever have an API that involves `pipe'
+ * as a member which we need to reference from within drm code.  But
+ * for now that is not the case.
+ *
+ * XXX Yes, this is disgusting.  Sorry.
+ */
+#if defined(__i386__) || defined(__x86_64__)
+#include <sys/file.h>
+#define        pipe    pipe_drmhack
+#endif
+
 #else
 #include <drm/drm_os_linux.h>
 #endif



Home | Main Index | Thread Index | Old Index