diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-12-11 11:19:01 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-12-11 11:19:01 +0000 |
commit | c8e857a0aff354ff6404e5f5e237796d98457fb2 (patch) | |
tree | f54a8f6934955f52aca020a91b46b620d2cc332d /xen/include/xen/lib.h | |
parent | aa9c44021251b17ad24add472751e03b5718cbde (diff) | |
download | xen-c8e857a0aff354ff6404e5f5e237796d98457fb2.tar.gz xen-c8e857a0aff354ff6404e5f5e237796d98457fb2.tar.bz2 xen-c8e857a0aff354ff6404e5f5e237796d98457fb2.zip |
Fix BUILD_BUG_ON()
As was noticed on the Linux side, using an array here isn't appropriate
if the condition is not a compile time constant - gcc allows such
arrays, and hence the intended effect of producing a compiler error is
not achieved in that case. Bit field widths do not know similar
language extensions, and hence always produce a compiler error.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/include/xen/lib.h')
-rw-r--r-- | xen/include/xen/lib.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index d6aa891eb9..cbadd0de15 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -16,7 +16,7 @@ void __warn(char *file, int line); #define WARN_ON(p) do { if (p) WARN(); } while (0) /* Force a compilation error if condition is true */ -#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)])) +#define BUILD_BUG_ON(condition) ((void)sizeof(struct { int:-!!(condition); })) #ifndef assert_failed #define assert_failed(p) \ |