From: "H.J. Lu" <hjl.tools@gmail.com>
To: GNU C Library <libc-alpha@sourceware.org>
Subject: [committed, PATCH] Replace %ld with %jd and cast to intmax_t
Date: Sat, 11 Jul 2015 20:46:00 -0000 [thread overview]
Message-ID: <20150711204630.GA20185@gmail.com> (raw)
On x32, GCC 5.1 complains:
tst-fmemopen2.c: In function âdo_test_without_bufferâ:
tst-fmemopen2.c:124:15: error: format â%ldâ expects argument of type âlong intâ, but argument 2 has type âoff_t {aka long long int}â [-Werror=format=]
printf ("FAIL: first ftello returned %ld, expected %zu\n", o, nstr);
^
tst-fmemopen2.c:135:15: error: format â%ldâ expects argument of type âlong intâ, but argument 2 has type âoff_t {aka long long int}â [-Werror=format=]
printf ("FAIL: second ftello returned %ld, expected %zu\n", o, nbuf);
^
tst-fmemopen2.c:148:15: error: format â%ldâ expects argument of type âlong intâ, but argument 2 has type âoff_t {aka long long int}â [-Werror=format=]
printf ("FAIL: third ftello returned %ld, expected %zu\n", o, nstr2);
^
tst-fmemopen2.c: In function âdo_test_length_zeroâ:
tst-fmemopen2.c:183:15: error: format â%ldâ expects argument of type âlong intâ, but argument 2 has type âoff_t {aka long long int}â [-Werror=format=]
printf ("FAIL: first ftello returned %ld, expected 0\n", o);
^
This patch silences GCC.
* stdio-common/tst-fmemopen2.c (do_test_without_buffer): Replace
%ld with %jd and cast to intmax_t.
(do_test_length_zero): Likewise.
---
ChangeLog | 6 ++++++
stdio-common/tst-fmemopen2.c | 12 ++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b6e7a79..84f038c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-07-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * stdio-common/tst-fmemopen2.c (do_test_without_buffer): Replace
+ %ld with %jd and cast to intmax_t.
+ (do_test_length_zero): Likewise.
+
2015-07-10 Roland McGrath <roland@hack.frob.com>
* sysdeps/nacl/pthread_condattr_setclock.c: New file.
diff --git a/stdio-common/tst-fmemopen2.c b/stdio-common/tst-fmemopen2.c
index 2f26f20..16dd3ad 100644
--- a/stdio-common/tst-fmemopen2.c
+++ b/stdio-common/tst-fmemopen2.c
@@ -121,7 +121,8 @@ do_test_without_buffer (void)
off_t o = ftello (fp);
if (o != nstr)
{
- printf ("FAIL: first ftello returned %ld, expected %zu\n", o, nstr);
+ printf ("FAIL: first ftello returned %jd, expected %zu\n",
+ (intmax_t) o, nstr);
result = 1;
}
if (fseeko (fp, 0, SEEK_END) != 0)
@@ -132,7 +133,8 @@ do_test_without_buffer (void)
o = ftello (fp);
if (o != nstr)
{
- printf ("FAIL: second ftello returned %ld, expected %zu\n", o, nbuf);
+ printf ("FAIL: second ftello returned %jd, expected %zu\n",
+ (intmax_t) o, nbuf);
result = 1;
}
@@ -145,7 +147,8 @@ do_test_without_buffer (void)
o = ftello (fp);
if (o != nstr2)
{
- printf ("FAIL: third ftello returned %ld, expected %zu\n", o, nstr2);
+ printf ("FAIL: third ftello returned %jd, expected %zu\n",
+ (intmax_t) o, nstr2);
result = 1;
}
fclose (fp);
@@ -180,7 +183,8 @@ do_test_length_zero (void)
off_t o = ftello (fp);
if (o != 0)
{
- printf ("FAIL: first ftello returned %ld, expected 0\n", o);
+ printf ("FAIL: first ftello returned %jd, expected 0\n",
+ (intmax_t) o);
result = 1;
}
fclose (fp);
--
2.4.3
reply other threads:[~2015-07-11 20:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150711204630.GA20185@gmail.com \
--to=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).