[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [MINIOS PATCH] lib.h: remove BUILD_BUG_ON



BUILD_BUG_ON should not appear in a public-facing header, otherwise it
risks clashing with macro with the same name in other code bases. I
encountered such issue when trying to add BUILD_BUG_ON to a private
header in Xen's gnttab library.

Ideally BUILD_BUG_ON should be moved to a private header, but there is
actually no user of it in mini-os tree, just remove it.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 include/lib.h | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 39d6a18..e7155e2 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -54,15 +54,6 @@
 #include <xen/event_channel.h>
 #include "gntmap.h"
 
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-#define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); })
-#define BUILD_BUG_ON_ZERO(cond) \
-    sizeof(struct { _Static_assert(!(cond), "!(" #cond ")"); })
-#else
-#define BUILD_BUG_ON_ZERO(cond) sizeof(struct { int:-!!(cond); })
-#define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
-#endif
-
 #ifdef HAVE_LIBC
 #include <sys/queue.h>
 #include <stdio.h>
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.