From: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH] rewrite QEMU_BUILD_BUG_ON
Date: Tue, 20 Dec 2011 17:03:47 +0800 [thread overview]
Message-ID: <1324371827-25099-1-git-send-email-wdongxu@linux.vnet.ibm.com> (raw)
From: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
On some platforms, __LINE__ will not expand to real number in QEMU_BUILD_BUG_ON,
so if using QEMU_BUILD_BUG_ON twice, compiler will report errors. This patch will
fix it.
BTW, I got error message on RHEL 6.1/gcc 4.4.5.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
---
compiler.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/compiler.h b/compiler.h
index a1c0794..736e770 100644
--- a/compiler.h
+++ b/compiler.h
@@ -30,8 +30,10 @@
# define QEMU_PACKED __attribute__((packed))
#endif
+#define cat(x,y) x ## y
+#define cat2(x,y) cat(x,y)
#define QEMU_BUILD_BUG_ON(x) \
- typedef char qemu_build_bug_on__##__LINE__[(x)?-1:1];
+ typedef char cat2(qemu_build_bug_on__,__LINE__)[(x)?-1:1];
#if defined __GNUC__
# if !QEMU_GNUC_PREREQ(4, 4)
--
1.7.5.4
next reply other threads:[~2011-12-20 9:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-20 9:03 Dong Xu Wang [this message]
2011-12-20 10:13 ` [Qemu-devel] [PATCH] rewrite QEMU_BUILD_BUG_ON Stefan Hajnoczi
2011-12-20 10:47 ` Dong Xu Wang
2011-12-20 12:08 ` Stefan Hajnoczi
2011-12-20 13:12 ` Dong Xu Wang
2011-12-20 13:41 ` Stefan Hajnoczi
2012-01-09 5:26 ` Dong Xu Wang
2012-02-08 12:49 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1324371827-25099-1-git-send-email-wdongxu@linux.vnet.ibm.com \
--to=wdongxu@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).