[PATCH kvm-unit-tests] x86: smp: fix 32-bit build

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

 



On macOS the 32-bit build gives the following warning:

lib/x86/smp.c:89:29: error: format '%d' expects argument of type 'int', but argument 2 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
   89 |         printf("setup: CPU %d online\n", apic_id());
      |                            ~^            ~~~~~~~~~
      |                             |            |
      |                             int          uint32_t {aka long unsigned int}
      |                            %ld

Fix by using the inttypes.h printf formats.

Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 lib/x86/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/x86/smp.c b/lib/x86/smp.c
index feaab7a..b9b91c7 100644
--- a/lib/x86/smp.c
+++ b/lib/x86/smp.c
@@ -86,7 +86,7 @@ void ap_online(void)
 {
 	irq_enable();
 
-	printf("setup: CPU %d online\n", apic_id());
+	printf("setup: CPU %" PRId32 " online\n", apic_id());
 	atomic_inc(&cpu_online_count);
 
 	/* Only the BSP runs the test's main(), APs are given work via IPIs. */
-- 
2.36.1




[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