From patchwork Mon Jul 6 12:35:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 50762 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7EB97229FC for ; Mon, 6 Jul 2015 13:29:55 +0000 (UTC) Received: by laar3 with SMTP id r3sf47480977laa.1 for ; Mon, 06 Jul 2015 06:29:54 -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:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=FPEloqlvrSIrqZ8JKYt/uF9DGixoeFGwdsKoyiTBV/Q=; b=SvjUnZkh2u3DpEJSKmZYt3AvBQTXjJLtOnPOAVJwLVNIGBvKRMWAZbtqaRrY39vVVX OgN9e2JSsD3R+gMn81McQx1AMdlBCzEPIOaeOeMIhSxNctk+Hh7rbxDHd6owKmm3Dvc1 ZDJtIE88MNXVatRwn8SWGzT+j8+qzZXJHknilB0sIIjk/rgMNEi4IZGMrPWArmw/YNkv 7BZR3Vp7VbP+KYtmygf3po1CqGupLSNu+1JIAqcHxQtriyKblkDosolHTbVdlZl9Xc5b eiE6U8gIQdW8zbL+HAomEDnlx2vz5qLFxhCDrZriP3ncE+Iu3GrXLQPJeLJY2bUV6oYK Pxhw== X-Gm-Message-State: ALoCoQltB3UNhzP4utnlIJZKbs8iEiwJEuDcZlJRs1j8Pj4Ck+xvgg9MdcMGA60/iFkQ2njHzg8O X-Received: by 10.152.27.130 with SMTP id t2mr30527885lag.2.1436189394434; Mon, 06 Jul 2015 06:29:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.70 with SMTP id z6ls701325lag.9.gmail; Mon, 06 Jul 2015 06:29:54 -0700 (PDT) X-Received: by 10.112.83.135 with SMTP id q7mr49369519lby.13.1436189394126; Mon, 06 Jul 2015 06:29:54 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id 8si15259751lan.120.2015.07.06.06.29.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 06:29:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lagx9 with SMTP id x9so154890914lag.1 for ; Mon, 06 Jul 2015 06:29:54 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr49065563lag.86.1436189393857; Mon, 06 Jul 2015 06:29:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1727667lbb; Mon, 6 Jul 2015 06:29:52 -0700 (PDT) X-Received: by 10.68.235.38 with SMTP id uj6mr105821384pbc.57.1436189391989; Mon, 06 Jul 2015 06:29:51 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id qp7si29123623pac.120.2015.07.06.06.29.50 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 06 Jul 2015 06:29:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:50742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC5lQ-0005H0-3y for patch@linaro.org; Mon, 06 Jul 2015 08:44:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC5ch-0000Db-IY for qemu-devel@nongnu.org; Mon, 06 Jul 2015 08:35:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZC5cf-0006Pk-Qh for qemu-devel@nongnu.org; Mon, 06 Jul 2015 08:35:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC5ce-0006PB-Ve for qemu-devel@nongnu.org; Mon, 06 Jul 2015 08:35:45 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 9C4ADB7CD6; Mon, 6 Jul 2015 12:35:44 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-50.ams2.redhat.com [10.36.112.50]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t66CZ8Nm009626; Mon, 6 Jul 2015 08:35:43 -0400 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 6 Jul 2015 14:35:07 +0200 Message-Id: <1436186108-29747-19-git-send-email-pbonzini@redhat.com> In-Reply-To: <1436186108-29747-1-git-send-email-pbonzini@redhat.com> References: <1436186108-29747-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell Subject: [Qemu-devel] [PULL 18/19] Stop including qemu-common.h in memory.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pbonzini@redhat.com 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.53 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Peter Maydell 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 Message-Id: <1435933104-15216-1-git-send-email-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- 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 0ebdc55..1394715 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 5be3cdd..237d654 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 */