[kvm-unit-tests PATCH] x86/pmu: Fix compilation on macOS

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

 



From: Thomas Huth <thuth@xxxxxxxxxx>

Compiling for i686 on macOS in the CI currently fails with:

.../cirrus-ci-build/x86/pmu.c: In function 'main':
.../cirrus-ci-build/x86/pmu.c:1012:41: error: format '%x' expects argument of
 type 'unsigned int', but argument 2 has type 'u32' {aka 'long unsigned int'}
 [-Werror=format=]
 1012 |     printf("Arch Events (mask):  0x%x\n", pmu.arch_event_available);
      |                                    ~^     ~~~~~~~~~~~~~~~~~~~~~~~~
      |                                     |        |
      |                                     |        u32 {aka long unsigned int}
      |                                     unsigned int
      |                                    %lx

Use the correct format string for u32 to fix this issue.

Fixes: 92dc5f7a ("x86/pmu: Mark Intel architectural event available [...]")
Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>
---
 x86/pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x86/pmu.c b/x86/pmu.c
index a6b0cfcc..f932ccab 100644
--- a/x86/pmu.c
+++ b/x86/pmu.c
@@ -1009,7 +1009,7 @@ int main(int ac, char **av)
 	printf("GP counters:         %d\n", pmu.nr_gp_counters);
 	printf("GP counter width:    %d\n", pmu.gp_counter_width);
 	printf("Event Mask length:   %d\n", pmu.arch_event_mask_length);
-	printf("Arch Events (mask):  0x%x\n", pmu.arch_event_available);
+	printf("Arch Events (mask):  0x%" PRIx32 "\n", pmu.arch_event_available);
 	printf("Fixed counters:      %d\n", pmu.nr_fixed_counters);
 	printf("Fixed counter width: %d\n", pmu.fixed_counter_width);
 
-- 
2.50.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