[CRIU] [crtools-bot] Make BUG_ON() clang-compatible

Cyrill Gorcunov gorcunov at openvz.org
Tue Jan 31 06:56:23 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 6ce8d8ab9309f31340edd1e1f5dfc5a6a23759e5
Author: Kir Kolyshkin <kir at openvz.org>
Date:   Tue Jan 31 15:34:21 2012 +0400

    Make BUG_ON() clang-compatible
    
    When trying to compile the beast with clang, it complains:
    
    ====
    ./include/lock.h:33:2: error: indirection of non-volatile null pointer will be deleted, not trap
            BUG_ON(ret < 0);
            ^~~~~~~~~~~~~~~
    In file included from restorer.c:18:
    ./include/util.h:118:27: note: instantiated from:
    #define BUG_ON(condition)       BUG_ON_HANDLER((condition))
                                    ^
    ./include/util.h:100:4: note: instantiated from:
                            *(unsigned long *)NULL = 0xdead0000 + __LINE__; \
                            ^
    ====
    
    Make clang happy again by adding 'volatile'.
    
    Signed-off-by: Kir Kolyshkin <kir at openvz.org>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 include/util.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/util.h b/include/util.h
index b44165e..05a6572 100644
--- a/include/util.h
+++ b/include/util.h
@@ -96,7 +96,7 @@ extern void printk(const char *format, ...);
 			write_string("BUG at " __FILE__ ": ");		\
 			write_num(__LINE__);				\
 			write_string("\n");				\
-			*(unsigned long *)NULL = 0xdead0000 + __LINE__;	\
+			*(volatile unsigned long *)NULL = 0xdead0000 + __LINE__;	\
 		}							\
 	} while (0)
 


More information about the CRIU mailing list