Misc cleanups
Subsystems (5)
cover Misc cleanups
From: Marc-André Lureau <[email protected]>
Hi,
A small collection of patches gleaned while working on different things (more specifically, I am looking at making qapi code usable outside of qemu, many things are twisted together, it takes effort but it is hopefully worth it)
Based-on: <[email protected]>
Marc-André Lureau (12):
compiler.h: replace QEMU_WARN_UNUSED_RESULT with
G_GNUC_WARN_UNUSED_RESULT
compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATED osdep.h: move qemu_build_not_reached()
compiler.h: replace QEMU_NORETURN with G_NORETURN compiler.h: drop __printf__ macro MinGW/glib workaround Replace config-time define HOST_WORDS_BIGENDIAN Simplify HOST_LONG_BITS
Move HOST_LONG_BITS to compiler.h scripts/modinfo-collect: remove unused/dead code
util: remove needless includes
util: remove the net/net.h dependency
qapi: remove needless include
meson.build | 1 - accel/tcg/atomic_template.h | 4 +- accel/tcg/internal.h | 3 +- audio/audio.h | 2 +- hw/display/pl110_template.h | 6 +-- hw/net/can/ctucan_core.h | 2 +- hw/net/vmxnet3.h | 4 +- include/exec/cpu-all.h | 4 +- include/exec/cpu-common.h | 2 +- include/exec/exec-all.h | 20 ++++----- include/exec/helper-head.h | 2 +- include/exec/memop.h | 2 +- include/exec/memory.h | 2 +- include/fpu/softfloat-types.h | 2 +- include/glib-compat.h | 4 ++ include/hw/core/cpu.h | 4 +- include/hw/core/tcg-cpu-ops.h | 6 +-- include/hw/hw.h | 2 +- include/hw/i386/intel_iommu.h | 6 +-- include/hw/i386/x86-iommu.h | 4 +- include/hw/virtio/virtio-access.h | 6 +-- include/hw/virtio/virtio-gpu-bswap.h | 2 +- include/libdecnumber/dconfig.h | 2 +- include/net/eth.h | 2 +- include/qemu-common.h | 3 +- include/qemu/bswap.h | 8 ++-- include/qemu/compiler.h | 35 +++------------- include/qemu/host-utils.h | 2 +- include/qemu/int128.h | 2 +- include/qemu/osdep.h | 25 +++++++----- include/qemu/range.h | 4 +- include/qemu/thread.h | 2 +- include/qom/object.h | 6 +-- include/tcg/tcg-ldst.h | 4 +- include/tcg/tcg.h | 2 +- include/ui/qemu-pixman.h | 2 +- linux-user/user-internals.h | 2 +- net/util.h | 2 +- scripts/cocci-macro-file.h | 6 +-- target/alpha/cpu.h | 10 ++--- target/arm/cpu.h | 8 ++-- target/arm/internals.h | 12 +++--- target/arm/translate-a64.h | 2 +- target/arm/vec_internal.h | 2 +- target/hppa/cpu.h | 2 +- target/i386/cpu.h | 2 +- target/i386/tcg/helper-tcg.h | 24 +++++------ target/microblaze/cpu.h | 6 +-- target/mips/cpu.h | 2 +- target/mips/tcg/tcg-internal.h | 16 ++++---- target/nios2/cpu.h | 6 +-- target/openrisc/exception.h | 2 +- target/ppc/cpu.h | 16 ++++---- target/ppc/internal.h | 6 +-- target/riscv/cpu.h | 10 ++--- target/s390x/s390x-internal.h | 6 +-- target/s390x/tcg/tcg_s390x.h | 12 +++--- target/s390x/tcg/vec.h | 2 +- target/sh4/cpu.h | 6 +-- target/sparc/cpu.h | 10 ++--- target/xtensa/cpu.h | 4 +- tests/fp/platform.h | 4 +- accel/kvm/kvm-all.c | 4 +- accel/stubs/tcg-stub.c | 4 +- audio/dbusaudio.c | 2 +- block/qcow2-refcount.c | 20 ++++----- bsd-user/signal.c | 2 +- disas.c | 2 +- hw/core/loader.c | 4 +- hw/display/artist.c | 6 +-- hw/display/pxa2xx_lcd.c | 2 +- hw/display/vga.c | 12 +++--- hw/display/virtio-gpu-gl.c | 2 +- hw/misc/mips_itu.c | 2 +- hw/s390x/event-facility.c | 2 +- hw/virtio/vhost.c | 2 +- linux-user/arm/nwfpe/double_cpdo.c | 4 +- linux-user/arm/nwfpe/fpa11_cpdt.c | 4 +- linux-user/ppc/signal.c | 3 +- linux-user/signal.c | 2 +- linux-user/syscall.c | 6 +-- monitor/hmp.c | 2 +- net/announce.c | 13 ++++++ net/net.c | 4 +- qapi/qmp-dispatch.c | 1 - qemu-img.c | 9 +++-- target/alpha/helper.c | 10 ++--- target/alpha/translate.c | 2 +- target/arm/crypto_helper.c | 2 +- target/arm/helper.c | 2 +- target/arm/kvm64.c | 4 +- target/arm/neon_helper.c | 2 +- target/arm/pauth_helper.c | 4 +- target/arm/sve_helper.c | 4 +- target/arm/tlb_helper.c | 6 +-- target/arm/translate-sve.c | 6 +-- target/arm/translate-vfp.c | 2 +- target/arm/translate.c | 2 +- target/hexagon/op_helper.c | 8 ++-- target/hppa/cpu.c | 2 +- target/hppa/op_helper.c | 4 +- target/hppa/translate.c | 2 +- target/i386/tcg/bpt_helper.c | 2 +- target/i386/tcg/excp_helper.c | 30 +++++++------- target/i386/tcg/misc_helper.c | 6 +-- target/i386/tcg/sysemu/misc_helper.c | 6 +-- target/i386/tcg/translate.c | 2 +- target/mips/tcg/lmmi_helper.c | 2 +- target/mips/tcg/msa_helper.c | 54 ++++++++++++------------- target/openrisc/exception.c | 2 +- target/openrisc/exception_helper.c | 2 +- target/ppc/arch_dump.c | 2 +- target/ppc/int_helper.c | 22 +++++----- target/ppc/kvm.c | 4 +- target/ppc/mem_helper.c | 2 +- target/riscv/op_helper.c | 4 +- target/riscv/vector_helper.c | 2 +- target/rx/op_helper.c | 20 ++++----- target/s390x/tcg/excp_helper.c | 20 ++++----- target/s390x/tcg/translate.c | 2 +- target/sh4/op_helper.c | 4 +- target/sparc/mmu_helper.c | 8 ++-- target/sparc/vis_helper.c | 4 +- target/tricore/op_helper.c | 2 +- tcg/tcg-op.c | 4 +- tcg/tcg.c | 14 +++---- tests/fp/fp-bench.c | 2 +- tests/fp/fp-test.c | 2 +- tests/qtest/vhost-user-blk-test.c | 2 +- tests/qtest/virtio-blk-test.c | 2 +- ui/vdagent.c | 2 +- ui/vnc.c | 2 +- util/bitmap.c | 2 +- util/cutils.c | 16 -------- util/host-utils.c | 2 +- target/ppc/translate/vmx-impl.c.inc | 4 +- target/ppc/translate/vsx-impl.c.inc | 2 +- target/riscv/insn_trans/trans_rvv.c.inc | 4 +- target/s390x/tcg/translate_vx.c.inc | 2 +- tcg/aarch64/tcg-target.c.inc | 4 +- tcg/arm/tcg-target.c.inc | 4 +- tcg/mips/tcg-target.c.inc | 2 +- tcg/ppc/tcg-target.c.inc | 10 ++--- tcg/riscv/tcg-target.c.inc | 4 +- scripts/checkpatch.pl | 6 +-- scripts/modinfo-collect.py | 5 --- 146 files changed, 410 insertions(+), 434 deletions(-)
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
PATCH 1/12 compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULT
From: Marc-André Lureau <[email protected]>
One less qemu-specific macro. It also helps to make some headers/units only depend on glib, and thus moved in standalone projects eventually.
--- include/qemu-common.h | 2 +- include/qemu/compiler.h | 2 -- include/qemu/range.h | 4 ++-- scripts/cocci-macro-file.h | 2 +- block/qcow2-refcount.c | 20 +++++++++++--------- scripts/checkpatch.pl | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-)
include/qemu-common.h +1 -1
@@ -29,7 +29,7 @@ int qemu_main(int argc, char **argv, char **envp);void *qemu_oom_check (void *ptr); ssize_t qemu_write_full(int fd, const void *buf, size_t count) - QEMU_WARN_UNUSED_RESULT; + G_GNUC_WARN_UNUSED_RESULT;#ifndef _WIN32int qemu_pipe (int pipefd[2 ]);
include/qemu/compiler.h +0 -2
@@ -19,8 +19,6 @@#define QEMU_NORETURN __attribute__ ((__noreturn__)) -#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#define QEMU_SENTINEL __attribute__((sentinel))#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
include/qemu/range.h +2 -2
@@ -114,8 +114,8 @@ static inline uint64_t range_upb(Range *range)* @size may be 0. If the range would overflow, returns -ERANGE, otherwise * 0. */ -static inline int QEMU_WARN_UNUSED_RESULT range_init(Range *range, uint64_t lob, -uint64_t size) +G_GNUC_WARN_UNUSED_RESULT +static inline int range_init(Range *range, uint64_t lob, uint64_t size) {if (lob + size < lob) {return -ERANGE ;
scripts/cocci-macro-file.h +1 -1
@@ -20,7 +20,7 @@/* From qemu/compiler.h */ #define QEMU_NORETURN __attribute__ ((__noreturn__)) -#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +#define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))#define QEMU_SENTINEL __attribute__((sentinel))#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))
block/qcow2-refcount.c +11 -9
@@ -32,9 +32,11 @@static int64_t alloc_clusters_noref (BlockDriverState *bs,uint64_t size,uint64_t max); -static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs, -int64_t offset,int64_t length,uint64_t addend, -bool decrease,enum qcow2_discard_type type); + +G_GNUC_WARN_UNUSED_RESULT +static int update_refcount(BlockDriverState *bs, +int64_t offset,int64_t length,uint64_t addend, +bool decrease,enum qcow2_discard_type type);static uint64_t get_refcount_ro0 (const void *refcount_array,uint64_t index);static uint64_t get_refcount_ro1 (const void *refcount_array,uint64_t index);
@@ -802,12 +804,12 @@ found:/* XXX: cache several refcount block clusters ? */ /* @addend is the absolute value of the addend; if @decrease is set, @addend * will be subtracted from the current refcount, otherwise it will be added */ -static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs, -int64_t offset, -int64_t length, -uint64_t addend, -bool decrease, -enum qcow2_discard_type type) +static int update_refcount (BlockDriverState *bs, +int64_t offset, +int64_t length, +uint64_t addend, +bool decrease, +enum qcow2_discard_type type) {BDRVQcow2State *s = bs->opaque;int64_t start, last, cluster_offset;
scripts/checkpatch.pl +1 -1
@@ -224,7 +224,7 @@ our $Attribute = qr{ const| volatile| QEMU_NORETURN| - QEMU_WARN_UNUSED_RESULT| + G_GNUC_WARN_UNUSED_RESULT| QEMU_SENTINEL| QEMU_PACKED| G_GNUC_PRINTF
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
Re: [PATCH 01/12] compiler.h: replace QEMU_WARN_UNUSED_RESULT with G_GNUC_WARN_UNUSED_RESULT
Quoted 6 lines · On 2/24/22 08:36, [email protected] wrote:
From: Marc-André Lureau<[email protected]>
One less qemu-specific macro. It also helps to make some headers/units only depend on glib, and thus moved in standalone projects eventually.
Signed-off-by Marc-André Lureau<[email protected]>
Quoted 8 lines
--- include/qemu-common.h | 2 +- include/qemu/compiler.h | 2 -- include/qemu/range.h | 4 ++-- scripts/cocci-macro-file.h | 2 +- block/qcow2-refcount.c | 20 +++++++++++--------- scripts/checkpatch.pl | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-)
r~
PATCH 2/12 compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATED
In reply to [email protected]From: Marc-André Lureau <[email protected]>
One less qemu-specific macro. It also helps to make some headers/units only depend on glib, and thus moved in standalone projects eventually.
--- include/qemu/compiler.h | 2 -- include/qom/object.h | 6 +++--- scripts/cocci-macro-file.h | 2 +- scripts/checkpatch.pl | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-)
include/qemu/compiler.h +0 -2
@@ -19,8 +19,6 @@#define QEMU_NORETURN __attribute__ ((__noreturn__)) -#define QEMU_SENTINEL __attribute__((sentinel)) -#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))# define QEMU_PACKED __attribute__((gcc_struct, packed))#else
include/qom/object.h +3 -3
@@ -616,7 +616,7 @@ Object *object_new_with_props(const char *typename,Object *parent, const char *id, Error **errp, - ...) QEMU_SENTINEL; + ...) G_GNUC_NULL_TERMINATED;/** * object_new_with_propv:
@@ -676,7 +676,7 @@ void object_apply_compat_props(Object *obj);* * Returns: %true on success, %false on error. */ -bool object_set_props(Object *obj, Error **errp, ...) QEMU_SENTINEL; +bool object_set_props(Object *obj, Error **errp, ...) G_GNUC_NULL_TERMINATED;/** * object_set_propv:
@@ -728,7 +728,7 @@ void object_initialize(void *obj, size_t size, const char *typename); bool object_initialize_child_with_props(Object *parentobj, const char *propname, void *childobj, size_t size, const char *type, - Error **errp, ...) QEMU_SENTINEL; + Error **errp, ...) G_GNUC_NULL_TERMINATED;/** * object_initialize_child_with_propsv:
scripts/cocci-macro-file.h +1 -1
@@ -21,7 +21,7 @@/* From qemu/compiler.h */ #define QEMU_NORETURN __attribute__ ((__noreturn__))#define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#define QEMU_SENTINEL __attribute__((sentinel)) +#define G_GNUC_NULL_TERMINATED __attribute__((sentinel))#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))# define QEMU_PACKED __attribute__((gcc_struct, packed))
scripts/checkpatch.pl +1 -1
@@ -225,7 +225,7 @@ our $Attribute = qr{ volatile| QEMU_NORETURN| G_GNUC_WARN_UNUSED_RESULT| - QEMU_SENTINEL| + G_GNUC_NULL_TERMINATED| QEMU_PACKED| G_GNUC_PRINTF }x;
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
Re: [PATCH 02/12] compiler.h: replace QEMU_SENTINEL with G_GNUC_NULL_TERMINATED
Quoted 5 lines · On 2/24/22 08:36, [email protected] wrote:
From: Marc-André Lureau<[email protected]>
One less qemu-specific macro. It also helps to make some headers/units only depend on glib, and thus moved in standalone projects eventually.
Quoted 7 lines
Signed-off-by Marc-André Lureau<[email protected]>--- include/qemu/compiler.h | 2 -- include/qom/object.h | 6 +++--- scripts/cocci-macro-file.h | 2 +- scripts/checkpatch.pl | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-)
r~
PATCH 3/12 osdep.h: move qemu_build_not_reached()
In reply to [email protected]From: Marc-André Lureau <[email protected]>
Move the macro and declaration so it can use glib in the following patch.
--- include/qemu/compiler.h | 16 ---------------- include/qemu/osdep.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-)
include/qemu/compiler.h +0 -16
@@ -151,22 +151,6 @@#define QEMU_ALWAYS_INLINE #endif -/** -* qemu_build_not_reached() -* -* The compiler, during optimization, is expected to prove that a call -* to this function cannot be reached and remove it. If the compiler -* supports QEMU_ERROR, this will be reported at compile time; otherwise -* this will be reported at link time due to the missing symbol. -*/ -extern void QEMU_NORETURN QEMU_ERROR("code path is reachable") -qemu_build_not_reached_always (void); -#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__) -#define qemu_build_not_reached () qemu_build_not_reached_always() -#else -#define qemu_build_not_reached () g_assert_not_reached() -#endif -/** * In most cases, normal "fallthrough" comments are good enough for * switch-case statements, but sometimes the compiler has problems
include/qemu/osdep.h +16 -0
@@ -157,6 +157,22 @@ extern "C" {#define assert (x) g_assert(x)#endif +/** +* qemu_build_not_reached() +* +* The compiler, during optimization, is expected to prove that a call +* to this function cannot be reached and remove it. If the compiler +* supports QEMU_ERROR, this will be reported at compile time; otherwise +* this will be reported at link time due to the missing symbol. +*/ +extern void QEMU_NORETURN QEMU_ERROR("code path is reachable") +qemu_build_not_reached_always (void); +#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__) +#define qemu_build_not_reached () qemu_build_not_reached_always() +#else +#define qemu_build_not_reached () g_assert_not_reached() +#endif +/* * According to waitpid man page: * WCOREDUMP
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
Re: [PATCH 03/12] osdep.h: move qemu_build_not_reached()
Quoted 10 lines · On 2/24/22 08:36, [email protected] wrote:
From: Marc-André Lureau<[email protected]>
Move the macro and declaration so it can use glib in the following patch.
Signed-off-by Marc-André Lureau<[email protected]>--- include/qemu/compiler.h | 16 ---------------- include/qemu/osdep.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-)
Would this be obviated by a change to _Noreturn?
r~
Re: [PATCH 03/12] osdep.h: move qemu_build_not_reached()
Hi
Quoted 6 lines · Richard Henderson
Quoted 5 lines · On 2/24/22 08:36, [email protected] wrote:
From: Marc-André Lureau<[email protected]>
Move the macro and declaration so it can use glib in the following patch.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Marc-André Lureau<[email protected]>--- include/qemu/compiler.h | 16 ---------------- include/qemu/osdep.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-)Would this be obviated by a change to
_Noreturn?
Yes. Or we could just switch this one to _Noreturn if we decide to use G_NORETURN elsewhere.
Signature · 1 line
Marc-André Lureau
PATCH 4/12 compiler.h: replace QEMU_NORETURN with G_NORETURN
In reply to [email protected]From: Marc-André Lureau <[email protected]>
G_NORETURN was introduced in glib 2.68, fallback to G_GNUC_NORETURN in glib-compat.
Note that this attribute must be placed before the function declaration (bringing a bit of consistency in qemu codebase usage).
--- accel/tcg/internal.h | 3 +-- include/exec/exec-all.h | 20 +++++++++---------- include/exec/helper-head.h | 2 +- include/glib-compat.h | 4 ++++ include/hw/core/cpu.h | 2 +- include/hw/core/tcg-cpu-ops.h | 6 +++--- include/hw/hw.h | 2 +- include/qemu/compiler.h | 2 -- include/qemu/osdep.h | 2 +- include/qemu/thread.h | 2 +- include/tcg/tcg-ldst.h | 4 ++-- include/tcg/tcg.h | 2 +- linux-user/user-internals.h | 2 +- scripts/cocci-macro-file.h | 2 +- target/alpha/cpu.h | 10 +++++----- target/arm/internals.h | 12 +++++------ target/hppa/cpu.h | 2 +- target/i386/tcg/helper-tcg.h | 24 +++++++++++----------- target/microblaze/cpu.h | 6 +++--- target/mips/tcg/tcg-internal.h | 16 +++++++-------- target/nios2/cpu.h | 6 +++--- target/openrisc/exception.h | 2 +- target/ppc/cpu.h | 14 ++++++------- target/ppc/internal.h | 6 +++--- target/riscv/cpu.h | 10 +++++----- target/s390x/s390x-internal.h | 6 +++--- target/s390x/tcg/tcg_s390x.h | 12 +++++------ target/sh4/cpu.h | 6 +++--- target/sparc/cpu.h | 10 +++++----- target/xtensa/cpu.h | 2 +- accel/stubs/tcg-stub.c | 4 ++-- bsd-user/signal.c | 2 +- hw/misc/mips_itu.c | 2 +- linux-user/signal.c | 2 +- monitor/hmp.c | 2 +- qemu-img.c | 9 +++++---- target/alpha/helper.c | 10 +++++----- target/arm/pauth_helper.c | 4 ++-- target/arm/tlb_helper.c | 6 +++--- target/hexagon/op_helper.c | 8 ++++---- target/hppa/cpu.c | 2 +- target/hppa/op_helper.c | 4 ++-- target/i386/tcg/bpt_helper.c | 2 +- target/i386/tcg/excp_helper.c | 30 ++++++++++++++-------------- target/i386/tcg/misc_helper.c | 6 +++--- target/i386/tcg/sysemu/misc_helper.c | 6 +++--- target/openrisc/exception.c | 2 +- target/openrisc/exception_helper.c | 2 +- target/riscv/op_helper.c | 4 ++-- target/rx/op_helper.c | 20 +++++++++---------- target/s390x/tcg/excp_helper.c | 20 +++++++++---------- target/sh4/op_helper.c | 4 ++-- target/sparc/mmu_helper.c | 8 ++++---- target/tricore/op_helper.c | 2 +- tcg/tcg.c | 2 +- tests/fp/fp-bench.c | 2 +- tests/fp/fp-test.c | 2 +- scripts/checkpatch.pl | 2 +- 58 files changed, 185 insertions(+), 183 deletions(-)
accel/tcg/internal.h +1 -2
@@ -14,8 +14,7 @@TranslationBlock *tb_gen_code (CPUState *cpu,target_ulong pc,target_ulong cs_base,uint32_t flags,int cflags); - -void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); +G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);void page_init (void );void tb_htable_init (void );
include/exec/exec-all.h +10 -10
@@ -61,10 +61,10 @@ void restore_state_to_opc(CPUArchState *env, TranslationBlock *tb,*/ bool cpu_restore_state (CPUState *cpu,uintptr_t searched_pc,bool will_exit); -void QEMU_NORETURN cpu_loop_exit_noexc(CPUState *cpu); -void QEMU_NORETURN cpu_loop_exit(CPUState *cpu); -void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); -void QEMU_NORETURN cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); +G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); +G_NORETURN void cpu_loop_exit(CPUState *cpu); +G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); +G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc);/** * cpu_loop_exit_requested:
@@ -697,9 +697,9 @@ bool handle_sigsegv_accerr_write(CPUState *cpu, sigset_t *old_set,* Use the TCGCPUOps hook to record cpu state, do guest operating system * specific things to raise SIGSEGV, and jump to the main cpu loop. */ -void QEMU_NORETURN cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr, -MMUAccessType access_type, -bool maperr,uintptr_t ra); +G_NORETURN void cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr, +MMUAccessType access_type, +bool maperr,uintptr_t ra);/** * cpu_loop_exit_sigbus:
@@ -711,9 +711,9 @@ void QEMU_NORETURN cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr,* Use the TCGCPUOps hook to record cpu state, do guest operating system * specific things to raise SIGBUS, and jump to the main cpu loop. */ -void QEMU_NORETURN cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr, -MMUAccessType access_type, -uintptr_t ra); +G_NORETURN void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr, +MMUAccessType access_type, +uintptr_t ra);#else static inline void mmap_lock (void ) {}
include/exec/helper-head.h +1 -1
@@ -46,7 +46,7 @@#define dh_ctype_ptr void *#define dh_ctype_cptr const void *#define dh_ctype_void void -#define dh_ctype_noreturn void QEMU_NORETURN +#define dh_ctype_noreturn G_NORETURN void#define dh_ctype (t) dh_ctype_##t#ifdef NEED_CPU_H
include/glib-compat.h +4 -0
@@ -147,4 +147,8 @@ qemu_g_test_slow(void)#pragma GCC diagnostic pop +#ifndef G_NORETURN +#define G_NORETURN G_GNUC_NORETURN +#endif +#endif
include/hw/core/cpu.h +1 -1
@@ -1008,7 +1008,7 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len);*/ AddressSpace *cpu_get_address_space (CPUState *cpu,int asidx); -void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...) +G_NORETURN void cpu_abort(CPUState *cpu, const char *fmt, ...) G_GNUC_PRINTF(2, 3);/* $(top_srcdir)/cpu.c */
include/hw/core/tcg-cpu-ops.h +3 -3
@@ -78,9 +78,9 @@ struct TCGCPUOps {* @do_unaligned_access: Callback for unaligned access handling * The callback must exit via raising an exception. */ - void (*do_unaligned_access)(CPUState *cpu, vaddr addr, - MMUAccessType access_type, - int mmu_idx, uintptr_t retaddr) QEMU_NORETURN; + G_NORETURN void (*do_unaligned_access)(CPUState *cpu, vaddr addr, +MMUAccessType access_type, +int mmu_idx,uintptr_t retaddr);/** * @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM
include/hw/hw.h +1 -1
@@ -5,6 +5,6 @@#error Cannot include hw/hw.h from user emulation#endif -void QEMU_NORETURN hw_error(const char *fmt, ...) G_GNUC_PRINTF(1, 2); +G_NORETURN void hw_error(const char *fmt, ...) G_GNUC_PRINTF(1, 2);#endif
include/qemu/compiler.h +0 -2
@@ -17,8 +17,6 @@#define QEMU_EXTERN_C extern#endif -#define QEMU_NORETURN __attribute__ ((__noreturn__)) -#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))# define QEMU_PACKED __attribute__((gcc_struct, packed))#else
include/qemu/osdep.h +1 -1
@@ -165,7 +165,7 @@ extern "C" {* supports QEMU_ERROR, this will be reported at compile time; otherwise * this will be reported at link time due to the missing symbol. */ -extern void QEMU_NORETURN QEMU_ERROR("code path is reachable") +G_NORETURN extern void QEMU_ERROR("code path is reachable")qemu_build_not_reached_always (void);#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)#define qemu_build_not_reached () qemu_build_not_reached_always()
include/qemu/thread.h +1 -1
@@ -188,7 +188,7 @@ void qemu_thread_create(QemuThread *thread, const char *name,void *qemu_thread_join (QemuThread *thread);void qemu_thread_get_self (QemuThread *thread);bool qemu_thread_is_self (QemuThread *thread); -void qemu_thread_exit(void *retval) QEMU_NORETURN; +G_NORETURN void qemu_thread_exit(void *retval);void qemu_thread_naming (bool enable);struct Notifier ;
include/tcg/tcg-ldst.h +2 -2
@@ -72,8 +72,8 @@ void helper_be_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val,#else -void QEMU_NORETURN helper_unaligned_ld(CPUArchState *env, target_ulong addr); -void QEMU_NORETURN helper_unaligned_st(CPUArchState *env, target_ulong addr); +G_NORETURN void helper_unaligned_ld(CPUArchState *env, target_ulong addr); +G_NORETURN void helper_unaligned_st(CPUArchState *env, target_ulong addr);#endif /* CONFIG_SOFTMMU */ #endif /* TCG_LDST_H */
include/tcg/tcg.h +1 -1
@@ -395,7 +395,7 @@ typedef TCGv_ptr TCGv_env;#define TCG_CALL_NO_WRITE_GLOBALS 0x0002/* Helper can be safely suppressed if the return value is not used. */ #define TCG_CALL_NO_SIDE_EFFECTS 0x0004 -/* Helper is QEMU_NORETURN. */ +/* Helper is G_NORETURN. */ #define TCG_CALL_NO_RETURN 0x0008/* convenience version of most used call flags */
linux-user/user-internals.h +1 -1
@@ -64,7 +64,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, abi_long arg5, abi_long arg6, abi_long arg7, abi_long arg8);extern __threadCPUState *thread_cpu; -void QEMU_NORETURN cpu_loop(CPUArchState *env); +G_NORETURN void cpu_loop(CPUArchState *env);const char *target_strerror (int err);int get_osversion (void );void init_qemu_uname_release (void );
scripts/cocci-macro-file.h +1 -1
@@ -19,7 +19,7 @@*/ /* From qemu/compiler.h */ -#define QEMU_NORETURN __attribute__ ((__noreturn__)) +#define G_NORETURN __attribute__ ((__noreturn__))#define G_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))#define G_GNUC_NULL_TERMINATED __attribute__((sentinel))
target/alpha/cpu.h +5 -5
@@ -438,8 +438,8 @@ void alpha_translate_init(void);#define CPU_RESOLVING_TYPE TYPE_ALPHA_CPUvoid alpha_cpu_list (void ); -void QEMU_NORETURN dynamic_excp(CPUAlphaState *, uintptr_t, int, int); -void QEMU_NORETURN arith_excp(CPUAlphaState *, uintptr_t, int, uint64_t); +G_NORETURN void dynamic_excp(CPUAlphaState *, uintptr_t, int, int); +G_NORETURN void arith_excp(CPUAlphaState *, uintptr_t, int, uint64_t);uint64_t cpu_alpha_load_fpcr (CPUAlphaState *env);void cpu_alpha_store_fpcr (CPUAlphaState *env,uint64_t val);
@@ -456,9 +456,9 @@ void alpha_cpu_record_sigbus(CPUState *cs, vaddr address,bool alpha_cpu_tlb_fill (CPUState *cs,vaddr address,int size,MMUAccessType access_type,int mmu_idx,bool probe,uintptr_t retaddr); -void alpha_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, - MMUAccessType access_type, int mmu_idx, - uintptr_t retaddr) QEMU_NORETURN; +G_NORETURN void alpha_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, +MMUAccessType access_type,int mmu_idx, +uintptr_t retaddr); void alpha_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, unsigned size, MMUAccessType access_type,
target/arm/internals.h +6 -6
@@ -102,13 +102,13 @@ FIELD(V7M_EXCRET, RES1, 7, 25) /* including the must-be-1 prefix */* and target exception level. This should be called from helper functions, * and never returns because we will longjump back up to the CPU main loop. */ -void QEMU_NORETURN raise_exception(CPUARMState *env, uint32_t excp, -uint32_t syndrome,uint32_t target_el); +G_NORETURN void raise_exception(CPUARMState *env, uint32_t excp, +uint32_t syndrome,uint32_t target_el);/* * Similarly, but also use unwinding to restore cpu state. */ -void QEMU_NORETURN raise_exception_ra(CPUARMState *env, uint32_t excp, +G_NORETURN void raise_exception_ra(CPUARMState *env, uint32_t excp,uint32_t syndrome,uint32_t target_el,uintptr_t ra);
@@ -600,9 +600,9 @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate);bool arm_s1_regime_using_lpae_format (CPUARMState *env,ARMMMUIdx mmu_idx);/* Raise a data fault alignment exception for the specified virtual address */ -void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, - MMUAccessType access_type, - int mmu_idx, uintptr_t retaddr) QEMU_NORETURN; +G_NORETURN void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, +MMUAccessType access_type, +int mmu_idx,uintptr_t retaddr);/* arm_cpu_do_transaction_failed: handle a memory system error response * (eg "no device/memory present at address") by raising an external abort
target/hppa/cpu.h +1 -1
@@ -344,6 +344,6 @@ extern const VMStateDescription vmstate_hppa_cpu;void hppa_cpu_alarm_timer (void *);int hppa_artype_for_page (CPUHPPAState *env,target_ulong vaddr);#endif -void QEMU_NORETURN hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra); +G_NORETURN void hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra);#endif /* HPPA_CPU_H */
target/i386/tcg/helper-tcg.h +12 -12
@@ -69,27 +69,27 @@ static inline target_long lshift(target_long x, int n)void tcg_x86_init (void );/* excp_helper.c */ -void QEMU_NORETURN raise_exception(CPUX86State *env, int exception_index); -void QEMU_NORETURN raise_exception_ra(CPUX86State *env, int exception_index, -uintptr_t retaddr); -void QEMU_NORETURN raise_exception_err(CPUX86State *env, int exception_index, -int error_code); -void QEMU_NORETURN raise_exception_err_ra(CPUX86State *env, int exception_index, -int error_code,uintptr_t retaddr); -void QEMU_NORETURN raise_interrupt(CPUX86State *nenv, int intno, int is_int, -int error_code,int next_eip_addend); +G_NORETURN void raise_exception(CPUX86State *env, int exception_index); +G_NORETURN void raise_exception_ra(CPUX86State *env, int exception_index, +uintptr_t retaddr); +G_NORETURN void raise_exception_err(CPUX86State *env, int exception_index, +int error_code); +G_NORETURN void raise_exception_err_ra(CPUX86State *env, int exception_index, +int error_code,uintptr_t retaddr); +G_NORETURN void raise_interrupt(CPUX86State *nenv, int intno, int is_int, +int error_code,int next_eip_addend);/* cc_helper.c */ extern const uint8_t parity_table[256 ];/* misc_helper.c */ void cpu_load_eflags (CPUX86State *env,int eflags,int update_mask); -void do_pause(CPUX86State *env) QEMU_NORETURN; +G_NORETURN void do_pause(CPUX86State *env);/* sysemu/svm_helper.c */ #ifndef CONFIG_USER_ONLY -void QEMU_NORETURN cpu_vmexit(CPUX86State *nenv, uint32_t exit_code, -uint64_t exit_info_1,uintptr_t retaddr); +G_NORETURN void cpu_vmexit(CPUX86State *nenv, uint32_t exit_code, +uint64_t exit_info_1,uintptr_t retaddr);void do_vmexit (CPUX86State *env);#endif
target/microblaze/cpu.h +3 -3
@@ -359,9 +359,9 @@ struct MicroBlazeCPU {void mb_cpu_do_interrupt (CPUState *cs);bool mb_cpu_exec_interrupt (CPUState *cs,int int_req);#endif /* !CONFIG_USER_ONLY */ -void mb_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, - MMUAccessType access_type, - int mmu_idx, uintptr_t retaddr) QEMU_NORETURN; +G_NORETURN void mb_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, +MMUAccessType access_type, +int mmu_idx,uintptr_t retaddr);void mb_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr mb_cpu_get_phys_page_attrs_debug (CPUState *cpu,vaddr addr,MemTxAttrs *attrs);
target/mips/tcg/tcg-internal.h +8 -8
@@ -18,18 +18,18 @@void mips_tcg_init (void );void mips_cpu_synchronize_from_tb (CPUState *cs,const TranslationBlock *tb); -void mips_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, - MMUAccessType access_type, int mmu_idx, - uintptr_t retaddr) QEMU_NORETURN; +G_NORETURN void mips_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, +MMUAccessType access_type,int mmu_idx, +uintptr_t retaddr);const char *mips_exception_name (int32_t exception); -void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env, uint32_t exception, -int error_code,uintptr_t pc); +G_NORETURN void do_raise_exception_err(CPUMIPSState *env, uint32_t exception, +int error_code,uintptr_t pc); -static inline void QEMU_NORETURN do_raise_exception(CPUMIPSState *env, -uint32_t exception, -uintptr_t pc) +G_NORETURN static inline void do_raise_exception(CPUMIPSState *env, +uint32_t exception, +uintptr_t pc) {do_raise_exception_err (env, exception,0 , pc); }
target/nios2/cpu.h +3 -3
@@ -196,9 +196,9 @@ void nios2_cpu_do_interrupt(CPUState *cs);void dump_mmu (CPUNios2State *env);void nios2_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr nios2_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); -void nios2_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, - MMUAccessType access_type, int mmu_idx, - uintptr_t retaddr) QEMU_NORETURN; +G_NORETURN void nios2_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, +MMUAccessType access_type,int mmu_idx, +uintptr_t retaddr);void do_nios2_semihosting (CPUNios2State *env);
target/openrisc/exception.h +1 -1
@@ -22,6 +22,6 @@#include "cpu.h" -void QEMU_NORETURN raise_exception(OpenRISCCPU *cpu, uint32_t excp); +G_NORETURN void raise_exception(OpenRISCCPU *cpu, uint32_t excp);#endif /* TARGET_OPENRISC_EXCEPTION_H */
target/ppc/cpu.h +7 -7
@@ -2491,13 +2491,13 @@ static inline void cpu_get_tb_cpu_state(CPUPPCState *env, target_ulong *pc, }#endif -void QEMU_NORETURN raise_exception(CPUPPCState *env, uint32_t exception); -void QEMU_NORETURN raise_exception_ra(CPUPPCState *env, uint32_t exception, -uintptr_t raddr); -void QEMU_NORETURN raise_exception_err(CPUPPCState *env, uint32_t exception, -uint32_t error_code); -void QEMU_NORETURN raise_exception_err_ra(CPUPPCState *env, uint32_t exception, -uint32_t error_code,uintptr_t raddr); +G_NORETURN void raise_exception(CPUPPCState *env, uint32_t exception); +G_NORETURN void raise_exception_ra(CPUPPCState *env, uint32_t exception, +uintptr_t raddr); +G_NORETURN void raise_exception_err(CPUPPCState *env, uint32_t exception, +uint32_t error_code); +G_NORETURN void raise_exception_err_ra(CPUPPCState *env, uint32_t exception, +uint32_t error_code,uintptr_t raddr);#if !defined(CONFIG_USER_ONLY )static inline int booke206_tlbm_id (CPUPPCState *env,ppcmas_tlb_t *tlbm)
target/ppc/internal.h +3 -3
@@ -286,9 +286,9 @@ void ppc_cpu_record_sigsegv(CPUState *cs, vaddr addr,bool ppc_cpu_tlb_fill (CPUState *cs,vaddr address,int size,MMUAccessType access_type,int mmu_idx,bool probe,uintptr_t retaddr); -void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr addr, - MMUAccessType access_type, int mmu_idx, - uintptr_t retaddr) QEMU_NORETURN; +G_NORETURN void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr addr, +MMUAccessType access_type,int mmu_idx, +uintptr_t retaddr);#endif #endif /* PPC_INTERNAL_H */
target/riscv/cpu.h +5 -5
@@ -448,9 +448,9 @@ void riscv_cpu_set_virt_enabled(CPURISCVState *env, bool enable);bool riscv_cpu_two_stage_lookup (int mmu_idx);int riscv_cpu_mmu_index (CPURISCVState *env,bool ifetch);hwaddr riscv_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); -void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr, - MMUAccessType access_type, int mmu_idx, - uintptr_t retaddr) QEMU_NORETURN; +G_NORETURN void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr, +MMUAccessType access_type,int mmu_idx, +uintptr_t retaddr);bool riscv_cpu_tlb_fill (CPUState *cs,vaddr address,int size,MMUAccessType access_type,int mmu_idx,bool probe,uintptr_t retaddr);
@@ -484,8 +484,8 @@ void riscv_cpu_set_aia_ireg_rmw_fn(CPURISCVState *env, uint32_t priv,void riscv_cpu_set_mode (CPURISCVState *env,target_ulong newpriv);void riscv_translate_init (void ); -void QEMU_NORETURN riscv_raise_exception(CPURISCVState *env, -uint32_t exception,uintptr_t pc); +G_NORETURN void riscv_raise_exception(CPURISCVState *env, +uint32_t exception,uintptr_t pc);target_ulong riscv_cpu_get_fflags (CPURISCVState *env);void riscv_cpu_set_fflags (CPURISCVState *env,target_ulong );
target/s390x/s390x-internal.h +3 -3
@@ -280,9 +280,9 @@ void s390_cpu_record_sigbus(CPUState *cs, vaddr address,bool s390_cpu_tlb_fill (CPUState *cs,vaddr address,int size,MMUAccessType access_type,int mmu_idx,bool probe,uintptr_t retaddr); -void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr, - MMUAccessType access_type, int mmu_idx, - uintptr_t retaddr) QEMU_NORETURN; +G_NORETURN void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr, +MMUAccessType access_type,int mmu_idx, +uintptr_t retaddr);#endif
target/s390x/tcg/tcg_s390x.h +6 -6
@@ -14,11 +14,11 @@#define TCG_S390X_H void tcg_s390_tod_updated (CPUState *cs,run_on_cpu_data opaque); -void QEMU_NORETURN tcg_s390_program_interrupt(CPUS390XState *env, -uint32_t code,uintptr_t ra); -void QEMU_NORETURN tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc, -uintptr_t ra); -void QEMU_NORETURN tcg_s390_vector_exception(CPUS390XState *env, uint32_t vxc, -uintptr_t ra); +G_NORETURN void tcg_s390_program_interrupt(CPUS390XState *env, +uint32_t code,uintptr_t ra); +G_NORETURN void tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc, +uintptr_t ra); +G_NORETURN void tcg_s390_vector_exception(CPUS390XState *env, uint32_t vxc, +uintptr_t ra);#endif /* TCG_S390X_H */
target/sh4/cpu.h +3 -3
@@ -209,9 +209,9 @@ void superh_cpu_dump_state(CPUState *cpu, FILE *f, int flags);hwaddr superh_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int superh_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int superh_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg); -void superh_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, - MMUAccessType access_type, int mmu_idx, - uintptr_t retaddr) QEMU_NORETURN; +G_NORETURN void superh_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, +MMUAccessType access_type,int mmu_idx, +uintptr_t retaddr);void sh4_translate_init (void );void sh4_cpu_list (void );
target/sparc/cpu.h +5 -5
@@ -574,11 +574,11 @@ void sparc_cpu_do_interrupt(CPUState *cpu);hwaddr sparc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int sparc_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int sparc_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg); -void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, -MMUAccessType access_type, -int mmu_idx, -uintptr_t retaddr); -void cpu_raise_exception_ra(CPUSPARCState *, int, uintptr_t) QEMU_NORETURN; +G_NORETURN void sparc_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, +MMUAccessType access_type, +int mmu_idx, +uintptr_t retaddr); +G_NORETURN void cpu_raise_exception_ra(CPUSPARCState *, int, uintptr_t);#ifndef NO_CPU_IO_DEFS /* cpu_init.c */
target/xtensa/cpu.h +1 -1
@@ -582,7 +582,7 @@ int xtensa_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);int xtensa_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg); void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, MMUAccessType access_type, int mmu_idx, - uintptr_t retaddr) QEMU_NORETURN; + uintptr_t retaddr) G_NORETURN;#define cpu_list xtensa_cpu_list
accel/stubs/tcg-stub.c +2 -2
@@ -28,12 +28,12 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size,g_assert_not_reached (); } -void QEMU_NORETURN cpu_loop_exit(CPUState *cpu) +G_NORETURN void cpu_loop_exit(CPUState *cpu) {g_assert_not_reached (); } -void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc) +G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc) {g_assert_not_reached (); }
bsd-user/signal.c +1 -1
@@ -346,7 +346,7 @@ static int core_dump_signal(int sig) }/* Abort execution with signal. */ -static void QEMU_NORETURN dump_core_and_abort(int target_sig) +G_NORETURN static void dump_core_and_abort(int target_sig) {CPUArchState *env = thread_cpu->env_ptr;CPUState *cpu =env_cpu (env);
hw/misc/mips_itu.c +1 -1
@@ -189,7 +189,7 @@ static void wake_blocked_threads(ITCStorageCell *c) c->blocked_threads =0 ; } -static void QEMU_NORETURN block_thread_and_exit(ITCStorageCell *c) +G_NORETURN static void block_thread_and_exit(ITCStorageCell *c) { c->blocked_threads |=1ULL << current_cpu->cpu_index; current_cpu->halted =1 ;
linux-user/signal.c +1 -1
@@ -725,7 +725,7 @@ void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr, }/* abort execution with signal */ -static void QEMU_NORETURN dump_core_and_abort(int target_sig) +G_NORETURN static void dump_core_and_abort(int target_sig) {CPUState *cpu = thread_cpu;CPUArchState *env = cpu->env_ptr;
monitor/hmp.c +1 -1
@@ -308,7 +308,7 @@ void help_cmd(Monitor *mon, const char *name)static const char *pch;static sigjmp_buf expr_env; -static void G_GNUC_PRINTF(2, 3) QEMU_NORETURN +G_NORETURN static void G_GNUC_PRINTF(2, 3) expr_error(Monitor *mon, const char *fmt, ...) { va_list ap;
qemu-img.c +5 -4
@@ -98,7 +98,8 @@ static void format_print(void *opaque, const char *name)printf (" %s" , name); } -static void QEMU_NORETURN G_GNUC_PRINTF(1, 2) error_exit(const char *fmt, ...) +G_NORETURN G_GNUC_PRINTF(1, 2) +static void error_exit(const char *fmt, ...) {va_list ap;
@@ -110,18 +111,18 @@ static void QEMU_NORETURN G_GNUC_PRINTF(1, 2) error_exit(const char *fmt, ...)exit (EXIT_FAILURE ); } -static void QEMU_NORETURN missing_argument(const char *option) +G_NORETURN static void missing_argument(const char *option) {error_exit ("missing argument for option '%s'" , option); } -static void QEMU_NORETURN unrecognized_option(const char *option) +G_NORETURN static void unrecognized_option(const char *option) {error_exit ("unrecognized option '%s'" , option); }/* Please keep in synch with docs/tools/qemu-img.rst */ -static void QEMU_NORETURN help(void) +G_NORETURN static void help(void) {const char *help_msg =QEMU_IMG_VERSION
target/alpha/helper.c +5 -5
@@ -514,7 +514,7 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, int flags)/* This should only be called from translate, via gen_excp. We expect that ENV->PC has already been updated. */ -void QEMU_NORETURN helper_excp(CPUAlphaState *env, int excp, int error) +G_NORETURN void helper_excp(CPUAlphaState *env, int excp, int error) {CPUState *cs =env_cpu (env);
@@ -524,8 +524,8 @@ void QEMU_NORETURN helper_excp(CPUAlphaState *env, int excp, int error) }/* This may be called from any of the helpers to set up EXCEPTION_INDEX. */ -void QEMU_NORETURN dynamic_excp(CPUAlphaState *env, uintptr_t retaddr, -int excp,int error) +G_NORETURN void dynamic_excp(CPUAlphaState *env, uintptr_t retaddr, +int excp,int error) {CPUState *cs =env_cpu (env);
@@ -539,8 +539,8 @@ void QEMU_NORETURN dynamic_excp(CPUAlphaState *env, uintptr_t retaddr,cpu_loop_exit (cs); } -void QEMU_NORETURN arith_excp(CPUAlphaState *env, uintptr_t retaddr, -int exc,uint64_t mask) +G_NORETURN void arith_excp(CPUAlphaState *env, uintptr_t retaddr, +int exc,uint64_t mask) { env->trap_arg0 = exc; env->trap_arg1 = mask;
target/arm/pauth_helper.c +2 -2
@@ -382,8 +382,8 @@ static uint64_t pauth_strip(CPUARMState *env, uint64_t ptr, bool data)return pauth_original_ptr (ptr, param); } -static void QEMU_NORETURN pauth_trap(CPUARMState *env, int target_el, -uintptr_t ra) +G_NORETURN static void pauth_trap(CPUARMState *env, int target_el, +uintptr_t ra) {raise_exception_ra (env,EXCP_UDEF ,syn_pactrap (), target_el, ra); }
target/arm/tlb_helper.c +3 -3
@@ -79,9 +79,9 @@ static uint32_t compute_fsr_fsc(CPUARMState *env, ARMMMUFaultInfo *fi,return fsr; } -static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr, -MMUAccessType access_type, -int mmu_idx,ARMMMUFaultInfo *fi) +G_NORETURN static void arm_deliver_fault(ARMCPU *cpu, vaddr addr, +MMUAccessType access_type, +int mmu_idx,ARMMMUFaultInfo *fi) {CPUARMState *env = &cpu->env;int target_el;
target/hexagon/op_helper.c +4 -4
@@ -34,9 +34,9 @@#define SF_MANTBITS 23/* Exceptions processing helpers */ -static void QEMU_NORETURN do_raise_exception_err(CPUHexagonState *env, -uint32_t exception, -uintptr_t pc) +G_NORETURN static void do_raise_exception_err(CPUHexagonState *env, +uint32_t exception, +uintptr_t pc) {CPUState *cs =env_cpu (env);qemu_log_mask (CPU_LOG_INT ,"%s: %d\n" , __func__, exception);
@@ -44,7 +44,7 @@ static void QEMU_NORETURN do_raise_exception_err(CPUHexagonState *env,cpu_loop_exit_restore (cs, pc); } -void QEMU_NORETURN HELPER(raise_exception)(CPUHexagonState *env, uint32_t excp) +G_NORETURN void HELPER(raise_exception)(CPUHexagonState *env, uint32_t excp) {do_raise_exception_err (env, excp,0 ); }
target/hppa/cpu.c +1 -1
@@ -72,7 +72,7 @@ static void hppa_cpu_disas_set_info(CPUState *cs, disassemble_info *info) }#ifndef CONFIG_USER_ONLY -static void QEMU_NORETURN +G_NORETURN static voidhppa_cpu_do_unaligned_access (CPUState *cs,vaddr addr,MMUAccessType access_type,int mmu_idx,uintptr_t retaddr)
target/hppa/op_helper.c +2 -2
@@ -27,7 +27,7 @@#include "fpu/softfloat.h" #include "trace.h" -void QEMU_NORETURN HELPER(excp)(CPUHPPAState *env, int excp) +G_NORETURN void HELPER(excp)(CPUHPPAState *env, int excp) {CPUState *cs =env_cpu (env);
@@ -35,7 +35,7 @@ void QEMU_NORETURN HELPER(excp)(CPUHPPAState *env, int excp)cpu_loop_exit (cs); } -void QEMU_NORETURN hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra) +G_NORETURN void hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra) {CPUState *cs =env_cpu (env);
target/i386/tcg/bpt_helper.c +1 -1
@@ -22,7 +22,7 @@#include "exec/helper-proto.h" #include "helper-tcg.h" -void QEMU_NORETURN helper_single_step(CPUX86State *env) +G_NORETURN void helper_single_step(CPUX86State *env) {#ifndef CONFIG_USER_ONLY check_hw_breakpoints (env, true);
target/i386/tcg/excp_helper.c +15 -15
@@ -25,13 +25,13 @@#include "exec/helper-proto.h" #include "helper-tcg.h" -void QEMU_NORETURN helper_raise_interrupt(CPUX86State *env, int intno, +G_NORETURN void helper_raise_interrupt(CPUX86State *env, int intno,int next_eip_addend) {raise_interrupt (env, intno,1 ,0 , next_eip_addend); } -void QEMU_NORETURN helper_raise_exception(CPUX86State *env, int exception_index) +G_NORETURN void helper_raise_exception(CPUX86State *env, int exception_index) {raise_exception (env, exception_index); }
@@ -87,10 +87,10 @@ static int check_exception(CPUX86State *env, int intno, int *error_code,* env->eip value AFTER the interrupt instruction. It is only relevant if * is_int is TRUE. */ -static void QEMU_NORETURN raise_interrupt2(CPUX86State *env, int intno, -int is_int,int error_code, -int next_eip_addend, -uintptr_t retaddr) +G_NORETURN static void raise_interrupt2(CPUX86State *env, int intno, +int is_int,int error_code, +int next_eip_addend, +uintptr_t retaddr) {CPUState *cs =env_cpu (env);
@@ -111,31 +111,31 @@ static void QEMU_NORETURN raise_interrupt2(CPUX86State *env, int intno,/* shortcuts to generate exceptions */ -void QEMU_NORETURN raise_interrupt(CPUX86State *env, int intno, int is_int, -int error_code,int next_eip_addend) +G_NORETURN void raise_interrupt(CPUX86State *env, int intno, int is_int, +int error_code,int next_eip_addend) {raise_interrupt2 (env, intno, is_int, error_code, next_eip_addend,0 ); } -void QEMU_NORETURN raise_exception_err(CPUX86State *env, int exception_index, -int error_code) +G_NORETURN void raise_exception_err(CPUX86State *env, int exception_index, +int error_code) {raise_interrupt2 (env, exception_index,0 , error_code,0 ,0 ); } -void QEMU_NORETURN raise_exception_err_ra(CPUX86State *env, int exception_index, -int error_code,uintptr_t retaddr) +G_NORETURN void raise_exception_err_ra(CPUX86State *env, int exception_index, +int error_code,uintptr_t retaddr) {raise_interrupt2 (env, exception_index,0 , error_code,0 , retaddr); } -void QEMU_NORETURN raise_exception(CPUX86State *env, int exception_index) +G_NORETURN void raise_exception(CPUX86State *env, int exception_index) {raise_interrupt2 (env, exception_index,0 ,0 ,0 ,0 ); } -void QEMU_NORETURN raise_exception_ra(CPUX86State *env, int exception_index, -uintptr_t retaddr) +G_NORETURN void raise_exception_ra(CPUX86State *env, int exception_index, +uintptr_t retaddr) {raise_interrupt2 (env, exception_index,0 ,0 ,0 , retaddr); }
target/i386/tcg/misc_helper.c +3 -3
@@ -80,7 +80,7 @@ void helper_rdtscp(CPUX86State *env) env->regs[R_ECX ] = (uint32_t )(env->tsc_aux); } -void QEMU_NORETURN helper_rdpmc(CPUX86State *env) +G_NORETURN void helper_rdpmc(CPUX86State *env) {if (((env->cr[4 ] &CR4_PCE_MASK ) ==0 ) && ((env->hflags &HF_CPL_MASK ) !=0 )) {
@@ -93,7 +93,7 @@ void QEMU_NORETURN helper_rdpmc(CPUX86State *env)raise_exception_err (env,EXCP06_ILLOP ,0 ); } -void QEMU_NORETURN do_pause(CPUX86State *env) +G_NORETURN void do_pause(CPUX86State *env) {CPUState *cs =env_cpu (env);
@@ -102,7 +102,7 @@ void QEMU_NORETURN do_pause(CPUX86State *env)cpu_loop_exit (cs); } -void QEMU_NORETURN helper_pause(CPUX86State *env, int next_eip_addend) +G_NORETURN void helper_pause(CPUX86State *env, int next_eip_addend) {cpu_svm_check_intercept_param (env,SVM_EXIT_PAUSE ,0 ,GETPC ()); env->eip += next_eip_addend;
target/i386/tcg/sysemu/misc_helper.c +3 -3
@@ -470,7 +470,7 @@ void helper_flush_page(CPUX86State *env, target_ulong addr)tlb_flush_page (env_cpu (env), addr); } -static void QEMU_NORETURN do_hlt(CPUX86State *env) +G_NORETURN static void do_hlt(CPUX86State *env) {CPUState *cs =env_cpu (env);
@@ -480,7 +480,7 @@ static void QEMU_NORETURN do_hlt(CPUX86State *env)cpu_loop_exit (cs); } -void QEMU_NORETURN helper_hlt(CPUX86State *env, int next_eip_addend) +G_NORETURN void helper_hlt(CPUX86State *env, int next_eip_addend) {cpu_svm_check_intercept_param (env,SVM_EXIT_HLT ,0 ,GETPC ()); env->eip += next_eip_addend;
@@ -497,7 +497,7 @@ void helper_monitor(CPUX86State *env, target_ulong ptr)cpu_svm_check_intercept_param (env,SVM_EXIT_MONITOR ,0 ,GETPC ()); } -void QEMU_NORETURN helper_mwait(CPUX86State *env, int next_eip_addend) +G_NORETURN void helper_mwait(CPUX86State *env, int next_eip_addend) {CPUState *cs =env_cpu (env);
target/openrisc/exception.c +1 -1
@@ -22,7 +22,7 @@#include "exec/exec-all.h" #include "exception.h" -void QEMU_NORETURN raise_exception(OpenRISCCPU *cpu, uint32_t excp) +G_NORETURN void raise_exception(OpenRISCCPU *cpu, uint32_t excp) {CPUState *cs =CPU (cpu);
target/openrisc/exception_helper.c +1 -1
@@ -30,7 +30,7 @@ void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp)raise_exception (cpu, excp); } -static void QEMU_NORETURN do_range(CPUOpenRISCState *env, uintptr_t pc) +G_NORETURN static void do_range(CPUOpenRISCState *env, uintptr_t pc) {CPUState *cs =env_cpu (env);
target/riscv/op_helper.c +2 -2
@@ -24,8 +24,8 @@#include "exec/helper-proto.h" /* Exceptions processing helpers */ -void QEMU_NORETURN riscv_raise_exception(CPURISCVState *env, -uint32_t exception,uintptr_t pc) +G_NORETURN void riscv_raise_exception(CPURISCVState *env, +uint32_t exception,uintptr_t pc) {CPUState *cs =env_cpu (env); cs->exception_index = exception;
target/rx/op_helper.c +10 -10
@@ -24,8 +24,8 @@#include "exec/cpu_ldst.h" #include "fpu/softfloat.h" -static inline void QEMU_NORETURN raise_exception(CPURXState *env, int index, -uintptr_t retaddr); +G_NORETURN static inline void raise_exception(CPURXState *env, int index, +uintptr_t retaddr);static void _set_psw (CPURXState *env,uint32_t psw,uint32_t rte) {
@@ -418,8 +418,8 @@ uint32_t helper_divu(CPURXState *env, uint32_t num, uint32_t den) }/* exception */ -static inline void QEMU_NORETURN raise_exception(CPURXState *env, int index, -uintptr_t retaddr) +G_NORETURN static inline void raise_exception(CPURXState *env, int index, +uintptr_t retaddr) {CPUState *cs =env_cpu (env);
@@ -427,22 +427,22 @@ static inline void QEMU_NORETURN raise_exception(CPURXState *env, int index,cpu_loop_exit_restore (cs, retaddr); } -void QEMU_NORETURN helper_raise_privilege_violation(CPURXState *env) +G_NORETURN void helper_raise_privilege_violation(CPURXState *env) {raise_exception (env,20 ,GETPC ()); } -void QEMU_NORETURN helper_raise_access_fault(CPURXState *env) +G_NORETURN void helper_raise_access_fault(CPURXState *env) {raise_exception (env,21 ,GETPC ()); } -void QEMU_NORETURN helper_raise_illegal_instruction(CPURXState *env) +G_NORETURN void helper_raise_illegal_instruction(CPURXState *env) {raise_exception (env,23 ,GETPC ()); } -void QEMU_NORETURN helper_wait(CPURXState *env) +G_NORETURN void helper_wait(CPURXState *env) {CPUState *cs =env_cpu (env);
@@ -451,12 +451,12 @@ void QEMU_NORETURN helper_wait(CPURXState *env)raise_exception (env,EXCP_HLT ,0 ); } -void QEMU_NORETURN helper_rxint(CPURXState *env, uint32_t vec) +G_NORETURN void helper_rxint(CPURXState *env, uint32_t vec) {raise_exception (env,0x100 + vec,0 ); } -void QEMU_NORETURN helper_rxbrk(CPURXState *env) +G_NORETURN void helper_rxbrk(CPURXState *env) {raise_exception (env,0x100 ,0 ); }
target/s390x/tcg/excp_helper.c +10 -10
@@ -33,8 +33,8 @@#include "hw/boards.h" #endif -void QEMU_NORETURN tcg_s390_program_interrupt(CPUS390XState *env, -uint32_t code,uintptr_t ra) +G_NORETURN void tcg_s390_program_interrupt(CPUS390XState *env, +uint32_t code,uintptr_t ra) {CPUState *cs =env_cpu (env);
@@ -45,8 +45,8 @@ void QEMU_NORETURN tcg_s390_program_interrupt(CPUS390XState *env,cpu_loop_exit (cs); } -void QEMU_NORETURN tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc, -uintptr_t ra) +G_NORETURN void tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc, +uintptr_t ra) {g_assert (dxc <=0xff );#if !defined(CONFIG_USER_ONLY )
@@ -62,8 +62,8 @@ void QEMU_NORETURN tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc,tcg_s390_program_interrupt (env,PGM_DATA , ra); } -void QEMU_NORETURN tcg_s390_vector_exception(CPUS390XState *env, uint32_t vxc, -uintptr_t ra) +G_NORETURN void tcg_s390_vector_exception(CPUS390XState *env, uint32_t vxc, +uintptr_t ra) {g_assert (vxc <=0xff );#if !defined(CONFIG_USER_ONLY )
@@ -87,7 +87,7 @@ void HELPER(data_exception)(CPUS390XState *env, uint32_t dxc)* this is only for the atomic operations, for which we want to raise a * specification exception. */ -static void QEMU_NORETURN do_unaligned_access(CPUState *cs, uintptr_t retaddr) +G_NORETURN static void do_unaligned_access(CPUState *cs, uintptr_t retaddr) {S390CPU *cpu =S390_CPU (cs);CPUS390XState *env = &cpu->env;
@@ -619,9 +619,9 @@ void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr,do_unaligned_access (cs, retaddr); } -static void QEMU_NORETURN monitor_event(CPUS390XState *env, -uint64_t monitor_code, -uint8_t monitor_class,uintptr_t ra) +G_NORETURN static void monitor_event(CPUS390XState *env, +uint64_t monitor_code, +uint8_t monitor_class,uintptr_t ra) {/* Store the Monitor Code and the Monitor Class Number into the lowcore */ stq_phys(env_cpu(env)->as,
target/sh4/op_helper.c +2 -2
@@ -57,8 +57,8 @@ void helper_ldtlb(CPUSH4State *env)#endif } -static inline void QEMU_NORETURN raise_exception(CPUSH4State *env, int index, -uintptr_t retaddr) +G_NORETURN static inline void raise_exception(CPUSH4State *env, int index, +uintptr_t retaddr) {CPUState *cs =env_cpu (env);
target/sparc/mmu_helper.c +4 -4
@@ -924,10 +924,10 @@ hwaddr sparc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) }#ifndef CONFIG_USER_ONLY -void QEMU_NORETURN sparc_cpu_do_unaligned_access(CPUState *cs, vaddr addr, -MMUAccessType access_type, -int mmu_idx, -uintptr_t retaddr) +G_NORETURN void sparc_cpu_do_unaligned_access(CPUState *cs, vaddr addr, +MMUAccessType access_type, +int mmu_idx, +uintptr_t retaddr) {SPARCCPU *cpu =SPARC_CPU (cs);CPUSPARCState *env = &cpu->env;
target/tricore/op_helper.c +1 -1
@@ -25,7 +25,7 @@/* Exception helpers */ -static void QEMU_NORETURN +G_NORETURN static voidraise_exception_sync_internal (CPUTriCoreState *env,uint32_t class,int tin,uintptr_t pc,uint32_t fcd_pc) {
tcg/tcg.c +1 -1
@@ -320,7 +320,7 @@ static void set_jmp_reset_offset(TCGContext *s, int which) }/* Signal overflow, starting over with fewer guest insns. */ -static void QEMU_NORETURN tcg_raise_tb_overflow(TCGContext *s) +static void G_NORETURN tcg_raise_tb_overflow(TCGContext *s) {siglongjmp (s->jmp_trans,-2 ); }
tests/fp/fp-bench.c +1 -1
@@ -545,7 +545,7 @@ static int round_name_to_mode(const char *name)return -1 ; } -static void QEMU_NORETURN die_host_rounding(enum rounding rounding) +G_NORETURN static void die_host_rounding(enum rounding rounding) {fprintf (stderr,"fatal: '%s' rounding not supported on this host\n" , round_names[rounding]);
tests/fp/fp-test.c +1 -1
@@ -921,7 +921,7 @@ static void parse_args(int argc, char *argv[]) } } -static void QEMU_NORETURN run_test(void) +G_NORETURN static void run_test(void) {unsigned int i;
scripts/checkpatch.pl +1 -1
@@ -223,7 +223,7 @@ our $Sparse = qr{ our $Attribute = qr{ const| volatile| - QEMU_NORETURN| + G_NORETURN| G_GNUC_WARN_UNUSED_RESULT| G_GNUC_NULL_TERMINATED| QEMU_PACKED|
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
Re: [PATCH 04/12] compiler.h: replace QEMU_NORETURN with G_NORETURN
Quoted 9 lines · On 2/24/22 08:36, [email protected] wrote:
From: Marc-André Lureau <[email protected]>
G_NORETURNwas introduced in glib 2.68, fallback toG_GNUC_NORETURNin glib-compat.Note that this attribute must be placed before the function declaration (bringing a bit of consistency in qemu codebase usage).
Signed-off-by Marc-André Lureau <[email protected]>
For C11, G_NORETURN is a wrapper for _Noreturn. Since we're using C11, we should just use _Noreturn.
target/xtensa/cpu.h int xtensa_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); · line 585
Quoted 4 lines
void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
MMUAccessTypeaccess_type, intmmu_idx,target/xtensa/cpu.h +1
-1- uintptr_t retaddr) QEMU_NORETURN; + uintptr_t retaddr) G_NORETURN;
Incorrect placement. I didn't scan the whole patch; I assume that using _Noreturn will flag this up as an error.
Review
Quoted 2 lines
(quoted diff) +1
-1-static void QEMU_NORETURN dump_core_and_abort(int target_sig) +G_NORETURN static void dump_core_and_abort(int target_sig)
I guess this can go either place, but I think I prefer the scope specifier first.
r~
Re: [PATCH 04/12] compiler.h: replace QEMU_NORETURN with G_NORETURN
Hi
Quoted 6 lines · Richard Henderson
Quoted 5 lines · On 2/24/22 08:36, [email protected] wrote:
From: Marc-André Lureau <[email protected]>
G_NORETURNwas introduced in glib 2.68, fallback toG_GNUC_NORETURNin glib-compat.
Quoted 8 lines
Quoted 4 lines
Note that this attribute must be placed before the function declaration (bringing a bit of consistency in qemu codebase usage).
Signed-off-by Marc-André Lureau <[email protected]>For C11,
G_NORETURNis a wrapper for_Noreturn. Since we're using C11, we should just use_Noreturn.
G_NORETURN has several flavours, one of them is the c++ [[noreturn]], but also MSVC specific etc.
Might be worth considering if we think about making code usable in different contexts.
Quoted 11 lines
Quoted 3 lines
void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
MMUAccessTypeaccess_type, int
mmu_idx,target/xtensa/cpu.h int xtensa_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); · line 585
Quoted 2 lines
target/xtensa/cpu.h +1
-1- uintptr_t retaddr) QEMU_NORETURN; + uintptr_t retaddr) G_NORETURN;Incorrect placement. I didn't scan the whole patch; I assume that using
_Noreturnwill
flag this up as an error.
Right, bad regexp search, will fix.
Quoted 7 lines
Review
Quoted 3 lines
(quoted diff) +1
-1-static void QEMU_NORETURN dump_core_and_abort(int target_sig) +G_NORETURN static void dump_core_and_abort(int target_sig)I guess this can go either place, but I think I prefer the scope specifier first.
Ok, I'll change it to "static G_NORETURN"
Signature · 1 line
Marc-André Lureau
PATCH 5/12 compiler.h: drop __printf__ macro MinGW/glib workaround
In reply to [email protected]From: Marc-André Lureau <[email protected]>
This workaround was added in commit 95df51a4 ("w32: Always use standard instead of native format strings"), as it claimed glib was using __printf__ attribute. This is surprising, since glib has always used G_GNUC_PRINTF which, as the name implies, uses __gnu_printf__ when possible.
Apparently, the workaound is no longer relevant though, I don't see the warnings.
--- include/qemu/compiler.h | 8 -------- 1 file changed, 8 deletions(-)
include/qemu/compiler.h +0 -8
@@ -73,14 +73,6 @@#define QEMU_BUILD_BUG_ON_ZERO (x) (sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)) - \ sizeof(QEMU_BUILD_BUG_ON_STRUCT(x))) -#if !defined(__clang__) && defined(_WIN32) -/* -* Map __printf__ to __gnu_printf__ because we want standard format strings even -* when MinGW or GLib include files use __printf__. -*/ -# define __printf__ __gnu_printf__ -#endif -#ifndef __has_warning#define __has_warning (x) 0/* compatibility with non-clang compilers */ #endif
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
Re: [PATCH 05/12] compiler.h: drop __printf__ macro MinGW/glib workaround
Quoted 8 lines · On Thu, 24 Feb 2022 at 18:38, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
This workaround was added in commit
95df51a4("w32: Always use standard instead of native format strings"), as it claimed glib was using__printf__attribute. This is surprising, since glib has always usedG_GNUC_PRINTFwhich, as the name implies, uses__gnu_printf__when possible.
This was not always true: before this commit from 2018
https://github.com/GNOME/glib/commit/98a0ab929d8c59ee27e5f470f11d077bb6a56749G_GNUC_PRINTF used always used __printf__.
I think that change only landed in glib 2.58, so since our current minimum glib version is 2.56 we need to retain this workaround.
Quoted 2 lines
Apparently, the workaound is no longer relevant though, I don't see the warnings.
You're probably building with a newer glib, and possibly also a newer mingw.
I've cc'd Stefan Weil who might know whether we can drop this workaround as far as the mingw part is concerned.
Quoted 25 lines
Signed-off-by Marc-André Lureau <[email protected]>--- include/qemu/compiler.h | 8 -------- 1 file changed, 8 deletions(-)include/qemu/compiler.h +0
-9@@ -73,14 +73,6 @@#define QEMU_BUILD_BUG_ON_ZERO (x) (sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)) - \ sizeof(QEMU_BUILD_BUG_ON_STRUCT(x))) -#if !defined(__clang__) && defined(_WIN32) -/* -* Map __printf__ to __gnu_printf__ because we want standard format strings even -* when MinGW or GLib include files use __printf__. -*/ -# define __printf__ __gnu_printf__ -#endif -#ifndef __has_warning#define __has_warning (x) 0/* compatibility with non-clang compilers */ #endif --
Quoted 1 line
2.35.1.273.ge6ebfd0e8cbb
thanks
-- PMM
Re: [PATCH 05/12] compiler.h: drop __printf__ macro MinGW/glib workaround
Hi Peter
Quoted 10 lines · Peter Maydell
Quoted 8 lines · On Thu, 24 Feb 2022 at 18:38, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
This workaround was added in commit
95df51a4("w32: Always use standard instead of native format strings"), as it claimed glib was using__printf__attribute. This is surprising, since glib has always usedG_GNUC_PRINTFwhich, as the name implies, uses__gnu_printf__when possible.
Quoted 8 lines
This was not always true: before this commit from 2018
https://github.com/GNOME/glib/commit/98a0ab929d8c59ee27e5f470f11d077bb6a56749
G_GNUC_PRINTFused always used__printf__.
I think that change only landed in glib 2.58, so since our current minimum glib version is 2.56 we need to retain this workaround.
Oops
Quoted 9 lines
Quoted 2 lines
Apparently, the workaound is no longer relevant though, I don't see the warnings.
You're probably building with a newer glib, and possibly also a newer mingw.
I've cc'd Stefan Weil who might know whether we can drop this workaround as far as the mingw part is concerned.
Probably safer to keep it until we bump glib dependency to >=2.58.
I would move it to glib-compat.h though, and leave a note there, as it is (or should be ) an old glib specific workaround.
Quoted 34 lines
include/qemu/compiler.h line 73
Quoted 12 lines
Signed-off-by Marc-André Lureau <[email protected]>--- include/qemu/compiler.h | 8 -------- 1 file changed, 8 deletions(-)include/qemu/compiler.h +0
-0@@ -73,14 +73,6 @@#define QEMU_BUILD_BUG_ON_ZERO (x) (sizeof(QEMU_BUILD_BUG_ON_STRUCT(x))- \
include/qemu/compiler.h
Quoted 5 lines
include/qemu/compiler.h +0
-3sizeof(QEMU_BUILD_BUG_ON_STRUCT(x))) -#if !defined(__clang__) && defined(_WIN32) -/* -* Map __printf__ to __gnu_printf__ because we want standard format strings even
Quoted 10 lines
include/qemu/compiler.h +0
-6-* when MinGW or GLib include files use __printf__. -*/ -# define __printf__ __gnu_printf__ -#endif -#ifndef __has_warning#define __has_warning (x) 0/* compatibility with non-clang compilers */ #endif --2.35.1.273.ge6ebfd0e8cbb
thanks
-- PMM
Signature · 1 line
Marc-André Lureau
Re: [PATCH 05/12] compiler.h: drop __printf__ macro MinGW/glib workaround
Quoted 11 lines · Marc-André Lureau
Quoted 5 lines · Peter Maydell
You're probably building with a newer glib, and possibly also a newer mingw.
I've cc'd Stefan Weil who might know whether we can drop this workaround as far as the mingw part is concerned.
Probably safer to keep it until we bump glib dependency to >=2.58.
I would move it to
glib-compat.hthough, and leave a note there, as it is (or should be ) an old glib specific workaround.
We can only move it to glib-compat if we confirm that only the glib-related part of the workaround is still relevant and the mingw side is now no longer needed, though.
-- PMM
Re: [PATCH 05/12] compiler.h: drop __printf__ macro MinGW/glib workaround
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Marc-André Lureau
Quoted 5 lines · Peter Maydell
You're probably building with a newer glib, and possibly also a newer mingw.
I've cc'd Stefan Weil who might know whether we can drop this workaround as far as the mingw part is concerned.
Quoted 7 lines
Quoted 3 lines
Probably safer to keep it until we bump glib dependency to >=2.58.
I would move it to
glib-compat.hthough, and leave a note there, as it is (or should be ) an old glib specific workaround.We can only move it to glib-compat if we confirm that only the glib-related part of the workaround is still relevant and the mingw side is now no longer needed, though.
We know glib uses the GNU printf semantics for all its APIs.
We know QEMU code will use the GNU printf annotation for all its APIs where it knows it has GNU printf, due to delegating to GLib.
For 3rd party libraries, we can have no confidence about whether they expect GNU or native printf format, unless we're doing something to override the printf family of functions at link time. IIRC, we're not doing that, so we can't assume 3rd party stuff expects GNU format, and so the sooner we get rid of the #define __printf__ __gnu_printf__ the better IMHO. The proof of course would be to see a CI test run with the define removed proving that no code we call relies on it.
We could even set our min GLib version to something newer just for Win32, on the basis that mingw in Fedora and msys2 both ship new enough versions, and cygwin is already outdated and so already needs to have its glib upgraded to remain compatible with QEMU.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH 05/12] compiler.h: drop __printf__ macro MinGW/glib workaround
Quoted 26 lines · Daniel P. Berrangé
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Marc-André Lureau
Quoted 5 lines · Peter Maydell
You're probably building with a newer glib, and possibly also a newer mingw.
I've cc'd Stefan Weil who might know whether we can drop this workaround as far as the mingw part is concerned.
Quoted 7 lines
Quoted 3 lines
Probably safer to keep it until we bump glib dependency to >=2.58.
I would move it to
glib-compat.hthough, and leave a note there, as it is (or should be ) an old glib specific workaround.We can only move it to glib-compat if we confirm that only the glib-related part of the workaround is still relevant and the mingw side is now no longer needed, though.
We know glib uses the GNU printf semantics for all its APIs.
We know QEMU code will use the GNU printf annotation for all its APIs where it knows it has GNU printf, due to delegating to GLib.
Quoted 8 lines
For 3rd party libraries, we can have no confidence about whether they expect GNU or native printf format, unless we're doing something to override the printf family of functions at link time. IIRC, we're not doing that, so we can't assume 3rd party stuff expects GNU format, and so the sooner we get rid of the #define
__printf____gnu_printf__the better IMHO. The proof of course would be to see a CI test run with the define removed proving that no code we call relies on it.
Yes, the workaround is definitely correct for QEMU's own code and for glib itself. We don't care about 3rd party libraries because we don't use any of those which take format-string arguments AFAIK. The 'mingw' part AIUI is purely for mingw itself, ie the standard library. What I'm asking is "what were the versions of mingw that were affected by this, and are they all old enough we don't need to care from that point of view?".
-- PMM
Re: [PATCH 05/12] compiler.h: drop __printf__ macro MinGW/glib workaround
Quoted 36 lines · Peter Maydell
Quoted 26 lines · Daniel P. Berrangé
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Marc-André Lureau
Quoted 5 lines · Peter Maydell
You're probably building with a newer glib, and possibly also a newer mingw.
I've cc'd Stefan Weil who might know whether we can drop this workaround as far as the mingw part is concerned.
Quoted 7 lines
Quoted 3 lines
Probably safer to keep it until we bump glib dependency to >=2.58.
I would move it to
glib-compat.hthough, and leave a note there, as it is (or should be ) an old glib specific workaround.We can only move it to glib-compat if we confirm that only the glib-related part of the workaround is still relevant and the mingw side is now no longer needed, though.
We know glib uses the GNU printf semantics for all its APIs.
We know QEMU code will use the GNU printf annotation for all its APIs where it knows it has GNU printf, due to delegating to GLib.
Quoted 8 lines
For 3rd party libraries, we can have no confidence about whether they expect GNU or native printf format, unless we're doing something to override the printf family of functions at link time. IIRC, we're not doing that, so we can't assume 3rd party stuff expects GNU format, and so the sooner we get rid of the #define
__printf____gnu_printf__the better IMHO. The proof of course would be to see a CI test run with the define removed proving that no code we call relies on it.
Quoted 8 lines
Yes, the workaround is definitely correct for QEMU's own code and for glib itself. We don't care about 3rd party libraries because we don't use any of those which take format-string arguments AFAIK. The 'mingw' part AIUI is purely for mingw itself, ie the standard library. What I'm asking is "what were the versions of mingw that were affected by this, and are they all old enough we don't need to care from that point of view?".
I've no idea about affected versions, but if they're more than 2 years old I'd say we don't need to care. The various places you get mingw prebuilt all tend to stay close to the cutting edge.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH 05/12] compiler.h: drop __printf__ macro MinGW/glib workaround
In reply to Peter MaydellAm 24.02.22 um 20:12 schrieb Peter Maydell:
Quoted 14 lines · On Thu, 24 Feb 2022 at 18:38, <[email protected]> wrote:
Quoted 7 lines
From: Marc-André Lureau <[email protected]>
This workaround was added in commit
95df51a4("w32: Always use standard instead of native format strings"), as it claimed glib was using__printf__attribute. This is surprising, since glib has always usedG_GNUC_PRINTFwhich, as the name implies, uses__gnu_printf__when possible.This was not always true: before this commit from 2018
https://github.com/GNOME/glib/commit/98a0ab929d8c59ee27e5f470f11d077bb6a56749G_GNUC_PRINTFused always used__printf__.
I think that change only landed in glib 2.58, so since our current minimum glib version is 2.56 we need to retain this workaround.
Quoted 7 lines
Quoted 2 lines
Apparently, the workaound is no longer relevant though, I don't see the warnings.
You're probably building with a newer glib, and possibly also a newer mingw.
I've cc'd Stefan Weil who might know whether we can drop this workaround as far as the mingw part is concerned.
My latest builds of QEMU for Windows still used glib 2.54 because that still is the "newest" version which is provided by Cygwin's mingw64:
https://cygwin.com/cgi-bin2/package-grep.cgi?grep=mingw64-.*-glib2.0
So I even had to downgrade the minimum glib version.
A hard requirement of a newer glib would mean that Cygwin mingw64 packages can no longer be used for building QEMU unless someone updates those packages.
Stefan
Re: [PATCH 05/12] compiler.h: drop __printf__ macro MinGW/glib workaround
Hi
Quoted 29 lines · Stefan Weil
Am 24.02.22 um 20:12 schrieb Peter Maydell:
Quoted 10 lines · On Thu, 24 Feb 2022 at 18:38, <[email protected]> wrote:
Quoted 7 lines
From: Marc-André Lureau <[email protected]>
This workaround was added in commit
95df51a4("w32: Always use standard instead of native format strings"), as it claimed glib was using__printf__attribute. This is surprising, since glib has always usedG_GNUC_PRINTFwhich, as the name implies, uses__gnu_printf__when possible.This was not always true: before this commit from 2018
https://github.com/GNOME/glib/commit/98a0ab929d8c59ee27e5f470f11d077bb6a56749
Quoted 11 lines
G_GNUC_PRINTFused always used__printf__.
I think that change only landed in glib 2.58, so since our current minimum glib version is 2.56 we need to retain this workaround.Quoted 2 lines
Apparently, the workaound is no longer relevant though, I don't see the warnings.
You're probably building with a newer glib, and possibly also a newer mingw.
I've cc'd Stefan Weil who might know whether we can drop this workaround as far as the mingw part is concerned.
My latest builds of QEMU for Windows still used glib 2.54 because that still is the "newest" version which is provided by Cygwin's mingw64:
Quoted 8 lines
https://cygwin.com/cgi-bin2/package-grep.cgi?grep=mingw64-.*-glib2.0
So I even had to downgrade the minimum glib version.
A hard requirement of a newer glib would mean that Cygwin mingw64 packages can no longer be used for building QEMU unless someone updates those packages.
That sounds doable, I can take a look.
Why not build with msys2 though? It is quite actively maintained and most people recommended it these days. My understanding is that msys2 is closer to native Windows (whereas cygwin tries to bring more POSIX compatiblity:
https://www.msys2.org/wiki/How-does-MSYS2-differ-from-Cygwin/)
Signature · 1 line
Marc-André Lureau
PATCH 6/12 Replace config-time define HOST_WORDS_BIGENDIAN
In reply to [email protected]From: Marc-André Lureau <[email protected]>
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.
--- meson.build | 1 - accel/tcg/atomic_template.h | 4 +- audio/audio.h | 2 +- hw/display/pl110_template.h | 6 +-- hw/net/can/ctucan_core.h | 2 +- hw/net/vmxnet3.h | 4 +- include/exec/cpu-all.h | 4 +- include/exec/cpu-common.h | 2 +- include/exec/memop.h | 2 +- include/exec/memory.h | 2 +- include/fpu/softfloat-types.h | 2 +- include/hw/core/cpu.h | 2 +- include/hw/i386/intel_iommu.h | 6 +-- include/hw/i386/x86-iommu.h | 4 +- include/hw/virtio/virtio-access.h | 6 +-- include/hw/virtio/virtio-gpu-bswap.h | 2 +- include/libdecnumber/dconfig.h | 2 +- include/net/eth.h | 2 +- include/qemu/bswap.h | 8 ++-- include/qemu/compiler.h | 2 + include/qemu/host-utils.h | 2 +- include/qemu/int128.h | 2 +- include/ui/qemu-pixman.h | 2 +- net/util.h | 2 +- target/arm/cpu.h | 8 ++-- target/arm/translate-a64.h | 2 +- target/arm/vec_internal.h | 2 +- target/i386/cpu.h | 2 +- target/mips/cpu.h | 2 +- target/ppc/cpu.h | 2 +- target/s390x/tcg/vec.h | 2 +- target/xtensa/cpu.h | 2 +- tests/fp/platform.h | 4 +- accel/kvm/kvm-all.c | 4 +- audio/dbusaudio.c | 2 +- disas.c | 2 +- hw/core/loader.c | 4 +- hw/display/artist.c | 6 +-- hw/display/pxa2xx_lcd.c | 2 +- hw/display/vga.c | 12 +++--- hw/display/virtio-gpu-gl.c | 2 +- hw/s390x/event-facility.c | 2 +- hw/virtio/vhost.c | 2 +- linux-user/arm/nwfpe/double_cpdo.c | 4 +- linux-user/arm/nwfpe/fpa11_cpdt.c | 4 +- linux-user/ppc/signal.c | 3 +- linux-user/syscall.c | 6 +-- net/net.c | 4 +- target/alpha/translate.c | 2 +- target/arm/crypto_helper.c | 2 +- target/arm/helper.c | 2 +- target/arm/kvm64.c | 4 +- target/arm/neon_helper.c | 2 +- target/arm/sve_helper.c | 4 +- target/arm/translate-sve.c | 6 +-- target/arm/translate-vfp.c | 2 +- target/arm/translate.c | 2 +- target/hppa/translate.c | 2 +- target/i386/tcg/translate.c | 2 +- target/mips/tcg/lmmi_helper.c | 2 +- target/mips/tcg/msa_helper.c | 54 ++++++++++++------------- target/ppc/arch_dump.c | 2 +- target/ppc/int_helper.c | 22 +++++----- target/ppc/kvm.c | 4 +- target/ppc/mem_helper.c | 2 +- target/riscv/vector_helper.c | 2 +- target/s390x/tcg/translate.c | 2 +- target/sparc/vis_helper.c | 4 +- tcg/tcg-op.c | 4 +- tcg/tcg.c | 12 +++--- tests/qtest/vhost-user-blk-test.c | 2 +- tests/qtest/virtio-blk-test.c | 2 +- ui/vdagent.c | 2 +- ui/vnc.c | 2 +- util/bitmap.c | 2 +- util/host-utils.c | 2 +- target/ppc/translate/vmx-impl.c.inc | 4 +- target/ppc/translate/vsx-impl.c.inc | 2 +- target/riscv/insn_trans/trans_rvv.c.inc | 4 +- target/s390x/tcg/translate_vx.c.inc | 2 +- tcg/aarch64/tcg-target.c.inc | 4 +- tcg/arm/tcg-target.c.inc | 4 +- tcg/mips/tcg-target.c.inc | 2 +- tcg/ppc/tcg-target.c.inc | 10 ++--- tcg/riscv/tcg-target.c.inc | 4 +- 85 files changed, 173 insertions(+), 173 deletions(-)
meson.build +0 -1
@@ -1574,7 +1574,6 @@ config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2] config_host_data.set_quoted('CONFIG_HOST_DSOSUF', host_dsosuf) config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device) -config_host_data.set('HOST_WORDS_BIGENDIAN', host_machine.endian() == 'big') have_coroutine_pool = get_option('coroutine_pool') if get_option('debug_stack_usage') and have_coroutine_pool
accel/tcg/atomic_template.h +2 -2
@@ -63,7 +63,7 @@the ATOMIC_NAME macro, and redefined below. */ #if DATA_SIZE ==1 # define END -#elif defined(HOST_WORDS_BIGENDIAN ) +#elif HOST_BIG_ENDIAN # define END _be#else # define END _le
@@ -196,7 +196,7 @@ GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new)/* Define reverse-host-endian atomic operations. Note that END is used within the ATOMIC_NAME macro. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define END _le#else # define END _be
audio/audio.h +1 -1
@@ -32,7 +32,7 @@typedef void (*audio_callback_fn ) (void *opaque,int avail); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define AUDIO_HOST_ENDIANNESS 1#else #define AUDIO_HOST_ENDIANNESS 0
hw/display/pl110_template.h +3 -3
@@ -15,18 +15,18 @@#if ORDER ==0 #define NAME glue(lblp_, BORDER) -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define SWAP_WORDS 1#endif #elif ORDER ==1 #define NAME glue(bbbp_, BORDER) -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN #define SWAP_WORDS 1#endif #else #define SWAP_PIXELS 1#define NAME glue(lbbp_, BORDER) -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define SWAP_WORDS 1#endif #endif
hw/net/can/ctucan_core.h +1 -1
@@ -31,7 +31,7 @@#include "exec/hwaddr.h" #include "net/can_emu.h" -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN #define __LITTLE_ENDIAN_BITFIELD 1#endif
hw/net/vmxnet3.h +2 -2
@@ -35,7 +35,7 @@#define __le32 uint32_t#define __le64 uint64_t -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define __BIG_ENDIAN_BITFIELD#else #endif
@@ -800,7 +800,7 @@ struct Vmxnet3_DriverShared {#undef __le16#undef __le32#undef __le64 -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #undef __BIG_ENDIAN_BITFIELD#endif
include/exec/cpu-all.h +2 -2
@@ -34,13 +34,13 @@/* some important defines: * -* HOST_WORDS_BIGENDIAN : if defined, the host cpu is big endian and +* HOST_BIG_ENDIAN : whether the host cpu is big endian and * otherwise little endian. * * TARGET_WORDS_BIGENDIAN : same for target cpu */ -#if defined(HOST_WORDS_BIGENDIAN ) != defined(TARGET_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN != defined(TARGET_WORDS_BIGENDIAN )#define BSWAP_NEEDED #endif
include/exec/cpu-common.h +1 -1
@@ -34,7 +34,7 @@ enum device_endian { DEVICE_LITTLE_ENDIAN, }; -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define DEVICE_HOST_ENDIAN DEVICE_BIG_ENDIAN#else #define DEVICE_HOST_ENDIAN DEVICE_LITTLE_ENDIAN
include/exec/memop.h +1 -1
@@ -28,7 +28,7 @@ typedef enum MemOp { MO_SIGN = 0x08, /* Sign-extended, otherwise zero-extended. */ MO_BSWAP = 0x10, /* Host reverse endian. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN MO_LE =MO_BSWAP , MO_BE = 0, #else
include/exec/memory.h +1 -1
@@ -2931,7 +2931,7 @@ static inline MemOp devend_memop(enum device_endian end)QEMU_BUILD_BUG_ON (DEVICE_HOST_ENDIAN !=DEVICE_LITTLE_ENDIAN &&DEVICE_HOST_ENDIAN !=DEVICE_BIG_ENDIAN ); -#if defined(HOST_WORDS_BIGENDIAN ) != defined(TARGET_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN != defined(TARGET_WORDS_BIGENDIAN )/* Swap if non-host endianness or native (target) endianness */ return (end ==DEVICE_HOST_ENDIAN ) ?0 :MO_BSWAP ;#else
include/fpu/softfloat-types.h +1 -1
@@ -103,7 +103,7 @@ typedef struct {#define make_floatx80 (exp, mant) ((floatx80) { mant, exp })#define make_floatx80_init (exp, mant) { .low = mant, .high = exp } typedef struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint64_t high, low; #else uint64_t low, high;
include/hw/core/cpu.h +1 -1
@@ -180,7 +180,7 @@ struct CPUClass { typedef union IcountDecr { uint32_t u32; struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint16_t high; uint16_t low; #else
include/hw/i386/intel_iommu.h +3 -3
@@ -145,7 +145,7 @@ enum {/* Interrupt Remapping Table Entry Definition */ union VTD_IR_TableEntry {struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t __reserved_1:8 ;/* Reserved 1 */ uint32_t vector:8 ;/* Interrupt Vector */ uint32_t irte_mode:1 ;/* IRTE Mode */
@@ -172,7 +172,7 @@ union VTD_IR_TableEntry {#endif uint32_t dest_id;/* Destination ID */ uint16_t source_id;/* Source-ID */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint64_t __reserved_2:44; /* Reserved 2 */ uint64_t sid_vtype:2; /* Source-ID Validation Type */ uint64_t sid_q:2; /* Source-ID Qualifier */
@@ -191,7 +191,7 @@ union VTD_IR_TableEntry {/* Programming format for MSI/MSI-X addresses */ union VTD_IR_MSIAddress {struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t __head:12 ;/* Should always be: 0x0fee */ uint32_t index_l:15 ;/* Interrupt index bit 14-0 */ uint32_t int_mode:1 ;/* Interrupt format */
include/hw/i386/x86-iommu.h +2 -2
@@ -87,7 +87,7 @@ struct X86IOMMUIrq { struct X86IOMMU_MSIMessage { union { struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t __addr_head:12; /* 0xfee */ uint32_t dest:8; uint32_t __reserved:8;
@@ -108,7 +108,7 @@ struct X86IOMMU_MSIMessage { };union {struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint16_t trigger_mode:1 ;uint16_t level:1 ;uint16_t __resved:3 ;
include/hw/virtio/virtio-access.h +3 -3
@@ -149,7 +149,7 @@ static inline uint64_t virtio_ldq_p(VirtIODevice *vdev, const void *ptr)static inline uint16_t virtio_tswap16 (VirtIODevice *vdev,uint16_t s) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return virtio_access_is_big_endian (vdev) ? s :bswap16 (s);#else return virtio_access_is_big_endian (vdev) ?bswap16 (s) : s;
@@ -215,7 +215,7 @@ static inline void virtio_tswap16s(VirtIODevice *vdev, uint16_t *s)static inline uint32_t virtio_tswap32 (VirtIODevice *vdev,uint32_t s) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return virtio_access_is_big_endian (vdev) ? s :bswap32 (s);#else return virtio_access_is_big_endian (vdev) ?bswap32 (s) : s;
@@ -229,7 +229,7 @@ static inline void virtio_tswap32s(VirtIODevice *vdev, uint32_t *s)static inline uint64_t virtio_tswap64 (VirtIODevice *vdev,uint64_t s) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return virtio_access_is_big_endian (vdev) ? s :bswap64 (s);#else return virtio_access_is_big_endian (vdev) ?bswap64 (s) : s;
include/hw/virtio/virtio-gpu-bswap.h +1 -1
@@ -29,7 +29,7 @@ virtio_gpu_ctrl_hdr_bswap(struct virtio_gpu_ctrl_hdr *hdr)static inline void virtio_gpu_bswap_32 (void *ptr,size_t size) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN size_t i;struct virtio_gpu_ctrl_hdr *hdr = (struct virtio_gpu_ctrl_hdr *) ptr;
include/libdecnumber/dconfig.h +1 -1
@@ -28,7 +28,7 @@02110-1301, USA. */ -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define WORDS_BIGENDIAN 1#else #define WORDS_BIGENDIAN 0
include/net/eth.h +1 -1
@@ -159,7 +159,7 @@ struct tcp_hdr {u_short th_dport;/* destination port */ uint32_t th_seq;/* sequence number */ uint32_t th_ack;/* acknowledgment number */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN u_char th_off : 4, /* data offset */ th_x2:4; /* (unused) */#else
include/qemu/bswap.h +4 -4
@@ -84,7 +84,7 @@ static inline void bswap64s(uint64_t *s) *s =bswap64 (*s); } -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define be_bswap (v, size) (v)#define le_bswap (v, size) glue(bswap, size)(v)#define be_bswaps (v, size)
@@ -188,7 +188,7 @@ CPU_CONVERT(le, 64, uint64_t)* a compile-time constant if you pass in a constant. So this can be * used to initialize static variables. */ -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN # define const_le32 (_x) \ ((((_x) & 0x000000ffU) << 24) | \ (((_x) & 0x0000ff00U) << 8) | \
@@ -211,7 +211,7 @@ typedef union { typedef union { float64 d; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN struct { uint32_t upper; uint32_t lower;
@@ -235,7 +235,7 @@ typedef union { typedef union { float128 q; -#if defined(HOST_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN struct { uint32_t upmost; uint32_t upper;
include/qemu/compiler.h +2 -0
@@ -7,6 +7,8 @@#ifndef COMPILER_H #define COMPILER_H +#define HOST_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +#if defined __clang_analyzer__ || defined __COVERITY__#define QEMU_STATIC_ANALYSIS 1#endif
include/qemu/host-utils.h +1 -1
@@ -88,7 +88,7 @@ static inline uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c)union {uint64_t ll;struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t high, low;#else uint32_t low, high;
include/qemu/int128.h +1 -1
@@ -205,7 +205,7 @@ typedef struct Int128 Int128;* a union with other integer types). */ struct Int128 { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN int64_t hi;uint64_t lo;#else
include/ui/qemu-pixman.h +1 -1
@@ -19,7 +19,7 @@* feeding libjpeg / libpng and writing screenshots. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define PIXMAN_BE_r8g8b8 PIXMAN_r8g8b8# define PIXMAN_BE_x8r8g8b8 PIXMAN_x8r8g8b8# define PIXMAN_BE_a8r8g8b8 PIXMAN_a8r8g8b8
net/util.h +1 -1
@@ -30,7 +30,7 @@* Structure of an internet header, naked of options. */ struct ip { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint8_t ip_v:4 ,/* version */ ip_hl:4 ;/* header length */ #else
target/arm/cpu.h +4 -4
@@ -95,7 +95,7 @@ enum {* therefore useful to be able to pass TCG the offset of the least * significant half of a uint64_t struct member. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define offsetoflow32 (S ,M ) (offsetof(S, M) + sizeof(uint32_t))#define offsetofhigh32 (S ,M ) offsetof(S, M)#else
@@ -380,7 +380,7 @@ typedef struct CPUARMState {union {/* Fault address registers. */ struct {uint64_t _unused_far0; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t ifar_ns;uint32_t dfar_ns;uint32_t ifar_s;
@@ -417,7 +417,7 @@ typedef struct CPUARMState {uint64_t c9_pminten;/* perf monitor interrupt enables */ union {/* Memory attribute redirection */ struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint64_t _unused_mair_0;uint32_t mair1_ns;uint32_t mair0_ns;
@@ -1089,7 +1089,7 @@ void aarch64_add_pauth_properties(Object *obj);*/ static inline uint64_t *sve_bswap64 (uint64_t *dst,uint64_t *src,int nr) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN int i;for (i =0 ; i < nr; ++i) {
target/arm/translate-a64.h +1 -1
@@ -71,7 +71,7 @@ static inline int vec_reg_offset(DisasContext *s, int regno, {int element_size =1 << size;int offs = element * element_size; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN /* This is complicated slightly because vfp.zregs[n].d[0] is * still the lowest and vfp.zregs[n].d[15] the highest of the * 256 byte vector, even on big endian systems.
target/arm/vec_internal.h +1 -1
@@ -29,7 +29,7 @@* The H1_<N> macros are used when performing byte arithmetic and then * casting the final pointer to a type of size N. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define H1 (x) ((x) ^ 7)#define H1_2 (x) ((x) ^ 6)#define H1_4 (x) ((x) ^ 4)
target/i386/cpu.h +1 -1
@@ -1226,7 +1226,7 @@ typedef struct BNDCSReg {#define BNDCFG_BNDPRESERVE 2ULL#define BNDCFG_BDIR_MASK TARGET_PAGE_MASK -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define ZMM_B (n) _b_ZMMReg[63 - (n)]#define ZMM_W (n) _w_ZMMReg[31 - (n)]#define ZMM_L (n) _l_ZMMReg[15 - (n)]
target/mips/cpu.h +1 -1
@@ -35,7 +35,7 @@ union fpr_t {*define FP_ENDIAN_IDX to access the same location * in the fpr_t union regardless of the host endianness */ -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN # define FP_ENDIAN_IDX 1#else # define FP_ENDIAN_IDX 0
target/ppc/cpu.h +1 -1
@@ -2637,7 +2637,7 @@ static inline bool lsw_reg_in_range(int start, int nregs, int rx) }/* Accessors for FP, VMX and VSX registers */ -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define VsrB (i) u8[i]#define VsrSB (i) s8[i]#define VsrH (i) u16[i]
target/s390x/tcg/vec.h +1 -1
@@ -38,7 +38,7 @@ typedef union S390Vector {* W: [ 1][ 0] - [ 3][ 2] * DW: [ 0] - [ 1] */ -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN #define H1 (x) ((x) ^ 7)#define H2 (x) ((x) ^ 3)#define H4 (x) ((x) ^ 1)
target/xtensa/cpu.h +1 -1
@@ -494,7 +494,7 @@ typedef struct XtensaConfigList {struct XtensaConfigList *next; } XtensaConfigList; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN enum {FP_F32_HIGH , FP_F32_LOW,
tests/fp/platform.h +2 -2
@@ -29,9 +29,9 @@* (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" +#include "qemu/compiler.h" -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN #define LITTLEENDIAN 1/* otherwise do not define it */ #endif
accel/kvm/kvm-all.c +2 -2
@@ -1202,8 +1202,8 @@ void kvm_hwpoison_page_add(ram_addr_t ram_addr)static uint32_t adjust_ioeventfd_endianness (uint32_t val,uint32_t size) { -#if defined(HOST_WORDS_BIGENDIAN ) != defined(TARGET_WORDS_BIGENDIAN ) -/* The kernel expects ioeventfd values in HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN != defined(TARGET_WORDS_BIGENDIAN ) +/* The kernel expects ioeventfd values in HOST_BIG_ENDIAN * endianness, but the memory core hands them in target endianness. * For example, PPC is always treated as big-endian even if running * on KVM and on PPC64LE. Correct here.
audio/dbusaudio.c +1 -1
@@ -122,7 +122,7 @@ static size_t dbus_put_buffer_out(HWVoiceOut *hw, void *buf, size_t size)return size; } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define AUDIO_HOST_BE TRUE#else #define AUDIO_HOST_BE FALSE
disas.c +1 -1
@@ -144,7 +144,7 @@ static void initialize_debug_host(CPUDebug *s) s->info.read_memory_func = host_read_memory; s->info.print_address_func = host_print_address; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN s->info.endian =BFD_ENDIAN_BIG ;#else s->info.endian =BFD_ENDIAN_LITTLE ;
hw/core/loader.c +2 -2
@@ -474,7 +474,7 @@ ssize_t load_elf_ram_sym(const char *filename, ret =ELF_LOAD_NOT_ELF ; goto fail; } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN data_order =ELFDATA2MSB ;#else data_order =ELFDATA2LSB ;
@@ -511,7 +511,7 @@ ssize_t load_elf_ram_sym(const char *filename,static void bswap_uboot_header (uboot_image_header_t *hdr) { -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN bswap32s (&hdr->ih_magic);bswap32s (&hdr->ih_hcrc);bswap32s (&hdr->ih_time);
hw/display/artist.c +3 -3
@@ -26,7 +26,7 @@#define TYPE_ARTIST "artist" OBJECT_DECLARE_SIMPLE_TYPE(ARTISTState, ARTIST) -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define ROP8OFF (_i) (3 - (_i))#else #define ROP8OFF
@@ -712,7 +712,7 @@ static void combine_write_reg(hwaddr addr, uint64_t val, int size, void *out)* FIXME: is there a qemu helper for this? */ -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN addr ^=3 ;#endif
@@ -1087,7 +1087,7 @@ static uint64_t combine_read_reg(hwaddr addr, int size, void *in)* FIXME: is there a qemu helper for this? */ -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN addr ^=3 ;#endif
hw/display/pxa2xx_lcd.c +1 -1
@@ -199,7 +199,7 @@ typedef struct QEMU_PACKED {SKIP_PIXEL (to); \ } while (0) -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define SWAP_WORDS 1#endif
hw/display/vga.c +6 -6
@@ -94,19 +94,19 @@ const uint8_t gr_mask[16] = { (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )) -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define PAT (x) cbswap_32(x)#else #define PAT (x) (x)#endif -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define BIG 1#else #define BIG 0#endif -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define GET_PLANE (data, p) (((data) >> (24 - (p) * 8)) & 0xff)#else #define GET_PLANE (data, p) (((data) >> ((p) * 8)) & 0xff)
@@ -133,7 +133,7 @@ static const uint32_t mask16[16] = {#undef PAT -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define PAT (x) (x)#else #define PAT (x) cbswap_32(x)
@@ -1296,7 +1296,7 @@ static void vga_draw_text(VGACommonState *s, int full_update)if (cx > cx_max) cx_max = cx; *ch_attr_ptr = ch_attr; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN ch = ch_attr >>8 ; cattr = ch_attr &0xff ;#else
@@ -1477,7 +1477,7 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)vga_draw_line_func *vga_draw_line =NULL ;bool share_surface, force_shadow = false;pixman_format_code_t format; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN bool byteswap = !s->big_endian_fb;#else bool byteswap = s->big_endian_fb;
hw/display/virtio-gpu-gl.c +1 -1
@@ -108,7 +108,7 @@ static void virtio_gpu_gl_device_realize(DeviceState *qdev, Error **errp) {VirtIOGPU *g =VIRTIO_GPU (qdev); -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN error_setg (errp,"virgl is not supported on bigendian platforms" );return ;#endif
hw/s390x/event-facility.c +1 -1
@@ -28,7 +28,7 @@ typedef struct SCLPEventsBus { } SCLPEventsBus;/* we need to save 32 bit chunks for compatibility */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define RECV_MASK_LOWER 1#define RECV_MASK_UPPER 0#else /* little endian host */
hw/virtio/vhost.c +1 -1
@@ -989,7 +989,7 @@ static inline bool vhost_needs_vring_endian(VirtIODevice *vdev)if (virtio_vdev_has_feature (vdev,VIRTIO_F_VERSION_1 )) {return false; } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return vdev->device_endian ==VIRTIO_DEVICE_ENDIAN_LITTLE ;#else return vdev->device_endian ==VIRTIO_DEVICE_ENDIAN_BIG ;
linux-user/arm/nwfpe/double_cpdo.c +2 -2
@@ -150,7 +150,7 @@ unsigned int DoubleCPDO(const unsigned int opcode)case MNF_CODE : {unsigned int *p = (unsigned int *)&rFm; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN p[0 ] ^=0x80000000 ;#else p[1 ] ^=0x80000000 ;
@@ -162,7 +162,7 @@ unsigned int DoubleCPDO(const unsigned int opcode)case ABS_CODE : {unsigned int *p = (unsigned int *)&rFm; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN p[0 ] &=0x7fffffff ;#else p[1 ] &=0x7fffffff ;
linux-user/arm/nwfpe/fpa11_cpdt.c +2 -2
@@ -44,7 +44,7 @@ void loadDouble(const unsigned int Fn, target_ulong addr)unsigned int *p; p = (unsigned int *)&fpa11->fpreg[Fn].fDouble; fpa11->fType[Fn] = typeDouble; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN /* FIXME - handle failure of get_user() */ get_user_u32 (p[0 ], addr);/* sign & exponent */ get_user_u32 (p[1 ], addr +4 );
@@ -147,7 +147,7 @@ void storeDouble(const unsigned int Fn, target_ulong addr)default : val = fpa11->fpreg[Fn].fDouble; }/* FIXME - handle put_user() failures */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN put_user_u32 (p[0 ], addr);/* msw */ put_user_u32 (p[1 ], addr +4 );/* lsw */ #else
linux-user/ppc/signal.c +1 -2
@@ -215,8 +215,7 @@ static target_ulong get_sigframe(struct target_sigaction *ka,return (oldsp - frame_size) & ~0xFUL ; } -#if ((defined(TARGET_WORDS_BIGENDIAN ) && defined(HOST_WORDS_BIGENDIAN )) || \ - (!defined(HOST_WORDS_BIGENDIAN ) && !defined(TARGET_WORDS_BIGENDIAN ))) +#if defined(TARGET_WORDS_BIGENDIAN ) ==HOST_BIG_ENDIAN #define PPC_VEC_HI 0#define PPC_VEC_LO 1#else
linux-user/syscall.c +3 -3
@@ -8152,7 +8152,7 @@ static int is_proc_myself(const char *filename, const char *entry)return 0 ; } -#if defined(HOST_WORDS_BIGENDIAN ) != defined(TARGET_WORDS_BIGENDIAN ) || \ +#if HOST_BIG_ENDIAN != defined(TARGET_WORDS_BIGENDIAN ) || \ defined(TARGET_SPARC ) || defined(TARGET_M68K ) || defined(TARGET_HPPA )static int is_proc (const char *filename,const char *entry) {
@@ -8160,7 +8160,7 @@ static int is_proc(const char *filename, const char *entry) }#endif -#if defined(HOST_WORDS_BIGENDIAN ) != defined(TARGET_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN != defined(TARGET_WORDS_BIGENDIAN )static int open_net_route (void *cpu_env,int fd) {FILE *fp;
@@ -8246,7 +8246,7 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags, { "stat", open_self_stat, is_proc_myself }, { "auxv", open_self_auxv, is_proc_myself }, { "cmdline", open_self_cmdline, is_proc_myself }, -#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) +#if HOST_BIG_ENDIAN != defined(TARGET_WORDS_BIGENDIAN) { "/proc/net/route", open_net_route, is_proc }, #endif #if defined(TARGET_SPARC) || defined(TARGET_HPPA)
net/net.c +2 -2
@@ -524,7 +524,7 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len)int qemu_set_vnet_le (NetClientState *nc,bool is_le) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN if (!nc || !nc->info->set_vnet_le) {return -ENOSYS ; }
@@ -537,7 +537,7 @@ int qemu_set_vnet_le(NetClientState *nc, bool is_le)int qemu_set_vnet_be (NetClientState *nc,bool is_be) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return 0 ;#else if (!nc || !nc->info->set_vnet_be) {
target/alpha/translate.c +1 -1
@@ -236,7 +236,7 @@ static TCGv dest_fpr(DisasContext *ctx, unsigned reg)static int get_flag_ofs (unsigned shift) {int ofs = offsetof(CPUAlphaState , flags); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN ofs +=3 - (shift /8 );#else ofs += shift /8 ;
target/arm/crypto_helper.c +1 -1
@@ -23,7 +23,7 @@ union CRYPTO_STATE {uint64_t l[2 ]; }; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define CR_ST_BYTE (state, i) ((state).bytes[(15 - (i)) ^ 8])#define CR_ST_WORD (state, i) ((state).words[(3 - (i)) ^ 2])#else
target/arm/helper.c +1 -1
@@ -8617,7 +8617,7 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, r2->cp =15 ; } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN if (r2->fieldoffset) { r2->fieldoffset +=sizeof (uint32_t ); }
target/arm/kvm64.c +2 -2
@@ -1011,7 +1011,7 @@ static int kvm_arch_put_fpsimd(CPUState *cs)for (i =0 ; i <32 ; i++) {uint64_t *q =aa64_vfp_qreg (env, i); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint64_t fp_val[2 ] = { q[1 ], q[0 ] }; reg.addr = (uintptr_t )fp_val;#else
@@ -1230,7 +1230,7 @@ static int kvm_arch_get_fpsimd(CPUState *cs)if (ret) {return ret; }else { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint64_t t; t = q[0 ], q[0 ] = q[1 ], q[1 ] = t;#endif
target/arm/neon_helper.c +1 -1
@@ -23,7 +23,7 @@ typedef struct \ { \type v1; \ } neon_##name; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define NEON_TYPE2 (name, type) \ typedef struct \ { \
target/arm/sve_helper.c +2 -2
@@ -2802,7 +2802,7 @@ static void swap_memmove(void *vd, void *vs, size_t n)uintptr_t o = (d | s | n) &7 ;size_t i; -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN o =0 ;#endif switch (o) {
@@ -2864,7 +2864,7 @@ static void swap_memzero(void *vd, size_t n)return ; } -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN o =0 ;#endif switch (o) {
target/arm/translate-sve.c +3 -3
@@ -2872,7 +2872,7 @@ static TCGv_i64 load_last_active(DisasContext *s, TCGv_i32 last,* The final adjustment for the vector register base * is added via constant offset to the load. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN /* Adjust for element ordering. See vec_reg_offset. */ if (esz <3 ) {tcg_gen_xori_i32 (last, last,8 - (1 << esz));
@@ -5711,7 +5711,7 @@ static void do_ldrq(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype)* for this load operation. */ TCGv_i64 tmp =tcg_temp_new_i64 (); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN poff +=6 ;#endif tcg_gen_ld16u_i64 (tmp, cpu_env, poff);
@@ -5790,7 +5790,7 @@ static void do_ldro(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype)* for this load operation. */ TCGv_i64 tmp =tcg_temp_new_i64 (); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN poff +=4 ;#endif tcg_gen_ld32u_i64 (tmp, cpu_env, poff);
target/arm/translate-vfp.c +1 -1
@@ -93,7 +93,7 @@ uint64_t vfp_expand_imm(int size, uint8_t imm8)static inline long vfp_f16_offset (unsigned reg,bool top) {long offs =vfp_reg_offset (false, reg); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN if (!top) { offs +=2 ; }
target/arm/translate.c +1 -1
@@ -1158,7 +1158,7 @@ long neon_element_offset(int reg, int element, MemOp memop) {int element_size =1 << (memop &MO_SIZE );int ofs = element * element_size; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN /* * Calculate the offset assuming fully little-endian, * then XOR to account for the order of the 8-byte units.
target/hppa/translate.c +1 -1
@@ -566,7 +566,7 @@ static void save_gpr(DisasContext *ctx, unsigned reg, TCGv_reg t) } } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define HI_OFS 0# define LO_OFS 4#else
target/i386/tcg/translate.c +1 -1
@@ -359,7 +359,7 @@ static void gen_update_cc_op(DisasContext *s)#endif /* !TARGET_X86_64 */ -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define REG_B_OFFSET (sizeof(target_ulong) - 1)#define REG_H_OFFSET (sizeof(target_ulong) - 2)#define REG_W_OFFSET (sizeof(target_ulong) - 2)
target/mips/tcg/lmmi_helper.c +1 -1
@@ -37,7 +37,7 @@ typedef union { } LMIValue;/* Some byte ordering issues can be mitigated by XORing in the following. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define BYTE_ORDER_XOR (N ) N#else # define BYTE_ORDER_XOR (N ) 0
target/mips/tcg/msa_helper.c +27 -27
216 lines not on this page · raw message
target/ppc/arch_dump.c +1 -1
@@ -161,7 +161,7 @@ static void ppc_write_elf_vmxregset(NoteFuncArg *arg, PowerPCCPU *cpu)bool needs_byteswap;ppc_avr_t *avr =cpu_avr_ptr (&cpu->env, i); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN needs_byteswap = s->dump_info.d_endian ==ELFDATA2LSB ;#else needs_byteswap = s->dump_info.d_endian ==ELFDATA2MSB ;
target/ppc/int_helper.c +11 -11
@@ -424,7 +424,7 @@ uint64_t helper_PEXTD(uint64_t src, uint64_t mask)/*****************************************************************************/ /* Altivec extension helpers */ -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define VECTOR_FOR_INORDER_I (index, element) \ for (index = 0; index < ARRAY_SIZE(r->element); index++)#else
@@ -1170,7 +1170,7 @@ void helper_vpermr(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, *r = result; } -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define VBPERMQ_INDEX (avr, i) ((avr)->u8[(i)])#define VBPERMD_INDEX (i) (i)#define VBPERMQ_DW (index) (((index) & 0x40) != 0)
@@ -1291,7 +1291,7 @@ void helper_vpmsumd(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) } -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define PKBIG 1#else #define PKBIG 0
@@ -1300,7 +1300,7 @@ void helper_vpkpx(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) {int i, j;ppc_avr_t result; -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN const ppc_avr_t *x[2 ] = { a, b };#else const ppc_avr_t *x[2 ] = { b, a };
@@ -1516,7 +1516,7 @@ void helper_vslo(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) {int sh = (b->VsrB (0xf ) >>3 ) &0xf ; -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN memmove (&r->u8[0 ], &a->u8[sh],16 - sh);memset (&r->u8[16 - sh],0 , sh);#else
@@ -1525,7 +1525,7 @@ void helper_vslo(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)#endif } -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define ELEM_ADDR (VEC ,IDX ,SIZE ) (&(VEC)->u8[IDX])#else #define ELEM_ADDR (VEC ,IDX ,SIZE ) (&(VEC)->u8[15 - (IDX)] - (SIZE) + 1)
@@ -1554,7 +1554,7 @@ VINSX(W, uint32_t) VINSX(D, uint64_t)#undef ELEM_ADDR#undef VINSX -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define VEXTDVLX (NAME ,SIZE ) \ void helper_##NAME(CPUPPCState *env, ppc_avr_t *t, ppc_avr_t *a, ppc_avr_t *b, \ target_ulong index) \
@@ -1593,7 +1593,7 @@ VEXTDVLX(VEXTDUHVLX, 2) VEXTDVLX(VEXTDUWVLX, 4) VEXTDVLX(VEXTDDVLX, 8)#undef VEXTDVLX -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define VEXTRACT (suffix, element) \ void helper_vextract##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t index) \ { \
@@ -1696,7 +1696,7 @@ void helper_vsro(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) {int sh = (b->VsrB (0xf ) >>3 ) &0xf ; -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN memmove (&r->u8[sh], &a->u8[0 ],16 - sh);memset (&r->u8[0 ],0 , sh);#else
@@ -1813,7 +1813,7 @@ void helper_vsum4ubs(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) } } -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define UPKHI 1#define UPKLO 0#else
@@ -1920,7 +1920,7 @@ VGENERIC_DO(popcntd, u64)#undef VGENERIC_DO -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define QW_ONE { .u64 = { 0, 1 } }#else #define QW_ONE { .u64 = { 1, 0 } }
target/ppc/kvm.c +2 -2
@@ -632,7 +632,7 @@ static int kvm_put_fp(CPUState *cs)uint64_t *fpr =cpu_fpr_ptr (&cpu->env, i);uint64_t *vsrl =cpu_vsrl_ptr (&cpu->env, i); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN vsr[0 ] =float64_val (*fpr); vsr[1 ] = *vsrl;#else
@@ -710,7 +710,7 @@ static int kvm_get_fp(CPUState *cs) strerror(errno));return ret; }else { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN *fpr = vsr[0 ];if (vsx) { *vsrl = vsr[1 ];
target/ppc/mem_helper.c +1 -1
@@ -461,7 +461,7 @@ uint32_t helper_stqcx_be_parallel(CPUPPCState *env, target_ulong addr,/*****************************************************************************/ /* Altivec extension helpers */ -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN #define HI_IDX 0#define LO_IDX 1#else
target/riscv/vector_helper.c +1 -1
@@ -79,7 +79,7 @@ target_ulong HELPER(vsetvl)(CPURISCVState *env, target_ulong s1,* Note that vector data is stored in host-endian 64-bit chunks, * so addressing units smaller than that needs a host-endian fixup. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define H1 (x) ((x) ^ 7)#define H1_2 (x) ((x) ^ 6)#define H1_4 (x) ((x) ^ 4)
target/s390x/tcg/translate.c +1 -1
@@ -263,7 +263,7 @@ static inline int vec_reg_offset(uint8_t reg, uint8_t enr, MemOp es)* 16 byte operations to handle it in a special way. */ g_assert (es <=MO_64 ); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN offs ^= (8 - bytes);#endif return offs +vec_full_reg_offset (reg);
target/sparc/vis_helper.c +2 -2
@@ -42,7 +42,7 @@ target_ulong helper_array8(target_ulong pixel_addr, target_ulong cubesize)GET_FIELD_SP (pixel_addr,11 ,12 ); } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN #define VIS_B64 (n) b[7 - (n)]#define VIS_W64 (n) w[3 - (n)]#define VIS_SW64 (n) sw[3 - (n)]
@@ -470,7 +470,7 @@ uint64_t helper_bshuffle(uint64_t gsr, uint64_t src1, uint64_t src2)uint32_t i, mask, host;/* Set up S such that we can index across all of the bytes. */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN s.ll[0 ] = src1; s.ll[1 ] = src2; host =0 ;
tcg/tcg-op.c +2 -2
@@ -1156,7 +1156,7 @@ void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset) {/* Since arg2 and ret have different types, they cannot be the same temporary */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN tcg_gen_ld_i32 (TCGV_HIGH (ret), arg2, offset);tcg_gen_ld_i32 (TCGV_LOW (ret), arg2, offset +4 );#else
@@ -1167,7 +1167,7 @@ void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset)void tcg_gen_st_i64 (TCGv_i64 arg1,TCGv_ptr arg2,tcg_target_long offset) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN tcg_gen_st_i32 (TCGV_HIGH (arg1), arg2, offset);tcg_gen_st_i32 (TCGV_LOW (arg1), arg2, offset +4 );#else
tcg/tcg.c +6 -6
@@ -51,7 +51,7 @@#else # define ELF_CLASS ELFCLASS64#endif -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define ELF_DATA ELFDATA2MSB#else # define ELF_DATA ELFDATA2LSB
@@ -883,7 +883,7 @@ TCGTemp *tcg_global_mem_new_internal(TCGType type, TCGv_ptr base,TCGTemp *base_ts =tcgv_ptr_temp (base);TCGTemp *ts =tcg_global_alloc (s);int indirect_reg =0 , bigendian =0 ; -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN bigendian =1 ;#endif
@@ -1541,7 +1541,7 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args) }#else if (TCG_TARGET_REG_BITS <64 && (typemask &6 ) == dh_typecode_i64) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN op->args[pi++] =temp_arg (ret +1 ); op->args[pi++] =temp_arg (ret);#else
@@ -1594,7 +1594,7 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args)* have to get more complicated to differentiate between * stack arguments and register arguments. */ -#if defined(HOST_WORDS_BIGENDIAN ) != defined(TCG_TARGET_STACK_GROWSUP ) +#if HOST_BIG_ENDIAN != defined(TCG_TARGET_STACK_GROWSUP ) op->args[pi++] =temp_arg (args[i] +1 ); op->args[pi++] =temp_arg (args[i]);#else
@@ -3592,7 +3592,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TCGOp *op)/* fall through */ case TEMP_VAL_MEM : -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN endian_fixup = itype ==TCG_TYPE_I32 ?4 :8 ; endian_fixup -=1 << vece;#else
@@ -3873,7 +3873,7 @@ static bool tcg_reg_alloc_dup2(TCGContext *s, const TCGOp *op)if (!itsh->mem_coherent) {temp_sync (s, itsh, s->reserved_regs,0 ,0 ); } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN TCGTemp *its = itsh;#else TCGTemp *its = itsl;
tests/qtest/vhost-user-blk-test.c +1 -1
@@ -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 */
tests/qtest/virtio-blk-test.c +1 -1
@@ -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 */
ui/vdagent.c +1 -1
@@ -664,7 +664,7 @@ static void vdagent_chr_open(Chardev *chr,VDAgentChardev *vd =QEMU_VDAGENT_CHARDEV (chr);ChardevQemuVDAgent *cfg = backend->u.qemu_vdagent.data; -#if defined(HOST_WORDS_BIGENDIAN ) +#if HOST_BIG_ENDIAN /* * TODO: vdagent protocol is defined to be LE, * so we have to byteswap everything on BE hosts.
ui/vnc.c +1 -1
@@ -2340,7 +2340,7 @@ static void pixel_format_message (VncState *vs) {vnc_write_u8 (vs, vs->client_pf.bits_per_pixel);/* bits-per-pixel */ vnc_write_u8 (vs, vs->client_pf.depth);/* depth */ -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN vnc_write_u8 (vs,1 );/* big-endian-flag */ #else vnc_write_u8 (vs,0 );/* big-endian-flag */
util/bitmap.c +1 -1
@@ -376,7 +376,7 @@ static void bitmap_to_from_le(unsigned long *dst, {long len =BITS_TO_LONGS (nbits); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN long index;for (index =0 ; index < len; index++) {
util/host-utils.c +1 -1
@@ -34,7 +34,7 @@ static inline void mul64(uint64_t *plow, uint64_t *phigh, typedef union { uint64_t ll; struct { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN uint32_t high, low; #else uint32_t low, high;
target/ppc/translate/vmx-impl.c.inc +2 -2
@@ -173,7 +173,7 @@ static void gen_mtvscr(DisasContext *ctx) val = tcg_temp_new_i32(); bofs = avr_full_offset(rB(ctx->opcode)); -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN bofs += 3 * 4; #endif
@@ -1157,7 +1157,7 @@ static void gen_vsplt(DisasContext *ctx, int vece) /* Experimental testing shows that hardware masks the immediate. */ bofs += (uimm << vece) & 15; -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN bofs ^= 15; bofs &= ~((1 << vece) - 1); #endif
target/ppc/translate/vsx-impl.c.inc +1 -1
@@ -1446,7 +1446,7 @@ static bool trans_XXSPLTW(DisasContext *ctx, arg_XX2 *a) tofs = vsr_full_offset(a->xt); bofs = vsr_full_offset(a->xb); bofs += a->uim << MO_32; -#ifndef HOST_WORDS_BIG_ENDIAN +#if !HOST_BIG_ENDIAN bofs ^= 8 | 4; #endif
target/riscv/insn_trans/trans_rvv.c.inc +2 -2
@@ -3288,7 +3288,7 @@ static void load_element(TCGv_i64 dest, TCGv_ptr base, /* offset of the idx element with base regsiter r */ static uint32_t endian_ofs(DisasContext *s, int r, int idx) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN return vreg_ofs(s, r) + ((idx ^ (7 >> s->sew)) << s->sew); #else return vreg_ofs(s, r) + (idx << s->sew);
@@ -3298,7 +3298,7 @@ static uint32_t endian_ofs(DisasContext *s, int r, int idx) /* adjust the index according to the endian */ static void endian_adjust(TCGv_i32 ofs, int sew) { -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN tcg_gen_xori_i32(ofs, ofs, 7 >> sew); #endif }
target/s390x/tcg/translate_vx.c.inc +1 -1
@@ -175,7 +175,7 @@ static void get_vec_element_ptr_i64(TCGv_ptr ptr, uint8_t reg, TCGv_i64 enr, /* convert it to an element offset relative to cpu_env (vec_reg_offset() */ tcg_gen_shli_i64(tmp, tmp, es); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN tcg_gen_xori_i64(tmp, tmp, 8 - NUM_VEC_ELEMENT_BYTES(es)); #endif tcg_gen_addi_i64(tmp, tmp, vec_full_reg_offset(reg));
tcg/aarch64/tcg-target.c.inc +2 -2
@@ -1557,7 +1557,7 @@ static void tcg_out_adr(TCGContext *s, TCGReg rd, const void *target) */ static void * const qemu_ld_helpers[MO_SIZE + 1] = { [MO_8] = helper_ret_ldub_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_16] = helper_be_lduw_mmu, [MO_32] = helper_be_ldul_mmu, [MO_64] = helper_be_ldq_mmu,
@@ -1574,7 +1574,7 @@ static void * const qemu_ld_helpers[MO_SIZE + 1] = { */ static void * const qemu_st_helpers[MO_SIZE + 1] = { [MO_8] = helper_ret_stb_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_16] = helper_be_stw_mmu, [MO_32] = helper_be_stl_mmu, [MO_64] = helper_be_stq_mmu,
tcg/arm/tcg-target.c.inc +2 -2
@@ -1296,7 +1296,7 @@ static void tcg_out_vldst(TCGContext *s, ARMInsn insn, static void * const qemu_ld_helpers[MO_SSIZE + 1] = { [MO_UB] = helper_ret_ldub_mmu, [MO_SB] = helper_ret_ldsb_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_UW] = helper_be_lduw_mmu, [MO_UL] = helper_be_ldul_mmu, [MO_UQ] = helper_be_ldq_mmu,
@@ -1316,7 +1316,7 @@ static void * const qemu_ld_helpers[MO_SSIZE + 1] = { */ static void * const qemu_st_helpers[MO_SIZE + 1] = { [MO_8] = helper_ret_stb_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_16] = helper_be_stw_mmu, [MO_32] = helper_be_stl_mmu, [MO_64] = helper_be_stq_mmu,
tcg/mips/tcg-target.c.inc +1 -1
@@ -26,7 +26,7 @@ #include "../tcg-ldst.c.inc" -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN # define MIPS_BE 1 #else # define MIPS_BE 0
tcg/ppc/tcg-target.c.inc +5 -5
@@ -1864,7 +1864,7 @@ void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_rx, i1 = ADDIS | TAI(TCG_REG_TB, TCG_REG_TB, hi >> 16); i2 = ADDI | TAI(TCG_REG_TB, TCG_REG_TB, lo); } -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN pair = (uint64_t)i1 << 32 | i2; #else pair = (uint64_t)i2 << 32 | i1;
@@ -3232,7 +3232,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, tcg_out_mem_long(s, 0, LVEBX, out, base, offset); } elt = extract32(offset, 0, 4); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN elt ^= 15; #endif tcg_out32(s, VSPLTB | VRT(out) | VRB(out) | (elt << 16));
@@ -3245,7 +3245,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, tcg_out_mem_long(s, 0, LVEHX, out, base, offset); } elt = extract32(offset, 1, 3); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN elt ^= 7; #endif tcg_out32(s, VSPLTH | VRT(out) | VRB(out) | (elt << 16));
@@ -3258,7 +3258,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, tcg_debug_assert((offset & 3) == 0); tcg_out_mem_long(s, 0, LVEWX, out, base, offset); elt = extract32(offset, 2, 2); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN elt ^= 3; #endif tcg_out32(s, VSPLTW | VRT(out) | VRB(out) | (elt << 16));
@@ -3272,7 +3272,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, tcg_out_mem_long(s, 0, LVX, out, base, offset & -16); tcg_out_vsldoi(s, TCG_VEC_TMP1, out, out, 8); elt = extract32(offset, 3, 1); -#ifndef HOST_WORDS_BIGENDIAN +#if !HOST_BIG_ENDIAN elt = !elt; #endif if (elt) {
tcg/riscv/tcg-target.c.inc +2 -2
@@ -854,7 +854,7 @@ static void tcg_out_mb(TCGContext *s, TCGArg a0) static void * const qemu_ld_helpers[MO_SSIZE + 1] = { [MO_UB] = helper_ret_ldub_mmu, [MO_SB] = helper_ret_ldsb_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_UW] = helper_be_lduw_mmu, [MO_SW] = helper_be_ldsw_mmu, [MO_UL] = helper_be_ldul_mmu,
@@ -879,7 +879,7 @@ static void * const qemu_ld_helpers[MO_SSIZE + 1] = { */ static void * const qemu_st_helpers[MO_SIZE + 1] = { [MO_8] = helper_ret_stb_mmu, -#ifdef HOST_WORDS_BIGENDIAN +#if HOST_BIG_ENDIAN [MO_16] = helper_be_stw_mmu, [MO_32] = helper_be_stl_mmu, [MO_64] = helper_be_stq_mmu,
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
Re: [PATCH 06/12] Replace config-time define HOST_WORDS_BIGENDIAN
Quoted 7 lines · On 2/24/22 08:36, [email protected] wrote:
From: Marc-André Lureau<[email protected]>
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.
Quoted 5 lines
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<[email protected]>
Looks ok. I'd like HOST_WORDS_BIGENDIAN to be poisoned, so that we're assured that we've caught all uses and new ones don't creep back in.
r~
Re: [PATCH 06/12] Replace config-time define HOST_WORDS_BIGENDIAN
Hi
Quoted 10 lines · Richard Henderson
Quoted 9 lines · On 2/24/22 08:36, [email protected] wrote:
From: Marc-André Lureau<[email protected]>
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.
Quoted 9 lines
Quoted 3 lines
gcc supports
__BYTE_ORDER__from about 4.6 and clang from 3.2.Signed-off-by Marc-André Lureau<[email protected]>Looks ok. I'd like
HOST_WORDS_BIGENDIANto be poisoned, so that we're assured that we've
caught all uses and new ones don't creep back in.
ack
Signature · 1 line
Marc-André Lureau
PATCH 7/12 Simplify HOST_LONG_BITS
In reply to [email protected]From: Marc-André Lureau <[email protected]>
Simplify the macro, not depending on headers defines, but compiler predefined __SIZEOF__POINTER__ only.
Available since gcc 4.3 and clang 2.8.
--- include/qemu/osdep.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
include/qemu/osdep.h +1 -7
@@ -261,13 +261,7 @@ G_NORETURN extern void QEMU_ERROR("code path is reachable")#endif /* HOST_LONG_BITS is the size of a native pointer in bits. */ -#if UINTPTR_MAX ==UINT32_MAX -# define HOST_LONG_BITS 32 -#elif UINTPTR_MAX ==UINT64_MAX -# define HOST_LONG_BITS 64 -#else -# error Unknown pointer size -#endif +#define HOST_LONG_BITS (__SIZEOF_POINTER__ * 8)/* Mac OSX has a <stdint.h> bug that incorrectly defines SIZE_MAX with * the wrong type. Our replacement isn't usable in preprocessor
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
Re: [PATCH 07/12] Simplify HOST_LONG_BITS
include/qemu/osdep.h G_NORETURN extern void QEMU_ERROR("code path is reachable") · line 264
Quoted 8 lines · On 2/24/22 08:36, [email protected] wrote:
include/qemu/osdep.h +1
-7-#if UINTPTR_MAX ==UINT32_MAX -# define HOST_LONG_BITS 32 -#elif UINTPTR_MAX ==UINT64_MAX -# define HOST_LONG_BITS 64 -#else -# error Unknown pointer size -#endif +#define HOST_LONG_BITS (__SIZEOF_POINTER__ * 8)
I guess. I'll note that there are 128-bit pointers on the horizon, but that UINTPTR_MAX would not necessarily change to match __SIZEOF_POINTER__ [1].
r~
PATCH 8/12 Move HOST_LONG_BITS to compiler.h
In reply to [email protected]From: Marc-André Lureau <[email protected]>
This will help to make common code independent.
--- include/qemu/compiler.h | 3 +++ include/qemu/osdep.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-)
include/qemu/compiler.h +3 -0
@@ -9,6 +9,9 @@#define HOST_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +/* HOST_LONG_BITS is the size of a native pointer in bits. */ +#define HOST_LONG_BITS (__SIZEOF_POINTER__ * 8) +#if defined __clang_analyzer__ || defined __COVERITY__#define QEMU_STATIC_ANALYSIS 1#endif
include/qemu/osdep.h +0 -3
@@ -260,9 +260,6 @@ G_NORETURN extern void QEMU_ERROR("code path is reachable")#define TIME_MAX TYPE_MAXIMUM(time_t)#endif -/* HOST_LONG_BITS is the size of a native pointer in bits. */ -#define HOST_LONG_BITS (__SIZEOF_POINTER__ * 8) -/* Mac OSX has a <stdint.h> bug that incorrectly defines SIZE_MAX with * the wrong type. Our replacement isn't usable in preprocessor * expressions, but it is sufficient for our needs. */
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
Re: [PATCH 08/12] Move HOST_LONG_BITS to compiler.h
Quoted 9 lines · On 2/24/22 08:36, [email protected] wrote:
From: Marc-André Lureau<[email protected]>
This will help to make common code independent.
Signed-off-by Marc-André Lureau<[email protected]>--- include/qemu/compiler.h | 3 +++ include/qemu/osdep.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-)
r~
PATCH 9/12 scripts/modinfo-collect: remove unused/dead code
In reply to [email protected]From: Marc-André Lureau <[email protected]>
--- scripts/modinfo-collect.py | 5 ----- 1 file changed, 5 deletions(-)
scripts/modinfo-collect.py +0 -5
@@ -18,13 +18,8 @@ def find_command(src, target, compile_commands): def process_command(src, command): skip = False - arg = False out = [] for item in shlex.split(command): - if arg: - out.append(x) - arg = False - continue if skip: skip = False continue
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
PATCH 10/12 util: remove needless includes
In reply to [email protected]From: Marc-André Lureau <[email protected]>
--- util/cutils.c | 2 -- 1 file changed, 2 deletions(-)
util/cutils.c +0 -2
@@ -27,8 +27,6 @@#include <math.h> #include "qemu-common.h" -#include "qemu/sockets.h" -#include "qemu/iov.h" #include "net/net.h" #include "qemu/ctype.h" #include "qemu/cutils.h"
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
Re: [PATCH 10/12] util: remove needless includes
Quoted 6 lines · On 2/24/22 08:36, [email protected] wrote:
From: Marc-André Lureau<[email protected]>
Signed-off-by Marc-André Lureau<[email protected]>--- util/cutils.c | 2 -- 1 file changed, 2 deletions(-)
r~
PATCH 11/12 util: remove the net/net.h dependency
In reply to [email protected]From: Marc-André Lureau <[email protected]>
Move qemu_ether_ntoa() which is only needed in net/.
--- include/qemu-common.h | 1 - net/announce.c | 13 +++++++++++++ util/cutils.c | 14 -------------- 3 files changed, 13 insertions(+), 15 deletions(-)
include/qemu-common.h +0 -1
@@ -108,7 +108,6 @@ void qemu_hexdump(FILE *fp, const char *prefix,*/ int parse_debug_env (const char *name,int max,int initial); -const char *qemu_ether_ntoa (const MACAddr *mac);void page_size_init (void );/* returns non-zero if dump is in progress, otherwise zero is
net/announce.c +13 -0
@@ -120,6 +120,19 @@ static int announce_self_create(uint8_t *buf,return 60 ;/* len (FCS will be added by hardware) */ } +/* +* Helper to print ethernet mac address +*/ +static const char *qemu_ether_ntoa (const MACAddr *mac) +{ +static char ret[18 ]; + +snprintf (ret,sizeof (ret),"%02x:%02x:%02x:%02x:%02x:%02x" , + mac->a[0 ], mac->a[1 ], mac->a[2 ], mac->a[3 ], mac->a[4 ], mac->a[5 ]); + +return ret; +} +static void qemu_announce_self_iter (NICState *nic,void *opaque) {AnnounceTimer *timer = opaque;
util/cutils.c +0 -14
@@ -27,7 +27,6 @@#include <math.h> #include "qemu-common.h" -#include "net/net.h" #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/error-report.h"
@@ -936,19 +935,6 @@ int parse_debug_env(const char *name, int max, int initial)return debug; } -/* -* Helper to print ethernet mac address -*/ -const char *qemu_ether_ntoa (const MACAddr *mac) -{ -static char ret[18 ]; - -snprintf (ret,sizeof (ret),"%02x:%02x:%02x:%02x:%02x:%02x" , - mac->a[0 ], mac->a[1 ], mac->a[2 ], mac->a[3 ], mac->a[4 ], mac->a[5 ]); - -return ret; -} -/* * Return human readable string for size @val. * @val can be anything that uint64_t allows (no more than "16 EiB").
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
Re: [PATCH 11/12] util: remove the net/net.h dependency
Quoted 7 lines · On Thu, 24 Feb 2022 at 18:39, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
Move
qemu_ether_ntoa()which is only needed innet/.Signed-off-by Marc-André Lureau <[email protected]>---
thanks
-- PMM
Re: [PATCH 11/12] util: remove the net/net.h dependency
In reply to [email protected]Quoted 10 lines · On 2/24/22 08:37, [email protected] wrote:
From: Marc-André Lureau<[email protected]>
Move
qemu_ether_ntoa()which is only needed innet/.Signed-off-by Marc-André Lureau<[email protected]>--- include/qemu-common.h | 1 - net/announce.c | 13 +++++++++++++ util/cutils.c | 14 -------------- 3 files changed, 13 insertions(+), 15 deletions(-)
r~
PATCH 12/12 qapi: remove needless include
In reply to [email protected]From: Marc-André Lureau <[email protected]>
--- qapi/qmp-dispatch.c | 1 - 1 file changed, 1 deletion(-)
qapi/qmp-dispatch.c +0 -1
@@ -21,7 +21,6 @@#include "qapi/qmp/qjson.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qobject-output-visitor.h" -#include "sysemu/runstate.h" #include "qapi/qmp/qbool.h" #include "qemu/coroutine.h" #include "qemu/main-loop.h"
Signature · 1 line
2.35.1.273.ge6ebfd0e8cbb
Re: [PATCH 12/12] qapi: remove needless include
Quoted 6 lines · On 2/24/22 08:37, [email protected] wrote:
From: Marc-André Lureau<[email protected]>
Signed-off-by Marc-André Lureau<[email protected]>--- qapi/qmp-dispatch.c | 1 - 1 file changed, 1 deletion(-)
r~