On 13 November 2018 at 18:02, Philippe Mathieu-Daudé <phi...@redhat.com> wrote:
> On 13/11/18 18:01, Peter Maydell wrote:
>>
>> On 13 November 2018 at 16:52, Samuel Ortiz <sa...@linux.intel.com> 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.)

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