[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/29] Move HOST_LONG_BITS from qemu-common.h to qemu
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 08/29] Move HOST_LONG_BITS from qemu-common.h to qemu/osdep.h |
Date: |
Tue, 22 Mar 2016 15:16:48 +0100 |
From: Markus Armbruster <address@hidden>
qemu-common.h should only be included by .c files. Its file comment
explains why: "No header file should depend on qemu-common.h, as this
would easily lead to circular header dependencies."
One of the reasons for headers to include it is HOST_LONG_BITS. Move
that to its more natural home qemu/osdep.h, to facilitate removing
these ill-advised includes later on.
This also lets us use HOST_LONG_BITS in bswap.h instead of duplicating
its definition there to avoid cyclic inclusion.
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/qemu-common.h | 9 ---------
include/qemu/bswap.h | 6 ++----
include/qemu/osdep.h | 9 +++++++++
3 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 5a2d997..fbd999c 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -23,15 +23,6 @@
#include "qemu/option.h"
#include "qemu/host-utils.h"
-/* 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
-
void cpu_ticks_init(void);
/* icount */
diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
index 95071ba..fcedf0d 100644
--- a/include/qemu/bswap.h
+++ b/include/qemu/bswap.h
@@ -419,11 +419,9 @@ static inline void stfq_be_p(void *ptr, float64 v)
static inline unsigned long leul_to_cpu(unsigned long v)
{
- /* In order to break an include loop between here and
- qemu-common.h, don't rely on HOST_LONG_BITS. */
-#if ULONG_MAX == UINT32_MAX
+#if HOST_LONG_BITS == 32
return le_bswap(v, 32);
-#elif ULONG_MAX == UINT64_MAX
+#elif HOST_LONG_BITS == 64
return le_bswap(v, 64);
#else
# error Unknown sizeof long
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 1c0ce4a..64b06e3 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -127,6 +127,15 @@ extern int daemon(int, int);
#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 MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
--
2.5.0
- [Qemu-devel] [PULL 00/29] Miscellaneous changes for 2016-03-22, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 02/29] Use scripts/clean-includes to drop redundant qemu/typedefs.h, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 03/29] Clean up includes some more, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 08/29] Move HOST_LONG_BITS from qemu-common.h to qemu/osdep.h,
Paolo Bonzini <=
- [Qemu-devel] [PULL 04/29] fw_cfg: Split fw_cfg_keys.h off fw_cfg.h, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 07/29] hw/pci/pci.h: Don't include qemu-common.h, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 09/29] Move QEMU_ALIGN_*() from qemu-common.h to qemu/osdep.h, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 11/29] isa: Move DMA_transfer_handler from qemu-common.h to hw/isa/isa.h, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 05/29] include/qemu/iov.h: Don't include qemu-common.h, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 06/29] include/hw/hw.h: Don't include qemu-common.h, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 10/29] Move ParallelIOArg from qemu-common.h to sysemu/char.h, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 12/29] include/crypto: Include qapi-types.h or qemu/bswap.h instead of qemu-common.h, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 13/29] hw: explicitly include qemu-common.h and cpu.h, Paolo Bonzini, 2016/03/22
- [Qemu-devel] [PULL 01/29] include/qemu/osdep.h: Don't include qapi/error.h, Paolo Bonzini, 2016/03/22