From patchwork Tue Jan 22 05:33:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 214341 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C7D7C2C0087 for ; Tue, 22 Jan 2013 16:31:16 +1100 (EST) Received: from localhost ([::1]:37216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxWS2-0000O8-Tv for incoming@patchwork.ozlabs.org; Tue, 22 Jan 2013 00:31:14 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxWRo-0000MC-1B for qemu-devel@nongnu.org; Tue, 22 Jan 2013 00:31:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TxWRd-0000pd-Ps for qemu-devel@nongnu.org; Tue, 22 Jan 2013 00:30:59 -0500 Received: from ozlabs.org ([203.10.76.45]:33091) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxWRd-0000mV-9N; Tue, 22 Jan 2013 00:30:49 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 7A89D2C007E; Tue, 22 Jan 2013 16:30:42 +1100 (EST) From: David Gibson To: aliguori@us.ibm.com Date: Tue, 22 Jan 2013 16:33:26 +1100 Message-Id: <1358832806-30670-1-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 203.10.76.45 Cc: agraf@suse.de, qemu-devel@nongnu.org, blauwirbel@gmail.com, qemu-ppc@nongnu.org, rth@twiddle.net, David Gibson Subject: [Qemu-devel] [PATCH] Fix circular dependency for HOST_LONG_BITS qemu-common.h <-> bswap.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Commit c732a52d3e3b7ed42d7daa94ba40a83408cd6f22 from Richard Henderson changed leul_to_cpu() in bswap.h from a macro to an inline function. Both versions use HOST_LONG_BITS, but as an inline, HOST_LONG_BITS now needs to be evaluated at the point of definition rather than only when the macro is invoked. HOST_LONG_BITS is defined in qemu-common.h... which in turn includes bswap.h leading to a circular dependency. This doesn't show up on little endian hosts like x86, because the macros used within leul_to_cpu() end up removing the reference to HOST_LONG_BITS. This problem, however, breaks build on all big endian hosts such as powerpc. This patch fixes the problem by moving the basic HOST_LONG_BITS definition to osdep.h, which is already included before bswap.h. Cc: Richard Henderson Signed-off-by: David Gibson --- include/qemu-common.h | 9 --------- include/qemu/osdep.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index ca464bb..ca7f8dc 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -72,15 +72,6 @@ #define TIME_MAX LONG_MAX #endif -/* HOST_LONG_BITS is the size of a native pointer in bits. */ -#if UINTPTR_MAX == UINT32_MAX -# define HOST_LONG_BITS 32 -#elif UINTPTR_MAX == UINT64_MAX -# define HOST_LONG_BITS 64 -#else -# error Unknown pointer size -#endif - #ifndef CONFIG_IOVEC #define CONFIG_IOVEC struct iovec { diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 87d3b9c..ebac074 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -3,6 +3,7 @@ #include #include +#include #include #ifdef __OpenBSD__ #include @@ -18,6 +19,15 @@ typedef unsigned int uint_fast16_t; typedef signed int int_fast16_t; #endif +/* HOST_LONG_BITS is the size of a native pointer in bits. */ +#if UINTPTR_MAX == UINT32_MAX +# define HOST_LONG_BITS 32 +#elif UINTPTR_MAX == UINT64_MAX +# define HOST_LONG_BITS 64 +#else +# error Unknown pointer size +#endif + #ifndef glue #define xglue(x, y) x ## y #define glue(x, y) xglue(x, y)