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] [xen-3.2-testing] Fix BUILD_BUG_ON()

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.2-testing] Fix BUILD_BUG_ON()
From: "Xen patchbot-3.2-testing" <patchbot-3.2-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 11 Dec 2008 14:00:36 -0800
Delivery-date: Thu, 11 Dec 2008 14:00:45 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1229002605 0
# Node ID 6b4982c3f8588ff80bfb5fa39ffa65457c1ef109
# Parent  51f26d6ebc6c0f581208701e8da629c0a112b21d
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@xxxxxxxxxx>
xen-unstable changeset:   18899:1419a73316e1d75d3e5d7c1530ac6ae7e7bc7fb4
xen-unstable date:        Thu Dec 11 11:19:01 2008 +0000
---
 xen/include/xen/lib.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -r 51f26d6ebc6c -r 6b4982c3f858 xen/include/xen/lib.h
--- a/xen/include/xen/lib.h     Wed Dec 10 14:35:38 2008 +0000
+++ b/xen/include/xen/lib.h     Thu Dec 11 13:36:45 2008 +0000
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.2-testing] Fix BUILD_BUG_ON(), Xen patchbot-3.2-testing <=