[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH] Fix circular dependency for HOST_LONG_BITS qemu-c
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH] Fix circular dependency for HOST_LONG_BITS qemu-common.h <-> bswap.h |
Date: |
Tue, 5 Feb 2013 10:30:56 +1100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Anthony, Richard, anyone?
Please apply - qemu has now been build-broken on all big endian
platforms for a month.
On Tue, Jan 22, 2013 at 04:33:26PM +1100, David Gibson wrote:
> 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 <address@hidden>
>
> Signed-off-by: David Gibson <address@hidden>
> ---
> 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 <stdarg.h>
> #include <stddef.h>
> +#include <stdint.h>
> #include <stdbool.h>
> #ifdef __OpenBSD__
> #include <sys/types.h>
> @@ -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)
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: Digital signature
- Re: [Qemu-ppc] [PATCH] Fix circular dependency for HOST_LONG_BITS qemu-common.h <-> bswap.h,
David Gibson <=
- Re: [Qemu-ppc] [PATCH] Fix circular dependency for HOST_LONG_BITS qemu-common.h <-> bswap.h, Richard Henderson, 2013/02/04
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] Fix circular dependency for HOST_LONG_BITS qemu-common.h <-> bswap.h, Peter Maydell, 2013/02/04
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] Fix circular dependency for HOST_LONG_BITS qemu-common.h <-> bswap.h, Richard Henderson, 2013/02/04
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] Fix circular dependency for HOST_LONG_BITS qemu-common.h <-> bswap.h, Andreas Färber, 2013/02/05
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] Fix circular dependency for HOST_LONG_BITS qemu-common.h <-> bswap.h, David Gibson, 2013/02/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] Fix circular dependency for HOST_LONG_BITS qemu-common.h <-> bswap.h, Anthony Liguori, 2013/02/13
- Re: [Qemu-ppc] [Qemu-devel] [PATCH] Fix circular dependency for HOST_LONG_BITS qemu-common.h <-> bswap.h, Andreas Färber, 2013/02/13