Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8d4fbcfbe0a4bfc73e7f0297c59ae514e1f1436f
Commit:     8d4fbcfbe0a4bfc73e7f0297c59ae514e1f1436f
Parent:     2f63251ed0a803ddbe7bf2577b69d467aa872f68
Author:     Linus Torvalds <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 31 21:12:07 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Jul 31 21:12:07 2007 -0700

    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 <[EMAIL PROTECTED]>
    Cc: Herbert Xu <[EMAIL PROTECTED]>
    Cc: Paul Mackerras <[EMAIL PROTECTED]>
    Cc: Al Viro <[EMAIL PROTECTED]>
    Cc: Ingo Molnar <[EMAIL PROTECTED]>
    Cc: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 include/asm-generic/bug.h |    6 +++---
 include/asm-powerpc/bug.h |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 344e309..d56fedb 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -33,7 +33,7 @@ struct bug_entry {
 
 #ifndef HAVE_ARCH_WARN_ON
 #define WARN_ON(condition) ({                                          \
-       typeof(condition) __ret_warn_on = (condition);                  \
+       int __ret_warn_on = !!(condition);                              \
        if (unlikely(__ret_warn_on)) {                                  \
                printk("WARNING: at %s:%d %s()\n", __FILE__,            \
                        __LINE__, __FUNCTION__);                        \
@@ -54,7 +54,7 @@ struct bug_entry {
 
 #ifndef HAVE_ARCH_WARN_ON
 #define WARN_ON(condition) ({                                          \
-       typeof(condition) __ret_warn_on = (condition);                  \
+       int __ret_warn_on = !!(condition);                              \
        unlikely(__ret_warn_on);                                        \
 })
 #endif
@@ -62,7 +62,7 @@ struct bug_entry {
 
 #define WARN_ON_ONCE(condition)        ({                              \
        static int __warned;                                    \
-       typeof(condition) __ret_warn_once = (condition);        \
+       int __ret_warn_once = !!(condition);                    \
                                                                \
        if (unlikely(__ret_warn_once))                          \
                if (WARN_ON(!__warned))                         \
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h
index a248b8b..e55d1f6 100644
--- a/include/asm-powerpc/bug.h
+++ b/include/asm-powerpc/bug.h
@@ -93,7 +93,7 @@
 } while (0)
 
 #define WARN_ON(x) ({                                          \
-       typeof(x) __ret_warn_on = (x);                          \
+       int __ret_warn_on = !!(x);                              \
        if (__builtin_constant_p(__ret_warn_on)) {              \
                if (__ret_warn_on)                              \
                        __WARN();                               \
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to