From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcvcm-0005vI-S5 for qemu-devel@nongnu.org; Tue, 20 Dec 2011 04:04:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rcvci-00023j-Oa for qemu-devel@nongnu.org; Tue, 20 Dec 2011 04:04:40 -0500 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:57429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcvci-00023P-7k for qemu-devel@nongnu.org; Tue, 20 Dec 2011 04:04:36 -0500 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Dec 2011 09:57:31 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pBK90NUm3403952 for ; Tue, 20 Dec 2011 20:00:23 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pBK94HbJ021496 for ; Tue, 20 Dec 2011 20:04:17 +1100 From: Dong Xu Wang Date: Tue, 20 Dec 2011 17:03:47 +0800 Message-Id: <1324371827-25099-1-git-send-email-wdongxu@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] rewrite QEMU_BUILD_BUG_ON List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Dong Xu Wang From: Dong Xu Wang 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 --- 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