[CRIU] [PATCH] Make BUG_ON() clang-compatible

Kir Kolyshkin kir at openvz.org
Tue Jan 31 06:29:01 EST 2012


When trying to compile the beast with clang, it complains:

In file included from restorer.c:22:
./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:
                        ^

Make clang happy again by adding 'volatile'.

Signed-off-by: Kir Kolyshkin <kir 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 cc53ead..e9c1832 100644
--- a/include/util.h
+++ b/include/util.h
@@ -97,7 +97,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)
 
-- 
1.7.4.4



More information about the CRIU mailing list