On Sun, Jul 01, 2007 at 12:46:04AM +0200, Stefan Reinauer wrote:
-/* Most GCC versions have a nasty bug with empty initializers */ -#if (__GNUC__ > 2) -typedef struct { } spinlock_t; -#define SPIN_LOCK_UNLOCKED (spinlock_t) { } -#else -typedef struct { int gcc_is_buggy; } spinlock_t; -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } -#endif
ACK. Sending a similar patch was already on my TODO list. We don't care about gcc <= 3, I guess.
#define barrier() do {} while(0) #define spin_is_locked(lock) 0 #define spin_unlock_wait(lock) do {} while(0) #define spin_lock(lock) do {} while(0) #define spin_unlock(lock) do {} while(0) +#define spin_define(lock) /* empty */
Why not this? #define spin_define(lock) do {} while(0)
+#define spin_define(spin) static struct spinlock spin = SPIN_LOCK_UNLOCKED
Uh, that looks like an inline function might be better here.
Uwe.