[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Stop including qemu-common.h in memory.h
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH] Stop including qemu-common.h in memory.h |
Date: |
Fri, 03 Jul 2015 19:26:53 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Peter Maydell <address@hidden> writes:
> 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.
Why not simply put it in qemu/typedefs.h?
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> 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.
Yup.