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

xen-devel

[Top] [All Lists]

[Xen-devel] [PATCH] change BUILD_BUG_ON()

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] change BUILD_BUG_ON()
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: 2008年12月11日 10:42:22 +0000
Delivery-date: 2008年12月11日 02:42:32 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxx>
--- 2008年11月20日.orig/xen/include/xen/lib.h 2007年09月10日 09:59:38.000000000 
+0200
+++ 2008年11月20日/xen/include/xen/lib.h 2008年12月11日 09:54:51.000000000 +0100
@@ -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) \
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] change BUILD_BUG_ON(), Jan Beulich <=
Previous by Date: [Xen-devel] [PATCH] x86: fix the potential of encountering panic "IO-APIC + timer doesn't work! ..." , Jan Beulich
Next by Date: Re: [Xen-devel] [PATCH][RFC] remove PV/x86 warnings (timewentbackwards) , Atsushi SAKAI
Previous by Thread: [Xen-devel] [PATCH] x86: fix the potential of encountering panic "IO-APIC + timer doesn't work! ..." , Jan Beulich
Next by Thread: [Xen-devel] [PATCH] hvmloader: enable bus mastering of PCI device , Kouya Shimura
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /