[PATCH 2.6.12-mm2] UP spinlocks gcc-2.9x fix

From: Mikael Pettersson
Date: Wed Jun 29 2005 - 16:52:09 EST


The spinlock consolidation patch that was included in 2.6.12-mm2
removed the kernel's fixes for empty structure bugs in gcc-2.95.

This patch re-adds those fixes. It also updates the corresponding
comment to state that the empty structure bug also is present in
early gcc-2.96 versions.

Signed-off-by: Mikael Pettersson <mikpe@xxxxxxxxx>

include/linux/spinlock_types_up.h | 14 ++++++++++++++
1 files changed, 14 insertions(+)

diff -rupN linux-2.6.12-mm2/include/linux/spinlock_types_up.h linux-2.6.12-mm2.up-spinlocks-gcc29x-fix/include/linux/spinlock_types_up.h
--- linux-2.6.12-mm2/include/linux/spinlock_types_up.h 2005-06-29 21:54:08.000000000 +0200
+++ linux-2.6.12-mm2.up-spinlocks-gcc29x-fix/include/linux/spinlock_types_up.h 2005-06-29 22:49:34.000000000 +0200
@@ -22,16 +22,30 @@ typedef struct {

#else

+/*
+ * All gcc 2.95 versions and early versions of 2.96 have a nasty bug
+ * with empty initializers.
+ */
+#if (__GNUC__ > 2)
typedef struct { } raw_spinlock_t;

#define __RAW_SPIN_LOCK_UNLOCKED { }
+#else
+typedef struct { int gcc_is_buggy; } raw_spinlock_t;
+#define __RAW_SPIN_LOCK_UNLOCKED (raw_spinlock_t) { 0 }
+#endif

#endif

+#if (__GNUC__ > 2)
typedef struct {
/* no debug version on UP */
} raw_rwlock_t;

#define __RAW_RW_LOCK_UNLOCKED { }
+#else
+typedef struct { int gcc_is_buggy; } raw_rwlock_t;
+#define __RAW_RW_LOCK_UNLOCKED (raw_rwlock_t) { 0 }
+#endif

#endif /* __LINUX_SPINLOCK_TYPES_UP_H */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/