diff mbox series

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

Message ID 20220726173756.108816-1-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] x86: smp: fix 32-bit build | expand

Commit Message

Paolo Bonzini July 26, 2022, 5:37 p.m. UTC
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@redhat.com>
---
 lib/x86/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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. */