diff options
48 files changed, 121 insertions, 148 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 82d4d0083b..6be7e1ed45 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -63,6 +63,17 @@ W: http://wiki.qemu.org/SecurityProcess M: Michael S. Tsirkin <mst@redhat.com> L: secalert@redhat.com +Trivial patches +--------------- +Trivial patches +M: Michael Tokarev <mjt@tls.msk.ru> +M: Laurent Vivier <laurent@vivier.eu> +S: Maintained +L: qemu-trivial@nongnu.org +K: ^Subject:.*(?i)trivial +T: git git://git.corpit.ru/qemu.git trivial-patches +T: git git://github.com/vivier/qemu.git trivial-patches + Guest CPU cores (TCG): ---------------------- Overall @@ -695,7 +695,7 @@ help: @echo '' ifdef CONFIG_WIN32 @echo 'Windows targets:' - @echo ' installer - Build NSIS-based installer for qemu-ga' + @echo ' installer - Build NSIS-based installer for QEMU' ifdef QEMU_GA_MSI_ENABLED @echo ' msi - Build MSI-based installer for qemu-ga' endif @@ -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; @@ -26,7 +26,6 @@ #include "exec/cputlb.h" #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" @@ -31,7 +31,6 @@ #define MAX_PACKET_LENGTH 4096 -#include "cpu.h" #include "qemu/sockets.h" #include "sysemu/kvm.h" #include "exec/semihost.h" diff --git a/hw/block/nvme.c b/hw/block/nvme.c index b380142028..d479fd22f5 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -375,7 +375,7 @@ static uint16_t nvme_create_sq(NvmeCtrl *n, NvmeCmd *cmd) if (!cqid || nvme_check_cqid(n, cqid)) { return NVME_INVALID_CQID | NVME_DNR; } - if (!sqid || (sqid && !nvme_check_sqid(n, sqid))) { + if (!sqid || !nvme_check_sqid(n, sqid)) { return NVME_INVALID_QID | NVME_DNR; } if (!qsize || qsize > NVME_CAP_MQES(n->bar.cap)) { @@ -449,7 +449,7 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeCmd *cmd) uint16_t qflags = le16_to_cpu(c->cq_flags); uint64_t prp1 = le64_to_cpu(c->prp1); - if (!cqid || (cqid && !nvme_check_cqid(n, cqid))) { + if (!cqid || !nvme_check_cqid(n, cqid)) { return NVME_INVALID_CQID | NVME_DNR; } if (!qsize || qsize > NVME_CAP_MQES(n->bar.cap)) { diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c index 9c0018448a..5c666f9b24 100644 --- a/hw/display/milkymist-tmu2.c +++ b/hw/display/milkymist-tmu2.c @@ -213,7 +213,7 @@ static void tmu2_start(MilkymistTMU2State *s) /* Read the QEMU source framebuffer into an OpenGL texture */ glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); - fb_len = 2*s->regs[R_TEXHRES]*s->regs[R_TEXVRES]; + fb_len = 2ULL * s->regs[R_TEXHRES] * s->regs[R_TEXVRES]; fb = cpu_physical_memory_map(s->regs[R_TEXFBUF], &fb_len, 0); if (fb == NULL) { glDeleteTextures(1, &texture); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 93be96f89c..5cd1da9a87 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -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" diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 9eebb1a521..1834d22a61 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -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" diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index cf9bd3eb45..cf48f420cc 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -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 */ diff --git a/hw/misc/milkymist-pfpu.c b/hw/misc/milkymist-pfpu.c index 1da21a643e..3ca25894f1 100644 --- a/hw/misc/milkymist-pfpu.c +++ b/hw/misc/milkymist-pfpu.c @@ -137,7 +137,7 @@ struct MilkymistPFPUState { }; typedef struct MilkymistPFPUState MilkymistPFPUState; -static inline hwaddr +static inline uint32_t get_dma_address(uint32_t base, uint32_t x, uint32_t y) { return base + 8 * (128 * y + x); diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 92aa563929..1f0c3e9910 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -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" diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c index 1cc598f7e9..6ac187fa32 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -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" diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index 4b2f07aecb..d01798f245 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -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" diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c8e29212cb..807ac52aed 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -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" diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index b7f8bca1fd..bbbe0b1245 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -809,17 +809,11 @@ static uint32_t s390_pci_generate_fid(Error **errp) { uint32_t fid = 0; - while (fid <= ZPCI_MAX_FID) { + do { if (!s390_pci_find_dev_by_fid(fid)) { return fid; } - - if (fid == ZPCI_MAX_FID) { - break; - } - - fid++; - } + } while (fid++ != ZPCI_MAX_FID); error_setg(errp, "no free fid could be found"); return 0; diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c index 712d1aece5..4ed96e970a 100644 --- a/hw/timer/grlib_gptimer.c +++ b/hw/timer/grlib_gptimer.c @@ -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" diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c index e88c0d20bc..9234eb3459 100644 --- a/hw/tpm/tpm_passthrough.c +++ b/hw/tpm/tpm_passthrough.c @@ -165,8 +165,7 @@ static int tpm_passthrough_unix_tx_bufs(TPMPassthruState *tpm_pt, ret = tpm_passthrough_unix_write(tpm_pt->tpm_fd, in, in_len); if (ret != in_len) { - if (!tpm_pt->tpm_op_canceled || - (tpm_pt->tpm_op_canceled && errno != ECANCELED)) { + if (!tpm_pt->tpm_op_canceled || errno != ECANCELED) { error_report("tpm_passthrough: error while transmitting data " "to TPM: %s (%i)", strerror(errno), errno); @@ -178,8 +177,7 @@ static int tpm_passthrough_unix_tx_bufs(TPMPassthruState *tpm_pt, ret = tpm_passthrough_unix_read(tpm_pt->tpm_fd, out, out_len); if (ret < 0) { - if (!tpm_pt->tpm_op_canceled || - (tpm_pt->tpm_op_canceled && errno != ECANCELED)) { + if (!tpm_pt->tpm_op_canceled || errno != ECANCELED) { error_report("tpm_passthrough: error while reading data from " "TPM: %s (%i)", strerror(errno), errno); diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index 381e7266ea..a6440fef91 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -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 diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c index 31cd171016..032078fd3e 100644 --- a/hw/unicore32/puv3.c +++ b/hw/unicore32/puv3.c @@ -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" diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 3213f9f8af..eceb5f3ee2 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -547,7 +547,7 @@ static int emulated_initfn(CCIDCardState *base) return 0; } -static int emulated_exitfn(CCIDCardState *base) +static void emulated_exitfn(CCIDCardState *base) { EmulatedState *card = EMULATED_CCID_CARD(base); VEvent *vevent = vevent_new(VEVENT_LAST, NULL, NULL); @@ -564,7 +564,6 @@ static int emulated_exitfn(CCIDCardState *base) qemu_mutex_destroy(&card->handle_apdu_mutex); qemu_mutex_destroy(&card->vreader_mutex); qemu_mutex_destroy(&card->event_list_mutex); - return 0; } static Property emulated_card_properties[] = { diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index 325129a2f6..88cb6d8978 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -365,11 +365,6 @@ static int passthru_initfn(CCIDCardState *base) return 0; } -static int passthru_exitfn(CCIDCardState *base) -{ - return 0; -} - static VMStateDescription passthru_vmstate = { .name = "ccid-card-passthru", .version_id = 1, @@ -396,7 +391,6 @@ static void passthru_class_initfn(ObjectClass *klass, void *data) CCIDCardClass *cc = CCID_CARD_CLASS(klass); cc->initfn = passthru_initfn; - cc->exitfn = passthru_exitfn; cc->get_atr = passthru_get_atr; cc->apdu_from_guest = passthru_apdu_from_guest; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); diff --git a/hw/usb/ccid.h b/hw/usb/ccid.h index 9334da8acd..1f070116d6 100644 --- a/hw/usb/ccid.h +++ b/hw/usb/ccid.h @@ -33,7 +33,7 @@ typedef struct CCIDCardClass { void (*apdu_from_guest)(CCIDCardState *card, const uint8_t *apdu, uint32_t len); - int (*exitfn)(CCIDCardState *card); + void (*exitfn)(CCIDCardState *card); int (*initfn)(CCIDCardState *card); } CCIDCardClass; diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 58d95fffb2..9cb0f50750 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -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 diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index af4b851356..89e11b68c4 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -508,14 +508,14 @@ static void ccid_card_apdu_from_guest(CCIDCardState *card, } } -static int ccid_card_exitfn(CCIDCardState *card) +static void ccid_card_exitfn(CCIDCardState *card) { CCIDCardClass *cc = CCID_CARD_GET_CLASS(card); if (cc->exitfn) { - return cc->exitfn(card); + cc->exitfn(card); } - return 0; + } static int ccid_card_initfn(CCIDCardState *card) @@ -1279,7 +1279,6 @@ void ccid_card_card_inserted(CCIDCardState *card) static int ccid_card_exit(DeviceState *qdev) { - int ret = 0; CCIDCardState *card = CCID_CARD(qdev); USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); USBCCIDState *s = USB_CCID_DEV(dev); @@ -1287,9 +1286,9 @@ static int ccid_card_exit(DeviceState *qdev) if (ccid_card_inserted(s)) { ccid_card_card_removed(card); } - ret = ccid_card_exitfn(card); + ccid_card_exitfn(card); s->card = NULL; - return ret; + return 0; } static int ccid_card_init(DeviceState *qdev) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 17fff80c8a..98dc7722c3 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -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" diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index a714d8ef80..8cc532ec0e 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -9,7 +9,7 @@ extern Monitor *cur_mon; /* flags for monitor_init */ -#define MONITOR_IS_DEFAULT 0x01 +/* 0x01 unused */ #define MONITOR_USE_READLINE 0x02 #define MONITOR_USE_CONTROL 0x04 #define MONITOR_USE_PRETTY 0x08 diff --git a/migration/migration.c b/migration/migration.c index 156e70791a..4084eb6f1b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -922,7 +922,7 @@ static void migrate_fd_cleanup(void *opaque) void migrate_fd_error(MigrationState *s, const Error *error) { - trace_migrate_fd_error(error ? error_get_pretty(error) : ""); + trace_migrate_fd_error(error_get_pretty(error)); assert(s->to_dst_file == NULL); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); @@ -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" @@ -4094,7 +4092,7 @@ QemuOptsList qemu_mon_opts = { .name = "chardev", .type = QEMU_OPT_STRING, },{ - .name = "default", + .name = "default", /* deprecated */ .type = QEMU_OPT_BOOL, },{ .name = "pretty", diff --git a/net/colo-compare.c b/net/colo-compare.c index 4ac916adcb..9bfc736f55 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -92,10 +92,6 @@ typedef struct CompareClass { ObjectClass parent_class; } CompareClass; -typedef struct CompareChardevProps { - bool is_socket; -} CompareChardevProps; - enum { PRIMARY_IN = 0, SECONDARY_IN, @@ -572,8 +568,6 @@ static int find_and_check_chardev(CharDriverState **chr, char *chr_name, Error **errp) { - CompareChardevProps props; - *chr = qemu_chr_find(chr_name); if (*chr == NULL) { error_setg(errp, "Device '%s' not found", @@ -581,8 +575,6 @@ static int find_and_check_chardev(CharDriverState **chr, return 1; } - memset(&props, 0, sizeof(props)); - if (!qemu_chr_has_feature(*chr, QEMU_CHAR_FEATURE_RECONNECTABLE)) { error_setg(errp, "chardev \"%s\" is not reconnectable", chr_name); diff --git a/qemu-ga.texi b/qemu-ga.texi index 0e53bf6b2c..4c7a8fd163 100644 --- a/qemu-ga.texi +++ b/qemu-ga.texi @@ -30,7 +30,7 @@ set user's password @end itemize qemu-ga will read a system configuration file on startup (located at -q@file{/etc/qemu/qemu-ga.conf} by default), then parse remaining +@file{/etc/qemu/qemu-ga.conf} by default), then parse remaining configuration options on the command line. For the same key, the last option wins, but the lists accumulate (see below for configuration file format). diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index 4750e9ab93..95bcde1d88 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -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 diff --git a/qemu-options.hx b/qemu-options.hx index b1fbdb08cd..95332cc05b 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -172,7 +172,7 @@ DEF("set", HAS_ARG, QEMU_OPTION_set, STEXI @item -set @var{group}.@var{id}.@var{arg}=@var{value} @findex -set -Set parameter @var{arg} for item @var{id} of type @var{group}\n" +Set parameter @var{arg} for item @var{id} of type @var{group} ETEXI DEF("global", HAS_ARG, QEMU_OPTION_global, @@ -2239,7 +2239,7 @@ two serial ports and the QEMU monitor: @example -chardev stdio,mux=on,id=char0 \ --mon chardev=char0,mode=readline,default \ +-mon chardev=char0,mode=readline \ -serial chardev:char0 \ -serial chardev:char0 @end example @@ -2250,7 +2250,7 @@ multiplexed between the QEMU monitor and a parallel port: @example -chardev stdio,mux=on,id=char0 \ --mon chardev=char0,mode=readline,default \ +-mon chardev=char0,mode=readline \ -parallel chardev:char0 \ -chardev tcp,...,mux=on,id=char1 \ -serial chardev:char1 \ @@ -3112,9 +3112,9 @@ Like -qmp but uses pretty JSON formatting. ETEXI DEF("mon", HAS_ARG, QEMU_OPTION_mon, \ - "-mon [chardev=]name[,mode=readline|control][,default]\n", QEMU_ARCH_ALL) + "-mon [chardev=]name[,mode=readline|control]\n", QEMU_ARCH_ALL) STEXI -@item -mon [chardev=]name[,mode=readline|control][,default] +@item -mon [chardev=]name[,mode=readline|control] @findex -mon Setup monitor on chardev @var{name}. ETEXI @@ -3902,7 +3902,7 @@ colo secondary: -object filter-redirector,id=f2,netdev=hn0,queue=rx,outdev=red1 -object filter-rewriter,id=rew0,netdev=hn0,queue=all -@item -object filter-dump,id=@var{id},netdev=@var{dev},file=@var{filename}][,maxlen=@var{len}] +@item -object filter-dump,id=@var{id},netdev=@var{dev}[,file=@var{filename}][,maxlen=@var{len}] Dump the network traffic on netdev @var{dev} to the file specified by @var{filename}. At most @var{len} bytes (64k by default) per packet are stored. @@ -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) { diff --git a/scripts/clean-includes b/scripts/clean-includes index 4412a5590a..dd938daa3e 100755 --- a/scripts/clean-includes +++ b/scripts/clean-includes @@ -14,15 +14,18 @@ # the top-level directory. # Usage: -# clean-includes [--git subjectprefix] file ... +# clean-includes [--git subjectprefix] [--check-dup-head] file ... # or -# clean-includes [--git subjectprefix] --all +# clean-includes [--git subjectprefix] [--check-dup-head] --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-dup-head is specified, additionally check for duplicate +# header includes. +# # 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,40 @@ 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-dup-head") + DUPHEAD=yes + shift + ;; + "--") + shift + break + ;; + *) + break + ;; + esac +done if [ $# -eq 0 ]; then - echo "Usage: clean-includes [--git subjectprefix] [--all | foo.c ...]" + echo "Usage: clean-includes [--git subjectprefix] [--check-dup-head] [--all | foo.c ...]" echo "(modifies the files in place)" exit 1 fi @@ -91,7 +111,6 @@ cat >"$COCCIFILE" <<EOT ) EOT - for f in "$@"; do case "$f" in *.inc.c) @@ -154,6 +173,15 @@ for f in "$@"; do done +if [ "$DUPHEAD" = "yes" ]; then + egrep "^[[:space:]]*#[[:space:]]*include" "$@" | tr -d '[:blank:]' \ + | 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 diff --git a/scripts/hxtool b/scripts/hxtool index 995bb7f08c..04f7d7b0ed 100644 --- a/scripts/hxtool +++ b/scripts/hxtool @@ -26,32 +26,32 @@ hxtotexi() ;; STEXI*) if test $flag -eq 1 ; then - echo "line $line: syntax error: expected ETEXI, found $str" >&2 + printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2 exit 1 fi flag=1 ;; ETEXI*) if test $flag -ne 1 ; then - echo "line $line: syntax error: expected STEXI, found $str" >&2 + printf "line %d: syntax error: expected STEXI, found '%s'\n" "$line" "$str" >&2 exit 1 fi flag=0 ;; SQMP*|EQMP*) if test $flag -eq 1 ; then - echo "line $line: syntax error: expected ETEXI, found $str" >&2 + printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2 exit 1 fi ;; DEFHEADING*) - echo "$(expr "$str" : "DEFHEADING(\(.*\))")" + printf '%s\n' "$(expr "$str" : "DEFHEADING(\(.*\))")" ;; ARCHHEADING*) - echo "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")" + printf '%s\n' "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")" ;; *) - test $flag -eq 1 && echo "$str" + test $flag -eq 1 && printf '%s\n' "$str" ;; esac line=$((line+1)) @@ -69,26 +69,26 @@ hxtoqmp() ;; SQMP*) if test $flag -eq 1 ; then - echo "line $line: syntax error: expected EQMP, found $str" >&2 + printf "line %d: syntax error: expected EQMP, found '%s'\n" "$line" "$str" >&2 exit 1 fi flag=1 ;; EQMP*) if test $flag -ne 1 ; then - echo "line $line: syntax error: expected SQMP, found $str" >&2 + printf "line %d: syntax error: expected SQMP, found '%s'\n" "$line" "$str" >&2 exit 1 fi flag=0 ;; STEXI*|ETEXI*) if test $flag -eq 1 ; then - echo "line $line: syntax error: expected EQMP, found $str" >&2 + printf "line %d: syntax error: expected EQMP, found '%s'\n" "$line" "$str" >&2 exit 1 fi ;; *) - test $flag -eq 1 && echo "$str" + test $flag -eq 1 && printf '%s\n' "$str" ;; esac line=$((line+1)) diff --git a/scripts/tracetool.py b/scripts/tracetool.py index 629b2593c8..fe9c9e904b 100755 --- a/scripts/tracetool.py +++ b/scripts/tracetool.py @@ -70,7 +70,7 @@ def make_group_name(filename): if dirname == "": return "common" - return re.sub(r"/|-", "_", dirname) + return re.sub(r"[^A-Za-z0-9]", "_", dirname) def main(args): global _SCRIPT diff --git a/target-i386/machine.c b/target-i386/machine.c index 71c0e4dc47..48037f1575 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -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" diff --git a/target-lm32/translate.c b/target-lm32/translate.c index 2d8caebbfc..842af63a98 100644 --- a/target-lm32/translate.c +++ b/target-lm32/translate.c @@ -33,12 +33,14 @@ #include "exec/log.h" -#define DISAS_LM32 1 -#if DISAS_LM32 -# define LOG_DIS(...) qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__) -#else -# define LOG_DIS(...) do { } while (0) -#endif +#define DISAS_LM32 0 + +#define LOG_DIS(...) \ + do { \ + if (DISAS_LM32) { \ + qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__); \ + } \ + } while (0) #define EXTRACT_FIELD(src, start, end) \ (((src) >> start) & ((1 << (end - start + 1)) - 1)) @@ -211,7 +213,7 @@ static void dec_and(DisasContext *dc) static void dec_andhi(DisasContext *dc) { - LOG_DIS("andhi r%d, r%d, %d\n", dc->r2, dc->r0, dc->imm16); + LOG_DIS("andhi r%d, r%d, %d\n", dc->r1, dc->r0, dc->imm16); tcg_gen_andi_tl(cpu_R[dc->r1], cpu_R[dc->r0], (dc->imm16 << 16)); } @@ -274,7 +276,7 @@ static inline void gen_cond_branch(DisasContext *dc, int cond) static void dec_be(DisasContext *dc) { - LOG_DIS("be r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("be r%d, r%d, %d\n", dc->r1, dc->r0, sign_extend(dc->imm16, 16) * 4); gen_cond_branch(dc, TCG_COND_EQ); @@ -282,7 +284,7 @@ static void dec_be(DisasContext *dc) static void dec_bg(DisasContext *dc) { - LOG_DIS("bg r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("bg r%d, r%d, %d\n", dc->r1, dc->r0, sign_extend(dc->imm16, 16 * 4)); gen_cond_branch(dc, TCG_COND_GT); @@ -290,7 +292,7 @@ static void dec_bg(DisasContext *dc) static void dec_bge(DisasContext *dc) { - LOG_DIS("bge r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("bge r%d, r%d, %d\n", dc->r1, dc->r0, sign_extend(dc->imm16, 16) * 4); gen_cond_branch(dc, TCG_COND_GE); @@ -298,7 +300,7 @@ static void dec_bge(DisasContext *dc) static void dec_bgeu(DisasContext *dc) { - LOG_DIS("bgeu r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("bgeu r%d, r%d, %d\n", dc->r1, dc->r0, sign_extend(dc->imm16, 16) * 4); gen_cond_branch(dc, TCG_COND_GEU); @@ -306,7 +308,7 @@ static void dec_bgeu(DisasContext *dc) static void dec_bgu(DisasContext *dc) { - LOG_DIS("bgu r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("bgu r%d, r%d, %d\n", dc->r1, dc->r0, sign_extend(dc->imm16, 16) * 4); gen_cond_branch(dc, TCG_COND_GTU); @@ -314,7 +316,7 @@ static void dec_bgu(DisasContext *dc) static void dec_bne(DisasContext *dc) { - LOG_DIS("bne r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("bne r%d, r%d, %d\n", dc->r1, dc->r0, sign_extend(dc->imm16, 16) * 4); gen_cond_branch(dc, TCG_COND_NE); @@ -342,9 +344,6 @@ static void dec_calli(DisasContext *dc) static inline void gen_compare(DisasContext *dc, int cond) { - int rX = (dc->format == OP_FMT_RR) ? dc->r2 : dc->r1; - int rY = (dc->format == OP_FMT_RR) ? dc->r0 : dc->r0; - int rZ = (dc->format == OP_FMT_RR) ? dc->r1 : -1; int i; if (dc->format == OP_FMT_RI) { @@ -358,16 +357,16 @@ static inline void gen_compare(DisasContext *dc, int cond) break; } - tcg_gen_setcondi_tl(cond, cpu_R[rX], cpu_R[rY], i); + tcg_gen_setcondi_tl(cond, cpu_R[dc->r1], cpu_R[dc->r0], i); } else { - tcg_gen_setcond_tl(cond, cpu_R[rX], cpu_R[rY], cpu_R[rZ]); + tcg_gen_setcond_tl(cond, cpu_R[dc->r2], cpu_R[dc->r0], cpu_R[dc->r1]); } } static void dec_cmpe(DisasContext *dc) { if (dc->format == OP_FMT_RI) { - LOG_DIS("cmpei r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("cmpei r%d, r%d, %d\n", dc->r1, dc->r0, sign_extend(dc->imm16, 16)); } else { LOG_DIS("cmpe r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); @@ -379,7 +378,7 @@ static void dec_cmpe(DisasContext *dc) static void dec_cmpg(DisasContext *dc) { if (dc->format == OP_FMT_RI) { - LOG_DIS("cmpgi r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("cmpgi r%d, r%d, %d\n", dc->r1, dc->r0, sign_extend(dc->imm16, 16)); } else { LOG_DIS("cmpg r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); @@ -391,7 +390,7 @@ static void dec_cmpg(DisasContext *dc) static void dec_cmpge(DisasContext *dc) { if (dc->format == OP_FMT_RI) { - LOG_DIS("cmpgei r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("cmpgei r%d, r%d, %d\n", dc->r1, dc->r0, sign_extend(dc->imm16, 16)); } else { LOG_DIS("cmpge r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); @@ -403,7 +402,7 @@ static void dec_cmpge(DisasContext *dc) static void dec_cmpgeu(DisasContext *dc) { if (dc->format == OP_FMT_RI) { - LOG_DIS("cmpgeui r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("cmpgeui r%d, r%d, %d\n", dc->r1, dc->r0, zero_extend(dc->imm16, 16)); } else { LOG_DIS("cmpgeu r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); @@ -415,7 +414,7 @@ static void dec_cmpgeu(DisasContext *dc) static void dec_cmpgu(DisasContext *dc) { if (dc->format == OP_FMT_RI) { - LOG_DIS("cmpgui r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("cmpgui r%d, r%d, %d\n", dc->r1, dc->r0, zero_extend(dc->imm16, 16)); } else { LOG_DIS("cmpgu r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); @@ -427,7 +426,7 @@ static void dec_cmpgu(DisasContext *dc) static void dec_cmpne(DisasContext *dc) { if (dc->format == OP_FMT_RI) { - LOG_DIS("cmpnei r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("cmpnei r%d, r%d, %d\n", dc->r1, dc->r0, sign_extend(dc->imm16, 16)); } else { LOG_DIS("cmpne r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); @@ -539,7 +538,7 @@ static void dec_modu(DisasContext *dc) static void dec_mul(DisasContext *dc) { if (dc->format == OP_FMT_RI) { - LOG_DIS("muli r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("muli r%d, r%d, %d\n", dc->r1, dc->r0, sign_extend(dc->imm16, 16)); } else { LOG_DIS("mul r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); @@ -563,7 +562,7 @@ static void dec_mul(DisasContext *dc) static void dec_nor(DisasContext *dc) { if (dc->format == OP_FMT_RI) { - LOG_DIS("nori r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("nori r%d, r%d, %d\n", dc->r1, dc->r0, zero_extend(dc->imm16, 16)); } else { LOG_DIS("nor r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); @@ -865,7 +864,7 @@ static void dec_wcsr(DisasContext *dc) { int no; - LOG_DIS("wcsr r%d, %d\n", dc->r1, dc->csr); + LOG_DIS("wcsr %d, r%d\n", dc->csr, dc->r1); switch (dc->csr) { case CSR_IE: @@ -959,7 +958,7 @@ static void dec_wcsr(DisasContext *dc) static void dec_xnor(DisasContext *dc) { if (dc->format == OP_FMT_RI) { - LOG_DIS("xnori r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("xnori r%d, r%d, %d\n", dc->r1, dc->r0, zero_extend(dc->imm16, 16)); } else { if (dc->r1 == R_R0) { @@ -981,7 +980,7 @@ static void dec_xnor(DisasContext *dc) static void dec_xor(DisasContext *dc) { if (dc->format == OP_FMT_RI) { - LOG_DIS("xori r%d, r%d, %d\n", dc->r0, dc->r1, + LOG_DIS("xori r%d, r%d, %d\n", dc->r1, dc->r0, zero_extend(dc->imm16, 16)); } else { LOG_DIS("xor r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); diff --git a/target-mips/machine.c b/target-mips/machine.c index a27f2f156d..d20d948457 100644 --- a/target-mips/machine.c +++ b/target-mips/machine.c @@ -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) diff --git a/target-ppc/machine.c b/target-ppc/machine.c index 4820f22377..e43cb6c39d 100644 --- a/target-ppc/machine.c +++ b/target-ppc/machine.c @@ -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) { diff --git a/target-ppc/mem_helper.c b/target-ppc/mem_helper.c index 6548715831..1ab8a6eab4 100644 --- a/target-ppc/mem_helper.c +++ b/target-ppc/mem_helper.c @@ -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 diff --git a/target-sparc/machine.c b/target-sparc/machine.c index 59c92f7582..aea6397861 100644 --- a/target-sparc/machine.c +++ b/target-sparc/machine.c @@ -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 = { diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c index 4c1e48748b..fb0fa56f1e 100644 --- a/target-xtensa/translate.c +++ b/target-xtensa/translate.c @@ -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" diff --git a/tests/crypto-tls-x509-helpers.h b/tests/crypto-tls-x509-helpers.h index a8faa92bc0..921341c649 100644 --- a/tests/crypto-tls-x509-helpers.h +++ b/tests/crypto-tls-x509-helpers.h @@ -21,9 +21,6 @@ #include <gnutls/gnutls.h> #include <gnutls/x509.h> -#include <gnutls/gnutls.h> -#include <gnutls/x509.h> - #if !(defined WIN32) && \ defined(CONFIG_TASN1) && \ (LIBGNUTLS_VERSION_NUMBER >= 0x020600) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index e4b2900898..96bf00eefa 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -22,8 +22,6 @@ #include "libqos/virtio-pci.h" #include "qapi/error.h" -#include "libqos/pci-pc.h" -#include "libqos/virtio-pci.h" #include "libqos/malloc-pc.h" #include "hw/virtio/virtio-net.h" diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 8ec99ccb4f..67c65893a4 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -28,7 +28,6 @@ #include "qemu/osdep.h" #include <termios.h> -#include <termios.h> #include <glib/gprintf.h> @@ -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" @@ -2408,8 +2407,9 @@ static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp) if (qemu_opt_get_bool(opts, "pretty", 0)) flags |= MONITOR_USE_PRETTY; - if (qemu_opt_get_bool(opts, "default", 0)) - flags |= MONITOR_IS_DEFAULT; + if (qemu_opt_get_bool(opts, "default", 0)) { + error_report("option 'default' does nothing and is deprecated"); + } chardev = qemu_opt_get(opts, "chardev"); chr = qemu_chr_find(chardev); @@ -2428,16 +2428,12 @@ static void monitor_parse(const char *optarg, const char *mode, bool pretty) QemuOpts *opts; const char *p; char label[32]; - int def = 0; if (strstart(optarg, "chardev:", &p)) { snprintf(label, sizeof(label), "%s", p); } else { snprintf(label, sizeof(label), "compat_monitor%d", monitor_device_index); - if (monitor_device_index == 0) { - def = 1; - } opts = qemu_chr_parse_compat(label, optarg); if (!opts) { error_report("parse error: %s", optarg); @@ -2449,8 +2445,6 @@ static void monitor_parse(const char *optarg, const char *mode, bool pretty) qemu_opt_set(opts, "mode", mode, &error_abort); qemu_opt_set(opts, "chardev", label, &error_abort); qemu_opt_set_bool(opts, "pretty", pretty, &error_abort); - if (def) - qemu_opt_set(opts, "default", "on", &error_abort); monitor_device_index++; } |