qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 02/13] target: arm: Remove unused headers


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH 02/13] target: arm: Remove unused headers
Date: Tue, 13 Nov 2018 19:10:25 +0100

On Tue, Nov 13, 2018 at 7:08 PM Peter Maydell <address@hidden> wrote:
> On 13 November 2018 at 18:02, Philippe Mathieu-Daudé <address@hidden> wrote:
> > On 13/11/18 18:01, Peter Maydell wrote:
> >> On 13 November 2018 at 16:52, Samuel Ortiz <address@hidden> wrote:
>
> >>> --- a/target/arm/helper.c
> >>> +++ b/target/arm/helper.c
> >>> @@ -12,13 +12,10 @@
> >>>   #include "internals.h"
> >>>   #include "exec/gdbstub.h"
> >>>   #include "exec/helper-proto.h"
> >>> -#include "qemu/host-utils.h"
> >>
> >>
> >> This is for muldiv64().
> >
> >
> > But it is already included by "cpu.h" -> "exec/cpu-defs.h"
>
> > So they are not "unused" but "unnecessary".
> >
> > I thought this would be better to clean this once, before Samuel split.
>
> Generally I think that if a .c file directly uses function X declared in
> header Y it should #include Y, even if it happens that it already includes
> other header Z that includes Y. Otherwise if we refactor Z later such
> that it no longer needs to include Y, it will break compilation of the .c
> file. (That is, Z including Y is a detail of the implementation of Z,
> not a guarantee made by Z to its users.)

Yes, this makes sense now, thanks.

Phil.

> The exception here is where the header guarantees that it's going
> to include certain other things (which is the case for eg our osdep.h).
>
> thanks
> -- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]