[PATCH] Fix warnings for WARN_ON if CONFIG_BUG is disabled
authorRalf Baechle <ralf@linux-mips.org>
Fri, 20 Oct 2006 06:28:34 +0000 (23:28 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 20 Oct 2006 17:26:38 +0000 (10:26 -0700)
In most cases the return value of WARN_ON() is ignored.  If the generic
definition for the !CONFIG_BUG case is used this will result in a warning:

  CC      kernel/sched.o
In file included from include/linux/bio.h:25,
                 from include/linux/blkdev.h:14,
                 from kernel/sched.c:39:
include/linux/ioprio.h: In function â\80\98task_ioprioâ\80\99:
include/linux/ioprio.h:50: warning: statement with no effect
kernel/sched.c: In function â\80\98context_switchâ\80\99:
kernel/sched.c:1834: warning: statement with no effect

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-generic/bug.h

index 1d9573cf4a0bd043ce1cfb9e9190b35e3ea435b1..c92ae0f166ff44f1757f456a132202b22f0f5368 100644 (file)
 #endif
 
 #ifndef HAVE_ARCH_WARN_ON
-#define WARN_ON(condition) unlikely((condition))
+#define WARN_ON(condition) ({                                          \
+       typeof(condition) __ret_warn_on = (condition);                  \
+       unlikely(__ret_warn_on);                                        \
+})
 #endif
 #endif