qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] clean-includes script to add osdep.h to everything
@ 2015-12-07 16:23 Peter Maydell
  2015-12-07 16:23 ` [Qemu-devel] [PATCH 1/3] scripts: Add new clean-includes script to fix C include directives Peter Maydell
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Peter Maydell @ 2015-12-07 16:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, patches

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.

(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.)


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.)


Peter Maydell (3):
  scripts: Add new clean-includes script to fix C include directives
  target-arm: Clean up includes
  hw/arm: Clean up includes

 hw/arm/allwinner-a10.c     |   1 +
 hw/arm/armv7m.c            |   1 +
 hw/arm/boot.c              |   2 +-
 hw/arm/collie.c            |   1 +
 hw/arm/cubieboard.c        |   1 +
 hw/arm/digic.c             |   1 +
 hw/arm/digic_boards.c      |   1 +
 hw/arm/exynos4210.c        |   1 +
 hw/arm/exynos4_boards.c    |   1 +
 hw/arm/fsl-imx25.c         |   1 +
 hw/arm/fsl-imx31.c         |   1 +
 hw/arm/gumstix.c           |   1 +
 hw/arm/highbank.c          |   1 +
 hw/arm/imx25_pdk.c         |   1 +
 hw/arm/integratorcp.c      |   1 +
 hw/arm/kzm.c               |   1 +
 hw/arm/mainstone.c         |   1 +
 hw/arm/musicpal.c          |   1 +
 hw/arm/netduino2.c         |   1 +
 hw/arm/nseries.c           |   1 +
 hw/arm/omap1.c             |   1 +
 hw/arm/omap2.c             |   1 +
 hw/arm/omap_sx1.c          |   1 +
 hw/arm/palm.c              |   1 +
 hw/arm/pxa2xx.c            |   1 +
 hw/arm/pxa2xx_gpio.c       |   1 +
 hw/arm/pxa2xx_pic.c        |   1 +
 hw/arm/realview.c          |   1 +
 hw/arm/spitz.c             |   1 +
 hw/arm/stellaris.c         |   1 +
 hw/arm/stm32f205_soc.c     |   1 +
 hw/arm/strongarm.c         |   1 +
 hw/arm/sysbus-fdt.c        |   1 +
 hw/arm/tosa.c              |   1 +
 hw/arm/versatilepb.c       |   1 +
 hw/arm/vexpress.c          |   1 +
 hw/arm/virt-acpi-build.c   |   1 +
 hw/arm/virt.c              |   1 +
 hw/arm/xilinx_zynq.c       |   1 +
 hw/arm/xlnx-ep108.c        |   1 +
 hw/arm/xlnx-zynqmp.c       |   1 +
 hw/arm/z2.c                |   1 +
 scripts/clean-includes     | 109 +++++++++++++++++++++++++++++++++++++++++++++
 target-arm/arm-semi.c      |   8 +---
 target-arm/cpu.c           |   1 +
 target-arm/cpu64.c         |   1 +
 target-arm/crypto_helper.c |   2 +-
 target-arm/gdbstub.c       |   2 +-
 target-arm/gdbstub64.c     |   2 +-
 target-arm/helper-a64.c    |   1 +
 target-arm/helper.c        |   1 +
 target-arm/iwmmxt_helper.c |   3 +-
 target-arm/kvm-stub.c      |   1 +
 target-arm/kvm.c           |   3 +-
 target-arm/kvm32.c         |   3 +-
 target-arm/kvm64.c         |   4 +-
 target-arm/machine.c       |   1 +
 target-arm/neon_helper.c   |   3 +-
 target-arm/op_helper.c     |   1 +
 target-arm/psci.c          |   1 +
 target-arm/translate-a64.c |   6 +--
 target-arm/translate.c     |   6 +--
 62 files changed, 170 insertions(+), 32 deletions(-)
 create mode 100755 scripts/clean-includes

-- 
1.9.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-01-19  8:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-07 16:23 [Qemu-devel] [PATCH 0/3] clean-includes script to add osdep.h to everything Peter Maydell
2015-12-07 16:23 ` [Qemu-devel] [PATCH 1/3] scripts: Add new clean-includes script to fix C include directives Peter Maydell
2016-01-11 15:23   ` Daniel P. Berrange
2015-12-07 16:23 ` [Qemu-devel] [PATCH 2/3] target-arm: Clean up includes Peter Maydell
2016-01-11 15:26   ` Daniel P. Berrange
2015-12-07 16:23 ` [Qemu-devel] [PATCH 3/3] hw/arm: " Peter Maydell
2016-01-11 13:08 ` [Qemu-devel] [PATCH 0/3] clean-includes script to add osdep.h to everything Peter Maydell
2016-01-11 15:19 ` Daniel P. Berrange
2016-01-18 16:33   ` Peter Maydell
2016-01-18 17:08     ` Peter Maydell
2016-01-19  7:27     ` Markus Armbruster
2016-01-19  8:46       ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).