]> xenbits.xensource.com Git - people/iwj/qemu.git/commitdiff
Stop including qemu-common.h in memory.h
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 3 Jul 2015 14:18:24 +0000 (15:18 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 6 Jul 2015 12:59:09 +0000 (14:59 +0200)
Including qemu-common.h from other header files is generally a bad
idea, because it means it's very easy to end up with a circular
dependency. For instance, if we wanted to include memory.h from
qom/cpu.h we'd end up with this loop:
 memory.h -> qemu-common.h -> cpu.h -> cpu-qom.h -> qom/cpu.h -> memory.h

Remove the include from memory.h. This requires us to fix up a few
other files which were inadvertently getting declarations indirectly
through memory.h.

The biggest change is splitting the fprintf_function typedef out
into its own header so other headers can get at it without having
to include qemu-common.h.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <1435933104-15216-1-git-send-email-peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/exec/cpu-common.h
include/exec/memory.h
include/hw/arm/arm.h
include/qemu-common.h
include/qemu/fprintf-fn.h [new file with mode: 0644]
target-s390x/mmu_helper.c

index de8a7200a9d6934bf31bec0cfcef54e4930b5c8b..9fb1d541d416dff3aea839c818bbbfdd4521cd6c 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "qemu/bswap.h"
 #include "qemu/queue.h"
+#include "qemu/fprintf-fn.h"
+#include "qemu/typedefs.h"
 
 /**
  * CPUListState:
index 0ebdc5550699a40e9dd088b626d4a128fa95ccdc..139471500f1bce089e8ec4aaa19f21282c270e06 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <stdint.h>
 #include <stdbool.h>
-#include "qemu-common.h"
 #include "exec/cpu-common.h"
 #ifndef CONFIG_USER_ONLY
 #include "exec/hwaddr.h"
index 760804cc46d7c4255380d87ce78dd0f3b12dca35..4dcd4f9b63697dad119bf17fce9bafbf3c9d4165 100644 (file)
@@ -14,6 +14,7 @@
 #include "exec/memory.h"
 #include "hw/irq.h"
 #include "qemu/notify.h"
+#include "cpu.h"
 
 /* armv7m.c */
 qemu_irq *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq,
index 5be3cddfa9412bc208eface1e011567bf76a39c6..237d6547b31a8ccbfee9cab1b057013c14ae724d 100644 (file)
@@ -15,6 +15,7 @@
 #include "qemu/compiler.h"
 #include "config-host.h"
 #include "qemu/typedefs.h"
+#include "qemu/fprintf-fn.h"
 
 #if defined(__arm__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__) || defined(__ia64__)
 #define WORDS_ALIGNED
@@ -85,9 +86,6 @@
 # error Unknown pointer size
 #endif
 
-typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
-
 #ifdef _WIN32
 #define fsync _commit
 #if !defined(lseek)
diff --git a/include/qemu/fprintf-fn.h b/include/qemu/fprintf-fn.h
new file mode 100644 (file)
index 0000000..9ddc90f
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Typedef for fprintf-alike function pointers.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_FPRINTF_FN_H
+#define QEMU_FPRINTF_FN_H 1
+
+#include "qemu/compiler.h"
+#include <stdio.h>
+
+typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
+    GCC_FMT_ATTR(2, 3);
+
+#endif
index 815ff42dde36d55b5e51250f58fcca67d1bce8bd..1ea6d812c281743b6974bf6575437d06f4f1bc26 100644 (file)
@@ -17,8 +17,8 @@
 
 #include "qemu/error-report.h"
 #include "exec/address-spaces.h"
-#include "sysemu/kvm.h"
 #include "cpu.h"
+#include "sysemu/kvm.h"
 
 /* #define DEBUG_S390 */
 /* #define DEBUG_S390_PTE */