diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-01 00:12:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-01 00:12:07 -0400 |
commit | 8d4fbcfbe0a4bfc73e7f0297c59ae514e1f1436f (patch) | |
tree | f4fe8e2028620b8aeb298c78ee5dc9d6df07e708 /include/asm-powerpc/bug.h | |
parent | 2f63251ed0a803ddbe7bf2577b69d467aa872f68 (diff) |
Fix WARN_ON() on bitfield ops
Alexey Dobriyan noticed that the new WARN_ON() semantics that were
introduced by commit 684f978347deb42d180373ac4c427f82ef963171 (to also
return the value to be warned on) didn't compile when given a bitfield,
because the typeof doesn't work for bitfields.
So instead of the typeof trick, use an "int" variable together with a
"!!(x)" expression, as suggested by Al Viro.
To make matters more interesting, Paul Mackerras points out that that is
sub-optimal on Power, but the old asm-coded comparison seems to be buggy
anyway on 32-bit Power if the conditional was 64-bit, so I think there
are more problems there.
Regardless, the new WARN_ON() semantics may have been a bad idea. But
this at least avoids the more serious complications.
Cc: Alexey Dobriyan <adobriyan@sw.ru>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Al Viro <viro@ftp.linux.org.uk>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-powerpc/bug.h')
-rw-r--r-- | include/asm-powerpc/bug.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h index a248b8bd4d7c..e55d1f66b86f 100644 --- a/include/asm-powerpc/bug.h +++ b/include/asm-powerpc/bug.h | |||
@@ -93,7 +93,7 @@ | |||
93 | } while (0) | 93 | } while (0) |
94 | 94 | ||
95 | #define WARN_ON(x) ({ \ | 95 | #define WARN_ON(x) ({ \ |
96 | typeof(x) __ret_warn_on = (x); \ | 96 | int __ret_warn_on = !!(x); \ |
97 | if (__builtin_constant_p(__ret_warn_on)) { \ | 97 | if (__builtin_constant_p(__ret_warn_on)) { \ |
98 | if (__ret_warn_on) \ | 98 | if (__ret_warn_on) \ |
99 | __WARN(); \ | 99 | __WARN(); \ |