From e03b56863d2bca3e649e81531c1b0299524481ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 23 Mar 2022 19:57:17 +0400 Subject: Replace config-time define HOST_WORDS_BIGENDIAN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace a config-time define with a compile time condition define (compatible with clang and gcc) that must be declared prior to its usage. This avoids having a global configure time define, but also prevents from bad usage, if the config header wasn't included before. This can help to make some code independent from qemu too. gcc supports __BYTE_ORDER__ from about 4.6 and clang from 3.2. Signed-off-by: Marc-André Lureau [ For the s390x parts I'm involved in ] Acked-by: Halil Pasic Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20220323155743.1585078-7-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- tests/qtest/vhost-user-blk-test.c | 2 +- tests/qtest/virtio-blk-test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/qtest') diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c index 62e670f..659b505 100644 --- a/tests/qtest/vhost-user-blk-test.c +++ b/tests/qtest/vhost-user-blk-test.c @@ -37,7 +37,7 @@ typedef struct QVirtioBlkReq { uint8_t status; } QVirtioBlkReq; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN static const bool host_is_big_endian = true; #else static const bool host_is_big_endian; /* false */ diff --git a/tests/qtest/virtio-blk-test.c b/tests/qtest/virtio-blk-test.c index 2a23698..f22594a 100644 --- a/tests/qtest/virtio-blk-test.c +++ b/tests/qtest/virtio-blk-test.c @@ -33,7 +33,7 @@ typedef struct QVirtioBlkReq { } QVirtioBlkReq; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN const bool host_is_big_endian = true; #else const bool host_is_big_endian; /* false */ -- cgit v1.1 From 415b732751daeccfff681898a716180ceb34dc4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 23 Mar 2022 19:57:32 +0400 Subject: include: move C/util-related declarations to cutils.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Message-Id: <20220323155743.1585078-22-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- tests/qtest/npcm7xx_rng-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/qtest') diff --git a/tests/qtest/npcm7xx_rng-test.c b/tests/qtest/npcm7xx_rng-test.c index 797f832..35b1c1f 100644 --- a/tests/qtest/npcm7xx_rng-test.c +++ b/tests/qtest/npcm7xx_rng-test.c @@ -20,7 +20,7 @@ #include "libqtest-single.h" #include "qemu/bitops.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #define RNG_BASE_ADDR 0xf000b000 -- cgit v1.1 From 0f9668e0c197ab6de95f61a906703a1d127c11f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 23 Mar 2022 19:57:43 +0400 Subject: Remove qemu-common.h include from most units MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Message-Id: <20220323155743.1585078-33-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- tests/qtest/acpi-utils.c | 1 - tests/qtest/ahci-test.c | 1 - tests/qtest/aspeed_hace-test.c | 1 - tests/qtest/bios-tables-test.c | 1 - tests/qtest/boot-sector.c | 1 - tests/qtest/cpu-plug-test.c | 1 - tests/qtest/dbus-display-test.c | 1 - tests/qtest/dbus-vmstate-test.c | 1 - tests/qtest/device-introspect-test.c | 1 - tests/qtest/e1000e-test.c | 2 -- tests/qtest/erst-test.c | 1 - tests/qtest/fdc-test.c | 1 - tests/qtest/fuzz/qos_fuzz.c | 1 - tests/qtest/hd-geo-test.c | 1 - tests/qtest/ide-test.c | 1 - tests/qtest/ipmi-bt-test.c | 1 - tests/qtest/ivshmem-test.c | 1 - tests/qtest/libqos/ahci.c | 1 - tests/qtest/libqos/malloc-pc.c | 2 -- tests/qtest/libqos/malloc-spapr.c | 2 -- tests/qtest/libqos/malloc.c | 1 - tests/qtest/libqtest.c | 1 - tests/qtest/machine-none-test.c | 1 - tests/qtest/npcm7xx_emc-test.c | 1 - tests/qtest/pxe-test.c | 1 - tests/qtest/qom-test.c | 1 - tests/qtest/rtl8139-test.c | 1 - tests/qtest/test-filter-mirror.c | 1 - tests/qtest/test-filter-redirector.c | 1 - tests/qtest/test-x86-cpuid-compat.c | 1 - tests/qtest/virtio-net-test.c | 1 - 31 files changed, 34 deletions(-) (limited to 'tests/qtest') diff --git a/tests/qtest/acpi-utils.c b/tests/qtest/acpi-utils.c index 766c48e..673fc97 100644 --- a/tests/qtest/acpi-utils.c +++ b/tests/qtest/acpi-utils.c @@ -14,7 +14,6 @@ #include "qemu/osdep.h" #include -#include "qemu-common.h" #include "qemu/bitmap.h" #include "acpi-utils.h" #include "boot-sector.h" diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index 8073ccc..aff5f3f 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -30,7 +30,6 @@ #include "libqos/ahci.h" #include "libqos/pci-pc.h" -#include "qemu-common.h" #include "qapi/qmp/qdict.h" #include "qemu/host-utils.h" diff --git a/tests/qtest/aspeed_hace-test.c b/tests/qtest/aspeed_hace-test.c index 09ee315..58aa220 100644 --- a/tests/qtest/aspeed_hace-test.c +++ b/tests/qtest/aspeed_hace-test.c @@ -8,7 +8,6 @@ #include "qemu/osdep.h" #include "libqos/libqtest.h" -#include "qemu-common.h" #include "qemu/bitops.h" #define HACE_CMD 0x10 diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index c4a2d1e..5dddeda 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -57,7 +57,6 @@ #include "qemu/osdep.h" #include -#include "qemu-common.h" #include "hw/firmware/smbios.h" #include "qemu/bitmap.h" #include "acpi-utils.h" diff --git a/tests/qtest/boot-sector.c b/tests/qtest/boot-sector.c index ea8f264..9d9825b 100644 --- a/tests/qtest/boot-sector.c +++ b/tests/qtest/boot-sector.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" #include "boot-sector.h" -#include "qemu-common.h" #include "libqos/libqtest.h" #define LOW(x) ((x) & 0xff) diff --git a/tests/qtest/cpu-plug-test.c b/tests/qtest/cpu-plug-test.c index a1c6894..7f5dd5f 100644 --- a/tests/qtest/cpu-plug-test.c +++ b/tests/qtest/cpu-plug-test.c @@ -9,7 +9,6 @@ #include "qemu/osdep.h" -#include "qemu-common.h" #include "libqtest-single.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" diff --git a/tests/qtest/dbus-display-test.c b/tests/qtest/dbus-display-test.c index 43c77af..8104316 100644 --- a/tests/qtest/dbus-display-test.c +++ b/tests/qtest/dbus-display-test.c @@ -3,7 +3,6 @@ #include #include #include "libqos/libqtest.h" -#include "qemu-common.h" #include "dbus-display1.h" static GDBusConnection* diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-test.c index aca9b98..a8acab7 100644 --- a/tests/qtest/dbus-vmstate-test.c +++ b/tests/qtest/dbus-vmstate-test.c @@ -2,7 +2,6 @@ #include #include #include "libqos/libqtest.h" -#include "qemu-common.h" #include "dbus-vmstate1.h" #include "migration-helpers.h" diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-introspect-test.c index bbec166..adf39b2 100644 --- a/tests/qtest/device-introspect-test.c +++ b/tests/qtest/device-introspect-test.c @@ -18,7 +18,6 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/qmp/qstring.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" diff --git a/tests/qtest/e1000e-test.c b/tests/qtest/e1000e-test.c index e648fdd..ddd6983 100644 --- a/tests/qtest/e1000e-test.c +++ b/tests/qtest/e1000e-test.c @@ -25,9 +25,7 @@ #include "qemu/osdep.h" -#include "qemu-common.h" #include "libqtest-single.h" -#include "qemu-common.h" #include "libqos/pci-pc.h" #include "qemu/sockets.h" #include "qemu/iov.h" diff --git a/tests/qtest/erst-test.c b/tests/qtest/erst-test.c index f94cd8d..a0adc35 100644 --- a/tests/qtest/erst-test.c +++ b/tests/qtest/erst-test.c @@ -11,7 +11,6 @@ #include #include "libqos/libqos-pc.h" #include "libqos/libqtest.h" -#include "qemu-common.h" #include "hw/pci/pci.h" diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c index b0d4001..4aa72f3 100644 --- a/tests/qtest/fdc-test.c +++ b/tests/qtest/fdc-test.c @@ -27,7 +27,6 @@ #include "libqtest-single.h" #include "qapi/qmp/qdict.h" -#include "qemu-common.h" /* TODO actually test the results and get rid of this */ #define qmp_discard_response(...) qobject_unref(qmp(__VA_ARGS__)) diff --git a/tests/qtest/fuzz/qos_fuzz.c b/tests/qtest/fuzz/qos_fuzz.c index 7a244c9..dc891d8 100644 --- a/tests/qtest/fuzz/qos_fuzz.c +++ b/tests/qtest/fuzz/qos_fuzz.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qapi/error.h" -#include "qemu-common.h" #include "exec/memory.h" #include "qemu/main-loop.h" diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index 64023c0..da9c4c2 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -16,7 +16,6 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/bswap.h" #include "qapi/qmp/qlist.h" #include "libqos/libqtest.h" diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index 19de3b4..b7243a1 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -30,7 +30,6 @@ #include "libqos/pci-pc.h" #include "libqos/malloc-pc.h" #include "qapi/qmp/qdict.h" -#include "qemu-common.h" #include "qemu/bswap.h" #include "hw/pci/pci_ids.h" #include "hw/pci/pci_regs.h" diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c index 19612e9..ed431e3 100644 --- a/tests/qtest/ipmi-bt-test.c +++ b/tests/qtest/ipmi-bt-test.c @@ -31,7 +31,6 @@ #include "libqtest-single.h" -#include "qemu-common.h" #define IPMI_IRQ 5 diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c index 4e8af42..95628a4 100644 --- a/tests/qtest/ivshmem-test.c +++ b/tests/qtest/ivshmem-test.c @@ -14,7 +14,6 @@ #include "libqos/libqos-pc.h" #include "libqos/libqos-spapr.h" #include "libqos/libqtest.h" -#include "qemu-common.h" #define TMPSHMSIZE (1 << 20) static char *tmpshm; diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c index eaa2096..41c4be5 100644 --- a/tests/qtest/libqos/ahci.c +++ b/tests/qtest/libqos/ahci.c @@ -28,7 +28,6 @@ #include "ahci.h" #include "pci-pc.h" -#include "qemu-common.h" #include "qemu/host-utils.h" #include "hw/pci/pci_ids.h" diff --git a/tests/qtest/libqos/malloc-pc.c b/tests/qtest/libqos/malloc-pc.c index f1e3b39..bbd1b48 100644 --- a/tests/qtest/libqos/malloc-pc.c +++ b/tests/qtest/libqos/malloc-pc.c @@ -16,8 +16,6 @@ #include "standard-headers/linux/qemu_fw_cfg.h" -#include "qemu-common.h" - #define ALLOC_PAGE_SIZE (4096) void pc_alloc_init(QGuestAllocator *s, QTestState *qts, QAllocOpts flags) diff --git a/tests/qtest/libqos/malloc-spapr.c b/tests/qtest/libqos/malloc-spapr.c index 05b306c..d90ed3c 100644 --- a/tests/qtest/libqos/malloc-spapr.c +++ b/tests/qtest/libqos/malloc-spapr.c @@ -8,8 +8,6 @@ #include "qemu/osdep.h" #include "malloc-spapr.h" -#include "qemu-common.h" - #define SPAPR_PAGE_SIZE 4096 /* Memory must be a multiple of 256 MB, diff --git a/tests/qtest/libqos/malloc.c b/tests/qtest/libqos/malloc.c index f708b01..f0c8f95 100644 --- a/tests/qtest/libqos/malloc.c +++ b/tests/qtest/libqos/malloc.c @@ -12,7 +12,6 @@ #include "qemu/osdep.h" #include "malloc.h" -#include "qemu-common.h" #include "qemu/host-utils.h" typedef struct MemBlock { diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index dc5566c..7b5890d 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -21,7 +21,6 @@ #include #include "libqos/libqtest.h" -#include "qemu-common.h" #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qapi/error.h" diff --git a/tests/qtest/machine-none-test.c b/tests/qtest/machine-none-test.c index 138101b..8ca1807 100644 --- a/tests/qtest/machine-none-test.c +++ b/tests/qtest/machine-none-test.c @@ -12,7 +12,6 @@ #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/cutils.h" #include "libqos/libqtest.h" #include "qapi/qmp/qdict.h" diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c index 7c435ac..a353fef 100644 --- a/tests/qtest/npcm7xx_emc-test.c +++ b/tests/qtest/npcm7xx_emc-test.c @@ -15,7 +15,6 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "libqos/libqos.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qnum.h" diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c index 32bbae3..3cb47d2 100644 --- a/tests/qtest/pxe-test.c +++ b/tests/qtest/pxe-test.c @@ -14,7 +14,6 @@ #include "qemu/osdep.h" #include -#include "qemu-common.h" #include "libqos/libqtest.h" #include "boot-sector.h" #include "libqos/libqos-spapr.h" diff --git a/tests/qtest/qom-test.c b/tests/qtest/qom-test.c index eb34af8..6b162e1 100644 --- a/tests/qtest/qom-test.c +++ b/tests/qtest/qom-test.c @@ -9,7 +9,6 @@ #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" #include "qemu/cutils.h" diff --git a/tests/qtest/rtl8139-test.c b/tests/qtest/rtl8139-test.c index 4506049..8fa3313 100644 --- a/tests/qtest/rtl8139-test.c +++ b/tests/qtest/rtl8139-test.c @@ -11,7 +11,6 @@ #include "libqtest-single.h" #include "libqos/pci-pc.h" #include "qemu/timer.h" -#include "qemu-common.h" /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/qtest/test-filter-mirror.c b/tests/qtest/test-filter-mirror.c index da4f94d..fdf66ce 100644 --- a/tests/qtest/test-filter-mirror.c +++ b/tests/qtest/test-filter-mirror.c @@ -9,7 +9,6 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "libqos/libqtest.h" #include "qapi/qmp/qdict.h" #include "qemu/iov.h" diff --git a/tests/qtest/test-filter-redirector.c b/tests/qtest/test-filter-redirector.c index fc16cf7..339d3c0 100644 --- a/tests/qtest/test-filter-redirector.c +++ b/tests/qtest/test-filter-redirector.c @@ -51,7 +51,6 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "libqos/libqtest.h" #include "qapi/qmp/qdict.h" #include "qemu/iov.h" diff --git a/tests/qtest/test-x86-cpuid-compat.c b/tests/qtest/test-x86-cpuid-compat.c index 39138db..b39c905 100644 --- a/tests/qtest/test-x86-cpuid-compat.c +++ b/tests/qtest/test-x86-cpuid-compat.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include "qemu-common.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" #include "qapi/qmp/qnum.h" diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c index a713958..fc9f2b9 100644 --- a/tests/qtest/virtio-net-test.c +++ b/tests/qtest/virtio-net-test.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "libqtest-single.h" #include "qemu/iov.h" #include "qemu/module.h" -- cgit v1.1