pktgen: sprintf arg type warning
Subsystems (2)
PATCH 1/1 pktgen: sprintf arg type warning
Fix sprintf arg type error (gcc 3.3.3), although it looks more like a gcc problem than a kernel source code problem to me. Doesn't matter on x86-32. Fixes a warning on x86-64.
net/core/pktgen.c:607: warning: long long unsigned int format, long unsigned int arg (arg 4)
diffstat:=
net/core/pktgen.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
net/core/pktgen.c renamed from net/core/pktgen.c~pktgen_type +1 -1
@@ -603,7 +603,7 @@ static void show_results(struct pktgen_ido_div (idle, cpu_speed); p +=sprintf (p,"OK: %llu(c%llu+d%lu) usec, %llu (%dbyte,%dfrags)\n" , - total, total - idle, idle, + total, total - (__u64 )idle, idle, info->sofar, size, nr_frags); pps = info->sofar *USEC_PER_SEC ;
--
~Randy
David S. Miller
maintainerQuoted 6 lines · On Fri, 8 Oct 2004 20:30:27 -0700 "Randy.Dunlap" <[email protected]> wrote:
Fix sprintf arg type error (gcc 3.3.3), although it looks more like a gcc problem than a kernel source code problem to me. Doesn't matter on x86-32. Fixes a warning on x86-64.
net/core/pktgen.c:607: warning: long long unsigned int format, long unsigned int arg (arg 4)
This won't fix the problem on sparc64 where u64 is an "unsigned long" So, just cast the thing to the type gcc wants "unsigned long long"
Quoted 8 lines · David S. Miller
Quoted 4 lines · On Fri, 8 Oct 2004 20:30:27 -0700 "Randy.Dunlap" <[email protected]> wrote:
Fix sprintf arg type error (gcc 3.3.3), although it looks more like a gcc problem than a kernel source code problem to me. Doesn't matter on x86-32. Fixes a warning on x86-64.
Quoted 6 lines
Quoted 1 line
net/core/pktgen.c:607: warning: long long unsigned int format, long unsigned int arg (arg 4)This won't fix the problem on sparc64 where u64 is an "unsigned long" So, just cast the thing to the type gcc wants "unsigned long long"
Other systems have addressed this problem by extending printf with portable %formats.
Sam
Quoted 2 lines
Other systems have addressed this problem by extending printf with portable %formats.
Problem is that gcc -Wformat doesn't know the new format codes, and in Linux we still have to support old gcc versions.
Standard trick is to cast to long.
-Andi
Quoted 5 lines · Andi Kleen
Quoted 1 line
Other systems have addressed this problem by extending printf with portable %formats.
Problem is that gcc -Wformat doesn't know the new format codes, and in Linux we still have to support old gcc versions.
Yes, gcc has been modified to understand the new %formats. That's the advantage to distributing a full system and not just a kernel :)
Quoted 6 lines
Standard trick is to cast to long.
-Andi
PATCH 1/1 pktgen: sprintf arg type warning
In reply to David S. MillerQuoted 2 lines
This won't fix the problem on sparc64 where u64 is an "unsigned long" So, just cast the thing to the type gcc wants "unsigned long long"
Yep, I should have known that. New patch attached.
(Note: testing new mail client; hopefully it's not munged.)
Signature · 1 line
~Randy
Fix printk arg format warning:net/core/pktgen.c:607: warning: long long unsigned int format, long unsigned int arg (arg 4)
diffstat:=
net/core/pktgen.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
net/core/pktgen.c renamed from net/core/pktgen.c~pktgen_type +1 -1
@@ -603,7 +603,7 @@ static void show_results(struct pktgen_ido_div (idle, cpu_speed); p +=sprintf (p,"OK: %llu(c%llu+d%lu) usec, %llu (%dbyte,%dfrags)\n" , - total, total - idle, idle, + total, (unsigned long long )(total - idle), idle, info->sofar, size, nr_frags); pps = info->sofar *USEC_PER_SEC ;