[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] cpu: Clean up includes
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] cpu: Clean up includes |
Date: |
Mon, 18 Jan 2016 14:27:08 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 01/18/2016 11:05 AM, Peter Maydell wrote:
>>> +++ b/qom/cpu.c
>>> @@ -18,6 +18,7 @@
>>> * <http://www.gnu.org/licenses/gpl-2.0.html>
>>> */
>>>
>>> +#include "qemu/osdep.h"
>>> #include "qemu-common.h"
>>
>> Shouldn't qemu-common.h include osdep.h?
>
> It does, but the intention is that every .c file should include
> qemu/osdep.h as its first include (even if some other include
> it has also results in osdep.h being pulled in).
Eventually, we want to force that NO .h file includes qemu/osdep.h. If
every .c file includes it first, then all other .h files can count on it
already being included and therefore don't need to include it
themselves. (This is comparable to the rule used in other projects,
like libvirt's handling of config.h which must be first in all .c files
and must not be included in .h files).
> This is a simple
> rule that's easy to check in code review and hopefully also
> in an automated way.
Indeed - we MUST turn on automation after all these individual patches
are in, to make sure we don't regress (again, something that libvirt has
already managed to do, so it shouldn't be too hard to automate, except
that libvirt's automation is courtesy of gnulib which we don't use here).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature