[tip:kmemcheck] kmemcheck: bitfields: introduce hack to work around gcc bug

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

 



Commit-ID:  1fcb01fa2d408e520816bfec5643e9bd0d20d0f3
Gitweb:     http://git.kernel.org/tip/1fcb01fa2d408e520816bfec5643e9bd0d20d0f3
Author:     Vegard Nossum <vegard.nossum@xxxxxxxxx>
AuthorDate: Sat, 28 Feb 2009 08:27:35 +0100
Commit:     Vegard Nossum <vegard.nossum@xxxxxxxxx>
CommitDate: Sat, 28 Feb 2009 08:27:35 +0100

kmemcheck: bitfields: introduce hack to work around gcc bug

gcc doesn't allow anonymous union + variable-sized array as the
only members in a struct. Apparently, anonymous unions were never
quite kosher anyway (a gcc extension), but this hack works around
it. This is needed for an annotation in the ftrace framework.

Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxx>


---
 include/linux/kmemcheck.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
index 54c053b..bc88808 100644
--- a/include/linux/kmemcheck.h
+++ b/include/linux/kmemcheck.h
@@ -34,7 +34,14 @@
 	union {						\
 		struct fields name;			\
 		struct fields;				\
-	};
+	};						\
+							\
+	/*						\
+	 * Erk. Due to gcc bug, we'll get a "error:	\
+	 * flexible array member in otherwise empty	\
+	 * struct without this.				\
+	 */						\
+	int kmemcheck_dummy_##name##_[0];
 
 #ifdef CONFIG_KMEMCHECK
 extern int kmemcheck_enabled;
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux