diff options
author | Dong Xu Wang <wdongxu@linux.vnet.ibm.com> | 2011-12-20 17:03:47 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-02-09 16:17:51 +0100 |
commit | ea8f978ffef325ab2fd0edcf5f24b6dcec6078f3 (patch) | |
tree | 78017a8c65b689b396d408977a1d2b5b5692b54a /compiler.h | |
parent | 75bab85ca01876f912caf46f5fcb4ca8d9a50584 (diff) | |
download | qemu-ea8f978ffef325ab2fd0edcf5f24b6dcec6078f3.zip qemu-ea8f978ffef325ab2fd0edcf5f24b6dcec6078f3.tar.gz qemu-ea8f978ffef325ab2fd0edcf5f24b6dcec6078f3.tar.bz2 |
rewrite QEMU_BUILD_BUG_ON
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>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'compiler.h')
-rw-r--r-- | compiler.h | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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) |