Re: [PATCH] lib: x86: Use portable format macros for uint32_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24/11/2022 13.31, Like Xu wrote:
From: Like Xu <likexu@xxxxxxxxxxx>

Compilation of the files fails on ARCH=i386 with i686-elf gcc on macos_i386
because they use "%d" format specifier that does not match the actual size of
uint32_t:

In function 'rdpmc':
lib/libcflat.h:141:24: error: format '%d' expects argument of type 'int',
but argument 6 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
   141 |                 printf("%s:%d: assert failed: %s: " fmt "\n",           \
       |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use PRId32 instead of "d" to take into account macos_i386 case.

Reported-by: Thomas Huth <thuth@xxxxxxxxxx>
Signed-off-by: Like Xu <likexu@xxxxxxxxxxx>
---
Nit, tested on macOS 13.0.1 only instead of cirrus-ci-macos-i386.

Thanks, this fixed the cirrus-ci job, indeed, too:

https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/jobs/3379034443

 Thomas





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux