clean-includes script to add osdep.h to everything
Subsystems (6)
cover clean-includes script to add osdep.h to everything
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
Signature · 1 line
1.9.1
PATCH 1/3 scripts: Add new clean-includes script to fix C include directives
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.
--- scripts/clean-includes | 109 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100755 scripts/clean-includes
scripts/clean-includes new file +109 -0
@@ -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 <[email protected]> +# +# 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
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH 1/3] scripts: Add new clean-includes script to fix C include directives
Quoted 116 lines · Peter Maydell
Add a new
scripts/clean-includes, which can be used to automatically ensure that a C source file includesqemu/osdep.hfirst and doesn't then include any headers whichosdep.hprovides already.Signed-off-by Peter Maydell <[email protected]>--- scripts/clean-includes | 109 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100755 scripts/clean-includesscripts/clean-includes new file +99
-0@@ -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 <[email protected]> +# +# 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
scripts/clean-includes line 109
Quoted 10 lines
scripts/clean-includes new file +10
-0+$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
Regards,
Daniel
Signature · 4 lines
|: 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 :|
PATCH 2/3 target-arm: Clean up includes
In reply to Peter MaydellClean 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.
--- 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(-)
target-arm/arm-semi.c +1 -7
@@ -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"
target-arm/cpu.c +1 -0
@@ -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"
target-arm/cpu64.c +1 -0
@@ -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 )
target-arm/crypto_helper.c +1 -1
@@ -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"
target-arm/gdbstub.c +1 -1
@@ -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"
target-arm/gdbstub64.c +1 -1
@@ -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"
target-arm/helper-a64.c +1 -0
@@ -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"
target-arm/helper.c +1 -0
@@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include "cpu.h" #include "internals.h" #include "exec/gdbstub.h"
target-arm/iwmmxt_helper.c +1 -2
@@ -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"
target-arm/kvm-stub.c +1 -0
@@ -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"
target-arm/kvm.c +1 -2
@@ -8,8 +8,7 @@* */ -#include <stdio.h> -#include <sys/types.h> +#include "qemu/osdep.h" #include <sys/ioctl.h> #include <sys/mman.h>
target-arm/kvm32.c +1 -2
@@ -8,8 +8,7 @@* */ -#include <stdio.h> -#include <sys/types.h> +#include "qemu/osdep.h" #include <sys/ioctl.h> #include <sys/mman.h>
target-arm/kvm64.c +1 -3
@@ -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"
target-arm/machine.c +1 -0
@@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/boards.h" #include "qemu/error-report.h"
target-arm/neon_helper.c +1 -2
@@ -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"
target-arm/op_helper.c +1 -0
@@ -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"
target-arm/psci.c +1 -0
@@ -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>
target-arm/translate-a64.c +1 -5
@@ -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"
target-arm/translate.c +1 -5
@@ -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"
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH 2/3] target-arm: Clean up includes
Quoted 277 lines · Peter Maydell
Clean up includes so that
osdep.his included first and headers which it implies are not included manually.This commit was created with
scripts/clean-includes.Signed-off-by Peter Maydell <[email protected]>--- 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(-)target-arm/arm-semi.c +1
-7@@ -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" target-arm/cpu.c +1
-0@@ -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" target-arm/cpu64.c +1
-0@@ -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 )target-arm/crypto_helper.c +1
-1@@ -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" target-arm/gdbstub.c +1
-1@@ -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" target-arm/gdbstub64.c +1
-1@@ -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" target-arm/helper-a64.c +1
-0@@ -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" target-arm/helper.c +1
-0@@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include "cpu.h" #include "internals.h" #include "exec/gdbstub.h" target-arm/iwmmxt_helper.c +1
-2@@ -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" target-arm/kvm-stub.c +1
-0@@ -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" target-arm/kvm.c +1
-2@@ -8,8 +8,7 @@* */ -#include <stdio.h> -#include <sys/types.h> +#include "qemu/osdep.h" #include <sys/ioctl.h> #include <sys/mman.h> target-arm/kvm32.c +1
-2@@ -8,8 +8,7 @@* */ -#include <stdio.h> -#include <sys/types.h> +#include "qemu/osdep.h" #include <sys/ioctl.h> #include <sys/mman.h> target-arm/kvm64.c +1
-3@@ -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" target-arm/machine.c +1
-0@@ -1,3 +1,4 @@ +#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/boards.h" #include "qemu/error-report.h" target-arm/neon_helper.c +1
-2@@ -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" target-arm/op_helper.c +1
-0@@ -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" target-arm/psci.c +1
-0@@ -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> target-arm/translate-a64.c +1
-5@@ -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" target-arm/translate.c +0
-0@@ -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/>. */
target-arm/translate.c
Quoted 10 lines
target-arm/translate.c +1
-6-#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
Regards,
Daniel
Signature · 4 lines
|: 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 :|
PATCH 3/3 hw/arm: Clean up includes
In reply to Peter MaydellClean 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.
--- 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(-)
hw/arm/allwinner-a10.c +1 -0
@@ -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"
hw/arm/armv7m.c +1 -0
@@ -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"
hw/arm/boot.c +1 -1
@@ -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"
hw/arm/collie.c +1 -0
@@ -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"
hw/arm/cubieboard.c +1 -0
@@ -15,6 +15,7 @@* for more details. */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/devices.h" #include "hw/boards.h"
hw/arm/digic.c +1 -0
@@ -20,6 +20,7 @@* */ +#include "qemu/osdep.h" #include "hw/arm/digic.h" #define DIGIC4_TIMER_BASE (n) (0xc0210000 + (n) * 0x100)
hw/arm/digic_boards.c +1 -0
@@ -23,6 +23,7 @@* */ +#include "qemu/osdep.h" #include "hw/boards.h" #include "exec/address-spaces.h" #include "qemu/error-report.h"
hw/arm/exynos4210.c +1 -0
@@ -21,6 +21,7 @@* */ +#include "qemu/osdep.h" #include "hw/boards.h" #include "sysemu/sysemu.h" #include "hw/sysbus.h"
hw/arm/exynos4_boards.c +1 -0
@@ -21,6 +21,7 @@* */ +#include "qemu/osdep.h" #include "sysemu/sysemu.h" #include "sysemu/qtest.h" #include "hw/sysbus.h"
hw/arm/fsl-imx25.c +1 -0
@@ -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"
hw/arm/fsl-imx31.c +1 -0
@@ -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"
hw/arm/gumstix.c +1 -0
@@ -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"
hw/arm/highbank.c +1 -0
@@ -17,6 +17,7 @@* */ +#include "qemu/osdep.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/devices.h"
hw/arm/imx25_pdk.c +1 -0
@@ -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"
hw/arm/integratorcp.c +1 -0
@@ -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"
hw/arm/kzm.c +1 -0
@@ -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"
hw/arm/mainstone.c +1 -0
@@ -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"
hw/arm/musicpal.c +1 -0
@@ -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"
hw/arm/netduino2.c +1 -0
@@ -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"
hw/arm/nseries.c +1 -0
@@ -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"
hw/arm/omap1.c +1 -0
@@ -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"
hw/arm/omap2.c +1 -0
@@ -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"
hw/arm/omap_sx1.c +1 -0
@@ -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"
hw/arm/palm.c +1 -0
@@ -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"
hw/arm/pxa2xx.c +1 -0
@@ -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"
hw/arm/pxa2xx_gpio.c +1 -0
@@ -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"
hw/arm/pxa2xx_pic.c +1 -0
@@ -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"
hw/arm/realview.c +1 -0
@@ -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"
hw/arm/spitz.c +1 -0
@@ -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"
hw/arm/stellaris.c +1 -0
@@ -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"
hw/arm/stm32f205_soc.c +1 -0
@@ -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"
hw/arm/strongarm.c +1 -0
@@ -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"
hw/arm/sysbus-fdt.c +1 -0
@@ -21,6 +21,7 @@* */ +#include "qemu/osdep.h" #include "hw/arm/sysbus-fdt.h" #include "qemu/error-report.h" #include "sysemu/device_tree.h"
hw/arm/tosa.c +1 -0
@@ -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"
hw/arm/versatilepb.c +1 -0
@@ -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"
hw/arm/vexpress.c +1 -0
@@ -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"
hw/arm/virt-acpi-build.c +1 -0
@@ -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"
hw/arm/virt.c +1 -0
@@ -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"
hw/arm/xilinx_zynq.c +1 -0
@@ -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"
hw/arm/xlnx-ep108.c +1 -0
@@ -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"
hw/arm/xlnx-zynqmp.c +1 -0
@@ -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"
hw/arm/z2.c +1 -0
@@ -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"
Signature · 1 line
1.9.1
Ping for review, please?
thanks
-- PMM
Quoted 120 lines · Peter Maydell
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 thatosdep.hprovides.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/*.cscripts/clean-includes--git hw/arm hw/arm/*.cNB: the script assumes my patch to make
osdep.hincludeglib-compat.hhas 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.hgives us.)A question I had about including
osdep.heverywhere:
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 includeshw/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
Quoted 29 lines · Peter Maydell
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 thatosdep.hprovides.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/*.cscripts/clean-includes--git hw/arm hw/arm/*.cNB: the script assumes my patch to make
osdep.hincludeglib-compat.hhas already been applied:
http://patchwork.ozlabs.org/patch/552828/
Quoted 6 lines
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.
Quoted 2 lines
(The part that will depend on these having gone in is where we update .h files to not include headers that
osdep.hgives us.)
Ideally it'd be good to get this done before 2.6, again just to avoid a long ongoing work in progress conversion.
Quoted 4 lines
A question I had about including
osdep.heverywhere:
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
Signature · 4 lines
|: 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 :|
Quoted 9 lines · Daniel P. Berrange
Quoted 8 lines · Peter Maydell
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 thatosdep.hprovides.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).
Quoted 15 lines
Quoted 8 lines
Patches 2 and 3 are examples of its output, produced via
scripts/clean-includes--git target-arm target-arm/*.cscripts/clean-includes--git hw/arm hw/arm/*.cNB: the script assumes my patch to make
osdep.hincludeglib-compat.hhas already been applied:
http://patchwork.ozlabs.org/patch/552828/Quoted 6 lines
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.
Quoted 3 lines
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.)
Quoted 9 lines
Quoted 4 lines
A question I had about including
osdep.heverywhere:
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
Quoted 8 lines · Peter Maydell
Quoted 7 lines · Daniel P. Berrange
Quoted 6 lines · Peter Maydell
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 thatosdep.hprovides.
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
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.hpatch it depends on has been committed already).
...now applied to master.
thanks
-- PMM
Quoted 34 lines · Peter Maydell
Quoted 9 lines · Daniel P. Berrange
Quoted 8 lines · Peter Maydell
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 thatosdep.hprovides.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.hpatch it depends on has been committed already).Quoted 15 lines
Quoted 8 lines
Patches 2 and 3 are examples of its output, produced via
scripts/clean-includes--git target-arm target-arm/*.cscripts/clean-includes--git hw/arm hw/arm/*.cNB: the script assumes my patch to make
osdep.hincludeglib-compat.hhas already been applied:
http://patchwork.ozlabs.org/patch/552828/Quoted 6 lines
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.
Quoted 3 lines
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.
Quoted 5 lines
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.
Quoted 11 lines
Quoted 9 lines
Quoted 4 lines
A question I had about including
osdep.heverywhere:
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.
Quoted 8 lines · Markus Armbruster
Quoted 6 lines · Peter Maydell
Quoted 4 lines · Daniel P. Berrange
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.
Quoted 5 lines
Quoted 1 line
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.hshould 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