Clean up includes
PATCH 1/1 Clean up includes
Clean up includes so that osdep.h is included first and headers which it implies are not included manually.
This commit was created with scripts/clean-includes, with the changes to the following files manually reverted:
contrib/libvhost-user/libvhost-user-glib.h
contrib/libvhost-user/libvhost-user.c
contrib/libvhost-user/libvhost-user.h
linux-user/mips64/cpu_loop.c
linux-user/mips64/signal.c
linux-user/sparc64/cpu_loop.c
linux-user/sparc64/signal.c
linux-user/x86_64/cpu_loop.c
linux-user/x86_64/signal.c
target/s390x/gen-features.c
tests/migration/s390x/a-b-bios.c
tests/test-rcu-simpleq.c
tests/test-rcu-tailq.c--- contrib/elf2dmp/pdb.h | 2 -- contrib/elf2dmp/pe.h | 1 - contrib/elf2dmp/qemu_elf.h | 1 - contrib/vhost-user-blk/vhost-user-blk.c | 1 - contrib/vhost-user-scsi/vhost-user-scsi.c | 1 - hw/rdma/rdma_utils.c | 1 + hw/rdma/rdma_utils.h | 1 - hw/rdma/vmw/pvrdma_dev_ring.h | 1 - hw/vfio/ap.c | 2 +- include/qemu/vfio-helpers.h | 1 - include/sysemu/whpx.h | 1 - target/i386/sev.c | 3 ++- target/i386/whp-dispatch.h | 1 - target/riscv/fpu_helper.c | 1 - tests/fp/platform.h | 1 - tests/tpm-util.h | 1 - tests/vhost-user-bridge.c | 2 +- util/qemu-thread-common.h | 1 - 18 files changed, 5 insertions(+), 18 deletions(-)
contrib/elf2dmp/pdb.h +0 -2
@@ -8,8 +8,6 @@ #ifndef PDB_H #define PDB_H -#include <stdint.h> -#include <stdlib.h> typedef struct GUID { unsigned int Data1;
contrib/elf2dmp/pe.h +0 -1
@@ -8,7 +8,6 @@ #ifndef PE_H #define PE_H -#include <stdint.h> typedef struct IMAGE_DOS_HEADER { uint16_t e_magic; /* 0x00: MZ Header signature */
contrib/elf2dmp/qemu_elf.h +0 -1
@@ -8,7 +8,6 @@ #ifndef QEMU_ELF_H #define QEMU_ELF_H -#include <stdint.h> #include <elf.h> typedef struct QEMUCPUSegment {
contrib/vhost-user-blk/vhost-user-blk.c +0 -1
@@ -20,7 +20,6 @@#include "contrib/libvhost-user/libvhost-user-glib.h" #include "contrib/libvhost-user/libvhost-user.h" -#include <glib.h> struct virtio_blk_inhdr {unsigned char status;
contrib/vhost-user-scsi/vhost-user-scsi.c +0 -1
@@ -16,7 +16,6 @@#include "contrib/libvhost-user/libvhost-user-glib.h" #include "standard-headers/linux/virtio_scsi.h" -#include <glib.h> #define VUS_ISCSI_INITIATOR "iqn.2016-11.com.nutanix:vhost-user-scsi"
hw/rdma/rdma_utils.c +1 -0
@@ -13,6 +13,7 @@* */ +#include "qemu/osdep.h" #include "rdma_utils.h" #ifdef PVRDMA_DEBUG
hw/rdma/rdma_utils.h +0 -1
@@ -17,7 +17,6 @@#ifndef RDMA_UTILS_H #define RDMA_UTILS_H -#include "qemu/osdep.h" #include "hw/pci/pci.h" #include "sysemu/dma.h"
hw/rdma/vmw/pvrdma_dev_ring.h +0 -1
@@ -16,7 +16,6 @@#ifndef PVRDMA_DEV_RING_H #define PVRDMA_DEV_RING_H -#include "qemu/typedefs.h" #define MAX_RING_NAME_SZ 32
hw/vfio/ap.c +1 -1
@@ -10,9 +10,9 @@* directory. */ +#include "qemu/osdep.h" #include <linux/vfio.h> #include <sys/ioctl.h> -#include "qemu/osdep.h" #include "qapi/error.h" #include "hw/sysbus.h" #include "hw/vfio/vfio.h"
include/qemu/vfio-helpers.h +0 -1
@@ -12,7 +12,6 @@#ifndef QEMU_VFIO_HELPERS_H #define QEMU_VFIO_HELPERS_H -#include "qemu/typedefs.h" typedef struct QEMUVFIOState QEMUVFIOState ;
include/sysemu/whpx.h +0 -1
@@ -13,7 +13,6 @@#ifndef QEMU_WHPX_H #define QEMU_WHPX_H -#include "config-host.h" #include "qemu-common.h" int whpx_init_vcpu (CPUState *cpu);
target/i386/sev.c +2 -1
@@ -11,12 +11,13 @@* */ +#include "qemu/osdep.h" +#include <linux/kvm.h> #include <linux/psp-sev.h> #include <sys/ioctl.h> -#include "qemu/osdep.h" #include "qapi/error.h" #include "qom/object_interfaces.h" #include "qemu/base64.h"
target/i386/whp-dispatch.h +0 -1
@@ -1,5 +1,4 @@#include "windows.h" -#include <stdbool.h> #include <WinHvPlatform.h> #include <WinHvEmulation.h>
target/riscv/fpu_helper.c +0 -1
@@ -17,7 +17,6 @@*/ #include "qemu/osdep.h" -#include <stdlib.h> #include "cpu.h" #include "qemu/host-utils.h" #include "exec/exec-all.h"
tests/fp/platform.h +0 -1
@@ -29,7 +29,6 @@* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config-host.h" #ifndef HOST_WORDS_BIGENDIAN #define LITTLEENDIAN 1
tests/tpm-util.h +0 -1
@@ -13,7 +13,6 @@#ifndef TESTS_TPM_UTIL_H #define TESTS_TPM_UTIL_H -#include "qemu/osdep.h" #include "io/channel-socket.h" typedef void (tx_func)(QTestState *s,
tests/vhost-user-bridge.c +1 -1
@@ -29,8 +29,8 @@#define _FILE_OFFSET_BITS 64 -#include "qemu/atomic.h" #include "qemu/osdep.h" +#include "qemu/atomic.h" #include "qemu/iov.h" #include "standard-headers/linux/virtio_net.h" #include "contrib/libvhost-user/libvhost-user.h"
util/qemu-thread-common.h +0 -1
@@ -13,7 +13,6 @@#ifndef QEMU_THREAD_COMMON_H #define QEMU_THREAD_COMMON_H -#include "qemu/typedefs.h" #include "qemu/thread.h" #include "trace.h"
Signature · 1 line
2.17.2
Quoted 9 lines · Markus Armbruster
Clean up includes so that
osdep.his included first and headers which it implies are not included manually.This commit was created with
scripts/clean-includes, with the changes to the following files manually reverted:
contrib/libvhost-user/libvhost-user-glib.h
contrib/libvhost-user/libvhost-user.c
contrib/libvhost-user/libvhost-user.h
The script should probably auto-exclude contrib/ if none of those files make it into our final binary, and especially if they are meant to be compiled as stand-alone examples.
Quoted 10 lines
linux-user/mips64/cpu_loop.c
linux-user/mips64/signal.c
linux-user/sparc64/cpu_loop.c
linux-user/sparc64/signal.c
linux-user/x86_64/cpu_loop.c
linux-user/x86_64/signal.c
target/s390x/gen-features.c
tests/migration/s390x/a-b-bios.c
tests/test-rcu-simpleq.c
tests/test-rcu-tailq.cShould any of these files be renamed *.c.inc to match their usage? (Presuming that you excluded them because they are pulled in via another .c file?)
Quoted 8 lines
Signed-off-by Markus Armbruster <[email protected]>--- contrib/elf2dmp/pdb.h | 2 -- contrib/elf2dmp/pe.h | 1 - contrib/elf2dmp/qemu_elf.h | 1 - contrib/vhost-user-blk/vhost-user-blk.c | 1 - contrib/vhost-user-scsi/vhost-user-scsi.c | 1 -
Hmm - my earlier question about auto-excluding contrib/ gets trickier. What's the rationale for including some files in here?
Quoted 6 lines
hw/rdma/rdma_utils.c | 1 + hw/rdma/rdma_utils.h | 1 - hw/rdma/vmw/pvrdma_dev_ring.h | 1 - hw/vfio/ap.c | 2 +- include/qemu/vfio-helpers.h | 1 - include/sysemu/whpx.h | 1 -
Quoted 8 lines
target/i386/sev.c | 3 ++- target/i386/whp-dispatch.h | 1 - target/riscv/fpu_helper.c | 1 - tests/fp/platform.h | 1 - tests/tpm-util.h | 1 - tests/vhost-user-bridge.c | 2 +- util/qemu-thread-common.h | 1 - 18 files changed, 5 insertions(+), 18 deletions(-)
The remainder of these files look reasonable.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 28 lines · Eric Blake
Quoted 9 lines · Markus Armbruster
Clean up includes so that
osdep.his included first and headers which it implies are not included manually.This commit was created with
scripts/clean-includes, with the changes to the following files manually reverted:
contrib/libvhost-user/libvhost-user-glib.h
contrib/libvhost-user/libvhost-user.c
contrib/libvhost-user/libvhost-user.hThe script should probably auto-exclude contrib/ if none of those files make it into our final binary, and especially if they are meant to be compiled as stand-alone examples.
Quoted 10 lines
linux-user/mips64/cpu_loop.c linux-user/mips64/signal.c linux-user/sparc64/cpu_loop.c linux-user/sparc64/signal.c linux-user/x86_64/cpu_loop.c linux-user/x86_64/signal.c target/s390x/gen-features.c tests/migration/s390x/a-b-bios.c tests/test-rcu-simpleq.c tests/test-rcu-tailq.c
Quoted 3 lines
Should any of these files be renamed *.c.inc to match their usage? (Presuming that you excluded them because they are pulled in via another .c file?)
The linux-user/T64/N.c contain nothing but
#include "../T/N.c"
plus sometimes a #define T_TARGET_SINGAL_H thrown in to suppress inclusion of a header.
Perhaps moving the actual meat into a common .inc.c would be cleaner.
Similarly, tests/test-rcu-simpleq.c contains nothing but
#define TEST_LIST_TYPE 2
#include "test-rcu-list.c"and tests/test-rcu-tailq.c is the same with 3 instead of 2.
Again, we could move the actual meat into a common .inc.c. But I'd first investigate compiling the test three times with the appropriate -DTEST_LIST_TYPE, using GNU Make's target-specific variable values.
target/s390x/gen-features.c is a standalone program that is compiled in a way that breaks when we include osdep.h. If that's fixable, fixing it would be nice. Aside: not sure I'd have written this in C.
tests/migration/s390x/ is a s390x guest firmware program for migration-test.c. It's compiled as a freestanding application. I guess osdep.h just gets in the way there.
All of the above is well beyond the scope of this simple cleanup patch.
Quoted 11 lines
Quoted 8 lines
Signed-off-by Markus Armbruster <[email protected]>--- contrib/elf2dmp/pdb.h | 2 -- contrib/elf2dmp/pe.h | 1 - contrib/elf2dmp/qemu_elf.h | 1 - contrib/vhost-user-blk/vhost-user-blk.c | 1 - contrib/vhost-user-scsi/vhost-user-scsi.c | 1 -Hmm - my earlier question about auto-excluding contrib/ gets trickier. What's the rationale for including some files in here?
These are standalone programs that already include osdep.h. My patch simply drops superfluous include directives.
Quoted 15 lines
Quoted 6 lines
hw/rdma/rdma_utils.c | 1 + hw/rdma/rdma_utils.h | 1 - hw/rdma/vmw/pvrdma_dev_ring.h | 1 - hw/vfio/ap.c | 2 +- include/qemu/vfio-helpers.h | 1 - include/sysemu/whpx.h | 1 -Quoted 8 lines
target/i386/sev.c | 3 ++- target/i386/whp-dispatch.h | 1 - target/riscv/fpu_helper.c | 1 - tests/fp/platform.h | 1 - tests/tpm-util.h | 1 - tests/vhost-user-bridge.c | 2 +- util/qemu-thread-common.h | 1 - 18 files changed, 5 insertions(+), 18 deletions(-)
Quoted 1 line
The remainder of these files look reasonable.
Thanks!
Quoted 6 lines · On Wed, 05 Dec 2018 09:07:13 +0100 Markus Armbruster <[email protected]> wrote:
Quoted 6 lines · Markus Armbruster
Quoted 5 lines
Clean up includes so that
osdep.his included first and headers which it implies are not included manually.This commit was created with
scripts/clean-includes, with the changes to the following files manually reverted:
(...)
Quoted 1 line
Quoted 1 line
Quoted 1 line
target/s390x/gen-features.c
(..)
Quoted 3 lines
target/s390x/gen-features.cis a standalone program that is compiled in a way that breaks when we includeosdep.h. If that's fixable, fixing it would be nice. Aside: not sure I'd have written this in C.
Yes, that file is a bit of an oddball. Might make sense to add a comment there that it is standalone, so you can find that out without looking at the Makefile. I don't think rewriting this to something else is worth the effort.
Quoted 20 lines · Markus Armbruster
Clean up includes so that
osdep.his included first and headers which it implies are not included manually.This commit was created with
scripts/clean-includes, with the changes to the following files manually reverted:contrib/libvhost-user/libvhost-user-glib.h contrib/libvhost-user/libvhost-user.c contrib/libvhost-user/libvhost-user.h linux-user/mips64/cpu_loop.c linux-user/mips64/signal.c linux-user/sparc64/cpu_loop.c linux-user/sparc64/signal.c linux-user/x86_64/cpu_loop.c linux-user/x86_64/signal.c target/s390x/gen-features.c tests/migration/s390x/a-b-bios.c tests/test-rcu-simpleq.c tests/test-rcu-tailq.c
Quoted 1 line
Signed-off-by Markus Armbruster <[email protected]>
Signature · 1 line
Eduardo
Quoted 20 lines · On Tue, 4 Dec 2018 18:25:35 +0100 Markus Armbruster <[email protected]> wrote:
Clean up includes so that
osdep.his included first and headers which it implies are not included manually.This commit was created with
scripts/clean-includes, with the changes to the following files manually reverted:contrib/libvhost-user/libvhost-user-glib.h contrib/libvhost-user/libvhost-user.c contrib/libvhost-user/libvhost-user.h linux-user/mips64/cpu_loop.c linux-user/mips64/signal.c linux-user/sparc64/cpu_loop.c linux-user/sparc64/signal.c linux-user/x86_64/cpu_loop.c linux-user/x86_64/signal.c target/s390x/gen-features.c tests/migration/s390x/a-b-bios.c tests/test-rcu-simpleq.c tests/test-rcu-tailq.c
Quoted 1 line
Signed-off-by Markus Armbruster <[email protected]>
Thanks,
Halil
Quoted 20 lines · Markus Armbruster
Clean up includes so that
osdep.his included first and headers which it implies are not included manually.This commit was created with
scripts/clean-includes, with the changes to the following files manually reverted:contrib/libvhost-user/libvhost-user-glib.h contrib/libvhost-user/libvhost-user.c contrib/libvhost-user/libvhost-user.h linux-user/mips64/cpu_loop.c linux-user/mips64/signal.c linux-user/sparc64/cpu_loop.c linux-user/sparc64/signal.c linux-user/x86_64/cpu_loop.c linux-user/x86_64/signal.c target/s390x/gen-features.c tests/migration/s390x/a-b-bios.c tests/test-rcu-simpleq.c tests/test-rcu-tailq.c
Quoted 7 lines
Signed-off-by Markus Armbruster <[email protected]>--- contrib/elf2dmp/pdb.h | 2 -- contrib/elf2dmp/pe.h | 1 - contrib/elf2dmp/qemu_elf.h | 1 - contrib/vhost-user-blk/vhost-user-blk.c | 1 - contrib/vhost-user-scsi/vhost-user-scsi.c | 1 -
For the rdma part:
Quoted 3 lines
hw/rdma/rdma_utils.c | 1 + hw/rdma/rdma_utils.h | 1 - hw/rdma/vmw/pvrdma_dev_ring.h | 1 -
Thanks.
Quoted 242 lines
hw/vfio/ap.c | 2 +- include/qemu/vfio-helpers.h | 1 - include/sysemu/whpx.h | 1 - target/i386/sev.c | 3 ++- target/i386/whp-dispatch.h | 1 - target/riscv/fpu_helper.c | 1 - tests/fp/platform.h | 1 - tests/tpm-util.h | 1 - tests/vhost-user-bridge.c | 2 +- util/qemu-thread-common.h | 1 - 18 files changed, 5 insertions(+), 18 deletions(-)contrib/elf2dmp/pdb.h +0
-2@@ -8,8 +8,6 @@ #ifndef PDB_H #define PDB_H -#include <stdint.h> -#include <stdlib.h> typedef struct GUID { unsigned int Data1;contrib/elf2dmp/pe.h +0
-1@@ -8,7 +8,6 @@ #ifndef PE_H #define PE_H -#include <stdint.h> typedef struct IMAGE_DOS_HEADER { uint16_t e_magic; /* 0x00: MZ Header signature */contrib/elf2dmp/qemu_elf.h +0
-1@@ -8,7 +8,6 @@ #ifndef QEMU_ELF_H #define QEMU_ELF_H -#include <stdint.h> #include <elf.h> typedef struct QEMUCPUSegment {contrib/vhost-user-blk/vhost-user-blk.c +0
-1@@ -20,7 +20,6 @@#include "contrib/libvhost-user/libvhost-user-glib.h" #include "contrib/libvhost-user/libvhost-user.h" -#include <glib.h> struct virtio_blk_inhdr {unsigned char status;contrib/vhost-user-scsi/vhost-user-scsi.c +0
-1@@ -16,7 +16,6 @@#include "contrib/libvhost-user/libvhost-user-glib.h" #include "standard-headers/linux/virtio_scsi.h" -#include <glib.h> #define VUS_ISCSI_INITIATOR "iqn.2016-11.com.nutanix:vhost-user-scsi"hw/rdma/rdma_utils.c +1
-0@@ -13,6 +13,7 @@* */ +#include "qemu/osdep.h" #include "rdma_utils.h" #ifdef PVRDMA_DEBUG hw/rdma/rdma_utils.h +0
-1@@ -17,7 +17,6 @@#ifndef RDMA_UTILS_H #define RDMA_UTILS_H -#include "qemu/osdep.h" #include "hw/pci/pci.h" #include "sysemu/dma.h" hw/rdma/vmw/pvrdma_dev_ring.h +0
-1@@ -16,7 +16,6 @@#ifndef PVRDMA_DEV_RING_H #define PVRDMA_DEV_RING_H -#include "qemu/typedefs.h" #define MAX_RING_NAME_SZ 32hw/vfio/ap.c +1
-1@@ -10,9 +10,9 @@* directory. */ +#include "qemu/osdep.h" #include <linux/vfio.h> #include <sys/ioctl.h> -#include "qemu/osdep.h" #include "qapi/error.h" #include "hw/sysbus.h" #include "hw/vfio/vfio.h" include/qemu/vfio-helpers.h +0
-1@@ -12,7 +12,6 @@#ifndef QEMU_VFIO_HELPERS_H #define QEMU_VFIO_HELPERS_H -#include "qemu/typedefs.h" typedef struct QEMUVFIOState QEMUVFIOState ;include/sysemu/whpx.h +0
-1@@ -13,7 +13,6 @@#ifndef QEMU_WHPX_H #define QEMU_WHPX_H -#include "config-host.h" #include "qemu-common.h" int whpx_init_vcpu (CPUState *cpu);target/i386/sev.c +2
-1@@ -11,12 +11,13 @@* */ +#include "qemu/osdep.h" +#include <linux/kvm.h> #include <linux/psp-sev.h> #include <sys/ioctl.h> -#include "qemu/osdep.h" #include "qapi/error.h" #include "qom/object_interfaces.h" #include "qemu/base64.h" target/i386/whp-dispatch.h +0
-1@@ -1,5 +1,4 @@#include "windows.h" -#include <stdbool.h> #include <WinHvPlatform.h> #include <WinHvEmulation.h> target/riscv/fpu_helper.c +0
-1@@ -17,7 +17,6 @@*/ #include "qemu/osdep.h" -#include <stdlib.h> #include "cpu.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" tests/fp/platform.h +0
-1@@ -29,7 +29,6 @@* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config-host.h" #ifndef HOST_WORDS_BIGENDIAN #define LITTLEENDIAN 1tests/tpm-util.h +0
-1@@ -13,7 +13,6 @@#ifndef TESTS_TPM_UTIL_H #define TESTS_TPM_UTIL_H -#include "qemu/osdep.h" #include "io/channel-socket.h" typedef void (tx_func)(QTestState *s,tests/vhost-user-bridge.c +1
-1@@ -29,8 +29,8 @@#define _FILE_OFFSET_BITS 64 -#include "qemu/atomic.h" #include "qemu/osdep.h" +#include "qemu/atomic.h" #include "qemu/iov.h" #include "standard-headers/linux/virtio_net.h" #include "contrib/libvhost-user/libvhost-user.h" util/qemu-thread-common.h +0
-1@@ -13,7 +13,6 @@#ifndef QEMU_THREAD_COMMON_H #define QEMU_THREAD_COMMON_H -#include "qemu/typedefs.h" #include "qemu/thread.h" #include "trace.h" Signature · 1 line
2.17.2
Quoted 20 lines · On Tue, 4 Dec 2018 18:25:35 +0100 Markus Armbruster <[email protected]> wrote:
Clean up includes so that
osdep.his included first and headers which it implies are not included manually.This commit was created with
scripts/clean-includes, with the changes to the following files manually reverted:contrib/libvhost-user/libvhost-user-glib.h contrib/libvhost-user/libvhost-user.c contrib/libvhost-user/libvhost-user.h linux-user/mips64/cpu_loop.c linux-user/mips64/signal.c linux-user/sparc64/cpu_loop.c linux-user/sparc64/signal.c linux-user/x86_64/cpu_loop.c linux-user/x86_64/signal.c target/s390x/gen-features.c tests/migration/s390x/a-b-bios.c tests/test-rcu-simpleq.c tests/test-rcu-tailq.c
Quoted 2 lines
Signed-off-by Markus Armbruster <[email protected]>---
For the elf2dmp:
Quoted 3 lines
contrib/elf2dmp/pdb.h | 2 -- contrib/elf2dmp/pe.h | 1 - contrib/elf2dmp/qemu_elf.h | 1 -
Signature · 1 line
Viktor Prutyanov