* [PATCH] iproute2: fix build failure on sparc due to -Wformat and tv_usec
@ 2013-05-18 16:18 Andreas Henriksson
2013-06-04 2:58 ` Stephen Hemminger
2013-06-25 20:37 ` Stephen Hemminger
0 siblings, 2 replies; 3+ messages in thread
From: Andreas Henriksson @ 2013-05-18 16:18 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
tv_usec is "suseconds_t" which is apparently usually
a signed long, but sometimes not....
Change the printf modifier to use signed and
cast the tv_usec to long in case it's not already long.
gcc -Wall -Wstrict-prototypes -Werror -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -O2 -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE -fPIC -c -o utils.o utils.c
utils.c: In function 'print_timestamp':
utils.c:802:2: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type '__suseconds_t' [-Werror=format]
cc1: all warnings being treated as errors
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
lib/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/utils.c b/lib/utils.c
index bcd6002..dae1b51 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -799,7 +799,7 @@ int print_timestamp(FILE *fp)
tstr = asctime(localtime(&tv.tv_sec));
tstr[strlen(tstr)-1] = 0;
- fprintf(fp, "Timestamp: %s %lu usec\n", tstr, tv.tv_usec);
+ fprintf(fp, "Timestamp: %s %ld usec\n", tstr, (long)tv.tv_usec);
return 0;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iproute2: fix build failure on sparc due to -Wformat and tv_usec
2013-05-18 16:18 [PATCH] iproute2: fix build failure on sparc due to -Wformat and tv_usec Andreas Henriksson
@ 2013-06-04 2:58 ` Stephen Hemminger
2013-06-25 20:37 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2013-06-04 2:58 UTC (permalink / raw)
To: Andreas Henriksson; +Cc: netdev
On Sat, 18 May 2013 18:18:51 +0200
Andreas Henriksson <andreas@fatal.se> wrote:
> tv_usec is "suseconds_t" which is apparently usually
> a signed long, but sometimes not....
> Change the printf modifier to use signed and
> cast the tv_usec to long in case it's not already long.
>
> gcc -Wall -Wstrict-prototypes -Werror -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -O2 -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE -fPIC -c -o utils.o utils.c
> utils.c: In function 'print_timestamp':
> utils.c:802:2: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type '__suseconds_t' [-Werror=format]
> cc1: all warnings being treated as errors
>
> Signed-off-by: Andreas Henriksson <andreas@fatal.se>
>
Applied, seems like a wierd Sparc/Solaris legacy issue.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iproute2: fix build failure on sparc due to -Wformat and tv_usec
2013-05-18 16:18 [PATCH] iproute2: fix build failure on sparc due to -Wformat and tv_usec Andreas Henriksson
2013-06-04 2:58 ` Stephen Hemminger
@ 2013-06-25 20:37 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2013-06-25 20:37 UTC (permalink / raw)
To: Andreas Henriksson; +Cc: netdev
On Sat, 18 May 2013 18:18:51 +0200
Andreas Henriksson <andreas@fatal.se> wrote:
> tv_usec is "suseconds_t" which is apparently usually
> a signed long, but sometimes not....
> Change the printf modifier to use signed and
> cast the tv_usec to long in case it's not already long.
>
> gcc -Wall -Wstrict-prototypes -Werror -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -O2 -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE -fPIC -c -o utils.o utils.c
> utils.c: In function 'print_timestamp':
> utils.c:802:2: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type '__suseconds_t' [-Werror=format]
> cc1: all warnings being treated as errors
>
> Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Sure applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-25 20:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-18 16:18 [PATCH] iproute2: fix build failure on sparc due to -Wformat and tv_usec Andreas Henriksson
2013-06-04 2:58 ` Stephen Hemminger
2013-06-25 20:37 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).