From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:59813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcxEv-0000tP-Fz for qemu-devel@nongnu.org; Tue, 20 Dec 2011 05:48:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RcxEp-0000mO-8M for qemu-devel@nongnu.org; Tue, 20 Dec 2011 05:48:09 -0500 Received: from e28smtp07.in.ibm.com ([122.248.162.7]:46674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcxEo-0000kY-Df for qemu-devel@nongnu.org; Tue, 20 Dec 2011 05:48:03 -0500 Received: from /spool/local by e28smtp07.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Dec 2011 16:17:54 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pBKAlnKX4137104 for ; Tue, 20 Dec 2011 16:17:49 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pBKAlnvK028372 for ; Tue, 20 Dec 2011 21:47:49 +1100 Message-ID: <4EF067D3.2010103@linux.vnet.ibm.com> Date: Tue, 20 Dec 2011 18:47:47 +0800 From: Dong Xu Wang MIME-Version: 1.0 References: <1324371827-25099-1-git-send-email-wdongxu@linux.vnet.ibm.com> <20111220101343.GC10603@stefanha-thinkpad.localdomain> In-Reply-To: <20111220101343.GC10603@stefanha-thinkpad.localdomain> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] rewrite QEMU_BUILD_BUG_ON List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org 于 2011年12月20日 18:13, Stefan Hajnoczi 写道: > On Tue, Dec 20, 2011 at 05:03:47PM +0800, Dong Xu Wang wrote: >> 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. > > Can you post the gcc -E output of the file that produces the error as > well as the gcc error output? > > Stefan > > I doubled the following lines in block/qcow2-snapshot.c(line 211 and 212): QEMU_BUILD_BUG_ON(offsetof(QCowHeader, snapshots_offset) != offsetof(QCowHeader, nb_snapshots) + sizeof(header_data.nb_snapshots));" While "gcc -E -C -I. block/qcow2-snapshot.c", I can get: typedef char qemu_build_bug_on____LINE__ # 241 "block/qcow2-snapshot.c" [(__builtin_offsetof (QCowHeader, snapshots_offset) != __builtin_offsetof (QCowHeader, nb_snapshots) + sizeof(header_data.nb_snapshots))?-1:1]; ; typedef char qemu_build_bug_on____LINE__ # 243 "block/qcow2-snapshot.c" [(__builtin_offsetof (QCowHeader, snapshots_offset) != __builtin_offsetof (QCowHeader, nb_snapshots) + sizeof(header_data.nb_snapshots))?-1:1]; __LINE__ are not expanded to real line number. While normally compiling, error message is: CC block/qcow2-snapshot.o block/qcow2-snapshot.c: In function \u2018qcow2_write_snapshots\u2019: block/qcow2-snapshot.c:244: error: redefinition of typedef \u2018qemu_build_bug_on____LINE__\u2019 block/qcow2-snapshot.c:242: note: previous declaration of \u2018qemu_build_bug_on____LINE__\u2019 was here make: *** [block/qcow2-snapshot.o] Error 1