Skip to contentSkip to conversation

remove some double-includes

PATCH In review Michael Tokarev 2 participants 5 messages May 14, 2013 Arm Samsung Exynos

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove some double-includes

Some source files #include the same header more than once for no good reason. Remove second #includes in such cases.

---
I used more lines in context diff below, to show that these #includes are actually repeated. In some cases, however, list of #includes is large and even this amount of context does not show another include.

 audio/audio_win_int.c      |    1 -
 hw/arm/highbank.c          |    1 -
 hw/audio/marvell_88w8618.c |    1 -
 hw/mips/mips_malta.c       |    1 -
 hw/misc/lm32_sys.c         |    1 -
 hw/ppc/spapr.c             |    2 --
 hw/ppc/spapr_hcall.c       |    1 -
 hw/timer/exynos4210_rtc.c  |    1 -
 include/hw/i386/pc.h       |    1 -
 include/qapi/qmp/qlist.h   |    1 -
 include/qemu/config-file.h |    1 -
 monitor.c                  |    1 -
 page_cache.c               |    1 -
 slirp/misc.c               |    2 --
 target-ppc/kvm.c           |    2 --
 tests/tcg/linux-test.c     |    1 -
 translate-all.c            |    1 -
 17 files changed, 20 deletions(-)
audio/audio_win_int.c +0 -1
index 5869052..e132405 100644
@@ -1,14 +1,13 @@
 /* public domain */
 
 #include "qemu-common.h"
-#include "audio.h"
 
 #define AUDIO_CAP "win-int"
 #include <windows.h>
 #include <mmsystem.h>
 
 #include "audio.h"
 #include "audio_int.h"
 #include "audio_win_int.h"
 
 int waveformat_from_audio_settings (WAVEFORMATEX *wfx,
hw/arm/highbank.c +0 -1
index 0fd9465..4405dbd 100644
@@ -17,21 +17,20 @@
  *
  */
 
 #include "hw/sysbus.h"
 #include "hw/arm/arm.h"
 #include "hw/devices.h"
 #include "hw/loader.h"
 #include "net/net.h"
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
-#include "hw/sysbus.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
 
 #define SMP_BOOT_ADDR 0x100
 #define SMP_BOOT_REG  0x40
 #define GIC_BASE_ADDR 0xfff10000
 
 #define NIRQ_GIC      160
 
 /* Board init.  */
hw/audio/marvell_88w8618.c +0 -1
index de06dfd..c5d88a7 100644
@@ -5,21 +5,20 @@
  * Copyright (c) 2008 Jan Kiszka
  *
  * This code is licensed under the GNU GPL v2.
  *
  * Contributions after 2012-01-13 are licensed under the terms of the
  * GNU GPL, version 2 or (at your option) any later version.
  */
 #include "hw/sysbus.h"
 #include "hw/hw.h"
 #include "hw/i2c/i2c.h"
-#include "hw/sysbus.h"
 #include "audio/audio.h"
 
 #define MP_AUDIO_SIZE           0x00001000
 
 /* Audio register offsets */
 #define MP_AUDIO_PLAYBACK_MODE  0x00
 #define MP_AUDIO_CLOCK_DIV      0x18
 #define MP_AUDIO_IRQ_STATUS     0x20
 #define MP_AUDIO_IRQ_ENABLE     0x24
 #define MP_AUDIO_TX_START_LO    0x28
hw/mips/mips_malta.c +0 -1
index 9d521cc..5033d51 100644
@@ -30,21 +30,20 @@
 #include "hw/boards.h"
 #include "hw/i2c/smbus.h"
 #include "block/block.h"
 #include "hw/block/flash.h"
 #include "hw/mips/mips.h"
 #include "hw/mips/cpudevs.h"
 #include "hw/pci/pci.h"
 #include "sysemu/char.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/arch_init.h"
-#include "hw/boards.h"
 #include "qemu/log.h"
 #include "hw/mips/bios.h"
 #include "hw/ide.h"
 #include "hw/loader.h"
 #include "elf.h"
 #include "hw/timer/mc146818rtc.h"
 #include "hw/timer/i8254.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
 #include "hw/sysbus.h"             /* SysBusDevice */
hw/misc/lm32_sys.c +0 -1
index 33a3b80..aeaf2b7 100644
@@ -27,21 +27,20 @@
  * (R_TESTNAME) and then write a zero to the pass/fail register (R_PASSFAIL) if
  * the test is passed or any non-zero value to it if the test is failed.
  */
 
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "trace.h"
 #include "qemu/log.h"
 #include "qemu/error-report.h"
 #include "sysemu/sysemu.h"
-#include "qemu/log.h"
 
 enum {
     R_CTRL = 0,
     R_PASSFAIL,
     R_TESTNAME,
     R_MAX
 };
 
 #define MAX_TESTNAME_LEN 16
 
hw/ppc/spapr.c +0 -2
index c96ac81..218ea23 100644
@@ -36,22 +36,20 @@
 #include "hw/boards.h"
 #include "hw/ppc/ppc.h"
 #include "hw/loader.h"
 
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_vio.h"
 #include "hw/pci-host/spapr.h"
 #include "hw/ppc/xics.h"
 #include "hw/pci/msi.h"
 
-#include "sysemu/kvm.h"
-#include "kvm_ppc.h"
 #include "hw/pci/pci.h"
 
 #include "exec/address-spaces.h"
 #include "hw/usb.h"
 #include "qemu/config-file.h"
 
 #include <libfdt.h>
 
 /* SLOF memory layout:
  *
hw/ppc/spapr_hcall.c +0 -1
index f518aee..8f0b7e8 100644
@@ -1,13 +1,12 @@
 #include "sysemu/sysemu.h"
 #include "cpu.h"
-#include "sysemu/sysemu.h"
 #include "helper_regs.h"
 #include "hw/ppc/spapr.h"
 #include "mmu-hash64.h"
 
 static target_ulong compute_tlbie_rb(target_ulong v, target_ulong r,
                                      target_ulong pte_index)
 {
     target_ulong rb, va_low;
 
     rb = (v & ~0x7fULL) << 16; /* AVA field */
hw/timer/exynos4210_rtc.c +0 -1
index bceee44..3ac77f9 100644
@@ -24,21 +24,20 @@
  *  CLKSEL Bit[1] not used
  *  CLKOUTEN Bit[9] not used
  */
 
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "qemu-common.h"
 #include "hw/ptimer.h"
 
 #include "hw/hw.h"
-#include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 
 #include "hw/arm/exynos4210.h"
 
 #define DEBUG_RTC 0
 
 #if DEBUG_RTC
 #define DPRINTF(fmt, ...) \
         do { fprintf(stdout, "RTC: [%24s:%5d] " fmt, __func__, __LINE__, \
                 ## __VA_ARGS__); } while (0)
include/hw/i386/pc.h +0 -1
index 2bd7090..740cf49 100644
@@ -1,20 +1,19 @@
 #ifndef HW_PC_H
 #define HW_PC_H
 
 #include "qemu-common.h"
 #include "exec/memory.h"
 #include "exec/ioport.h"
 #include "hw/isa/isa.h"
 #include "hw/block/fdc.h"
 #include "net/net.h"
-#include "exec/memory.h"
 #include "hw/i386/ioapic.h"
 
 /* PC-style peripherals (also used by other machines).  */
 
 /* parallel.c */
 static inline bool parallel_init(ISABus *bus, int index, CharDriverState *chr)
 {
     ISADevice *dev;
 
     dev = isa_try_create(bus, "isa-parallel");
include/qapi/qmp/qlist.h +0 -1
index 382f04c..6cc4831 100644
@@ -8,21 +8,20 @@
  *
  * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
  * See the COPYING.LIB file in the top-level directory.
  */
 
 #ifndef QLIST_H
 #define QLIST_H
 
 #include "qapi/qmp/qobject.h"
 #include "qemu/queue.h"
-#include "qemu/queue.h"
 
 typedef struct QListEntry {
     QObject *value;
     QTAILQ_ENTRY(QListEntry) next;
 } QListEntry;
 
 typedef struct QList {
     QObject_HEAD;
     QTAILQ_HEAD(,QListEntry) head;
 } QList;
include/qemu/config-file.h +0 -1
index ccfccae..ad4a9e5 100644
@@ -1,17 +1,16 @@
 #ifndef QEMU_CONFIG_H
 #define QEMU_CONFIG_H
 
 #include <stdio.h>
 #include "qemu/option.h"
 #include "qapi/error.h"
-#include "qemu/option.h"
 
 QemuOptsList *qemu_find_opts(const char *group);
 QemuOptsList *qemu_find_opts_err(const char *group, Error **errp);
 void qemu_add_opts(QemuOptsList *list);
 int qemu_set_option(const char *str);
 int qemu_global_option(const char *str);
 void qemu_add_globals(void);
 
 void qemu_config_write(FILE *fp);
 int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname);
monitor.c +0 -1
index 62aaebe..6ce2a4e 100644
@@ -56,21 +56,20 @@
 #include "qapi/qmp/qjson.h"
 #include "qapi/qmp/json-streamer.h"
 #include "qapi/qmp/json-parser.h"
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "trace.h"
 #include "trace/control.h"
 #ifdef CONFIG_TRACE_SIMPLE
 #include "trace/simple.h"
 #endif
-#include "ui/qemu-spice.h"
 #include "exec/memory.h"
 #include "qmp-commands.h"
 #include "hmp.h"
 #include "qemu/thread.h"
 
 /* for pic/irq_info */
 #if defined(TARGET_SPARC)
 #include "hw/sparc/sun4m.h"
 #endif
 #include "hw/lm32/lm32_pic.h"
page_cache.c +0 -1
index 938a79c..a05db64 100644
@@ -14,21 +14,20 @@
 
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <strings.h>
 #include <string.h>
 #include <sys/time.h>
 #include <sys/types.h>
 #include <stdbool.h>
 #include <glib.h>
-#include <strings.h>
 
 #include "qemu-common.h"
 #include "migration/page_cache.h"
 
 #ifdef DEBUG_CACHE
 #define DPRINTF(fmt, ...) \
     do { fprintf(stdout, "cache: " fmt, ## __VA_ARGS__); } while (0)
 #else
 #define DPRINTF(fmt, ...) \
     do { } while (0)
slirp/misc.c +0 -2
index 8ecced5..0bcc481 100644
@@ -235,22 +235,20 @@ strdup(str)
 {
 	char *bptr;
 
 	bptr = (char *)malloc(strlen(str)+1);
 	strcpy(bptr, str);
 
 	return bptr;
 }
 #endif
 
-#include "monitor/monitor.h"
-
 void lprint(const char *format, ...)
 {
     va_list args;
 
     va_start(args, format);
     monitor_vprintf(default_mon, format, args);
     va_end(args);
 }
 
 void slirp_connection_info(Slirp *slirp, Monitor *mon)
target-ppc/kvm.c +0 -2
index 725071e..3ab2946 100644
@@ -23,22 +23,20 @@
 #include <linux/kvm.h>
 
 #include "qemu-common.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
 #include "kvm_ppc.h"
 #include "cpu.h"
 #include "sysemu/cpus.h"
 #include "sysemu/device_tree.h"
-#include "hw/sysbus.h"
-#include "hw/ppc/spapr.h"
 #include "mmu-hash64.h"
 
 #include "hw/sysbus.h"
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_vio.h"
 #include "sysemu/watchdog.h"
 
 //#define DEBUG_KVM
 
 #ifdef DEBUG_KVM
tests/tcg/linux-test.c +0 -1
index 83cb32d..1c6c013 100644
@@ -32,21 +32,20 @@
 #include <time.h>
 #include <sys/time.h>
 #include <sys/uio.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <sched.h>
 #include <dirent.h>
 #include <setjmp.h>
 #include <sys/shm.h>
-#include <sched.h>
 
 #define TESTPATH "/tmp/linux-test.tmp"
 #define TESTPORT 7654
 #define STACK_SIZE 16384
 
 void error1(const char *filename, int line, const char *fmt, ...)
 {
     va_list ap;
     va_start(ap, fmt);
     fprintf(stderr, "%s:%d: ", filename, line);
translate-all.c +0 -1
index da93608..a18bf55 100644
@@ -52,21 +52,20 @@
 #include <libutil.h>
 #endif
 #endif
 #else
 #include "exec/address-spaces.h"
 #endif
 #include "qemu/timer.h"
 
 #include "exec/cputlb.h"
 #include "translate-all.h"
-#include "qemu/timer.h"
 
 //#define DEBUG_TB_INVALIDATE
 //#define DEBUG_FLUSH
 /* make various TB consistency checks */
 //#define DEBUG_TB_CHECK
 
 #if !defined(CONFIG_USER_ONLY)
 /* TB consistency checks only implemented for usermode emulation.  */
 #undef DEBUG_TB_CHECK
 #endif
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 10 lines · Michael Tokarev

Some source files #include the same header more than once for no good reason. Remove second #includes in such cases.

translate-all.c +0 -0
index da93608..a18bf55 100644
@@ -52,21 +52,20 @@
 #include <libutil.h>

translate-all.c line 62

Quoted 10 lines
translate-all.c +0 -1
 #endif
 #endif
 #else
 #include "exec/address-spaces.h"
 #endif
 #include "qemu/timer.h"
 
 #include "exec/cputlb.h"
 #include "translate-all.h"
-#include "qemu/timer.h"

There's already been a patch on the list for this one:
http://patchwork.ozlabs.org/patch/240540/

thanks
-- PMM

#2 lore raw
Quoted 18 lines · Peter Maydell
Quoted 17 lines · Michael Tokarev

Some source files #include the same header more than once for no good reason. Remove second #includes in such cases.

translate-all.c +0 -0
index da93608..a18bf55 100644
@@ -52,21 +52,20 @@
 #include <libutil.h>
 #endif
 #endif
 #else
 #include "exec/address-spaces.h"
 #endif
 #include "qemu/timer.h"
 
Quoted 7 lines

translate-all.c line 62

Quoted 3 lines
translate-all.c +0 -1
 #include "exec/cputlb.h"
 #include "translate-all.h"
-#include "qemu/timer.h"

There's already been a patch on the list for this one:
http://patchwork.ozlabs.org/patch/240540/

Yes I know Peter, and actually this is the patch which prompte me to look for other places. The person in question does not reply (so far), so I thought maybe cleaning up more duplicates is a good idea, or else the patch will just stuck.

/mjt

#3 lore raw
Quoted 8 lines · Michael Tokarev
Quoted 4 lines · Peter Maydell

There's already been a patch on the list for this one:
http://patchwork.ozlabs.org/patch/240540/

Yes I know Peter, and actually this is the patch which prompte me to look for other places. The person in question does not reply (so far)

Is there anything they need to reply to? The patch is good, it has a signed-off-by and a review, you can just put it in the trivial queue to be applied next time you do a pull request for it.

thanks
-- PMM

#4 lore raw
Quoted 6 lines · Peter Maydell
Quoted 5 lines · Michael Tokarev
Quoted 4 lines · Peter Maydell

There's already been a patch on the list for this one:
http://patchwork.ozlabs.org/patch/240540/

Quoted 8 lines
Quoted 3 lines

Yes I know Peter, and actually this is the patch which prompte me to look for other places. The person in question does not reply (so far)

Is there anything they need to reply to? The patch is good, it has a signed-off-by and a review, you can just put it in the trivial queue to be applied next time you do a pull request for it.

OH. That's my dirty script. I didn't notice S-o-b in text without patch description ;)

Sure that's enough now when I see it :)

Thank you!

/mjt