WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add BUILD_BUG_ON() and a handful of users.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add BUILD_BUG_ON() and a handful of users.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 27 Apr 2006 21:34:11 +0000
Delivery-date: Thu, 27 Apr 2006 14:35:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID ef0a56c0784df4625d5e5ef8cf6f33ea6fee4d5e
# Parent  4e909143218cfc4477b3acf3a4c5a99d60ce4b2e
Add BUILD_BUG_ON() and a handful of users.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

diff -r 4e909143218c -r ef0a56c0784d xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Thu Apr 27 14:13:42 2006 +0100
+++ b/xen/arch/x86/setup.c      Thu Apr 27 15:55:09 2006 +0100
@@ -391,17 +391,17 @@ void __init __start_xen(multiboot_info_t
     total_pages = nr_pages;
 
     /* Sanity check for unwanted bloat of dom0_op structure. */
-    BUG_ON(sizeof(((struct dom0_op *)0)->u) !=
-           sizeof(((struct dom0_op *)0)->u.pad));
-
-    BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
-    BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
-    BUG_ON(sizeof(vcpu_info_t) != 64);
+    BUILD_BUG_ON(sizeof(((struct dom0_op *)0)->u) !=
+                 sizeof(((struct dom0_op *)0)->u.pad));
+
+    BUILD_BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
+    BUILD_BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
+    BUILD_BUG_ON(sizeof(vcpu_info_t) != 64);
 
     /* __foo are defined in public headers. Check they match internal defs. */
-    BUG_ON(__HYPERVISOR_VIRT_START != HYPERVISOR_VIRT_START);
+    BUILD_BUG_ON(__HYPERVISOR_VIRT_START != HYPERVISOR_VIRT_START);
 #ifdef HYPERVISOR_VIRT_END
-    BUG_ON(__HYPERVISOR_VIRT_END   != HYPERVISOR_VIRT_END);
+    BUILD_BUG_ON(__HYPERVISOR_VIRT_END   != HYPERVISOR_VIRT_END);
 #endif
 
     init_frametable();
diff -r 4e909143218c -r ef0a56c0784d xen/include/xen/lib.h
--- a/xen/include/xen/lib.h     Thu Apr 27 14:13:42 2006 +0100
+++ b/xen/include/xen/lib.h     Thu Apr 27 15:55:09 2006 +0100
@@ -15,6 +15,9 @@
 } while ( 0 )
 
 #define BUG_ON(_p) do { if (_p) BUG(); } while ( 0 )
+
+/* Force a compilation error if condition is true */
+#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)]))
 
 #ifndef NDEBUG
 #define ASSERT(_p) { if ( !(_p) ) { printk("Assertion '%s' failed, line %d, 
file %s\n", #_p , __LINE__, __FILE__); BUG(); } }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Add BUILD_BUG_ON() and a handful of users., Xen patchbot -unstable <=