[ofa-general] [PATCH] infiniband-diags: eliminate compiler warnings

Jack Morgenstein jackm at dev.mellanox.co.il
Wed Sep 24 06:59:23 PDT 2008


infiniband: eliminate compiler warnings on x86_64

The printf's below generated warnings of the form:
warning: format '%lu' expects type 'long unsigned int', but argument 4 has type 'long long unsigned int'
on 64-bit systems -- due to the influence of the <>ull constants. Casting solves this.

Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>
---

Please fix for upcoming OFED 1.4 release candidate.

Index: infiniband-diags/src/ibping.c
===================================================================
--- infiniband-diags.orig/src/ibping.c	2008-09-21 17:09:26.000000000 +0300
+++ infiniband-diags/src/ibping.c	2008-09-24 16:38:16.000000000 +0300
@@ -174,7 +174,7 @@ report(int sig)
 	printf("\n--- %s (%s) ibping statistics ---\n", last_host, portid2str(&portid));
 	printf("%" PRIu64 " packets transmitted, %" PRIu64 " received, %" PRIu64 "%% packet loss, time %" PRIu64 " ms\n",
 		ntrans, replied,
-		(lost != 0) ?  lost * 100ull / ntrans : 0ull, total_time / 1000ull);
+		(uint64_t) ((lost != 0) ?  lost * 100ull / ntrans : 0ull), (uint64_t) (total_time / 1000ull));
 	printf("rtt min/avg/max = %" PRIu64 ".%03" PRIu64 "/%" PRIu64 ".%03" PRIu64 "/%" PRIu64 ".%03" PRIu64 " ms\n",
 		minrtt == ~0ull ? 0 : minrtt/1000,
 		minrtt == ~0ull ? 0 : minrtt%1000,



More information about the general mailing list