debuggers.hg
changeset 18937:1419a73316e1
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>
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>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Thu Dec 11 11:19:01 2008 +0000 (2008-12-11) |
parents | 6401c9533ef5 |
children | 147c646a2836 |
files | xen/include/xen/lib.h |
line diff
1.1 --- a/xen/include/xen/lib.h Wed Dec 10 14:05:41 2008 +0000 1.2 +++ b/xen/include/xen/lib.h Thu Dec 11 11:19:01 2008 +0000 1.3 @@ -16,7 +16,7 @@ void __warn(char *file, int line); 1.4 #define WARN_ON(p) do { if (p) WARN(); } while (0) 1.5 1.6 /* Force a compilation error if condition is true */ 1.7 -#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)])) 1.8 +#define BUILD_BUG_ON(condition) ((void)sizeof(struct { int:-!!(condition); })) 1.9 1.10 #ifndef assert_failed 1.11 #define assert_failed(p) \