ia64/xen-unstable

changeset 9878:ef0a56c0784d

Add BUILD_BUG_ON() and a handful of users.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Apr 27 15:55:09 2006 +0100 (2006-04-27)
parents 4e909143218c
children e0d986fc0978
files xen/arch/x86/setup.c xen/include/xen/lib.h
line diff
     1.1 --- a/xen/arch/x86/setup.c	Thu Apr 27 14:13:42 2006 +0100
     1.2 +++ b/xen/arch/x86/setup.c	Thu Apr 27 15:55:09 2006 +0100
     1.3 @@ -391,17 +391,17 @@ void __init __start_xen(multiboot_info_t
     1.4      total_pages = nr_pages;
     1.5  
     1.6      /* Sanity check for unwanted bloat of dom0_op structure. */
     1.7 -    BUG_ON(sizeof(((struct dom0_op *)0)->u) !=
     1.8 -           sizeof(((struct dom0_op *)0)->u.pad));
     1.9 +    BUILD_BUG_ON(sizeof(((struct dom0_op *)0)->u) !=
    1.10 +                 sizeof(((struct dom0_op *)0)->u.pad));
    1.11  
    1.12 -    BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
    1.13 -    BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
    1.14 -    BUG_ON(sizeof(vcpu_info_t) != 64);
    1.15 +    BUILD_BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
    1.16 +    BUILD_BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
    1.17 +    BUILD_BUG_ON(sizeof(vcpu_info_t) != 64);
    1.18  
    1.19      /* __foo are defined in public headers. Check they match internal defs. */
    1.20 -    BUG_ON(__HYPERVISOR_VIRT_START != HYPERVISOR_VIRT_START);
    1.21 +    BUILD_BUG_ON(__HYPERVISOR_VIRT_START != HYPERVISOR_VIRT_START);
    1.22  #ifdef HYPERVISOR_VIRT_END
    1.23 -    BUG_ON(__HYPERVISOR_VIRT_END   != HYPERVISOR_VIRT_END);
    1.24 +    BUILD_BUG_ON(__HYPERVISOR_VIRT_END   != HYPERVISOR_VIRT_END);
    1.25  #endif
    1.26  
    1.27      init_frametable();
     2.1 --- a/xen/include/xen/lib.h	Thu Apr 27 14:13:42 2006 +0100
     2.2 +++ b/xen/include/xen/lib.h	Thu Apr 27 15:55:09 2006 +0100
     2.3 @@ -16,6 +16,9 @@
     2.4  
     2.5  #define BUG_ON(_p) do { if (_p) BUG(); } while ( 0 )
     2.6  
     2.7 +/* Force a compilation error if condition is true */
     2.8 +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)]))
     2.9 +
    2.10  #ifndef NDEBUG
    2.11  #define ASSERT(_p) { if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s\n", #_p , __LINE__, __FILE__); BUG(); } }
    2.12  #else