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

* [Qemu-devel] [PATCH 1/3] scripts: Add new clean-includes script to fix C include directives
  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 ` 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
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Peter Maydell @ 2015-12-07 16:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, patches

Add a new scripts/clean-includes, which can be used to automatically
ensure that a C source file includes qemu/osdep.h first and doesn't
then include any headers which osdep.h provides already.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 scripts/clean-includes | 109 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100755 scripts/clean-includes

diff --git a/scripts/clean-includes b/scripts/clean-includes
new file mode 100755
index 0000000..1af1f82
--- /dev/null
+++ b/scripts/clean-includes
@@ -0,0 +1,109 @@
+#!/bin/sh -e
+#
+# Clean up QEMU #include lines by ensuring that qemu/osdep.h
+# is the first include listed.
+#
+# Copyright (c) 2015 Linaro Limited
+#
+# Authors:
+#  Peter Maydell <peter.maydell@linaro.org>
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+# 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.
+
+# This script requires Coccinelle to be installed.
+
+
+# The following one-liner may be handy for finding files to run this on.
+# However some caution is required regarding files that might be part
+# of the guest agent or standalone tests.
+
+# for i in `git ls-tree --name-only HEAD`  ; do test -f $i && \
+#   grep -E '^# *include' $i | head -1 | grep 'osdep.h' ; test $? != 0 && \
+#   echo $i ; done
+
+
+GIT=no
+
+if [ $# -ne 0 ] && [ "$1" = "--git" ]; then
+    if [ $# -eq 1 ]; then
+        echo "--git option requires an argument"
+        exit 1
+    fi
+    GITSUBJ="$2"
+    GIT=yes
+    shift
+    shift
+fi
+
+if [ $# -eq 0 ]; then
+    echo "Usage: clean-includes [--git subjectprefix] foo.c ..."
+    echo "(modifies the files in place)"
+    exit 1
+fi
+
+# Annoyingly coccinelle won't read a scriptfile unless its
+# name ends '.cocci', so write it out to a tempfile with the
+# right kind of name.
+COCCIFILE="$(mktemp --suffix=.cocci)"
+
+trap 'rm -f -- "$COCCIFILE"' INT TERM HUP EXIT
+
+cat >"$COCCIFILE" <<EOT
+@@
+@@
+
+(
++ #include "qemu/osdep.h"
+ #include "..."
+|
++ #include "qemu/osdep.h"
+ #include <...>
+)
+EOT
+
+
+for f in "$@"; do
+  # First, use coccinelle to add qemu/osdep.h before the first existing include
+  # (this will add two lines if the file uses both "..." and <...> #includes,
+  # but we will remove the extras in the next step)
+  spatch  --in-place --no-show-diff --cocci-file "$COCCIFILE" "$f"
+
+  # Now remove any duplicate osdep.h includes
+  perl -n -i  -e 'print if !/#include "qemu\/osdep.h"/ || !$n++;' "$f"
+
+  # Remove includes that osdep.h already provides
+  perl -n -i -e 'print if !/\s*#\s*include\s*(["<][^>"]*[">])/ ||
+                          ! (grep { $_ eq $1 } qw (
+           "config-host.h" "qemu/compiler.h" "config.h"
+           <stdarg.h> <stddef.h> <stdbool.h> <stdint.h> <sys/types.h>
+           <stdlib.h> <stdio.h> <string.h> <strings.h> <inttypes.h>
+           <limits.h> <unistd.h> <time.h> <ctype.h> <errno.h> <fcntl.h>
+           <sys/stat.h> <sys/time.h> <assert.h> <signal.h>
+           "glib-compat.h" "qapi/error.h"
+            ))' "$f"
+
+done
+
+if [ "$GIT" = "yes" ]; then
+    git add -- "$@"
+    git commit --signoff -F - <<EOF
+$GITSUBJ: Clean up includes
+
+Clean up includes so that osdep.h is included first and headers
+which it implies are not included manually.
+
+This commit was created with scripts/clean-includes.
+
+EOF
+
+fi
-- 
1.9.1

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

* [Qemu-devel] [PATCH 2/3] target-arm: Clean up includes
  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
@ 2015-12-07 16:23 ` Peter Maydell
  2016-01-11 15:26   ` Daniel P. Berrange
  2015-12-07 16:23 ` [Qemu-devel] [PATCH 3/3] hw/arm: " Peter Maydell
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Peter Maydell @ 2015-12-07 16:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Markus Armbruster, patches

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 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 +-----
 19 files changed, 19 insertions(+), 31 deletions(-)

diff --git a/target-arm/arm-semi.c b/target-arm/arm-semi.c
index d7cff3d..76c33b9 100644
--- a/target-arm/arm-semi.c
+++ b/target-arm/arm-semi.c
@@ -18,13 +18,7 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
+#include "qemu/osdep.h"
 
 #include "cpu.h"
 #include "exec/semihost.h"
diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 30739fc..72cb65f 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -18,6 +18,7 @@
  * <http://www.gnu.org/licenses/gpl-2.0.html>
  */
 
+#include "qemu/osdep.h"
 #include "cpu.h"
 #include "internals.h"
 #include "qemu-common.h"
diff --git a/target-arm/cpu64.c b/target-arm/cpu64.c
index 63c8b1c..5f8a177 100644
--- a/target-arm/cpu64.c
+++ b/target-arm/cpu64.c
@@ -18,6 +18,7 @@
  * <http://www.gnu.org/licenses/gpl-2.0.html>
  */
 
+#include "qemu/osdep.h"
 #include "cpu.h"
 #include "qemu-common.h"
 #if !defined(CONFIG_USER_ONLY)
diff --git a/target-arm/crypto_helper.c b/target-arm/crypto_helper.c
index 5d22838..3b6df3f 100644
--- a/target-arm/crypto_helper.c
+++ b/target-arm/crypto_helper.c
@@ -9,7 +9,7 @@
  * version 2 of the License, or (at your option) any later version.
  */
 
-#include <stdlib.h>
+#include "qemu/osdep.h"
 
 #include "cpu.h"
 #include "exec/exec-all.h"
diff --git a/target-arm/gdbstub.c b/target-arm/gdbstub.c
index 1c34396..08b91a4 100644
--- a/target-arm/gdbstub.c
+++ b/target-arm/gdbstub.c
@@ -17,7 +17,7 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include "config.h"
+#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "exec/gdbstub.h"
 
diff --git a/target-arm/gdbstub64.c b/target-arm/gdbstub64.c
index 8f3b8d1..634c6bc 100644
--- a/target-arm/gdbstub64.c
+++ b/target-arm/gdbstub64.c
@@ -16,7 +16,7 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include "config.h"
+#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "exec/gdbstub.h"
 
diff --git a/target-arm/helper-a64.c b/target-arm/helper-a64.c
index deb8dbe..c46af93 100644
--- a/target-arm/helper-a64.c
+++ b/target-arm/helper-a64.c
@@ -17,6 +17,7 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/gdbstub.h"
 #include "exec/helper-proto.h"
diff --git a/target-arm/helper.c b/target-arm/helper.c
index afc4163..18d60ff 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -1,3 +1,4 @@
+#include "qemu/osdep.h"
 #include "cpu.h"
 #include "internals.h"
 #include "exec/gdbstub.h"
diff --git a/target-arm/iwmmxt_helper.c b/target-arm/iwmmxt_helper.c
index a506914..7d87e1a 100644
--- a/target-arm/iwmmxt_helper.c
+++ b/target-arm/iwmmxt_helper.c
@@ -19,8 +19,7 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdlib.h>
-#include <stdio.h>
+#include "qemu/osdep.h"
 
 #include "cpu.h"
 #include "exec/exec-all.h"
diff --git a/target-arm/kvm-stub.c b/target-arm/kvm-stub.c
index db2edc2..38bf433 100644
--- a/target-arm/kvm-stub.c
+++ b/target-arm/kvm-stub.c
@@ -9,6 +9,7 @@
  * See the COPYING file in the top-level directory.
  *
  */
+#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "kvm_arm.h"
 
diff --git a/target-arm/kvm.c b/target-arm/kvm.c
index 79ef4c6..c1c5584 100644
--- a/target-arm/kvm.c
+++ b/target-arm/kvm.c
@@ -8,8 +8,7 @@
  *
  */
 
-#include <stdio.h>
-#include <sys/types.h>
+#include "qemu/osdep.h"
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 
diff --git a/target-arm/kvm32.c b/target-arm/kvm32.c
index df1e2b0..646ba41 100644
--- a/target-arm/kvm32.c
+++ b/target-arm/kvm32.c
@@ -8,8 +8,7 @@
  *
  */
 
-#include <stdio.h>
-#include <sys/types.h>
+#include "qemu/osdep.h"
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 
diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c
index ceebfeb..d409259 100644
--- a/target-arm/kvm64.c
+++ b/target-arm/kvm64.c
@@ -8,14 +8,12 @@
  *
  */
 
-#include <stdio.h>
-#include <sys/types.h>
+#include "qemu/osdep.h"
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 
 #include <linux/kvm.h>
 
-#include "config-host.h"
 #include "qemu-common.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
diff --git a/target-arm/machine.c b/target-arm/machine.c
index 36a0d15..97cbfe3 100644
--- a/target-arm/machine.c
+++ b/target-arm/machine.c
@@ -1,3 +1,4 @@
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/boards.h"
 #include "qemu/error-report.h"
diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
index 47d13e9..1f1844f 100644
--- a/target-arm/neon_helper.c
+++ b/target-arm/neon_helper.c
@@ -6,8 +6,7 @@
  *
  * This code is licensed under the GNU GPL v2.
  */
-#include <stdlib.h>
-#include <stdio.h>
+#include "qemu/osdep.h"
 
 #include "cpu.h"
 #include "exec/exec-all.h"
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index 6cd54c8..af5a783 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -16,6 +16,7 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
+#include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "internals.h"
diff --git a/target-arm/psci.c b/target-arm/psci.c
index 20e4cb6..c55487f 100644
--- a/target-arm/psci.c
+++ b/target-arm/psci.c
@@ -15,6 +15,7 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
+#include "qemu/osdep.h"
 #include <cpu.h>
 #include <cpu-qom.h>
 #include <exec/helper-proto.h>
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
index 14e8131..80f6c20 100644
--- a/target-arm/translate-a64.c
+++ b/target-arm/translate-a64.c
@@ -16,11 +16,7 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
+#include "qemu/osdep.h"
 
 #include "cpu.h"
 #include "tcg-op.h"
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 5d22879..48884ab 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -18,11 +18,7 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
+#include "qemu/osdep.h"
 
 #include "cpu.h"
 #include "internals.h"
-- 
1.9.1

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

* [Qemu-devel] [PATCH 3/3] hw/arm: Clean up includes
  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
  2015-12-07 16:23 ` [Qemu-devel] [PATCH 2/3] target-arm: Clean up includes Peter Maydell
@ 2015-12-07 16:23 ` 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
  4 siblings, 0 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

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 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 +
 42 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index b0ca81c..02c8caa 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -15,6 +15,7 @@
  * for more details.
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/devices.h"
 #include "hw/arm/allwinner-a10.h"
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index a80d2ad..f3973f7 100644
--- a/hw/arm/armv7m.c
+++ b/hw/arm/armv7m.c
@@ -7,6 +7,7 @@
  * This code is licensed under the GPL.
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
 #include "hw/loader.h"
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 75f69bf..7742dd3 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -7,7 +7,7 @@
  * This code is licensed under the GPL.
  */
 
-#include "config.h"
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/arm/arm.h"
 #include "hw/arm/linux-boot-if.h"
diff --git a/hw/arm/collie.c b/hw/arm/collie.c
index 9991c0c..8bb308a 100644
--- a/hw/arm/collie.c
+++ b/hw/arm/collie.c
@@ -8,6 +8,7 @@
  * Contributions after 2012-01-13 are licensed under the terms of the
  * GNU GPL, version 2 or (at your option) any later version.
  */
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "hw/boards.h"
diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
index bf068cd..9fcbaf4 100644
--- a/hw/arm/cubieboard.c
+++ b/hw/arm/cubieboard.c
@@ -15,6 +15,7 @@
  * for more details.
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/devices.h"
 #include "hw/boards.h"
diff --git a/hw/arm/digic.c b/hw/arm/digic.c
index 90f8190..82087ba 100644
--- a/hw/arm/digic.c
+++ b/hw/arm/digic.c
@@ -20,6 +20,7 @@
  *
  */
 
+#include "qemu/osdep.h"
 #include "hw/arm/digic.h"
 
 #define DIGIC4_TIMER_BASE(n)    (0xc0210000 + (n) * 0x100)
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index 710045a..ef52fafb 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -23,6 +23,7 @@
  *
  */
 
+#include "qemu/osdep.h"
 #include "hw/boards.h"
 #include "exec/address-spaces.h"
 #include "qemu/error-report.h"
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
index d934980..0d5a22f 100644
--- a/hw/arm/exynos4210.c
+++ b/hw/arm/exynos4210.c
@@ -21,6 +21,7 @@
  *
  */
 
+#include "qemu/osdep.h"
 #include "hw/boards.h"
 #include "sysemu/sysemu.h"
 #include "hw/sysbus.h"
diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c
index da82b27..42faa8c 100644
--- a/hw/arm/exynos4_boards.c
+++ b/hw/arm/exynos4_boards.c
@@ -21,6 +21,7 @@
  *
  */
 
+#include "qemu/osdep.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/qtest.h"
 #include "hw/sysbus.h"
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
index e1cadac..8507cf0 100644
--- a/hw/arm/fsl-imx25.c
+++ b/hw/arm/fsl-imx25.c
@@ -22,6 +22,7 @@
  *  with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "qemu/osdep.h"
 #include "hw/arm/fsl-imx25.h"
 #include "sysemu/sysemu.h"
 #include "exec/address-spaces.h"
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
index 53d4473..331a5b1 100644
--- a/hw/arm/fsl-imx31.c
+++ b/hw/arm/fsl-imx31.c
@@ -19,6 +19,7 @@
  *  with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "qemu/osdep.h"
 #include "hw/arm/fsl-imx31.h"
 #include "sysemu/sysemu.h"
 #include "exec/address-spaces.h"
diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c
index 32ad041..626d338 100644
--- a/hw/arm/gumstix.c
+++ b/hw/arm/gumstix.c
@@ -34,6 +34,7 @@
  * # qemu-system-arm -M verdex -pflash flash -monitor null -nographic -m 289
  */
 
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/arm/pxa.h"
 #include "net/net.h"
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index 85ae69e..cb8ed0b 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -17,6 +17,7 @@
  *
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
 #include "hw/devices.h"
diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c
index 59a4c11..e0fbc3b 100644
--- a/hw/arm/imx25_pdk.c
+++ b/hw/arm/imx25_pdk.c
@@ -23,6 +23,7 @@
  *  with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "qemu/osdep.h"
 #include "hw/arm/fsl-imx25.h"
 #include "hw/boards.h"
 #include "qemu/error-report.h"
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index 421bde9..149dbea 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -7,6 +7,7 @@
  * This code is licensed under the GPL
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/devices.h"
 #include "hw/boards.h"
diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c
index eff6f46..3acd8a9 100644
--- a/hw/arm/kzm.c
+++ b/hw/arm/kzm.c
@@ -13,6 +13,7 @@
  * i.MX31 SoC
  */
 
+#include "qemu/osdep.h"
 #include "hw/arm/fsl-imx31.h"
 #include "hw/boards.h"
 #include "qemu/error-report.h"
diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c
index e434cb6..98a892f 100644
--- a/hw/arm/mainstone.c
+++ b/hw/arm/mainstone.c
@@ -11,6 +11,7 @@
  * Contributions after 2012-01-13 are licensed under the terms of the
  * GNU GPL, version 2 or (at your option) any later version.
  */
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/arm/pxa.h"
 #include "hw/arm/arm.h"
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index b534bb9..54548f3 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -9,6 +9,7 @@
  * GNU GPL, version 2 or (at your option) any later version.
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
 #include "hw/devices.h"
diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c
index a3b9e82..0c5350e 100644
--- a/hw/arm/netduino2.c
+++ b/hw/arm/netduino2.c
@@ -22,6 +22,7 @@
  * THE SOFTWARE.
  */
 
+#include "qemu/osdep.h"
 #include "hw/boards.h"
 #include "qemu/error-report.h"
 #include "hw/arm/stm32f205_soc.h"
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index 2a8835e..4297311 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -18,6 +18,7 @@
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "sysemu/sysemu.h"
 #include "hw/arm/omap.h"
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
index 6b1c076..6f68130 100644
--- a/hw/arm/omap1.c
+++ b/hw/arm/omap1.c
@@ -17,6 +17,7 @@
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "qemu/osdep.h"
 #include "hw/boards.h"
 #include "hw/hw.h"
 #include "hw/arm/arm.h"
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
index 98ee19f..d11224e 100644
--- a/hw/arm/omap2.c
+++ b/hw/arm/omap2.c
@@ -18,6 +18,7 @@
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "qemu/osdep.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "hw/boards.h"
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
index 8eaf8f3..68236a3 100644
--- a/hw/arm/omap_sx1.c
+++ b/hw/arm/omap_sx1.c
@@ -25,6 +25,7 @@
  * You should have received a copy of the GNU General Public License along
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "ui/console.h"
 #include "hw/arm/omap.h"
diff --git a/hw/arm/palm.c b/hw/arm/palm.c
index 82ec99d..cae0a46 100644
--- a/hw/arm/palm.c
+++ b/hw/arm/palm.c
@@ -16,6 +16,7 @@
  * You should have received a copy of the GNU General Public License along
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "audio/audio.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index 79d22d9..db58781 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -7,6 +7,7 @@
  * This code is licensed under the GPL.
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/arm/pxa.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c
index c89c804..67e7e70 100644
--- a/hw/arm/pxa2xx_gpio.c
+++ b/hw/arm/pxa2xx_gpio.c
@@ -7,6 +7,7 @@
  * This code is licensed under the GPL.
  */
 
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "hw/arm/pxa.h"
diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c
index d41ac93..8a39b1c 100644
--- a/hw/arm/pxa2xx_pic.c
+++ b/hw/arm/pxa2xx_pic.c
@@ -8,6 +8,7 @@
  * This code is licensed under the GPL.
  */
 
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/arm/pxa.h"
 #include "hw/sysbus.h"
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index e14828d..d78bbfa 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -7,6 +7,7 @@
  * This code is licensed under the GPL.
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
 #include "hw/arm/primecell.h"
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
index 8d3cc0b..317ade1 100644
--- a/hw/arm/spitz.c
+++ b/hw/arm/spitz.c
@@ -10,6 +10,7 @@
  * GNU GPL, version 2 or (at your option) any later version.
  */
 
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/arm/pxa.h"
 #include "hw/arm/arm.h"
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
index 0114e0a..3eb7d3c 100644
--- a/hw/arm/stellaris.c
+++ b/hw/arm/stellaris.c
@@ -7,6 +7,7 @@
  * This code is licensed under the GPL.
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/ssi.h"
 #include "hw/arm/arm.h"
diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c
index 3f99340..79bfe6d 100644
--- a/hw/arm/stm32f205_soc.c
+++ b/hw/arm/stm32f205_soc.c
@@ -22,6 +22,7 @@
  * THE SOFTWARE.
  */
 
+#include "qemu/osdep.h"
 #include "hw/arm/arm.h"
 #include "exec/address-spaces.h"
 #include "hw/arm/stm32f205_soc.h"
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
index 9624ecb..d9f2f5b 100644
--- a/hw/arm/strongarm.c
+++ b/hw/arm/strongarm.c
@@ -27,6 +27,7 @@
  *  GNU GPL, version 2 or (at your option) any later version.
  */
 
+#include "qemu/osdep.h"
 #include "hw/boards.h"
 #include "hw/sysbus.h"
 #include "strongarm.h"
diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c
index 9d28797..68a3de5 100644
--- a/hw/arm/sysbus-fdt.c
+++ b/hw/arm/sysbus-fdt.c
@@ -21,6 +21,7 @@
  *
  */
 
+#include "qemu/osdep.h"
 #include "hw/arm/sysbus-fdt.h"
 #include "qemu/error-report.h"
 #include "sysemu/device_tree.h"
diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c
index 02814d7..c387950 100644
--- a/hw/arm/tosa.c
+++ b/hw/arm/tosa.c
@@ -11,6 +11,7 @@
  * GNU GPL, version 2 or (at your option) any later version.
  */
 
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/arm/pxa.h"
 #include "hw/arm/arm.h"
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index 912c290..20b8b65 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -7,6 +7,7 @@
  * This code is licensed under the GPL.
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
 #include "hw/devices.h"
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 058abbd..4d1b185 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -21,6 +21,7 @@
  *  GNU GPL, version 2 or (at your option) any later version.
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
 #include "hw/arm/primecell.h"
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 3c2c5d6..c8fa902 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -26,6 +26,7 @@
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "hw/arm/virt-acpi-build.h"
 #include "qemu/bitmap.h"
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 9c6792c..bf61b9e 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -28,6 +28,7 @@
  * This is essentially the same approach kvmtool uses.
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
 #include "hw/arm/primecell.h"
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 1c1a445..25a4227 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -15,6 +15,7 @@
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
 #include "net/net.h"
diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-ep108.c
index 85b978f..7bf5802 100644
--- a/hw/arm/xlnx-ep108.c
+++ b/hw/arm/xlnx-ep108.c
@@ -15,6 +15,7 @@
  * for more details.
  */
 
+#include "qemu/osdep.h"
 #include "hw/arm/xlnx-zynqmp.h"
 #include "hw/boards.h"
 #include "qemu/error-report.h"
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
index 87553bb..3a191bc 100644
--- a/hw/arm/xlnx-zynqmp.c
+++ b/hw/arm/xlnx-zynqmp.c
@@ -15,6 +15,7 @@
  * for more details.
  */
 
+#include "qemu/osdep.h"
 #include "hw/arm/xlnx-zynqmp.h"
 #include "hw/intc/arm_gic_common.h"
 #include "exec/address-spaces.h"
diff --git a/hw/arm/z2.c b/hw/arm/z2.c
index b44eb76..aecb24a 100644
--- a/hw/arm/z2.c
+++ b/hw/arm/z2.c
@@ -11,6 +11,7 @@
  * GNU GPL, version 2 or (at your option) any later version.
  */
 
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/arm/pxa.h"
 #include "hw/arm/arm.h"
-- 
1.9.1

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

* Re: [Qemu-devel] [PATCH 0/3] clean-includes script to add osdep.h to everything
  2015-12-07 16:23 [Qemu-devel] [PATCH 0/3] clean-includes script to add osdep.h to everything Peter Maydell
                   ` (2 preceding siblings ...)
  2015-12-07 16:23 ` [Qemu-devel] [PATCH 3/3] hw/arm: " Peter Maydell
@ 2016-01-11 13:08 ` Peter Maydell
  2016-01-11 15:19 ` Daniel P. Berrange
  4 siblings, 0 replies; 12+ messages in thread
From: Peter Maydell @ 2016-01-11 13:08 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Paolo Bonzini, Markus Armbruster, Patch Tracking

Ping for review, please?

thanks
-- PMM


On 7 December 2015 at 16:23, Peter Maydell <peter.maydell@linaro.org> 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.
>
> (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

* Re: [Qemu-devel] [PATCH 0/3] clean-includes script to add osdep.h to everything
  2015-12-07 16:23 [Qemu-devel] [PATCH 0/3] clean-includes script to add osdep.h to everything Peter Maydell
                   ` (3 preceding siblings ...)
  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
  4 siblings, 1 reply; 12+ messages in thread
From: Daniel P. Berrange @ 2016-01-11 15:19 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, qemu-devel, Markus Armbruster, patches

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 :|

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

* Re: [Qemu-devel] [PATCH 1/3] scripts: Add new clean-includes script to fix C include directives
  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
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel P. Berrange @ 2016-01-11 15:23 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, qemu-devel, Markus Armbruster, patches

On Mon, Dec 07, 2015 at 04:23:43PM +0000, Peter Maydell wrote:
> Add a new scripts/clean-includes, which can be used to automatically
> ensure that a C source file includes qemu/osdep.h first and doesn't
> then include any headers which osdep.h provides already.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  scripts/clean-includes | 109 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 109 insertions(+)
>  create mode 100755 scripts/clean-includes
> 
> diff --git a/scripts/clean-includes b/scripts/clean-includes
> new file mode 100755
> index 0000000..1af1f82
> --- /dev/null
> +++ b/scripts/clean-includes
> @@ -0,0 +1,109 @@
> +#!/bin/sh -e
> +#
> +# Clean up QEMU #include lines by ensuring that qemu/osdep.h
> +# is the first include listed.
> +#
> +# Copyright (c) 2015 Linaro Limited
> +#
> +# Authors:
> +#  Peter Maydell <peter.maydell@linaro.org>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2
> +# or (at your option) any later version. See the COPYING file in
> +# the top-level directory.
> +
> +# 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.
> +
> +# This script requires Coccinelle to be installed.
> +
> +
> +# The following one-liner may be handy for finding files to run this on.
> +# However some caution is required regarding files that might be part
> +# of the guest agent or standalone tests.
> +
> +# for i in `git ls-tree --name-only HEAD`  ; do test -f $i && \
> +#   grep -E '^# *include' $i | head -1 | grep 'osdep.h' ; test $? != 0 && \
> +#   echo $i ; done
> +
> +
> +GIT=no
> +
> +if [ $# -ne 0 ] && [ "$1" = "--git" ]; then
> +    if [ $# -eq 1 ]; then
> +        echo "--git option requires an argument"
> +        exit 1
> +    fi
> +    GITSUBJ="$2"
> +    GIT=yes
> +    shift
> +    shift
> +fi
> +
> +if [ $# -eq 0 ]; then
> +    echo "Usage: clean-includes [--git subjectprefix] foo.c ..."
> +    echo "(modifies the files in place)"
> +    exit 1
> +fi
> +
> +# Annoyingly coccinelle won't read a scriptfile unless its
> +# name ends '.cocci', so write it out to a tempfile with the
> +# right kind of name.
> +COCCIFILE="$(mktemp --suffix=.cocci)"
> +
> +trap 'rm -f -- "$COCCIFILE"' INT TERM HUP EXIT
> +
> +cat >"$COCCIFILE" <<EOT
> +@@
> +@@
> +
> +(
> ++ #include "qemu/osdep.h"
> + #include "..."
> +|
> ++ #include "qemu/osdep.h"
> + #include <...>
> +)
> +EOT
> +
> +
> +for f in "$@"; do
> +  # First, use coccinelle to add qemu/osdep.h before the first existing include
> +  # (this will add two lines if the file uses both "..." and <...> #includes,
> +  # but we will remove the extras in the next step)
> +  spatch  --in-place --no-show-diff --cocci-file "$COCCIFILE" "$f"
> +
> +  # Now remove any duplicate osdep.h includes
> +  perl -n -i  -e 'print if !/#include "qemu\/osdep.h"/ || !$n++;' "$f"
> +
> +  # Remove includes that osdep.h already provides
> +  perl -n -i -e 'print if !/\s*#\s*include\s*(["<][^>"]*[">])/ ||
> +                          ! (grep { $_ eq $1 } qw (
> +           "config-host.h" "qemu/compiler.h" "config.h"
> +           <stdarg.h> <stddef.h> <stdbool.h> <stdint.h> <sys/types.h>
> +           <stdlib.h> <stdio.h> <string.h> <strings.h> <inttypes.h>
> +           <limits.h> <unistd.h> <time.h> <ctype.h> <errno.h> <fcntl.h>
> +           <sys/stat.h> <sys/time.h> <assert.h> <signal.h>
> +           "glib-compat.h" "qapi/error.h"
> +            ))' "$f"
> +
> +done
> +
> +if [ "$GIT" = "yes" ]; then
> +    git add -- "$@"
> +    git commit --signoff -F - <<EOF
> +$GITSUBJ: Clean up includes
> +
> +Clean up includes so that osdep.h is included first and headers
> +which it implies are not included manually.
> +
> +This commit was created with scripts/clean-includes.
> +
> +EOF
> +
> +fi
> -- 

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>


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 :|

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

* Re: [Qemu-devel] [PATCH 2/3] target-arm: Clean up includes
  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
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel P. Berrange @ 2016-01-11 15:26 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, qemu-devel, Markus Armbruster, patches

On Mon, Dec 07, 2015 at 04:23:44PM +0000, Peter Maydell wrote:
> Clean up includes so that osdep.h is included first and headers
> which it implies are not included manually.
> 
> This commit was created with scripts/clean-includes.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  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 +-----
>  19 files changed, 19 insertions(+), 31 deletions(-)
> 
> diff --git a/target-arm/arm-semi.c b/target-arm/arm-semi.c
> index d7cff3d..76c33b9 100644
> --- a/target-arm/arm-semi.c
> +++ b/target-arm/arm-semi.c
> @@ -18,13 +18,7 @@
>   *  along with this program; if not, see <http://www.gnu.org/licenses/>.
>   */
>  
> -#include <sys/types.h>
> -#include <sys/stat.h>
> -#include <fcntl.h>
> -#include <unistd.h>
> -#include <stdlib.h>
> -#include <stdio.h>
> -#include <time.h>
> +#include "qemu/osdep.h"
>  
>  #include "cpu.h"
>  #include "exec/semihost.h"
> diff --git a/target-arm/cpu.c b/target-arm/cpu.c
> index 30739fc..72cb65f 100644
> --- a/target-arm/cpu.c
> +++ b/target-arm/cpu.c
> @@ -18,6 +18,7 @@
>   * <http://www.gnu.org/licenses/gpl-2.0.html>
>   */
>  
> +#include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "internals.h"
>  #include "qemu-common.h"
> diff --git a/target-arm/cpu64.c b/target-arm/cpu64.c
> index 63c8b1c..5f8a177 100644
> --- a/target-arm/cpu64.c
> +++ b/target-arm/cpu64.c
> @@ -18,6 +18,7 @@
>   * <http://www.gnu.org/licenses/gpl-2.0.html>
>   */
>  
> +#include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "qemu-common.h"
>  #if !defined(CONFIG_USER_ONLY)
> diff --git a/target-arm/crypto_helper.c b/target-arm/crypto_helper.c
> index 5d22838..3b6df3f 100644
> --- a/target-arm/crypto_helper.c
> +++ b/target-arm/crypto_helper.c
> @@ -9,7 +9,7 @@
>   * version 2 of the License, or (at your option) any later version.
>   */
>  
> -#include <stdlib.h>
> +#include "qemu/osdep.h"
>  
>  #include "cpu.h"
>  #include "exec/exec-all.h"
> diff --git a/target-arm/gdbstub.c b/target-arm/gdbstub.c
> index 1c34396..08b91a4 100644
> --- a/target-arm/gdbstub.c
> +++ b/target-arm/gdbstub.c
> @@ -17,7 +17,7 @@
>   * You should have received a copy of the GNU Lesser General Public
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
> -#include "config.h"
> +#include "qemu/osdep.h"
>  #include "qemu-common.h"
>  #include "exec/gdbstub.h"
>  
> diff --git a/target-arm/gdbstub64.c b/target-arm/gdbstub64.c
> index 8f3b8d1..634c6bc 100644
> --- a/target-arm/gdbstub64.c
> +++ b/target-arm/gdbstub64.c
> @@ -16,7 +16,7 @@
>   * You should have received a copy of the GNU Lesser General Public
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
> -#include "config.h"
> +#include "qemu/osdep.h"
>  #include "qemu-common.h"
>  #include "exec/gdbstub.h"
>  
> diff --git a/target-arm/helper-a64.c b/target-arm/helper-a64.c
> index deb8dbe..c46af93 100644
> --- a/target-arm/helper-a64.c
> +++ b/target-arm/helper-a64.c
> @@ -17,6 +17,7 @@
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
>  
> +#include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "exec/gdbstub.h"
>  #include "exec/helper-proto.h"
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index afc4163..18d60ff 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -1,3 +1,4 @@
> +#include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "internals.h"
>  #include "exec/gdbstub.h"
> diff --git a/target-arm/iwmmxt_helper.c b/target-arm/iwmmxt_helper.c
> index a506914..7d87e1a 100644
> --- a/target-arm/iwmmxt_helper.c
> +++ b/target-arm/iwmmxt_helper.c
> @@ -19,8 +19,7 @@
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
>  
> -#include <stdlib.h>
> -#include <stdio.h>
> +#include "qemu/osdep.h"
>  
>  #include "cpu.h"
>  #include "exec/exec-all.h"
> diff --git a/target-arm/kvm-stub.c b/target-arm/kvm-stub.c
> index db2edc2..38bf433 100644
> --- a/target-arm/kvm-stub.c
> +++ b/target-arm/kvm-stub.c
> @@ -9,6 +9,7 @@
>   * See the COPYING file in the top-level directory.
>   *
>   */
> +#include "qemu/osdep.h"
>  #include "qemu-common.h"
>  #include "kvm_arm.h"
>  
> diff --git a/target-arm/kvm.c b/target-arm/kvm.c
> index 79ef4c6..c1c5584 100644
> --- a/target-arm/kvm.c
> +++ b/target-arm/kvm.c
> @@ -8,8 +8,7 @@
>   *
>   */
>  
> -#include <stdio.h>
> -#include <sys/types.h>
> +#include "qemu/osdep.h"
>  #include <sys/ioctl.h>
>  #include <sys/mman.h>
>  
> diff --git a/target-arm/kvm32.c b/target-arm/kvm32.c
> index df1e2b0..646ba41 100644
> --- a/target-arm/kvm32.c
> +++ b/target-arm/kvm32.c
> @@ -8,8 +8,7 @@
>   *
>   */
>  
> -#include <stdio.h>
> -#include <sys/types.h>
> +#include "qemu/osdep.h"
>  #include <sys/ioctl.h>
>  #include <sys/mman.h>
>  
> diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c
> index ceebfeb..d409259 100644
> --- a/target-arm/kvm64.c
> +++ b/target-arm/kvm64.c
> @@ -8,14 +8,12 @@
>   *
>   */
>  
> -#include <stdio.h>
> -#include <sys/types.h>
> +#include "qemu/osdep.h"
>  #include <sys/ioctl.h>
>  #include <sys/mman.h>
>  
>  #include <linux/kvm.h>
>  
> -#include "config-host.h"
>  #include "qemu-common.h"
>  #include "qemu/timer.h"
>  #include "sysemu/sysemu.h"
> diff --git a/target-arm/machine.c b/target-arm/machine.c
> index 36a0d15..97cbfe3 100644
> --- a/target-arm/machine.c
> +++ b/target-arm/machine.c
> @@ -1,3 +1,4 @@
> +#include "qemu/osdep.h"
>  #include "hw/hw.h"
>  #include "hw/boards.h"
>  #include "qemu/error-report.h"
> diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
> index 47d13e9..1f1844f 100644
> --- a/target-arm/neon_helper.c
> +++ b/target-arm/neon_helper.c
> @@ -6,8 +6,7 @@
>   *
>   * This code is licensed under the GNU GPL v2.
>   */
> -#include <stdlib.h>
> -#include <stdio.h>
> +#include "qemu/osdep.h"
>  
>  #include "cpu.h"
>  #include "exec/exec-all.h"
> diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
> index 6cd54c8..af5a783 100644
> --- a/target-arm/op_helper.c
> +++ b/target-arm/op_helper.c
> @@ -16,6 +16,7 @@
>   * You should have received a copy of the GNU Lesser General Public
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
> +#include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "exec/helper-proto.h"
>  #include "internals.h"
> diff --git a/target-arm/psci.c b/target-arm/psci.c
> index 20e4cb6..c55487f 100644
> --- a/target-arm/psci.c
> +++ b/target-arm/psci.c
> @@ -15,6 +15,7 @@
>   *  You should have received a copy of the GNU General Public License
>   *  along with this program; if not, see <http://www.gnu.org/licenses/>.
>   */
> +#include "qemu/osdep.h"
>  #include <cpu.h>
>  #include <cpu-qom.h>
>  #include <exec/helper-proto.h>
> diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
> index 14e8131..80f6c20 100644
> --- a/target-arm/translate-a64.c
> +++ b/target-arm/translate-a64.c
> @@ -16,11 +16,7 @@
>   * You should have received a copy of the GNU Lesser General Public
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
> -#include <stdarg.h>
> -#include <stdlib.h>
> -#include <stdio.h>
> -#include <string.h>
> -#include <inttypes.h>
> +#include "qemu/osdep.h"
>  
>  #include "cpu.h"
>  #include "tcg-op.h"
> diff --git a/target-arm/translate.c b/target-arm/translate.c
> index 5d22879..48884ab 100644
> --- a/target-arm/translate.c
> +++ b/target-arm/translate.c
> @@ -18,11 +18,7 @@
>   * You should have received a copy of the GNU Lesser General Public
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
> -#include <stdarg.h>
> -#include <stdlib.h>
> -#include <stdio.h>
> -#include <string.h>
> -#include <inttypes.h>
> +#include "qemu/osdep.h"
>  
>  #include "cpu.h"
>  #include "internals.h"
> --

Looks like the script is producing sane results

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>

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 :|

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

* Re: [Qemu-devel] [PATCH 0/3] clean-includes script to add osdep.h to everything
  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
  0 siblings, 2 replies; 12+ messages in thread
From: Peter Maydell @ 2016-01-18 16:33 UTC (permalink / raw)
  To: Daniel P. Berrange
  Cc: Paolo Bonzini, QEMU Developers, Markus Armbruster, Patch Tracking

On 11 January 2016 at 15:19, Daniel P. Berrange <berrange@redhat.com> wrote:
> 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.

In the absence of any other comments from anybody I guess we can
go ahead and commit this series... (the osdep.h patch it depends
on has been committed already).

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

I guess I'll start off with some series for the obviously maintained
areas of the tree and then we can mop up the rest later.

(At some point a script which identifies files which haven't been
cleaned up yet would be handy.)

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

OK, let's assume that works.

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH 0/3] clean-includes script to add osdep.h to everything
  2016-01-18 16:33   ` Peter Maydell
@ 2016-01-18 17:08     ` Peter Maydell
  2016-01-19  7:27     ` Markus Armbruster
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Maydell @ 2016-01-18 17:08 UTC (permalink / raw)
  To: Daniel P. Berrange
  Cc: Paolo Bonzini, QEMU Developers, Markus Armbruster, Patch Tracking

On 18 January 2016 at 16:33, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 11 January 2016 at 15:19, Daniel P. Berrange <berrange@redhat.com> wrote:
>> 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.
>
> In the absence of any other comments from anybody I guess we can
> go ahead and commit this series... (the osdep.h patch it depends
> on has been committed already).

...now applied to master.

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH 0/3] clean-includes script to add osdep.h to everything
  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
  1 sibling, 1 reply; 12+ messages in thread
From: Markus Armbruster @ 2016-01-19  7:27 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, QEMU Developers, Patch Tracking

Peter Maydell <peter.maydell@linaro.org> writes:

> On 11 January 2016 at 15:19, Daniel P. Berrange <berrange@redhat.com> wrote:
>> 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.
>
> In the absence of any other comments from anybody I guess we can
> go ahead and commit this series... (the osdep.h patch it depends
> on has been committed already).
>
>>> 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.
>
> I guess I'll start off with some series for the obviously maintained
> areas of the tree and then we can mop up the rest later.
>
> (At some point a script which identifies files which haven't been
> cleaned up yet would be handy.)

Do what you think is best.  I'd go for a single patch fixing up the
complete tree.

>>> 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.
>
> OK, let's assume that works.

If it doesn't, we need a header with just configuration results that is
included in every .c file first.  Just like config.h should be when
using autoconf.

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

* Re: [Qemu-devel] [PATCH 0/3] clean-includes script to add osdep.h to everything
  2016-01-19  7:27     ` Markus Armbruster
@ 2016-01-19  8:46       ` Peter Maydell
  0 siblings, 0 replies; 12+ messages in thread
From: Peter Maydell @ 2016-01-19  8:46 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Paolo Bonzini, QEMU Developers, Patch Tracking

On 19 January 2016 at 07:27, Markus Armbruster <armbru@redhat.com> wrote:
> Peter Maydell <peter.maydell@linaro.org> writes:
>
>> On 11 January 2016 at 15:19, Daniel P. Berrange <berrange@redhat.com> wrote:
>>> 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.
>>
>> OK, let's assume that works.
>
> If it doesn't, we need a header with just configuration results that is
> included in every .c file first.  Just like config.h should be when
> using autoconf.

An example of the kind of code that I wasn't sure about is
the stuff in tests/tcg/mips/ -- this currently doesn't
include any QEMU headers that I can see and I don't think
they're even on the include path.

In any case I'll do the obvious stuff first and circle back
to the oddball standalone sources later.

thanks
-- PMM

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