From patchwork Fri Jul 3 14:18:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 50632 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8069222916 for ; Fri, 3 Jul 2015 14:18:28 +0000 (UTC) Received: by wiwz6 with SMTP id z6sf33442700wiw.0 for ; Fri, 03 Jul 2015 07:18:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=y0MtzG1yQIK6eACv0Zb9YVXnsal+8v6gwNgBtXVmx6I=; b=YddbTExuyYpW65VQ4uZcHtgaCdQeO+UQKqiLGxNa4cArww1wj7u8zUSAKfi8QCVInL ic57n1QlodNYaITJxeeIagJgU3EKgJSYt73rAyoC3i3qOq6etj54nXsvCB042dn1dCmw yVAV+gNuKD+JTvkPORkU8H77utsqWYc70YtDQVjXhOSwdxtQTzG/wjVv0I8PTWZiZOxP vjwh3Yr1Ckk7PA5196dP3TqTUu0BTI1sTRcrDWFYUx3r4qlyKJHPxMbTAPOcOQoH0IMF MYJLlPhc2R26TO55CarORm1jMtEw9MGx7N+nUP9YJtXGzXQMY8ZxycVIzvszpFmumMlc r+sg== X-Gm-Message-State: ALoCoQnhfGvuo1v97J06gMIYjRHK6A2xVk+yPUKy0ZmAbBPFkafOdPzJnem+Ux+HOWR5ru+lOHRm X-Received: by 10.180.216.12 with SMTP id om12mr7580712wic.1.1435933107881; Fri, 03 Jul 2015 07:18:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.81 with SMTP id v17ls554734laz.2.gmail; Fri, 03 Jul 2015 07:18:27 -0700 (PDT) X-Received: by 10.112.118.137 with SMTP id km9mr36406368lbb.28.1435933107592; Fri, 03 Jul 2015 07:18:27 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id o1si7356471lbc.8.2015.07.03.07.18.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jul 2015 07:18:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lagh6 with SMTP id h6so87000536lag.2 for ; Fri, 03 Jul 2015 07:18:27 -0700 (PDT) X-Received: by 10.152.88.68 with SMTP id be4mr33225207lab.76.1435933107178; Fri, 03 Jul 2015 07:18:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp61838lbb; Fri, 3 Jul 2015 07:18:26 -0700 (PDT) X-Received: by 10.180.75.4 with SMTP id y4mr27199183wiv.1.1435933106191; Fri, 03 Jul 2015 07:18:26 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id o5si9701824wiz.39.2015.07.03.07.18.25 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 03 Jul 2015 07:18:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZB1nM-0003xt-N9; Fri, 03 Jul 2015 15:18:24 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-trivial@nongnu.org Subject: [PATCH] Stop including qemu-common.h in memory.h Date: Fri, 3 Jul 2015 15:18:24 +0100 Message-Id: <1435933104-15216-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- I originally wrote this because I thought I was going to need to include memory.h in qom/cpu.h. In fact I managed to avoid that in the end, but this still seems like useful cleanup. include/exec/cpu-common.h | 2 ++ include/exec/memory.h | 1 - include/hw/arm/arm.h | 1 + include/qemu-common.h | 4 +--- include/qemu/fprintf-fn.h | 16 ++++++++++++++++ target-s390x/mmu_helper.c | 2 +- 6 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 include/qemu/fprintf-fn.h diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index de8a720..9fb1d54 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -13,6 +13,8 @@ #include "qemu/bswap.h" #include "qemu/queue.h" +#include "qemu/fprintf-fn.h" +#include "qemu/typedefs.h" /** * CPUListState: diff --git a/include/exec/memory.h b/include/exec/memory.h index 8ae004e..1881320 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -23,7 +23,6 @@ #include #include -#include "qemu-common.h" #include "exec/cpu-common.h" #ifndef CONFIG_USER_ONLY #include "exec/hwaddr.h" diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h index 760804c..4dcd4f9 100644 --- a/include/hw/arm/arm.h +++ b/include/hw/arm/arm.h @@ -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, diff --git a/include/qemu-common.h b/include/qemu-common.h index d52d09c..09b8c06 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -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 index 0000000..4f66d45 --- /dev/null +++ b/include/qemu/fprintf-fn.h @@ -0,0 +1,16 @@ +/* + * 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 FPRINTF_FN_H + +#include "qemu/compiler.h" +#include + +typedef int (*fprintf_function)(FILE *f, const char *fmt, ...) + GCC_FMT_ATTR(2, 3); + +#endif diff --git a/target-s390x/mmu_helper.c b/target-s390x/mmu_helper.c index 815ff42..1ea6d81 100644 --- a/target-s390x/mmu_helper.c +++ b/target-s390x/mmu_helper.c @@ -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 */