tools/libxc: Use _Static_assert if available
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 9 Jun 2014 15:41:08 +0000 (16:41 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 10 Jun 2014 12:46:45 +0000 (13:46 +0100)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxc/xc_private.h

index 29e926c4ec33837dd21d50f89b2721353f246bef..12476ec4ffc0fae48c34aad719ab4db43738c74c 100644 (file)
 #define PAGE_MASK               XC_PAGE_MASK
 
 /* Force a compilation error if condition is true */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#define XC_BUILD_BUG_ON(p) ({ _Static_assert(!(p), "!(" #p ")"); })
+#else
 #define XC_BUILD_BUG_ON(p) ((void)sizeof(struct { int:-!!(p); }))
+#endif
 
 /*
 ** Define max dirty page cache to permit during save/restore -- need to balance