Re: [PATCH 10/27] Replace config-time define HOST_WORDS_BIGENDIAN

Philippe Mathieu-Daudé
2022-03-16T13:12:02Z

On 16/3/22 14:04, Philippe Mathieu-Daudé wrote:
> On 16/3/22 10:53, marcandre.lureau@redhat.com wrote:
>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> Replace a config-time define with a compile time condition
>> define (compatible with clang and gcc) that must be declared prior to
>> its usage. This avoids having a global configure time define, but also
>> prevents from bad usage, if the config header wasn't included before.
>>
>> This can help to make some code independent from qemu too.
>>
>> gcc supports __BYTE_ORDER__ from about 4.6 and clang from 3.2.
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> ---
>>   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(-)
>>
>> diff --git a/meson.build b/meson.build
>> index f20712cb93d7..88df1bc42973 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -1591,7 +1591,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')
>
> Can we poison HOST_WORDS_BIGENDIAN definition to force cleaning old
> patches before merging them?

Now noticed elsewhere a patch #11 doing exactly that.

Addressing Halil comment in "exec/cpu-all.h":
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>