diff options
169 files changed, 132 insertions, 321 deletions
diff --git a/audio/audio.h b/audio/audio.h index e7ea39777e..b41a97053d 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -24,7 +24,6 @@ #ifndef QEMU_AUDIO_H #define QEMU_AUDIO_H -#include "config-host.h" #include "qemu/queue.h" typedef void (*audio_callback_fn) (void *opaque, int avail); diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 735cb4042a..1b5f9983d1 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -17,15 +17,12 @@ #ifndef QEMU_H #define QEMU_H -#include <signal.h> -#include <string.h> #include "cpu.h" #include "exec/cpu_ldst.h" #undef DEBUG_REMAP #ifdef DEBUG_REMAP -#include <stdlib.h> #endif /* DEBUG_REMAP */ #include "exec/user/abitypes.h" diff --git a/contrib/ivshmem-client/ivshmem-client.h b/contrib/ivshmem-client/ivshmem-client.h index 3a4f809682..54cde17d93 100644 --- a/contrib/ivshmem-client/ivshmem-client.h +++ b/contrib/ivshmem-client/ivshmem-client.h @@ -19,7 +19,6 @@ * purposes. */ -#include <limits.h> #include <sys/select.h> #include "qemu/queue.h" diff --git a/contrib/ivshmem-server/ivshmem-server.h b/contrib/ivshmem-server/ivshmem-server.h index c9359a0a8a..e9de8a369d 100644 --- a/contrib/ivshmem-server/ivshmem-server.h +++ b/contrib/ivshmem-server/ivshmem-server.h @@ -26,10 +26,7 @@ * associated to the ivshmem shared memory. */ -#include <limits.h> #include <sys/select.h> -#include <stdint.h> -#include <stdbool.h> #include "qemu/event_notifier.h" #include "qemu/queue.h" diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc index d4d46d5ff3..9280950ce3 100644 --- a/disas/arm-a64.cc +++ b/disas/arm-a64.cc @@ -17,12 +17,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "vixl/a64/disasm-a64.h" - extern "C" { +#include "qemu/osdep.h" #include "disas/bfd.h" } +#include "vixl/a64/disasm-a64.h" + using namespace vixl; static Decoder *vixl_decoder = NULL; diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index 956fda0919..b8c26024a9 100644 --- a/fsdev/file-op-9p.h +++ b/fsdev/file-op-9p.h @@ -12,11 +12,8 @@ */ #ifndef _FILEOP_H #define _FILEOP_H -#include <sys/types.h> #include <dirent.h> -#include <sys/time.h> #include <utime.h> -#include <sys/stat.h> #include <sys/uio.h> #include <sys/vfs.h> diff --git a/hw/9pfs/9p-synth.h b/hw/9pfs/9p-synth.h index eaf5a0c293..82962512a1 100644 --- a/hw/9pfs/9p-synth.h +++ b/hw/9pfs/9p-synth.h @@ -13,9 +13,6 @@ #ifndef HW_9PFS_SYNTH_H #define HW_9PFS_SYNTH_H 1 -#include <unistd.h> -#include <sys/types.h> -#include <limits.h> typedef struct V9fsSynthNode V9fsSynthNode; typedef ssize_t (*v9fs_synth_read)(void *buf, int len, off_t offset, diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index edcd51be15..1a19418a8c 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -1,9 +1,7 @@ #ifndef _QEMU_9P_H #define _QEMU_9P_H -#include <sys/types.h> #include <dirent.h> -#include <sys/time.h> #include <utime.h> #include <sys/resource.h> #include <glib.h> diff --git a/hw/audio/gusemu.h b/hw/audio/gusemu.h index 331bb6fec0..b7f0751268 100644 --- a/hw/audio/gusemu.h +++ b/hw/audio/gusemu.h @@ -34,7 +34,6 @@ typedef signed char GUSchar; typedef signed short GUSsample; #else - #include <stdint.h> typedef int8_t GUSchar; typedef uint8_t GUSbyte; typedef uint16_t GUSword; diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h index 40ba6a4207..bdb43a5a34 100644 --- a/hw/display/vga_int.h +++ b/hw/display/vga_int.h @@ -25,7 +25,6 @@ #define HW_VGA_INT_H 1 #include <hw/hw.h> -#include "qapi/error.h" #include "exec/memory.h" #define ST01_V_RETRACE 0x08 diff --git a/hw/net/fsl_etsec/registers.h b/hw/net/fsl_etsec/registers.h index 7ad7686470..6fb96842b8 100644 --- a/hw/net/fsl_etsec/registers.h +++ b/hw/net/fsl_etsec/registers.h @@ -24,7 +24,6 @@ #ifndef _ETSEC_REGISTERS_H_ #define _ETSEC_REGISTERS_H_ -#include <stdint.h> enum eTSEC_Register_Access_Type { ACC_RW = 1, /* Read/Write */ diff --git a/hw/timer/Makefile.objs b/hw/timer/Makefile.objs index 133bd0d455..5cfea6e0da 100644 --- a/hw/timer/Makefile.objs +++ b/hw/timer/Makefile.objs @@ -25,7 +25,6 @@ obj-$(CONFIG_OMAP) += omap_gptimer.o obj-$(CONFIG_OMAP) += omap_synctimer.o obj-$(CONFIG_PXA2XX) += pxa2xx_timer.o obj-$(CONFIG_SH4) += sh_timer.o -obj-$(CONFIG_TUSB6010) += tusb6010.o obj-$(CONFIG_DIGIC) += digic-timer.o obj-$(CONFIG_MC146818RTC) += mc146818rtc.o diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs index 8f00fbd8f6..2717027d34 100644 --- a/hw/usb/Makefile.objs +++ b/hw/usb/Makefile.objs @@ -10,6 +10,8 @@ common-obj-$(CONFIG_USB_EHCI_SYSBUS) += hcd-ehci-sysbus.o common-obj-$(CONFIG_USB_XHCI) += hcd-xhci.o common-obj-$(CONFIG_USB_MUSB) += hcd-musb.o +obj-$(CONFIG_TUSB6010) += tusb6010.o + # emulated usb devices common-obj-$(CONFIG_USB) += dev-hub.o common-obj-$(CONFIG_USB) += dev-hid.o diff --git a/hw/usb/core.c b/hw/usb/core.c index bea5e1ee8b..45fa00c517 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -129,9 +129,16 @@ static void do_token_setup(USBDevice *s, USBPacket *p) } usb_packet_copy(p, s->setup_buf, p->iov.size); + s->setup_index = 0; p->actual_length = 0; s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6]; - s->setup_index = 0; + if (s->setup_len > sizeof(s->data_buf)) { + fprintf(stderr, + "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n", + s->setup_len, sizeof(s->data_buf)); + p->status = USB_RET_STALL; + return; + } request = (s->setup_buf[0] << 8) | s->setup_buf[1]; value = (s->setup_buf[3] << 8) | s->setup_buf[2]; @@ -152,13 +159,6 @@ static void do_token_setup(USBDevice *s, USBPacket *p) } s->setup_state = SETUP_STATE_DATA; } else { - if (s->setup_len > sizeof(s->data_buf)) { - fprintf(stderr, - "usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n", - s->setup_len, sizeof(s->data_buf)); - p->status = USB_RET_STALL; - return; - } if (s->setup_len == 0) s->setup_state = SETUP_STATE_ACK; else @@ -177,7 +177,7 @@ static void do_token_in(USBDevice *s, USBPacket *p) request = (s->setup_buf[0] << 8) | s->setup_buf[1]; value = (s->setup_buf[3] << 8) | s->setup_buf[2]; index = (s->setup_buf[5] << 8) | s->setup_buf[4]; - + switch(s->setup_state) { case SETUP_STATE_ACK: if (!(s->setup_buf[0] & USB_DIR_IN)) { diff --git a/hw/usb/desc.h b/hw/usb/desc.h index 8e8db03a0c..4d81c68e0e 100644 --- a/hw/usb/desc.h +++ b/hw/usb/desc.h @@ -1,7 +1,6 @@ #ifndef QEMU_HW_USB_DESC_H #define QEMU_HW_USB_DESC_H -#include <inttypes.h> #include <wchar.h> /* binary representation */ diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 985a6298bf..c6abd38c2a 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -654,7 +654,8 @@ typedef struct USBNetState { static int is_rndis(USBNetState *s) { - return s->dev.config->bConfigurationValue == DEV_RNDIS_CONFIG_VALUE; + return s->dev.config ? + s->dev.config->bConfigurationValue == DEV_RNDIS_CONFIG_VALUE : 0; } static int ndis_query(USBNetState *s, uint32_t oid, @@ -915,8 +916,9 @@ static int rndis_query_response(USBNetState *s, bufoffs = le32_to_cpu(buf->InformationBufferOffset) + 8; buflen = le32_to_cpu(buf->InformationBufferLength); - if (bufoffs + buflen > length) + if (buflen > length || bufoffs >= length || bufoffs + buflen > length) { return USB_RET_STALL; + } infobuflen = ndis_query(s, le32_to_cpu(buf->OID), bufoffs + (uint8_t *) buf, buflen, infobuf, @@ -961,8 +963,9 @@ static int rndis_set_response(USBNetState *s, bufoffs = le32_to_cpu(buf->InformationBufferOffset) + 8; buflen = le32_to_cpu(buf->InformationBufferLength); - if (bufoffs + buflen > length) + if (buflen > length || bufoffs >= length || bufoffs + buflen > length) { return USB_RET_STALL; + } ret = ndis_set(s, le32_to_cpu(buf->OID), bufoffs + (uint8_t *) buf, buflen); @@ -1212,8 +1215,9 @@ static void usb_net_handle_dataout(USBNetState *s, USBPacket *p) if (le32_to_cpu(msg->MessageType) == RNDIS_PACKET_MSG) { uint32_t offs = 8 + le32_to_cpu(msg->DataOffset); uint32_t size = le32_to_cpu(msg->DataLength); - if (offs + size <= len) + if (offs < len && size < len && offs + size <= len) { qemu_send_packet(qemu_get_queue(s->nic), s->out_buf + offs, size); + } } s->out_ptr -= len; memmove(s->out_buf, &s->out_buf[len], s->out_ptr); diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index bed55dda78..17ed4617ef 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1347,16 +1347,6 @@ static void ohci_frame_boundary(void *opaque) */ static int ohci_bus_start(OHCIState *ohci) { - ohci->eof_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, - ohci_frame_boundary, - ohci); - - if (ohci->eof_timer == NULL) { - trace_usb_ohci_bus_eof_timer_failed(ohci->name); - ohci_die(ohci); - return 0; - } - trace_usb_ohci_start(ohci->name); /* Delay the first SOF event by one frame time as @@ -1373,11 +1363,7 @@ static int ohci_bus_start(OHCIState *ohci) static void ohci_bus_stop(OHCIState *ohci) { trace_usb_ohci_stop(ohci->name); - if (ohci->eof_timer) { - timer_del(ohci->eof_timer); - timer_free(ohci->eof_timer); - } - ohci->eof_timer = NULL; + timer_del(ohci->eof_timer); } /* Sets a flag in a port status register but only set it if the port is @@ -1907,6 +1893,9 @@ static void usb_ohci_init(OHCIState *ohci, DeviceState *dev, usb_packet_init(&ohci->usb_packet); ohci->async_td = 0; + + ohci->eof_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, + ohci_frame_boundary, ohci); } #define TYPE_PCI_OHCI "pci-ohci" @@ -1976,6 +1965,9 @@ static void usb_ohci_exit(PCIDevice *dev) if (!ohci->masterbus) { usb_bus_release(&s->bus); } + + timer_del(s->eof_timer); + timer_free(s->eof_timer); } static void usb_ohci_reset_pci(DeviceState *d) @@ -2041,23 +2033,13 @@ static bool ohci_eof_timer_needed(void *opaque) { OHCIState *ohci = opaque; - return ohci->eof_timer != NULL; -} - -static int ohci_eof_timer_pre_load(void *opaque) -{ - OHCIState *ohci = opaque; - - ohci_bus_start(ohci); - - return 0; + return timer_pending(ohci->eof_timer); } static const VMStateDescription vmstate_ohci_eof_timer = { .name = "ohci-core/eof-timer", .version_id = 1, .minimum_version_id = 1, - .pre_load = ohci_eof_timer_pre_load, .needed = ohci_eof_timer_needed, .fields = (VMStateField[]) { VMSTATE_TIMER_PTR(eof_timer, OHCIState), diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 5ccfb8395a..c370240be2 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -773,8 +773,22 @@ static int uhci_handle_td(UHCIState *s, UHCIQueue *q, uint32_t qh_addr, bool spd; bool queuing = (q != NULL); uint8_t pid = td->token & 0xff; - UHCIAsync *async = uhci_async_find_td(s, td_addr); + UHCIAsync *async; + + switch (pid) { + case USB_TOKEN_OUT: + case USB_TOKEN_SETUP: + case USB_TOKEN_IN: + break; + default: + /* invalid pid : frame interrupted */ + s->status |= UHCI_STS_HCPERR; + s->cmd &= ~UHCI_CMD_RS; + uhci_update_irq(s); + return TD_RESULT_STOP_FRAME; + } + async = uhci_async_find_td(s, td_addr); if (async) { if (uhci_queue_verify(async->queue, qh_addr, td, td_addr, queuing)) { assert(q == NULL || q == async->queue); @@ -880,11 +894,7 @@ static int uhci_handle_td(UHCIState *s, UHCIQueue *q, uint32_t qh_addr, break; default: - /* invalid pid : frame interrupted */ - uhci_async_free(async); - s->status |= UHCI_STS_HCPERR; - uhci_update_irq(s); - return TD_RESULT_STOP_FRAME; + abort(); /* Never to execute */ } if (async->packet.status == USB_RET_ASYNC) { diff --git a/hw/timer/tusb6010.c b/hw/usb/tusb6010.c index 9f6af90806..9f6af90806 100644 --- a/hw/timer/tusb6010.c +++ b/hw/usb/tusb6010.c diff --git a/hw/vfio/amd-xgbe.c b/hw/vfio/amd-xgbe.c index 53451eb22d..2c60310cf9 100644 --- a/hw/vfio/amd-xgbe.c +++ b/hw/vfio/amd-xgbe.c @@ -11,6 +11,7 @@ * */ +#include "qemu/osdep.h" #include "hw/vfio/vfio-amd-xgbe.h" static void amd_xgbe_realize(DeviceState *dev, Error **errp) diff --git a/include/block/accounting.h b/include/block/accounting.h index 0f46cb4ec1..2db2a009a1 100644 --- a/include/block/accounting.h +++ b/include/block/accounting.h @@ -25,8 +25,6 @@ #ifndef BLOCK_ACCOUNTING_H #define BLOCK_ACCOUNTING_H -#include <stdint.h> -#include <stdbool.h> #include "qemu/typedefs.h" #include "qemu/timed-average.h" diff --git a/include/block/nbd.h b/include/block/nbd.h index b197adca1c..b86a976984 100644 --- a/include/block/nbd.h +++ b/include/block/nbd.h @@ -19,7 +19,6 @@ #ifndef NBD_H #define NBD_H -#include <sys/types.h> #include "qemu-common.h" #include "qemu/option.h" diff --git a/include/block/snapshot.h b/include/block/snapshot.h index c6910da63a..e5c0553115 100644 --- a/include/block/snapshot.h +++ b/include/block/snapshot.h @@ -26,7 +26,6 @@ #define SNAPSHOT_H #include "qemu-common.h" -#include "qapi/error.h" #include "qemu/option.h" diff --git a/include/block/write-threshold.h b/include/block/write-threshold.h index f1b899cd5f..8a79505ada 100644 --- a/include/block/write-threshold.h +++ b/include/block/write-threshold.h @@ -12,7 +12,6 @@ #ifndef BLOCK_WRITE_THRESHOLD_H #define BLOCK_WRITE_THRESHOLD_H -#include <stdint.h> #include "qemu/typedefs.h" #include "qemu-common.h" diff --git a/include/config.h b/include/config.h index e20f78696a..992d761053 100644 --- a/include/config.h +++ b/include/config.h @@ -1,2 +1 @@ -#include "config-host.h" #include "config-target.h" diff --git a/include/crypto/cipher.h b/include/crypto/cipher.h index f90ac79567..c04c3ac9b9 100644 --- a/include/crypto/cipher.h +++ b/include/crypto/cipher.h @@ -22,7 +22,6 @@ #define QCRYPTO_CIPHER_H__ #include "qemu-common.h" -#include "qapi/error.h" typedef struct QCryptoCipher QCryptoCipher; diff --git a/include/crypto/hash.h b/include/crypto/hash.h index 5e8d9a1372..aebccd1386 100644 --- a/include/crypto/hash.h +++ b/include/crypto/hash.h @@ -22,7 +22,6 @@ #define QCRYPTO_HASH_H__ #include "qemu-common.h" -#include "qapi/error.h" /* See also "QCryptoHashAlgorithm" defined in qapi/crypto.json */ diff --git a/include/crypto/init.h b/include/crypto/init.h index 5fc510c4f8..4836a37e3f 100644 --- a/include/crypto/init.h +++ b/include/crypto/init.h @@ -22,7 +22,6 @@ #define QCRYPTO_INIT_H__ #include "qemu-common.h" -#include "qapi/error.h" int qcrypto_init(Error **errp); diff --git a/include/crypto/secret.h b/include/crypto/secret.h index 913519ae27..60f2a502b7 100644 --- a/include/crypto/secret.h +++ b/include/crypto/secret.h @@ -22,7 +22,6 @@ #define QCRYPTO_SECRET_H__ #include "qemu-common.h" -#include "qapi/error.h" #include "qom/object.h" #define TYPE_QCRYPTO_SECRET "secret" diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h index 21761b7ce1..4bf1d2e255 100644 --- a/include/crypto/tlscreds.h +++ b/include/crypto/tlscreds.h @@ -22,7 +22,6 @@ #define QCRYPTO_TLSCRED_H__ #include "qemu-common.h" -#include "qapi/error.h" #include "qom/object.h" #ifdef CONFIG_GNUTLS diff --git a/include/elf.h b/include/elf.h index 1098d217ec..28d448bbcc 100644 --- a/include/elf.h +++ b/include/elf.h @@ -1,7 +1,6 @@ #ifndef _QEMU_ELF_H #define _QEMU_ELF_H -#include <inttypes.h> /* 32-bit ELF base types. */ typedef uint32_t Elf32_Addr; diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 83b1781afc..08e5093d0e 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -154,7 +154,6 @@ static inline void tswap64s(uint64_t *s) /* MMU memory access macros */ #if defined(CONFIG_USER_ONLY) -#include <assert.h> #include "exec/user/abitypes.h" /* On some host systems the guest address space is reserved on the host. diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index 5093be26ac..854e7e3566 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -23,9 +23,6 @@ #error cpu.h included from common code #endif -#include "config.h" -#include <inttypes.h> -#include "qemu/osdep.h" #include "qemu/queue.h" #include "tcg-target.h" #ifndef CONFIG_USER_ONLY diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h index b009ccb11a..ec790432d5 100644 --- a/include/exec/helper-head.h +++ b/include/exec/helper-head.h @@ -18,7 +18,6 @@ #ifndef DEF_HELPER_H #define DEF_HELPER_H 1 -#include "qemu/osdep.h" #define HELPER(name) glue(helper_, name) diff --git a/include/exec/memory.h b/include/exec/memory.h index c92734ae2b..d5f2b2ce6f 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -21,8 +21,6 @@ #define DIRTY_MEMORY_MIGRATION 2 #define DIRTY_MEMORY_NUM 3 /* num of dirty bits */ -#include <stdint.h> -#include <stdbool.h> #include "exec/cpu-common.h" #ifndef CONFIG_USER_ONLY #include "exec/hwaddr.h" @@ -31,7 +29,6 @@ #include "qemu/queue.h" #include "qemu/int128.h" #include "qemu/notify.h" -#include "qapi/error.h" #include "qom/object.h" #include "qemu/rcu.h" diff --git a/include/exec/user/thunk.h b/include/exec/user/thunk.h index 3b67462726..ad1d60266e 100644 --- a/include/exec/user/thunk.h +++ b/include/exec/user/thunk.h @@ -19,7 +19,6 @@ #ifndef THUNK_H #define THUNK_H -#include <inttypes.h> #include "cpu.h" /* types enums definitions */ diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 624ed61661..c937062530 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -86,9 +86,6 @@ this code that are retained. #include <sunmath.h> #endif -#include <inttypes.h> -#include "config-host.h" -#include "qemu/osdep.h" /* This 'flag' type must be able to hold at least 0 and 1. It should * probably be replaced with 'bool' but the uses would need to be audited diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index 2de30211f2..7462e20fe3 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -19,7 +19,6 @@ * <http://www.gnu.org/licenses/>. */ -#include "qapi/error.h" #include "qemu/typedefs.h" #include "qemu/notify.h" #include "qemu/option.h" diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index aa29d30d1f..d3e0c8fe87 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -1,9 +1,7 @@ #ifndef HW_ACPI_GEN_UTILS_H #define HW_ACPI_GEN_UTILS_H -#include <stdint.h> #include <glib.h> -#include "qemu/compiler.h" #include "hw/acpi/acpi-defs.h" /* Reserve RAM space for tables: add another order of magnitude. */ diff --git a/include/hw/acpi/bios-linker-loader.h b/include/hw/acpi/bios-linker-loader.h index 498c0af773..721b7b9e25 100644 --- a/include/hw/acpi/bios-linker-loader.h +++ b/include/hw/acpi/bios-linker-loader.h @@ -2,8 +2,6 @@ #define BIOS_LINKER_LOADER_H #include <glib.h> -#include <stdbool.h> -#include <inttypes.h> GArray *bios_linker_loader_init(void); diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h index f3526d4aaf..31b7820b6f 100644 --- a/include/hw/acpi/pcihp.h +++ b/include/hw/acpi/pcihp.h @@ -27,7 +27,6 @@ #ifndef HW_ACPI_PCIHP_H #define HW_ACPI_PCIHP_H -#include <inttypes.h> #include <qemu/typedefs.h> #include "hw/acpi/acpi.h" #include "migration/vmstate.h" diff --git a/include/hw/block/block.h b/include/hw/block/block.h index 8d7c4b413f..984660efd6 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -12,7 +12,6 @@ #define HW_BLOCK_COMMON_H #include "qemu-common.h" -#include "qapi/error.h" /* Configuration */ diff --git a/include/hw/i386/topology.h b/include/hw/i386/topology.h index 148cc1bbc8..fc95572394 100644 --- a/include/hw/i386/topology.h +++ b/include/hw/i386/topology.h @@ -38,8 +38,6 @@ * CPUID Fn8000_0008_ECX[ApicIdCoreIdSize[3:0]] is set to apicid_core_width(). */ -#include <stdint.h> -#include <string.h> #include "qemu/bitops.h" diff --git a/include/hw/isa/apm.h b/include/hw/isa/apm.h index 3edea5f623..4839ff1df2 100644 --- a/include/hw/isa/apm.h +++ b/include/hw/isa/apm.h @@ -1,7 +1,6 @@ #ifndef APM_H #define APM_H -#include <stdint.h> #include "qemu-common.h" #include "hw/hw.h" #include "exec/memory.h" diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index 664eaf6452..5d19975df5 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -2,8 +2,6 @@ #define FW_CFG_H #ifndef NO_QEMU_PROTOS -#include <stdint.h> -#include <stddef.h> #include "exec/hwaddr.h" #include "qemu/typedefs.h" diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index dedf277627..0be07c8352 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -6,7 +6,6 @@ #include "hw/qdev.h" #include "exec/memory.h" #include "sysemu/dma.h" -#include "qapi/error.h" /* PCI includes legacy ISA access. */ #include "hw/isa/isa.h" diff --git a/include/hw/pci/shpc.h b/include/hw/pci/shpc.h index 2c871b947b..b2085543d7 100644 --- a/include/hw/pci/shpc.h +++ b/include/hw/pci/shpc.h @@ -4,7 +4,6 @@ #include "qemu-common.h" #include "exec/memory.h" #include "migration/vmstate.h" -#include "qapi/error.h" #include "hw/hotplug.h" #include "hw/pci/pci.h" diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index abcdee852b..c3ff99f975 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -7,7 +7,6 @@ #include "qemu/bitmap.h" #include "qom/object.h" #include "hw/irq.h" -#include "qapi/error.h" #include "hw/hotplug.h" enum { diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h index c59cc81915..d6b012f6be 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -11,7 +11,6 @@ #ifndef VHOST_BACKEND_H_ #define VHOST_BACKEND_H_ -#include <stdbool.h> typedef enum VhostBackendType { VHOST_BACKEND_TYPE_NONE = 0, diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index df334818c1..bf3fe97927 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -6,7 +6,6 @@ * must not depend on any xen headers being present in * /usr/include/xen, so it can be included unconditionally. */ -#include <inttypes.h> #include "hw/irq.h" #include "qemu-common.h" diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 7a3cce0b8c..bd65e67054 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -1,10 +1,7 @@ #ifndef QEMU_HW_XEN_COMMON_H #define QEMU_HW_XEN_COMMON_H 1 -#include "config-host.h" -#include <stddef.h> -#include <inttypes.h> /* * If we have new enough libxenctrl then we do not want/need these compat diff --git a/include/io/channel.h b/include/io/channel.h index 3e17fe7129..0a1f1ce7fc 100644 --- a/include/io/channel.h +++ b/include/io/channel.h @@ -22,7 +22,6 @@ #define QIO_CHANNEL_H__ #include "qemu-common.h" -#include "qapi/error.h" #include "qom/object.h" #define TYPE_QIO_CHANNEL "qio-channel" diff --git a/include/io/task.h b/include/io/task.h index 2418714156..2e69d8a47f 100644 --- a/include/io/task.h +++ b/include/io/task.h @@ -22,7 +22,6 @@ #define QIO_TASK_H__ #include "qemu-common.h" -#include "qapi/error.h" #include "qom/object.h" typedef struct QIOTask QIOTask; diff --git a/include/libdecnumber/dconfig.h b/include/libdecnumber/dconfig.h index 2f0455a06a..0f7dccef1f 100644 --- a/include/libdecnumber/dconfig.h +++ b/include/libdecnumber/dconfig.h @@ -27,7 +27,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "config-host.h" #if defined(HOST_WORDS_BIGENDIAN) #define WORDS_BIGENDIAN 1 diff --git a/include/libdecnumber/decContext.h b/include/libdecnumber/decContext.h index c3e46f405f..01365e2313 100644 --- a/include/libdecnumber/decContext.h +++ b/include/libdecnumber/decContext.h @@ -56,9 +56,6 @@ #define DECCFULLNAME "Decimal Context Descriptor" /* Verbose name */ #define DECCAUTHOR "Mike Cowlishaw" /* Who to blame */ - #include <stdint.h> - #include <stdio.h> /* for printf, etc. */ - #include <signal.h> /* for traps */ /* Extended flags setting -- set this to 0 to use only IEEE flags */ #define DECEXTFLAG 1 /* 1=enable extended flags */ diff --git a/include/libdecnumber/decNumberLocal.h b/include/libdecnumber/decNumberLocal.h index 71ed77bf21..94fb512923 100644 --- a/include/libdecnumber/decNumberLocal.h +++ b/include/libdecnumber/decNumberLocal.h @@ -42,8 +42,6 @@ #define DECVERSION "decNumber 3.53" /* Package Version [16 max.] */ #define DECNLAUTHOR "Mike Cowlishaw" /* Who to blame */ - #include <stdlib.h> /* for abs */ - #include <string.h> /* for memset, strcpy */ #include "libdecnumber/dconfig.h" /* Conditional code flag -- set this to match hardware platform */ diff --git a/include/migration/migration.h b/include/migration/migration.h index 97622e4fd2..85b6026d10 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -18,7 +18,6 @@ #include "qemu-common.h" #include "qemu/thread.h" #include "qemu/notify.h" -#include "qapi/error.h" #include "migration/vmstate.h" #include "qapi-types.h" #include "exec/cpu-common.h" diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h index b5d08d217d..3f6b4ed581 100644 --- a/include/migration/qemu-file.h +++ b/include/migration/qemu-file.h @@ -25,7 +25,6 @@ #define QEMU_FILE_H 1 #include "exec/cpu-common.h" -#include <stdint.h> /* This function writes a chunk of data to a file at the given position. * The pos argument can be ignored if the file is only being used for diff --git a/include/net/checksum.h b/include/net/checksum.h index 2d7a363d40..7de1acb79a 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h @@ -18,7 +18,6 @@ #ifndef QEMU_NET_CHECKSUM_H #define QEMU_NET_CHECKSUM_H -#include <stdint.h> struct iovec; uint32_t net_checksum_add_cont(int len, uint8_t *buf, int seq); diff --git a/include/net/eth.h b/include/net/eth.h index 84384febf2..18d0be3b16 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -26,8 +26,6 @@ #ifndef QEMU_ETH_H #define QEMU_ETH_H -#include <sys/types.h> -#include <string.h> #include "qemu/bswap.h" #include "qemu/iov.h" diff --git a/include/qapi/error.h b/include/qapi/error.h index e64fe54cf9..02e9dd20a7 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -115,9 +115,6 @@ #ifndef ERROR_H #define ERROR_H -#include <stdarg.h> -#include <stdbool.h> -#include "qemu/compiler.h" #include "qapi-types.h" /* diff --git a/include/qapi/qmp-event.h b/include/qapi/qmp-event.h index 8a8ffb5718..40fe3cbc12 100644 --- a/include/qapi/qmp-event.h +++ b/include/qapi/qmp-event.h @@ -14,7 +14,6 @@ #ifndef QMP_EVENT_H #define QMP_EVENT_H -#include "qapi/error.h" #include "qapi/qmp/qdict.h" typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict, Error **errp); diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index e389697f19..495520994c 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -16,7 +16,6 @@ #include "qapi/qmp/qobject.h" #include "qapi/qmp/qdict.h" -#include "qapi/error.h" typedef void (QmpCommandFunc)(QDict *, QObject **, Error **); diff --git a/include/qapi/qmp/json-lexer.h b/include/qapi/qmp/json-lexer.h index cb456d53e5..afee7828cd 100644 --- a/include/qapi/qmp/json-lexer.h +++ b/include/qapi/qmp/json-lexer.h @@ -14,7 +14,6 @@ #ifndef QEMU_JSON_LEXER_H #define QEMU_JSON_LEXER_H -#include "glib-compat.h" typedef enum json_token_type { JSON_MIN = 100, diff --git a/include/qapi/qmp/json-parser.h b/include/qapi/qmp/json-parser.h index fea89f873a..9987f8ca85 100644 --- a/include/qapi/qmp/json-parser.h +++ b/include/qapi/qmp/json-parser.h @@ -16,7 +16,6 @@ #include "qemu-common.h" #include "qapi/qmp/qlist.h" -#include "qapi/error.h" QObject *json_parser_parse(GQueue *tokens, va_list *ap); QObject *json_parser_parse_err(GQueue *tokens, va_list *ap, Error **errp); diff --git a/include/qapi/qmp/json-streamer.h b/include/qapi/qmp/json-streamer.h index 09b3d3ec15..00d8a23af8 100644 --- a/include/qapi/qmp/json-streamer.h +++ b/include/qapi/qmp/json-streamer.h @@ -14,8 +14,6 @@ #ifndef QEMU_JSON_STREAMER_H #define QEMU_JSON_STREAMER_H -#include <stdint.h> -#include "glib-compat.h" #include "qapi/qmp/json-lexer.h" typedef struct JSONToken { diff --git a/include/qapi/qmp/qbool.h b/include/qapi/qmp/qbool.h index 836d078866..a41111c309 100644 --- a/include/qapi/qmp/qbool.h +++ b/include/qapi/qmp/qbool.h @@ -14,7 +14,6 @@ #ifndef QBOOL_H #define QBOOL_H -#include <stdbool.h> #include "qapi/qmp/qobject.h" typedef struct QBool { diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h index 6c2a0e501e..71b8eb0416 100644 --- a/include/qapi/qmp/qdict.h +++ b/include/qapi/qmp/qdict.h @@ -16,8 +16,6 @@ #include "qapi/qmp/qobject.h" #include "qapi/qmp/qlist.h" #include "qemu/queue.h" -#include <stdbool.h> -#include <stdint.h> #define QDICT_BUCKET_MAX 512 diff --git a/include/qapi/qmp/qfloat.h b/include/qapi/qmp/qfloat.h index a8af2a89b2..b5d15836b5 100644 --- a/include/qapi/qmp/qfloat.h +++ b/include/qapi/qmp/qfloat.h @@ -14,7 +14,6 @@ #ifndef QFLOAT_H #define QFLOAT_H -#include <stdint.h> #include "qapi/qmp/qobject.h" typedef struct QFloat { diff --git a/include/qapi/qmp/qint.h b/include/qapi/qmp/qint.h index 049e528079..3aaff768dd 100644 --- a/include/qapi/qmp/qint.h +++ b/include/qapi/qmp/qint.h @@ -13,7 +13,6 @@ #ifndef QINT_H #define QINT_H -#include <stdint.h> #include "qapi/qmp/qobject.h" typedef struct QInt { diff --git a/include/qapi/qmp/qjson.h b/include/qapi/qmp/qjson.h index ee4d31a46a..02b1f2ce31 100644 --- a/include/qapi/qmp/qjson.h +++ b/include/qapi/qmp/qjson.h @@ -14,8 +14,6 @@ #ifndef QJSON_H #define QJSON_H -#include <stdarg.h> -#include "qemu/compiler.h" #include "qapi/qmp/qobject.h" #include "qapi/qmp/qstring.h" diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h index 74459ae14b..b8ddbca405 100644 --- a/include/qapi/qmp/qobject.h +++ b/include/qapi/qmp/qobject.h @@ -32,8 +32,6 @@ #ifndef QOBJECT_H #define QOBJECT_H -#include <stddef.h> -#include <assert.h> #include "qapi-types.h" struct QObject { diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h index df7df558b2..10076b7c8c 100644 --- a/include/qapi/qmp/qstring.h +++ b/include/qapi/qmp/qstring.h @@ -13,7 +13,6 @@ #ifndef QSTRING_H #define QSTRING_H -#include <stdint.h> #include "qapi/qmp/qobject.h" typedef struct QString { diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h index 6a1ddfbd9a..2bd8f292b2 100644 --- a/include/qapi/visitor-impl.h +++ b/include/qapi/visitor-impl.h @@ -12,7 +12,6 @@ #ifndef QAPI_VISITOR_IMPL_H #define QAPI_VISITOR_IMPL_H -#include "qapi/error.h" #include "qapi/visitor.h" struct Visitor diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h index 83cad74c88..1000da2bda 100644 --- a/include/qapi/visitor.h +++ b/include/qapi/visitor.h @@ -16,8 +16,6 @@ #include "qemu/typedefs.h" #include "qapi/qmp/qobject.h" -#include "qapi/error.h" -#include <stdlib.h> /* This struct is layout-compatible with all other *List structs * created by the qapi generator. It is used as a typical diff --git a/include/qemu-common.h b/include/qemu-common.h index f557be78e3..a85e9bf98a 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -12,7 +12,6 @@ #ifndef QEMU_COMMON_H #define QEMU_COMMON_H -#include "qemu/osdep.h" #include "qemu/typedefs.h" #include "qemu/fprintf-fn.h" diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index 05b447c728..8f1d8d927d 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -15,7 +15,6 @@ #ifndef __QEMU_ATOMIC_H #define __QEMU_ATOMIC_H 1 -#include "qemu/compiler.h" /* Compiler barrier */ diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h index 86dd9cd5fc..0e33fa5d9d 100644 --- a/include/qemu/bitmap.h +++ b/include/qemu/bitmap.h @@ -13,10 +13,7 @@ #define BITMAP_H #include <glib.h> -#include <string.h> -#include <stdlib.h> -#include "qemu/osdep.h" #include "qemu/bitops.h" /* diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h index 8164225152..755fdd1293 100644 --- a/include/qemu/bitops.h +++ b/include/qemu/bitops.h @@ -12,8 +12,6 @@ #ifndef BITOPS_H #define BITOPS_H -#include <stdint.h> -#include <assert.h> #include "host-utils.h" #include "atomic.h" diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 07d88de746..95071ba9e8 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -1,15 +1,10 @@ #ifndef BSWAP_H #define BSWAP_H -#include "config-host.h" -#include <inttypes.h> -#include <limits.h> -#include <string.h> #include "fpu/softfloat.h" #ifdef CONFIG_MACHINE_BSWAP_H # include <sys/endian.h> -# include <sys/types.h> # include <machine/bswap.h> #elif defined(__FreeBSD__) # include <sys/endian.h> diff --git a/include/qemu/compatfd.h b/include/qemu/compatfd.h index fc3791520f..aa12ee9364 100644 --- a/include/qemu/compatfd.h +++ b/include/qemu/compatfd.h @@ -14,7 +14,6 @@ #ifndef QEMU_COMPATFD_H #define QEMU_COMPATFD_H -#include <signal.h> struct qemu_signalfd_siginfo { uint32_t ssi_signo; /* Signal number */ diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index c5fbe28b02..8f1cc7ba67 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -3,7 +3,6 @@ #ifndef COMPILER_H #define COMPILER_H -#include "config-host.h" /*---------------------------------------------------------------------------- | The macro QEMU_GNUC_PREREQ tests for minimum version of the GNU C compiler. diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h index d4ba20e049..3b8ecb0953 100644 --- a/include/qemu/config-file.h +++ b/include/qemu/config-file.h @@ -1,9 +1,7 @@ #ifndef QEMU_CONFIG_H #define QEMU_CONFIG_H -#include <stdio.h> #include "qemu/option.h" -#include "qapi/error.h" #include "qapi/qmp/qdict.h" QemuOptsList *qemu_find_opts(const char *group); diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h index 20c027a7fd..99b939846b 100644 --- a/include/qemu/coroutine.h +++ b/include/qemu/coroutine.h @@ -15,7 +15,6 @@ #ifndef QEMU_COROUTINE_H #define QEMU_COROUTINE_H -#include <stdbool.h> #include "qemu/typedefs.h" #include "qemu/queue.h" #include "qemu/timer.h" diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h index 7ab235590e..7a2a363fb3 100644 --- a/include/qemu/error-report.h +++ b/include/qemu/error-report.h @@ -13,9 +13,6 @@ #ifndef QEMU_ERROR_H #define QEMU_ERROR_H -#include <stdarg.h> -#include <stdbool.h> -#include "qemu/compiler.h" typedef struct Location { /* all members are private to qemu-error.c */ diff --git a/include/qemu/fprintf-fn.h b/include/qemu/fprintf-fn.h index 9ddc90f1c5..b6bad35b1b 100644 --- a/include/qemu/fprintf-fn.h +++ b/include/qemu/fprintf-fn.h @@ -8,8 +8,6 @@ #ifndef QEMU_FPRINTF_FN_H #define QEMU_FPRINTF_FN_H 1 -#include "qemu/compiler.h" -#include <stdio.h> typedef int (*fprintf_function)(FILE *f, const char *fmt, ...) GCC_FMT_ATTR(2, 3); diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h index bb94a00c5f..e29188c0ad 100644 --- a/include/qemu/hbitmap.h +++ b/include/qemu/hbitmap.h @@ -12,9 +12,6 @@ #ifndef HBITMAP_H #define HBITMAP_H 1 -#include <limits.h> -#include <stdint.h> -#include <stdbool.h> #include "bitops.h" #include "host-utils.h" diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 3ef97d503d..1cdae0d0ed 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -25,10 +25,7 @@ #ifndef HOST_UTILS_H #define HOST_UTILS_H 1 -#include "qemu/compiler.h" /* QEMU_GNUC_PREREQ */ #include "qemu/bswap.h" -#include <limits.h> -#include <stdbool.h> #ifdef CONFIG_INT128 static inline void mulu64(uint64_t *plow, uint64_t *phigh, diff --git a/include/qemu/int128.h b/include/qemu/int128.h index fb782aaddd..c5988813df 100644 --- a/include/qemu/int128.h +++ b/include/qemu/int128.h @@ -1,9 +1,6 @@ #ifndef INT128_H #define INT128_H -#include <assert.h> -#include <stdint.h> -#include <stdbool.h> typedef struct Int128 Int128; diff --git a/include/qemu/log.h b/include/qemu/log.h index 30817f7b42..1afac63760 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -1,10 +1,6 @@ #ifndef QEMU_LOG_H #define QEMU_LOG_H -#include <stdarg.h> -#include <stdbool.h> -#include <stdio.h> -#include "qemu/compiler.h" /* Private global variables, don't use */ extern FILE *qemu_logfile; diff --git a/include/qemu/memfd.h b/include/qemu/memfd.h index 53858ed43c..745a8c501e 100644 --- a/include/qemu/memfd.h +++ b/include/qemu/memfd.h @@ -1,8 +1,6 @@ #ifndef QEMU_MEMFD_H #define QEMU_MEMFD_H -#include "config-host.h" -#include <stdbool.h> #ifndef F_LINUX_SPECIFIC_BASE #define F_LINUX_SPECIFIC_BASE 1024 diff --git a/include/qemu/module.h b/include/qemu/module.h index 72d94984a2..85fafa2e79 100644 --- a/include/qemu/module.h +++ b/include/qemu/module.h @@ -14,7 +14,6 @@ #ifndef QEMU_MODULE_H #define QEMU_MODULE_H -#include "qemu/osdep.h" #define DSO_STAMP_FUN glue(qemu_stamp, CONFIG_STAMP) #define DSO_STAMP_FUN_STR stringify(DSO_STAMP_FUN) diff --git a/include/qemu/option.h b/include/qemu/option.h index 71f5f27ec8..8809ce1e75 100644 --- a/include/qemu/option.h +++ b/include/qemu/option.h @@ -26,9 +26,7 @@ #ifndef QEMU_OPTIONS_H #define QEMU_OPTIONS_H -#include <stdint.h> #include "qemu/queue.h" -#include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qemu/typedefs.h" diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 431cf71364..4538fdca42 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -26,8 +26,25 @@ #define QEMU_OSDEP_H #include "config-host.h" +#ifdef NEED_CPU_H +#include "config-target.h" +#endif #include "qemu/compiler.h" +/* Older versions of C++ don't get definitions of various macros from + * stdlib.h unless we define these macros before first inclusion of + * that system header. + */ +#ifndef __STDC_CONSTANT_MACROS +#define __STDC_CONSTANT_MACROS +#endif +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_FORMAT_MACROS +#define __STDC_FORMAT_MACROS +#endif + /* The following block of code temporarily renames the daemon() function so the * compiler does not see the warning associated with it in stdlib.h on OSX */ diff --git a/include/qemu/range.h b/include/qemu/range.h index cfa021fd48..9fc547b9cb 100644 --- a/include/qemu/range.h +++ b/include/qemu/range.h @@ -1,7 +1,6 @@ #ifndef QEMU_RANGE_H #define QEMU_RANGE_H -#include <inttypes.h> #include <qemu/typedefs.h> #include "qemu/queue.h" diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h index 7c7cca7f6f..56d3a682a9 100644 --- a/include/qemu/rcu.h +++ b/include/qemu/rcu.h @@ -23,15 +23,8 @@ * IBM's contributions to this file may be relicensed under LGPLv2 or later. */ -#include <stdlib.h> -#include <assert.h> -#include <limits.h> -#include <unistd.h> -#include <stdint.h> -#include <stdbool.h> #include <glib.h> -#include "qemu/compiler.h" #include "qemu/thread.h" #include "qemu/queue.h" #include "qemu/atomic.h" diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index cde2f5e0d6..0be68de87d 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -13,7 +13,6 @@ int inet_aton(const char *cp, struct in_addr *ia); #else -#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> @@ -26,7 +25,6 @@ int inet_aton(const char *cp, struct in_addr *ia); #endif /* !_WIN32 */ -#include "qapi/error.h" #include "qapi-types.h" /* misc helpers */ diff --git a/include/qemu/thread.h b/include/qemu/thread.h index 5114ec8e79..bdae6dfdbe 100644 --- a/include/qemu/thread.h +++ b/include/qemu/thread.h @@ -1,8 +1,6 @@ #ifndef __QEMU_THREAD_H #define __QEMU_THREAD_H 1 -#include <inttypes.h> -#include <stdbool.h> typedef struct QemuMutex QemuMutex; typedef struct QemuCond QemuCond; diff --git a/include/qemu/throttle.h b/include/qemu/throttle.h index 63df69070a..9109657609 100644 --- a/include/qemu/throttle.h +++ b/include/qemu/throttle.h @@ -25,7 +25,6 @@ #ifndef THROTTLE_H #define THROTTLE_H -#include <stdint.h> #include "qemu-common.h" #include "qemu/timer.h" diff --git a/include/qemu/timed-average.h b/include/qemu/timed-average.h index 364bf88f70..08245e7a10 100644 --- a/include/qemu/timed-average.h +++ b/include/qemu/timed-average.h @@ -25,7 +25,6 @@ #ifndef TIMED_AVERAGE_H #define TIMED_AVERAGE_H -#include <stdint.h> #include "qemu/timer.h" diff --git a/include/qemu/xattr.h b/include/qemu/xattr.h index f910d96eaf..83cf98cbd8 100644 --- a/include/qemu/xattr.h +++ b/include/qemu/xattr.h @@ -18,7 +18,6 @@ * in /usr/include/sys, and don't have ENOATTR. */ -#include "config-host.h" #ifdef CONFIG_LIBATTR # include <attr/xattr.h> diff --git a/include/qom/cpu.h b/include/qom/cpu.h index ff54600e71..1df7cb4073 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -20,7 +20,6 @@ #ifndef QEMU_CPU_H #define QEMU_CPU_H -#include <signal.h> #include <setjmp.h> #include "hw/qdev-core.h" #include "disas/bfd.h" diff --git a/include/qom/object.h b/include/qom/object.h index 33abce930b..eda16df005 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -15,11 +15,8 @@ #define QEMU_OBJECT_H #include <glib.h> -#include <stdint.h> -#include <stdbool.h> #include "qemu/queue.h" #include "qemu/typedefs.h" -#include "qapi/error.h" struct TypeImpl; typedef struct TypeImpl *Type; diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index ec303316bb..66c5cf22e1 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -14,7 +14,6 @@ #define BLOCK_BACKEND_H #include "qemu/typedefs.h" -#include "qapi/error.h" /* * TODO Have to include block/block.h for a bunch of block layer diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index b06a0607a9..16432f3508 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -11,7 +11,6 @@ #define BLOCKDEV_H #include "block/block.h" -#include "qapi/error.h" #include "qemu/queue.h" void blockdev_mark_auto_del(BlockBackend *blk); diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index efa8b9993a..b0fbb9bb35 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -10,7 +10,6 @@ #ifndef DMA_H #define DMA_H -#include <stdio.h> #include "exec/memory.h" #include "exec/address-spaces.h" #include "hw/hw.h" diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index 1ce439415d..a19801d20b 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -14,7 +14,6 @@ #include "sysemu/sysemu.h" /* for MAX_NODES */ #include "qom/object.h" -#include "qapi/error.h" #include "exec/memory.h" #include "qemu/option.h" #include "qemu/bitmap.h" diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 7741f91f9c..6695fa7cfd 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -14,8 +14,6 @@ #ifndef QEMU_KVM_H #define QEMU_KVM_H -#include <errno.h> -#include "config-host.h" #include "qemu/queue.h" #include "qom/cpu.h" #include "exec/memattrs.h" diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h index a6392bc50f..bb184c9cfe 100644 --- a/include/sysemu/numa.h +++ b/include/sysemu/numa.h @@ -1,7 +1,6 @@ #ifndef SYSEMU_NUMA_H #define SYSEMU_NUMA_H -#include <stdint.h> #include "qemu/bitmap.h" #include "qemu/option.h" #include "sysemu/sysemu.h" diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index f1315213f1..5b9c4d6143 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -26,7 +26,6 @@ #ifndef QEMU_OS_POSIX_H #define QEMU_OS_POSIX_H -#include <sys/time.h> void os_set_line_buffering(void); void os_set_proc_name(const char *s); diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h index 05473b75a5..70aa40aa72 100644 --- a/include/sysemu/qtest.h +++ b/include/sysemu/qtest.h @@ -15,7 +15,6 @@ #define QTEST_H #include "qemu-common.h" -#include "qapi/error.h" extern bool qtest_allowed; diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index abb4688200..e4108e8b1a 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -12,10 +12,7 @@ * */ -#include <stdbool.h> -#include <stdint.h> #include "qapi-types.h" -#include "qapi/error.h" #include "qemu/typedefs.h" /* replay clock kinds */ diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h index 0a27c9b88c..858be8cef4 100644 --- a/include/sysemu/rng.h +++ b/include/sysemu/rng.h @@ -15,7 +15,6 @@ #include "qom/object.h" #include "qemu-common.h" -#include "qapi/error.h" #define TYPE_RNG_BACKEND "rng-backend" #define RNG_BACKEND(obj) \ diff --git a/include/sysemu/seccomp.h b/include/sysemu/seccomp.h index 1189fa241d..cfc06008cb 100644 --- a/include/sysemu/seccomp.h +++ b/include/sysemu/seccomp.h @@ -16,7 +16,6 @@ #define QEMU_SECCOMP_H #include <seccomp.h> -#include "qemu/osdep.h" int seccomp_start(void); #endif diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h index 0a366be0f2..e3ec80020f 100644 --- a/include/sysemu/tpm_backend.h +++ b/include/sysemu/tpm_backend.h @@ -15,7 +15,6 @@ #include "qom/object.h" #include "qemu-common.h" -#include "qapi/error.h" #include "qapi-types.h" #include "qemu/option.h" #include "sysemu/tpm.h" diff --git a/include/sysemu/xen-mapcache.h b/include/sysemu/xen-mapcache.h index c59804060b..c849489fb2 100644 --- a/include/sysemu/xen-mapcache.h +++ b/include/sysemu/xen-mapcache.h @@ -9,7 +9,6 @@ #ifndef XEN_MAPCACHE_H #define XEN_MAPCACHE_H -#include <stdlib.h> typedef hwaddr (*phys_offset_to_gaddr_t)(hwaddr start_addr, ram_addr_t size, diff --git a/include/ui/console.h b/include/ui/console.h index c8f9f7e65e..6631b9690a 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -7,7 +7,6 @@ #include "qemu/notify.h" #include "qemu/typedefs.h" #include "qapi-types.h" -#include "qapi/error.h" #ifdef CONFIG_OPENGL # include <epoxy/gl.h> diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h index f9ce357ff3..2dabe49f41 100644 --- a/include/ui/qemu-spice.h +++ b/include/ui/qemu-spice.h @@ -18,7 +18,6 @@ #ifndef QEMU_SPICE_H #define QEMU_SPICE_H -#include "config-host.h" #ifdef CONFIG_SPICE diff --git a/io/channel-util.c b/io/channel-util.c index f96907cb5c..0fb4bd0837 100644 --- a/io/channel-util.c +++ b/io/channel-util.c @@ -18,6 +18,7 @@ * */ +#include "qemu/osdep.h" #include "io/channel-util.h" #include "io/channel-file.h" #include "io/channel-socket.h" diff --git a/linux-user/arm/nwfpe/fpa11.h b/linux-user/arm/nwfpe/fpa11.h index bb9ac6554e..7e114eee8a 100644 --- a/linux-user/arm/nwfpe/fpa11.h +++ b/linux-user/arm/nwfpe/fpa11.h @@ -21,9 +21,6 @@ #ifndef __FPA11_H__ #define __FPA11_H__ -#include <stdlib.h> -#include <stdio.h> -#include <errno.h> #include <cpu.h> diff --git a/linux-user/qemu.h b/linux-user/qemu.h index bd90cc3799..ba5b433d99 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -1,15 +1,12 @@ #ifndef QEMU_H #define QEMU_H -#include <signal.h> -#include <string.h> #include "cpu.h" #include "exec/cpu_ldst.h" #undef DEBUG_REMAP #ifdef DEBUG_REMAP -#include <stdlib.h> #endif /* DEBUG_REMAP */ #include "exec/user/abitypes.h" diff --git a/nbd/nbd-internal.h b/nbd/nbd-internal.h index db6ab65ced..d09b4ee308 100644 --- a/nbd/nbd-internal.h +++ b/nbd/nbd-internal.h @@ -16,16 +16,12 @@ #include "qemu/coroutine.h" #include "qemu/iov.h" -#include <errno.h> -#include <string.h> #ifndef _WIN32 #include <sys/ioctl.h> #endif #if defined(__sun__) || defined(__HAIKU__) #include <sys/ioccom.h> #endif -#include <ctype.h> -#include <inttypes.h> #ifdef __linux__ #include <linux/fs.h> diff --git a/net/tap-linux.h b/net/tap-linux.h index 01dc6f8a2d..1dc3a9f279 100644 --- a/net/tap-linux.h +++ b/net/tap-linux.h @@ -16,7 +16,6 @@ #ifndef QEMU_TAP_LINUX_H #define QEMU_TAP_LINUX_H -#include <stdint.h> #ifdef __linux__ #include <linux/ioctl.h> diff --git a/net/util.h b/net/util.h index 10c7da95f0..60b73d372d 100644 --- a/net/util.h +++ b/net/util.h @@ -25,7 +25,6 @@ #ifndef QEMU_NET_UTIL_H #define QEMU_NET_UTIL_H -#include <stdint.h> int net_parse_macaddr(uint8_t *macaddr, const char *p); diff --git a/qemu-nbd.c b/qemu-nbd.c index efc427c4f4..5fe94d0e7b 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -31,8 +31,6 @@ #include "io/channel-socket.h" #include <getopt.h> -#include <sys/types.h> -#include <signal.h> #include <libgen.h> #include <pthread.h> diff --git a/qga/vss-win32.h b/qga/vss-win32.h index 298927dfa5..4d1d15081e 100644 --- a/qga/vss-win32.h +++ b/qga/vss-win32.h @@ -13,7 +13,6 @@ #ifndef VSS_WIN32_H #define VSS_WIN32_H -#include "qapi/error.h" bool vss_init(bool init_requester); void vss_deinit(bool deinit_requester); diff --git a/qga/vss-win32/requester.h b/qga/vss-win32/requester.h index c3093cf4b6..ad2bf3df61 100644 --- a/qga/vss-win32/requester.h +++ b/qga/vss-win32/requester.h @@ -14,7 +14,6 @@ #define VSS_WIN32_REQUESTER_H #include <basetyps.h> /* STDAPI */ -#include "qemu/compiler.h" #ifdef __cplusplus extern "C" { diff --git a/qga/vss-win32/vss-common.h b/qga/vss-win32/vss-common.h index ce14e14290..91dae0c38d 100644 --- a/qga/vss-win32/vss-common.h +++ b/qga/vss-win32/vss-common.h @@ -14,7 +14,6 @@ #define VSS_WIN32_H #define __MIDL_user_allocate_free_DEFINED__ -#include "config-host.h" #include <windows.h> #include <shlwapi.h> @@ -18,6 +18,7 @@ * <http://www.gnu.org/licenses/gpl-2.0.html> */ +#include "qemu/osdep.h" #include "qemu-common.h" #include "qom/cpu.h" #include "sysemu/kvm.h" diff --git a/replay/replay-internal.h b/replay/replay-internal.h index 77e0d292c7..5438ebdb9c 100644 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -12,7 +12,6 @@ * */ -#include <stdio.h> enum ReplayEvents { /* for instruction event */ diff --git a/scripts/clean-includes b/scripts/clean-includes index 1af1f824b8..d2dd7ae3ce 100755 --- a/scripts/clean-includes +++ b/scripts/clean-includes @@ -1,7 +1,8 @@ #!/bin/sh -e # # Clean up QEMU #include lines by ensuring that qemu/osdep.h -# is the first include listed. +# is the first include listed in .c files, and no headers provided +# by osdep.h itself are redundantly included in either .c or .h files. # # Copyright (c) 2015 Linaro Limited # @@ -14,14 +15,25 @@ # Usage: # clean-includes [--git subjectprefix] file ... +# or +# clean-includes [--git subjectprefix] --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. +# +# Using --all will cause clean-includes to run on the whole source +# tree (excluding certain directories which are known not to need +# handling). # This script requires Coccinelle to be installed. +# .c files will have the osdep.h included added, and redundant +# includes removed. +# .h files will have redundant includes (including includes of osdep.h) +# removed. +# Other files (including C++ and ObjectiveC) can't be handled by this script. # 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 @@ -34,6 +46,9 @@ GIT=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" @@ -46,11 +61,16 @@ if [ $# -ne 0 ] && [ "$1" = "--git" ]; then fi if [ $# -eq 0 ]; then - echo "Usage: clean-includes [--git subjectprefix] foo.c ..." + echo "Usage: clean-includes [--git subjectprefix] [--all | foo.c ...]" echo "(modifies the files in place)" exit 1 fi +if [ "$1" = "--all" ]; then + # We assume there are no files in the tree with spaces in their name + set -- $(git ls-files '*.[ch]' | grep -E -v "$XDIRREGEX") +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. @@ -73,13 +93,44 @@ 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" + case "$f" in + *.c) + MODE=c + ;; + *include/qemu/osdep.h | \ + *include/qemu/compiler.h | \ + *include/config.h | \ + *include/standard-headers/ ) + # Removing include lines from osdep.h itself would be counterproductive. + echo "SKIPPING $f (special case header)" + continue + ;; + *include/standard-headers/*) + echo "SKIPPING $f (autogenerated header)" + continue + ;; + *.h) + MODE=h + ;; + *) + echo "WARNING: ignoring $f (cannot handle non-C files)" + continue + ;; + esac + + if [ "$MODE" = "c" ]; then + # 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" + else + # Remove includes of osdep.h itself + perl -n -i -e 'print if !/\s*#\s*include\s*(["<][^>"]*[">])/ || + ! (grep { $_ eq $1 } qw ("qemu/osdep.h"))' "$f" + fi # Remove includes that osdep.h already provides perl -n -i -e 'print if !/\s*#\s*include\s*(["<][^>"]*[">])/ || diff --git a/scripts/tracetool/format/ust_events_c.py b/scripts/tracetool/format/ust_events_c.py index bc970936be..9967c7a82e 100644 --- a/scripts/tracetool/format/ust_events_c.py +++ b/scripts/tracetool/format/ust_events_c.py @@ -22,6 +22,8 @@ def generate(events, backend): out('/* This file is autogenerated by tracetool, do not edit. */', '', + '#include "qemu/osdep.h"', + '', '#define TRACEPOINT_DEFINE', '#define TRACEPOINT_CREATE_PROBES', '', diff --git a/slirp/slirp.h b/slirp/slirp.h index 239fe2917a..07c13b4725 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -1,11 +1,9 @@ #ifndef __COMMON_H__ #define __COMMON_H__ -#include "config-host.h" #include "slirp_config.h" #ifdef _WIN32 -# include <inttypes.h> typedef char *caddr_t; @@ -23,43 +21,31 @@ typedef char *caddr_t; # endif #endif -#include <sys/types.h> #ifdef HAVE_SYS_BITYPES_H # include <sys/bitypes.h> #endif -#include <sys/time.h> #ifdef HAVE_UNISTD_H -# include <unistd.h> #endif #ifdef HAVE_STDLIB_H -# include <stdlib.h> #endif -#include <stdio.h> -#include <errno.h> #ifndef HAVE_MEMMOVE #define memmove(x, y, z) bcopy(y, x, z) #endif #if TIME_WITH_SYS_TIME -# include <sys/time.h> -# include <time.h> #else # ifdef HAVE_SYS_TIME_H -# include <sys/time.h> # else -# include <time.h> # endif #endif #ifdef HAVE_STRING_H -# include <string.h> #else -# include <strings.h> #endif #ifndef _WIN32 @@ -82,11 +68,9 @@ void *malloc(size_t arg); void free(void *ptr); #endif -#include <fcntl.h> #ifndef NO_UNIX_SOCKETS #include <sys/un.h> #endif -#include <signal.h> #ifdef HAVE_SYS_SIGNAL_H # include <sys/signal.h> #endif @@ -115,12 +99,10 @@ void free(void *ptr); #endif #ifdef __STDC__ -#include <stdarg.h> #else #include <varargs.h> #endif -#include <sys/stat.h> /* Avoid conflicting with the libc insque() and remque(), which have different prototypes. */ diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h index bcd8076abb..420f2a53fe 100644 --- a/target-alpha/cpu.h +++ b/target-alpha/cpu.h @@ -20,7 +20,6 @@ #if !defined (__CPU_ALPHA_H__) #define __CPU_ALPHA_H__ -#include "config.h" #include "qemu-common.h" #define TARGET_LONG_BITS 64 diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 16238216f4..3cbda73578 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -19,7 +19,6 @@ #ifndef CPU_ARM_H #define CPU_ARM_H -#include "config.h" #include "kvm-consts.h" diff --git a/target-arm/kvm-consts.h b/target-arm/kvm-consts.h index 943bf8980a..a2c9518592 100644 --- a/target-arm/kvm-consts.h +++ b/target-arm/kvm-consts.h @@ -15,7 +15,6 @@ #define ARM_KVM_CONSTS_H #ifdef CONFIG_KVM -#include "qemu/compiler.h" #include <linux/kvm.h> #include <linux/psci.h> diff --git a/target-cris/cpu.h b/target-cris/cpu.h index 32204607ca..415cf91436 100644 --- a/target-cris/cpu.h +++ b/target-cris/cpu.h @@ -20,7 +20,6 @@ #ifndef CPU_CRIS_H #define CPU_CRIS_H -#include "config.h" #include "qemu-common.h" #define TARGET_LONG_BITS 32 diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h index 5f9d960b25..cb750176c0 100644 --- a/target-i386/cpu-qom.h +++ b/target-i386/cpu-qom.h @@ -22,7 +22,6 @@ #include "qom/cpu.h" #include "cpu.h" -#include "qapi/error.h" #include "qemu/notify.h" #ifdef TARGET_X86_64 diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 0af43a3ae1..c78f824678 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -16,10 +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 <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <inttypes.h> +#include "qemu/osdep.h" #include "cpu.h" #include "sysemu/kvm.h" diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 94cb4db27d..7febc3f5ec 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -19,7 +19,6 @@ #ifndef CPU_I386_H #define CPU_I386_H -#include "config.h" #include "qemu-common.h" #include "standard-headers/asm-x86/hyperv.h" diff --git a/target-i386/mpx_helper.c b/target-i386/mpx_helper.c index 1bf717af05..052a69c52f 100644 --- a/target-i386/mpx_helper.c +++ b/target-i386/mpx_helper.c @@ -17,6 +17,7 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ +#include "qemu/osdep.h" #include "cpu.h" #include "exec/helper-proto.h" #include "exec/cpu_ldst.h" diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h index 2b7620c7da..f220fc0bb9 100644 --- a/target-lm32/cpu.h +++ b/target-lm32/cpu.h @@ -24,7 +24,6 @@ #define CPUArchState struct CPULM32State -#include "config.h" #include "qemu-common.h" #include "exec/cpu-defs.h" struct CPULM32State; diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h index 224c16967c..48b4c872fc 100644 --- a/target-m68k/cpu.h +++ b/target-m68k/cpu.h @@ -24,7 +24,6 @@ #define CPUArchState struct CPUM68KState -#include "config.h" #include "qemu-common.h" #include "exec/cpu-defs.h" diff --git a/target-microblaze/cpu.h b/target-microblaze/cpu.h index 6b212ab7f0..2f7335eaa7 100644 --- a/target-microblaze/cpu.h +++ b/target-microblaze/cpu.h @@ -19,7 +19,6 @@ #ifndef CPU_MICROBLAZE_H #define CPU_MICROBLAZE_H -#include "config.h" #include "qemu-common.h" #define TARGET_LONG_BITS 32 diff --git a/target-mips/cpu.h b/target-mips/cpu.h index 86b6333634..bd23c2a054 100644 --- a/target-mips/cpu.h +++ b/target-mips/cpu.h @@ -7,7 +7,6 @@ #define CPUArchState struct CPUMIPSState -#include "config.h" #include "qemu-common.h" #include "mips-defs.h" #include "exec/cpu-defs.h" diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h index a612744011..4ee207796c 100644 --- a/target-moxie/cpu.h +++ b/target-moxie/cpu.h @@ -19,7 +19,6 @@ #ifndef _CPU_MOXIE_H #define _CPU_MOXIE_H -#include "config.h" #include "qemu-common.h" #define TARGET_LONG_BITS 32 diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h index eb71607395..4b63f25804 100644 --- a/target-openrisc/cpu.h +++ b/target-openrisc/cpu.h @@ -27,7 +27,6 @@ /* cpu_openrisc_map_address_* in CPUOpenRISCTLBContext need this decl. */ struct OpenRISCCPU; -#include "config.h" #include "qemu-common.h" #include "exec/cpu-defs.h" #include "fpu/softfloat.h" diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h index 892f4dc949..2b10597fa9 100644 --- a/target-ppc/cpu.h +++ b/target-ppc/cpu.h @@ -19,7 +19,6 @@ #if !defined (__CPU_PPC_H__) #define __CPU_PPC_H__ -#include "config.h" #include "qemu-common.h" //#define PPC_EMULATE_32BITS_HYPV diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index 06ca60b25f..6ae5699e0b 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -22,7 +22,6 @@ #ifndef CPU_S390X_H #define CPU_S390X_H -#include "config.h" #include "qemu-common.h" #define TARGET_LONG_BITS 64 diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h index 5b022c5973..3b23e967bb 100644 --- a/target-sh4/cpu.h +++ b/target-sh4/cpu.h @@ -19,7 +19,6 @@ #ifndef _CPU_SH4_H #define _CPU_SH4_H -#include "config.h" #include "qemu-common.h" #define TARGET_LONG_BITS 32 diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 58ff4743b4..dc46122758 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -1,7 +1,6 @@ #ifndef CPU_SPARC_H #define CPU_SPARC_H -#include "config.h" #include "qemu-common.h" #include "qemu/bswap.h" diff --git a/target-tilegx/cpu.h b/target-tilegx/cpu.h index 03df107a67..022cad186a 100644 --- a/target-tilegx/cpu.h +++ b/target-tilegx/cpu.h @@ -19,7 +19,6 @@ #ifndef CPU_TILEGX_H #define CPU_TILEGX_H -#include "config.h" #include "qemu-common.h" #define TARGET_LONG_BITS 64 diff --git a/target-tricore/cpu.h b/target-tricore/cpu.h index 20a12f3a40..be6f12170d 100644 --- a/target-tricore/cpu.h +++ b/target-tricore/cpu.h @@ -20,7 +20,6 @@ #define __TRICORE_CPU_H__ #include "tricore-defs.h" -#include "config.h" #include "qemu-common.h" #include "exec/cpu-defs.h" #include "fpu/softfloat.h" diff --git a/target-unicore32/cpu.h b/target-unicore32/cpu.h index 01c370c30d..9c1fbf9b77 100644 --- a/target-unicore32/cpu.h +++ b/target-unicore32/cpu.h @@ -19,7 +19,6 @@ #define CPUArchState struct CPUUniCore32State -#include "config.h" #include "qemu-common.h" #include "exec/cpu-defs.h" #include "fpu/softfloat.h" diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h index 15ce0107d6..d0bd9dada8 100644 --- a/target-xtensa/cpu.h +++ b/target-xtensa/cpu.h @@ -33,7 +33,6 @@ #define CPUArchState struct CPUXtensaState -#include "config.h" #include "qemu-common.h" #include "exec/cpu-defs.h" #include "fpu/softfloat.h" diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index 77e5952781..3942f9cccf 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -40,7 +40,6 @@ #if !defined(TCG_TARGET_H) #define TCG_TARGET_H -#include "config-host.h" #define TCG_TARGET_INTERPRETER 1 #define TCG_TARGET_INSN_UNIT_SIZE 1 diff --git a/tests/boot-sector.c b/tests/boot-sector.c index 0b48bb34bf..3ffe2987ff 100644 --- a/tests/boot-sector.c +++ b/tests/boot-sector.c @@ -10,9 +10,8 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "boot-sector.h" -#include <string.h> -#include <stdio.h> #include "qemu-common.h" #include "libqtest.h" diff --git a/tests/libqos/ahci.h b/tests/libqos/ahci.h index 69dc4d7ca9..71dd7a6e5a 100644 --- a/tests/libqos/ahci.h +++ b/tests/libqos/ahci.h @@ -25,9 +25,6 @@ * THE SOFTWARE. */ -#include <stdint.h> -#include <stdlib.h> -#include <stdbool.h> #include "libqos/libqos.h" #include "libqos/pci.h" #include "libqos/malloc-pc.h" diff --git a/tests/libqos/fw_cfg.h b/tests/libqos/fw_cfg.h index 61b1548b4e..e8371b2317 100644 --- a/tests/libqos/fw_cfg.h +++ b/tests/libqos/fw_cfg.h @@ -13,8 +13,6 @@ #ifndef LIBQOS_FW_CFG_H #define LIBQOS_FW_CFG_H -#include <stdint.h> -#include <sys/types.h> typedef struct QFWCFG QFWCFG; diff --git a/tests/libqos/i2c.h b/tests/libqos/i2c.h index c21f1dcbd5..6e648f922a 100644 --- a/tests/libqos/i2c.h +++ b/tests/libqos/i2c.h @@ -9,7 +9,6 @@ #ifndef LIBQOS_I2C_H #define LIBQOS_I2C_H -#include <stdint.h> typedef struct I2CAdapter I2CAdapter; struct I2CAdapter { diff --git a/tests/libqos/malloc.h b/tests/libqos/malloc.h index 0c6c9b7f30..ae9dac8f61 100644 --- a/tests/libqos/malloc.h +++ b/tests/libqos/malloc.h @@ -13,8 +13,6 @@ #ifndef LIBQOS_MALLOC_H #define LIBQOS_MALLOC_H -#include <stdint.h> -#include <sys/types.h> #include "qemu/queue.h" typedef enum { diff --git a/tests/libqos/pci.h b/tests/libqos/pci.h index dfaee9ec37..c06add8dbf 100644 --- a/tests/libqos/pci.h +++ b/tests/libqos/pci.h @@ -13,7 +13,6 @@ #ifndef LIBQOS_PCI_H #define LIBQOS_PCI_H -#include <stdint.h> #include "libqtest.h" #define QPCI_DEVFN(dev, fn) (((dev) << 3) | (fn)) diff --git a/tests/libqtest.h b/tests/libqtest.h index ebdd5bbe53..37f37adbf7 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -17,13 +17,7 @@ #ifndef LIBQTEST_H #define LIBQTEST_H -#include <stddef.h> -#include <stdint.h> -#include <stdbool.h> -#include <stdarg.h> -#include <sys/types.h> #include "qapi/qmp/qdict.h" -#include "glib-compat.h" typedef struct QTestState QTestState; diff --git a/tests/pxe-test.c b/tests/pxe-test.c index fa430958ea..875e4c4a26 100644 --- a/tests/pxe-test.c +++ b/tests/pxe-test.c @@ -11,8 +11,7 @@ * See the COPYING file in the top-level directory. */ -#include <string.h> -#include <stdio.h> +#include "qemu/osdep.h" #include <glib.h> #include <glib/gstdio.h> #include "qemu-common.h" diff --git a/trace/control-internal.h b/trace/control-internal.h index 07cb1c1685..dcf67f505a 100644 --- a/trace/control-internal.h +++ b/trace/control-internal.h @@ -10,7 +10,6 @@ #ifndef TRACE__CONTROL_INTERNAL_H #define TRACE__CONTROL_INTERNAL_H -#include <string.h> extern TraceEvent trace_events[]; diff --git a/trace/ftrace.h b/trace/ftrace.h index 863e052e90..92372e3caa 100644 --- a/trace/ftrace.h +++ b/trace/ftrace.h @@ -1,7 +1,6 @@ #ifndef TRACE_FTRACE_H #define TRACE_FTRACE_H -#include <stdbool.h> #define MAX_TRACE_STRLEN 512 diff --git a/trace/simple.h b/trace/simple.h index 8d1a32eba0..1e7de45575 100644 --- a/trace/simple.h +++ b/trace/simple.h @@ -11,9 +11,6 @@ #ifndef TRACE_SIMPLE_H #define TRACE_SIMPLE_H -#include <stdint.h> -#include <stdbool.h> -#include <stdio.h> #include "trace/generated-events.h" diff --git a/ui/vnc-palette.h b/ui/vnc-palette.h index d02f0236c1..1bd4318f53 100644 --- a/ui/vnc-palette.h +++ b/ui/vnc-palette.h @@ -31,8 +31,6 @@ #include "qapi/qmp/qlist.h" #include "qemu/queue.h" -#include <stdint.h> -#include <stdbool.h> #define VNC_PALETTE_HASH_SIZE 256 #define VNC_PALETTE_MAX_SIZE 256 @@ -38,7 +38,6 @@ #include "io/channel-socket.h" #include "io/channel-tls.h" #include <zlib.h> -#include <stdbool.h> #include "keymaps.h" #include "vnc-palette.h" |