* [PATCH v2] Doc: networking: txtimestamp: fix printf format warning
@ 2015-06-04 19:27 Frans Klaver
2015-06-04 23:04 ` Jonathan Corbet
0 siblings, 1 reply; 2+ messages in thread
From: Frans Klaver @ 2015-06-04 19:27 UTC (permalink / raw)
To: Jonathan Corbet; +Cc: linux-doc, linux-kernel, Richard Cochran, Frans Klaver
Documentation/networking/timestamping/txtimestamp.c: In function ‘__print_timestamp’:
Documentation/networking/timestamping/txtimestamp.c:99:3: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int64_t’ [-Wformat=]
fprintf(stderr, " (%+ld us)", cur_ms - prev_ms);
int64_t differs per platform, so a type specifier that differs along
with it is required.
Signed-off-by: Frans Klaver <fransklaver@gmail.com>
---
v1..v2: switch from cast to inttypes.h defined PRId64
Documentation/networking/timestamping/txtimestamp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/networking/timestamping/txtimestamp.c b/Documentation/networking/timestamping/txtimestamp.c
index 8217510..5df0704 100644
--- a/Documentation/networking/timestamping/txtimestamp.c
+++ b/Documentation/networking/timestamping/txtimestamp.c
@@ -36,6 +36,7 @@
#include <asm/types.h>
#include <error.h>
#include <errno.h>
+#include <inttypes.h>
#include <linux/errqueue.h>
#include <linux/if_ether.h>
#include <linux/net_tstamp.h>
@@ -49,7 +50,6 @@
#include <poll.h>
#include <stdarg.h>
#include <stdbool.h>
-#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -96,7 +96,7 @@ static void __print_timestamp(const char *name, struct timespec *cur,
prev_ms = (long) ts_prev.tv_sec * 1000 * 1000;
prev_ms += ts_prev.tv_nsec / 1000;
- fprintf(stderr, " (%+ld us)", cur_ms - prev_ms);
+ fprintf(stderr, " (%+" PRId64 " us)", cur_ms - prev_ms);
}
ts_prev = *cur;
--
2.4.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] Doc: networking: txtimestamp: fix printf format warning
2015-06-04 19:27 [PATCH v2] Doc: networking: txtimestamp: fix printf format warning Frans Klaver
@ 2015-06-04 23:04 ` Jonathan Corbet
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Corbet @ 2015-06-04 23:04 UTC (permalink / raw)
To: Frans Klaver; +Cc: linux-doc, linux-kernel, Richard Cochran
On Thu, 4 Jun 2015 21:27:38 +0200
Frans Klaver <fransklaver@gmail.com> wrote:
> Documentation/networking/timestamping/txtimestamp.c: In function ‘__print_timestamp’:
> Documentation/networking/timestamping/txtimestamp.c:99:3: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int64_t’ [-Wformat=]
> fprintf(stderr, " (%+ld us)", cur_ms - prev_ms);
>
> int64_t differs per platform, so a type specifier that differs along
> with it is required.
OK, I've applied this to the docs tree.
Thanks,
jon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-04 23:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-04 19:27 [PATCH v2] Doc: networking: txtimestamp: fix printf format warning Frans Klaver
2015-06-04 23:04 ` Jonathan Corbet
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).