[PATCH] fix for buggy GCC and rwlock_t

Stephen.Rothwell@nec.com.au
Wed, 04 Nov 1998 17:03:04 +1100


Hi Linus,

Someone else mentioned this previously, but rwlock_t in the
UP case needs the same tratment as spinlock_t in order to compile
with gcc 2.7.2.3.

Cheers,
Stephen

--
Stephen Rothwell                    Stephen.Rothwell@nec.com.au
NEC Australia                       Phone:  +61-2-62508747
Information Systems Group           Fax:    +61-2-62508746
Canberra, Australia                 Mobile: +61-417-575843

--- linux-2.1.127-6/include/asm-i386/spinlock.h Wed Nov 4 16:52:57 1998 +++ linux/include/asm-i386/spinlock.h Wed Nov 4 16:57:41 1998 @@ -88,9 +88,16 @@ * can "mix" irq-safe locks - any writer needs to get a * irq-safe write-lock, but readers can get non-irqsafe * read-locks. + * + * Gcc-2.7.x has a nasty bug with empty initializers. */ -typedef struct { } rwlock_t; -#define RW_LOCK_UNLOCKED (rwlock_t) { } +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) + typedef struct { } rwlock_t; + #define RW_LOCK_UNLOCKED (rwlock_t) { } +#else + typedef struct { int gcc_is_buggy; } rwlock_t; + #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } +#endif #define read_lock(lock) do { } while(0) #define read_unlock(lock) do { } while(0)

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/