On Mon, Dec 07, 2015 at 04:23:42PM +0000, Peter Maydell wrote: > We've had some discussion previously (on list and IRC) about adding an > include of "qemu/osdep.h" to everything. The basic idea is that every > .c file should include "qemu/osdep.h" as its first include; then every > other header (and the .c file itself) can rely on the facilities that > osdep.h provides. > > This patchset is mostly here to get comment and review on the script > I've written to do the job of automatically updating the source files. > > To quote the usage comment from the script: > > # Usage: > # clean-includes [--git subjectprefix] file ... > # > # If the --git subjectprefix option is given, then after making > # the changes to the files this script will create a git commit > # with the subject line "subjectprefix: Clean up includes" > # and a boilerplate commit message. > > The script requires Perl and Coccinelle. > > Patches 2 and 3 are examples of its output, produced via > scripts/clean-includes --git target-arm target-arm/*.c > scripts/clean-includes --git hw/arm hw/arm/*.c > > NB: the script assumes my patch to make osdep.h include > glib-compat.h has already been applied: > http://patchwork.ozlabs.org/patch/552828/ > > Once we're happy with the set of transformations it produces the > next question is how we want to apply it to the tree. The good > news is that the changes to the .c files are idempotent and don't > depend on each other, so we could send things via different > submaintainer trees. Or we could have a single patchseries which we > apply all at once on the theory that this minimises the pain overall.
I think either approach would work as long as we don't let it drag out too long in sub-maintainer trees. ie aim to get every file cleaned & merged before 2.6 rc. > (The part that will depend on these having gone in is where we > update .h files to not include headers that osdep.h gives us.) Ideally it'd be good to get this done before 2.6, again just to avoid a long ongoing work in progress conversion. > A question I had about including osdep.h everywhere: > are there any files in the tree where we *can't* include it? > (Obvious possible candidates would be standalone test programs > and the guest-agent code.) I think even guest-agent code & tests could include it in order to get clean includes, even if they don't use any of the QEMU functions defined in it. So I think its simplest to just say every .c file must use it and leave it at that. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|