script/clean-includes: added duplicate #include check
PATCH 1/2 script/clean-includes: added duplicate #include check
Added script to check duplicate #include entries. This check will scan and print the files in which duplicate #include entries are present.
Script might output false positive entries as well. Such entries should not be removed. So if it finds any duplicate entries script will terminate with an exit status 1. Then each and every file should be checked manually and corrected if necessary.
In order to enable the check use --check-duphead option with script/clean-includes.
--- scripts/clean-includes | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-)
scripts/clean-includes +37 -13
@@ -14,15 +14,18 @@ # the top-level directory. # Usage: -# clean-includes [--git subjectprefix] file ... +# clean-includes [--git subjectprefix] [--check-duphead] file ... # or -# clean-includes [--git subjectprefix] --all +# clean-includes [--git subjectprefix] [--check-duphead] --all # # 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. # +# If --check-duphead option is used, then check for duplicate +# header files will be enabled. +# # Using --all will cause clean-includes to run on the whole source # tree (excluding certain directories which are known not to need # handling).
@@ -45,23 +48,36 @@ GIT=no +DUPHEAD=no # Extended regular expression defining files to ignore when using --all XDIRREGEX='^(tests/tcg|tests/multiboot|pc-bios|disas/libvixl)' -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 +while true +do + case $1 in + "--git") + if [ $# -eq 1 ]; then + echo "--git option requires an argument" + exit 1 + fi + GITSUBJ="$2" + GIT=yes + shift + shift + ;; + "--check-duphead") + DUPHEAD=yes + shift + ;; + *) + break + ;; + esac +done if [ $# -eq 0 ]; then - echo "Usage: clean-includes [--git subjectprefix] [--all | foo.c ...]" + echo "Usage: clean-includes [--git subjectprefix] [--check-duphead] [--all | foo.c ...]" echo "(modifies the files in place)" exit 1 fi
@@ -154,6 +170,14 @@ for f in "$@"; do done +if [ "$DUPHEAD" = "yes" ]; then + grep "^#include" $@ | sort | uniq -c | awk '{if ($1 > 1) print $0}' + if [ $? -eq 0 ]; then + echo "Found duplicate header file includes. Please check the above files manually." + exit 1 + fi +fi + if [ "$GIT" = "yes" ]; then git add -- "$@" git commit --signoff -F - <<EOF
Signature · 1 line
2.7.4
PATCH 2/2 clean-up: removed duplicate #includes
Some files contain multiple #includes of the same header file. Removed most of those unnecessary duplicate entries using scripts/clean-includes.
--- accel.c | 1 - cputlb.c | 1 - gdbstub.c | 1 - hw/i386/acpi-build.c | 1 - hw/microblaze/boot.c | 1 - hw/mips/mips_malta.c | 1 - hw/nvram/fw_cfg.c | 1 - hw/pci-bridge/pci_expander_bridge.c | 1 - hw/ppc/ppc405_boards.c | 1 - hw/ppc/spapr.c | 1 - hw/timer/grlib_gptimer.c | 1 - hw/tpm/tpm_tis.c | 1 - hw/unicore32/puv3.c | 1 - hw/usb/dev-mtp.c | 1 - include/hw/i386/pc.h | 1 - monitor.c | 2 -- qemu-io-cmds.c | 1 - qmp.c | 1 - target-i386/machine.c | 3 --- target-mips/machine.c | 1 - target-ppc/machine.c | 1 - target-ppc/mem_helper.c | 1 - target-sparc/machine.c | 3 --- target-xtensa/translate.c | 1 - tests/crypto-tls-x509-helpers.h | 3 --- tests/vhost-user-test.c | 2 -- util/oslib-posix.c | 1 - vl.c | 1 - 28 files changed, 36 deletions(-)
accel.c +0 -1
@@ -33,7 +33,6 @@#include "sysemu/qtest.h" #include "hw/xen/xen.h" #include "qom/object.h" -#include "hw/boards.h" int tcg_tb_size;static bool tcg_allowed = true;
cputlb.c +0 -1
@@ -28,7 +28,6 @@#include "exec/memory-internal.h" #include "exec/ram_addr.h" -#include "exec/exec-all.h" #include "tcg/tcg.h" #include "qemu/error-report.h" #include "exec/log.h"
gdbstub.c +0 -1
@@ -31,7 +31,6 @@#define MAX_PACKET_LENGTH 4096 -#include "cpu.h" #include "qemu/sockets.h" #include "sysemu/kvm.h" #include "exec/semihost.h"
hw/i386/acpi-build.c +0 -1
@@ -53,7 +53,6 @@#include "hw/pci/pci_bus.h" #include "hw/pci-host/q35.h" #include "hw/i386/x86-iommu.h" -#include "hw/timer/hpet.h" #include "hw/acpi/aml-build.h"
hw/microblaze/boot.c +0 -1
@@ -30,7 +30,6 @@#include "qemu/option.h" #include "qemu/config-file.h" #include "qemu/error-report.h" -#include "qemu-common.h" #include "sysemu/device_tree.h" #include "sysemu/sysemu.h" #include "hw/loader.h"
hw/mips/mips_malta.c +0 -1
@@ -47,7 +47,6 @@#include "elf.h" #include "hw/timer/mc146818rtc.h" #include "hw/timer/i8254.h" -#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "hw/sysbus.h" /* SysBusDevice */
hw/nvram/fw_cfg.c +0 -1
@@ -29,7 +29,6 @@#include "hw/isa/isa.h" #include "hw/nvram/fw_cfg.h" #include "hw/sysbus.h" -#include "hw/boards.h" #include "trace.h" #include "qemu/error-report.h" #include "qemu/config-file.h"
hw/pci-bridge/pci_expander_bridge.c +0 -1
@@ -15,7 +15,6 @@#include "hw/pci/pci.h" #include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" -#include "hw/pci/pci_bus.h" #include "hw/pci/pci_bridge.h" #include "hw/i386/pc.h" #include "qemu/range.h"
hw/ppc/ppc405_boards.c +0 -1
@@ -37,7 +37,6 @@#include "qemu/log.h" #include "qemu/error-report.h" #include "hw/loader.h" -#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h"
hw/ppc/spapr.c +0 -1
@@ -37,7 +37,6 @@#include "sysemu/block-backend.h" #include "sysemu/cpus.h" #include "sysemu/kvm.h" -#include "sysemu/device_tree.h" #include "kvm_ppc.h" #include "migration/migration.h" #include "mmu-hash64.h"
hw/timer/grlib_gptimer.c +0 -1
@@ -26,7 +26,6 @@#include "hw/sysbus.h" #include "qemu/timer.h" #include "hw/ptimer.h" -#include "qemu/timer.h" #include "qemu/main-loop.h" #include "trace.h"
hw/tpm/tpm_tis.c +0 -1
@@ -34,7 +34,6 @@#include "qapi/error.h" #include "qemu-common.h" #include "qemu/main-loop.h" -#include "sysemu/tpm_backend.h" #define DEBUG_TIS 0
hw/unicore32/puv3.c +0 -1
@@ -13,7 +13,6 @@#include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" -#include "qemu-common.h" #include "ui/console.h" #include "elf.h" #include "exec/address-spaces.h"
hw/usb/dev-mtp.c +0 -1
@@ -17,7 +17,6 @@#include <sys/statvfs.h> #ifdef CONFIG_INOTIFY1 #include <sys/inotify.h> -#include "qapi/error.h" #include "qemu/main-loop.h" #endif
include/hw/i386/pc.h +0 -1
@@ -13,7 +13,6 @@#include "qemu/bitmap.h" #include "sysemu/sysemu.h" #include "hw/pci/pci.h" -#include "hw/boards.h" #include "hw/compat.h" #include "hw/mem/pc-dimm.h" #include "hw/mem/nvdimm.h"
monitor.c +0 -2
@@ -59,7 +59,6 @@#include "qapi/qmp/json-streamer.h" #include "qapi/qmp/json-parser.h" #include "qom/object_interfaces.h" -#include "cpu.h" #include "trace.h" #include "trace/control.h" #include "monitor/hmp-target.h"
@@ -76,7 +75,6 @@#include "qapi/qmp-event.h" #include "qapi-event.h" #include "qmp-introspect.h" -#include "sysemu/block-backend.h" #include "sysemu/qtest.h" #include "qemu/cutils.h" #include "qapi/qmp/dispatch.h"
qemu-io-cmds.c +0 -1
@@ -18,7 +18,6 @@#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/timer.h" -#include "sysemu/block-backend.h" #include "qemu/cutils.h" #define CMD_NOFILE_OK 0x01
qmp.c +0 -1
@@ -36,7 +36,6 @@#include "qom/object_interfaces.h" #include "hw/mem/pc-dimm.h" #include "hw/acpi/acpi_dev_interface.h" -#include "qemu/uuid.h" NameInfo *qmp_query_name (Error **errp) {
target-i386/machine.c +0 -3
@@ -7,10 +7,7 @@#include "hw/i386/pc.h" #include "hw/isa/isa.h" #include "migration/cpu.h" -#include "exec/exec-all.h" -#include "cpu.h" -#include "exec/exec-all.h" #include "sysemu/kvm.h" #include "qemu/error-report.h"
target-mips/machine.c +0 -1
@@ -2,7 +2,6 @@#include "qemu-common.h" #include "cpu.h" #include "hw/hw.h" -#include "cpu.h" #include "migration/cpu.h" static int cpu_post_load (void *opaque,int version_id)
target-ppc/machine.c +0 -1
@@ -8,7 +8,6 @@#include "helper_regs.h" #include "mmu-hash64.h" #include "migration/cpu.h" -#include "exec/exec-all.h" static int cpu_load_old (QEMUFile *f,void *opaque,int version_id) {
target-ppc/mem_helper.c +0 -1
@@ -23,7 +23,6 @@#include "exec/helper-proto.h" #include "helper_regs.h" -#include "exec/exec-all.h" #include "exec/cpu_ldst.h" //#define DEBUG_OP
target-sparc/machine.c +0 -3
@@ -6,10 +6,7 @@#include "hw/boards.h" #include "qemu/timer.h" -#include "cpu.h" -#include "exec/exec-all.h" #include "migration/cpu.h" -#include "exec/exec-all.h" #ifdef TARGET_SPARC64 static const VMStateDescription vmstate_cpu_timer = {
target-xtensa/translate.c +0 -1
@@ -36,7 +36,6 @@#include "tcg-op.h" #include "qemu/log.h" #include "sysemu/sysemu.h" -#include "exec/exec-all.h" #include "exec/cpu_ldst.h" #include "exec/semihost.h"
tests/crypto-tls-x509-helpers.h +0 -3
@@ -21,9 +21,6 @@#include <gnutls/gnutls.h> #include <gnutls/x509.h> -#include <gnutls/gnutls.h> -#include <gnutls/x509.h> -#if !(definedWIN32 ) && \ defined(CONFIG_TASN1 ) && \ (LIBGNUTLS_VERSION_NUMBER >=0x020600 )
tests/vhost-user-test.c +0 -2
@@ -20,8 +20,6 @@#include "libqos/pci-pc.h" #include "libqos/virtio-pci.h" -#include "libqos/pci-pc.h" -#include "libqos/virtio-pci.h" #include "libqos/malloc-pc.h" #include "hw/virtio/virtio-net.h"
util/oslib-posix.c +0 -1
@@ -28,7 +28,6 @@#include "qemu/osdep.h" #include <termios.h> -#include <termios.h> #include <glib/gprintf.h>
vl.c +0 -1
@@ -110,7 +110,6 @@ int main(int argc, char **argv)#include "trace.h" #include "trace/control.h" #include "qemu/queue.h" -#include "sysemu/cpus.h" #include "sysemu/arch_init.h" #include "ui/qemu-spice.h"
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PATCH 2/2] clean-up: removed duplicate #includes
Quoted 395 lines · Anand J
Some files contain multiple #includes of the same header file. Removed most of those unnecessary duplicate entries using
scripts/clean-includes.Signed-off-by Anand J <[email protected]>--- accel.c | 1 - cputlb.c | 1 - gdbstub.c | 1 - hw/i386/acpi-build.c | 1 - hw/microblaze/boot.c | 1 - hw/mips/mips_malta.c | 1 - hw/nvram/fw_cfg.c | 1 - hw/pci-bridge/pci_expander_bridge.c | 1 - hw/ppc/ppc405_boards.c | 1 - hw/ppc/spapr.c | 1 - hw/timer/grlib_gptimer.c | 1 - hw/tpm/tpm_tis.c | 1 - hw/unicore32/puv3.c | 1 - hw/usb/dev-mtp.c | 1 - include/hw/i386/pc.h | 1 - monitor.c | 2 -- qemu-io-cmds.c | 1 - qmp.c | 1 - target-i386/machine.c | 3 --- target-mips/machine.c | 1 - target-ppc/machine.c | 1 - target-ppc/mem_helper.c | 1 - target-sparc/machine.c | 3 --- target-xtensa/translate.c | 1 - tests/crypto-tls-x509-helpers.h | 3 --- tests/vhost-user-test.c | 2 -- util/oslib-posix.c | 1 - vl.c | 1 - 28 files changed, 36 deletions(-)accel.c +0
-1@@ -33,7 +33,6 @@#include "sysemu/qtest.h" #include "hw/xen/xen.h" #include "qom/object.h" -#include "hw/boards.h" int tcg_tb_size;static bool tcg_allowed = true;cputlb.c +0
-1@@ -28,7 +28,6 @@#include "exec/memory-internal.h" #include "exec/ram_addr.h" -#include "exec/exec-all.h" #include "tcg/tcg.h" #include "qemu/error-report.h" #include "exec/log.h" gdbstub.c +0
-1@@ -31,7 +31,6 @@#define MAX_PACKET_LENGTH 4096 -#include "cpu.h" #include "qemu/sockets.h" #include "sysemu/kvm.h" #include "exec/semihost.h" hw/i386/acpi-build.c +0
-1@@ -53,7 +53,6 @@#include "hw/pci/pci_bus.h" #include "hw/pci-host/q35.h" #include "hw/i386/x86-iommu.h" -#include "hw/timer/hpet.h" #include "hw/acpi/aml-build.h" hw/microblaze/boot.c +0
-1@@ -30,7 +30,6 @@#include "qemu/option.h" #include "qemu/config-file.h" #include "qemu/error-report.h" -#include "qemu-common.h" #include "sysemu/device_tree.h" #include "sysemu/sysemu.h" #include "hw/loader.h" hw/mips/mips_malta.c +0
-1@@ -47,7 +47,6 @@#include "elf.h" #include "hw/timer/mc146818rtc.h" #include "hw/timer/i8254.h" -#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "hw/sysbus.h" /* SysBusDevice */ hw/nvram/fw_cfg.c +0
-1@@ -29,7 +29,6 @@#include "hw/isa/isa.h" #include "hw/nvram/fw_cfg.h" #include "hw/sysbus.h" -#include "hw/boards.h" #include "trace.h" #include "qemu/error-report.h" #include "qemu/config-file.h" hw/pci-bridge/pci_expander_bridge.c +0
-1@@ -15,7 +15,6 @@#include "hw/pci/pci.h" #include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" -#include "hw/pci/pci_bus.h" #include "hw/pci/pci_bridge.h" #include "hw/i386/pc.h" #include "qemu/range.h" hw/ppc/ppc405_boards.c +0
-1@@ -37,7 +37,6 @@#include "qemu/log.h" #include "qemu/error-report.h" #include "hw/loader.h" -#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" hw/ppc/spapr.c +0
-1@@ -37,7 +37,6 @@#include "sysemu/block-backend.h" #include "sysemu/cpus.h" #include "sysemu/kvm.h" -#include "sysemu/device_tree.h" #include "kvm_ppc.h" #include "migration/migration.h" #include "mmu-hash64.h" hw/timer/grlib_gptimer.c +0
-1@@ -26,7 +26,6 @@#include "hw/sysbus.h" #include "qemu/timer.h" #include "hw/ptimer.h" -#include "qemu/timer.h" #include "qemu/main-loop.h" #include "trace.h" hw/tpm/tpm_tis.c +0
-1@@ -34,7 +34,6 @@#include "qapi/error.h" #include "qemu-common.h" #include "qemu/main-loop.h" -#include "sysemu/tpm_backend.h" #define DEBUG_TIS 0hw/unicore32/puv3.c +0
-1@@ -13,7 +13,6 @@#include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" -#include "qemu-common.h" #include "ui/console.h" #include "elf.h" #include "exec/address-spaces.h" hw/usb/dev-mtp.c +0
-1@@ -17,7 +17,6 @@#include <sys/statvfs.h> #ifdef CONFIG_INOTIFY1 #include <sys/inotify.h> -#include "qapi/error.h" #include "qemu/main-loop.h" #endif include/hw/i386/pc.h +0
-1@@ -13,7 +13,6 @@#include "qemu/bitmap.h" #include "sysemu/sysemu.h" #include "hw/pci/pci.h" -#include "hw/boards.h" #include "hw/compat.h" #include "hw/mem/pc-dimm.h" #include "hw/mem/nvdimm.h" monitor.c +0
-2@@ -59,7 +59,6 @@#include "qapi/qmp/json-streamer.h" #include "qapi/qmp/json-parser.h" #include "qom/object_interfaces.h" -#include "cpu.h" #include "trace.h" #include "trace/control.h" #include "monitor/hmp-target.h" @@ -76,7 +75,6 @@#include "qapi/qmp-event.h" #include "qapi-event.h" #include "qmp-introspect.h" -#include "sysemu/block-backend.h" #include "sysemu/qtest.h" #include "qemu/cutils.h" #include "qapi/qmp/dispatch.h" qemu-io-cmds.c +0
-1@@ -18,7 +18,6 @@#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/timer.h" -#include "sysemu/block-backend.h" #include "qemu/cutils.h" #define CMD_NOFILE_OK 0x01qmp.c +0
-1@@ -36,7 +36,6 @@#include "qom/object_interfaces.h" #include "hw/mem/pc-dimm.h" #include "hw/acpi/acpi_dev_interface.h" -#include "qemu/uuid.h" NameInfo *qmp_query_name (Error **errp) {target-i386/machine.c +0
-3@@ -7,10 +7,7 @@#include "hw/i386/pc.h" #include "hw/isa/isa.h" #include "migration/cpu.h" -#include "exec/exec-all.h" -#include "cpu.h" -#include "exec/exec-all.h" #include "sysemu/kvm.h" #include "qemu/error-report.h" target-mips/machine.c +0
-1@@ -2,7 +2,6 @@#include "qemu-common.h" #include "cpu.h" #include "hw/hw.h" -#include "cpu.h" #include "migration/cpu.h" static int cpu_post_load (void *opaque,int version_id)target-ppc/machine.c +0
-1@@ -8,7 +8,6 @@#include "helper_regs.h" #include "mmu-hash64.h" #include "migration/cpu.h" -#include "exec/exec-all.h" static int cpu_load_old (QEMUFile *f,void *opaque,int version_id) {target-ppc/mem_helper.c +0
-1@@ -23,7 +23,6 @@#include "exec/helper-proto.h" #include "helper_regs.h" -#include "exec/exec-all.h" #include "exec/cpu_ldst.h" //#define DEBUG_OP target-sparc/machine.c +0
-3@@ -6,10 +6,7 @@#include "hw/boards.h" #include "qemu/timer.h" -#include "cpu.h" -#include "exec/exec-all.h" #include "migration/cpu.h" -#include "exec/exec-all.h" #ifdef TARGET_SPARC64 static const VMStateDescription vmstate_cpu_timer = {target-xtensa/translate.c +0
-1@@ -36,7 +36,6 @@#include "tcg-op.h" #include "qemu/log.h" #include "sysemu/sysemu.h" -#include "exec/exec-all.h" #include "exec/cpu_ldst.h" #include "exec/semihost.h" tests/crypto-tls-x509- renamed from tests/crypto-tls-x509-helpers.h +0
-0
helpers.h
index a8faa92..921341c 100644tests/crypto-tls-x509-helpers.h +0
-3@@ -21,9 +21,6 @@#include <gnutls/gnutls.h> #include <gnutls/x509.h> -#include <gnutls/gnutls.h> -#include <gnutls/x509.h> -#if !(definedWIN32 ) && \ defined(CONFIG_TASN1 ) && \ (LIBGNUTLS_VERSION_NUMBER >=0x020600 )tests/vhost-user-test.c +0
-2@@ -20,8 +20,6 @@#include "libqos/pci-pc.h" #include "libqos/virtio-pci.h" -#include "libqos/pci-pc.h" -#include "libqos/virtio-pci.h" #include "libqos/malloc-pc.h" #include "hw/virtio/virtio-net.h" util/oslib-posix.c +0
-1@@ -28,7 +28,6 @@#include "qemu/osdep.h" #include <termios.h> -#include <termios.h> #include <glib/gprintf.h> vl.c +0
-2@@ -110,7 +110,6 @@ int main(int argc, char **argv)#include "trace.h" #include "trace/control.h" #include "qemu/queue.h" -#include "sysemu/cpus.h" #include "sysemu/arch_init.h" #include "ui/qemu-spice.h" --2.7.4
Re: [Qemu-devel] [PATCH 2/2] clean-up: removed duplicate #includes
Quoted 33 lines · Anand J
On Tue, Oct 18, 2016 at 4:03 PM, Anand J <[email protected] <mailto:[email protected]>> wrote:
Some files contain multiple #includes of the same header file. Removed most of those unnecessary duplicate entries using
scripts/clean-includes.Signed-off-by Anand J <[email protected]<mailto:[email protected]>>
---
accel.c| 1 -
cputlb.c| 1 -
gdbstub.c| 1 -
hw/i386/acpi-build.c| 1 -
hw/microblaze/boot.c| 1 -
hw/mips/mips_malta.c| 1 -
hw/nvram/fw_cfg.c| 1 -
hw/pci-bridge/pci_expander_bridge.c| 1 -
hw/ppc/ppc405_boards.c| 1 -
hw/ppc/spapr.c| 1 -
hw/timer/grlib_gptimer.c| 1 -
hw/tpm/tpm_tis.c| 1 -
hw/unicore32/puv3.c| 1 -
hw/usb/dev-mtp.c| 1 -
include/hw/i386/pc.h| 1 -
monitor.c| 2 --
qemu-io-cmds.c| 1 -
qmp.c| 1 -
target-i386/machine.c| 3 ---
target-mips/machine.c| 1 -
target-ppc/machine.c| 1 -
Quoted 8 lines
target-ppc/mem_helper.c| 1 -
target-sparc/machine.c| 3 ---
target-xtensa/translate.c| 1 -
tests/crypto-tls-x509-helpers.h| 3 ---
tests/vhost-user-test.c| 2 --
util/oslib-posix.c| 1 -
vl.c| 1 -
28 files changed, 36 deletions(-)
This patch looks also fine to me now - but again, please no HTML e-mails. Could you please resend as plain text mail with CC: to [email protected] ?
Thanks,
Thomas
Re: [Qemu-devel] [PATCH 2/2] clean-up: removed duplicate #includes
send a new patch. please check http://patchwork.ozlabs.org/patch/684532/
Thanks,
Anand
Quoted 51 lines · Thomas Huth
Quoted 33 lines · Anand J
On Tue, Oct 18, 2016 at 4:03 PM, Anand J <[email protected] <mailto:[email protected]>> wrote:
Some files contain multiple #includes of the same header file. Removed most of those unnecessary duplicate entries using
scripts/clean-includes.Signed-off-by Anand J <[email protected]<mailto:[email protected]>>
---
accel.c| 1 -
cputlb.c| 1 -
gdbstub.c| 1 -
hw/i386/acpi-build.c| 1 -
hw/microblaze/boot.c| 1 -
hw/mips/mips_malta.c| 1 -
hw/nvram/fw_cfg.c| 1 -
hw/pci-bridge/pci_expander_bridge.c| 1 -
hw/ppc/ppc405_boards.c| 1 -
hw/ppc/spapr.c| 1 -
hw/timer/grlib_gptimer.c| 1 -
hw/tpm/tpm_tis.c| 1 -
hw/unicore32/puv3.c| 1 -
hw/usb/dev-mtp.c| 1 -
include/hw/i386/pc.h| 1 -
monitor.c| 2 --
qemu-io-cmds.c| 1 -
qmp.c| 1 -
target-i386/machine.c| 3 ---
target-mips/machine.c| 1 -
target-ppc/machine.c| 1 -Quoted 8 lines
target-ppc/mem_helper.c| 1 -
target-sparc/machine.c| 3 ---
target-xtensa/translate.c| 1 -
tests/crypto-tls-x509-helpers.h| 3 ---
tests/vhost-user-test.c| 2 --
util/oslib-posix.c| 1 -
vl.c| 1 -
28 files changed, 36 deletions(-)This patch looks also fine to me now - but again, please no HTML e-mails. Could you please resend as plain text mail with CC: to [email protected] ?
Thanks,
Thomas
Quoted 111 lines · Anand J
Added script to check duplicate #include entries. This check will scan and print the files in which duplicate #include entries are present.
Script might output false positive entries as well. Such entries should not be removed. So if it finds any duplicate entries script will terminate with an exit status 1. Then each and every file should be checked manually and corrected if necessary.
In order to enable the check use --check-duphead option with script/clean-includes.
Signed-off-by Anand J <[email protected]>--- scripts/clean-includes | 50 ++++++++++++++++++++++++++++++ +++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-)scripts/clean-includes +29
-13@@ -14,15 +14,18 @@ # the top-level directory. # Usage: -# clean-includes [--git subjectprefix] file ... +# clean-includes [--git subjectprefix] [--check-duphead] file ... # or -# clean-includes [--git subjectprefix] --all +# clean-includes [--git subjectprefix] [--check-duphead] --all # # 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. # +# If --check-duphead option is used, then check for duplicate +# header files will be enabled. +# # Using --all will cause clean-includes to run on the whole source # tree (excluding certain directories which are known not to need # handling).@@ -45,23 +48,36 @@ GIT=no +DUPHEAD=no # Extended regular expression defining files to ignore when using --all XDIRREGEX='^(tests/tcg|tests/multiboot|pc-bios|disas/libvixl)' -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 +while true +do + case $1 in + "--git") + if [ $# -eq 1 ]; then + echo "--git option requires an argument" + exit 1 + fi + GITSUBJ="$2" + GIT=yes + shift + shift + ;; + "--check-duphead") + DUPHEAD=yes + shift + ;; + *) + break + ;; + esac +done if [ $# -eq 0 ]; then - echo "Usage: clean-includes [--git subjectprefix] [--all | foo.c ...]" + echo "Usage: clean-includes [--git subjectprefix] [--check-duphead][--all |
foo.c...]"
echo "(modifies the files in place)"
exit 1
fiscripts/clean-includes +4
-0@@ -154,6 +170,14 @@ for f in "$@"; do done +if [ "$DUPHEAD" = "yes" ]; then + grep "^#include" $@ | sort | uniq -c | awk '{if ($1 > 1) print $0}' + if [ $? -eq 0 ]; then + echo "Found duplicate header file includes. Please check theabove files manually."
scripts/clean-includes +4
-1+ exit 1 + fi +fi + if [ "$GIT" = "yes" ]; then git add -- "$@" git commit --signoff -F - <<EOF --2.7.4
Thomas Huth
Reviewed-byQuoted 16 lines · Anand J
On Tue, Oct 18, 2016 at 4:03 PM, Anand J <[email protected] <mailto:[email protected]>> wrote:
Added script to check duplicate #include entries. This check will scan and print the files in which duplicate #include entries are present.
Script might output false positive entries as well. Such entries should not be removed. So if it finds any duplicate entries script will terminate with an exit status 1. Then each and every file should be checked manually and corrected if necessary.
In order to enable the check use --check-duphead option with script/clean-includes.
Quoted 6 lines
Signed-off-by Anand J <[email protected]<mailto:[email protected]>>
---
scripts/clean-includes| 50
+++++++++++++++++++++++++++++++++++++-------------
1 file changed, 37 insertions(+), 13 deletions(-)
Thanks for the update, this patch looks fine to me now, so feel free to add my:
But please avoid sending patches in HTML e-mails. Could you maybe please resend the patch as plain text mail? And while you're at it, add CC: to [email protected], I think the patch is simple enough to go through the trivial tree.
Thanks,
Thomas
send a new patch. please check http://patchwork.ozlabs.org/patch/684533/
Thanks,
Anand
Quoted 40 lines · Thomas Huth
Quoted 6 lines · Anand J
On Tue, Oct 18, 2016 at 4:03 PM, Anand J <[email protected] <mailto:[email protected]>> wrote:
Added script to check duplicate #include entries. This check will
scan
Quoted 3 lines
and print the files in which duplicate #include entries are present.
Script might output false positive entries as well. Such entries
should
Quoted 7 lines
not be removed. So if it finds any duplicate entries script will terminate with an exit status 1. Then each and every file should be checked manually and corrected if necessary.
In order to enable the check use --check-duphead option with script/clean-includes.
Quoted 6 lines
Signed-off-by Anand J <[email protected]<mailto:[email protected]>>
---
scripts/clean-includes| 50
+++++++++++++++++++++++++++++++++++++-------------
1 file changed, 37 insertions(+), 13 deletions(-)Thanks for the update, this patch looks fine to me now, so feel free to add my:
Reviewed-by Thomas Huth <[email protected]>But please avoid sending patches in HTML e-mails. Could you maybe please resend the patch as plain text mail? And while you're at it, add CC: to [email protected], I think the patch is simple enough to go through the trivial tree.
Thanks,
Thomas