public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Fix nss/tst-nss-test1.c format warning
@ 2014-11-26 22:47 Joseph Myers
  2014-11-27  0:45 ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2014-11-26 22:47 UTC (permalink / raw)
  To: libc-alpha

Testing for 32-bit x86 shows up a warning "tst-nss-test1.c:25:3:
warning: format '%ju' expects argument of type 'uintmax_t', but
argument 2 has type 'int' [-Wformat=]".  The argument is a difference
of two pointers, a signed quantity of type ptrdiff_t for which the
right format is %td; this patch makes this test use that format.

Tested for 32-bit x86.

2014-11-26  Joseph Myers  <joseph@codesourcery.com>

	* nss/tst-nss-test1.c (do_test): Use %td printf format for pointer
	difference, not %ju.

diff --git a/nss/tst-nss-test1.c b/nss/tst-nss-test1.c
index 4e443d4..c5750e0 100644
--- a/nss/tst-nss-test1.c
+++ b/nss/tst-nss-test1.c
@@ -21,7 +21,7 @@ do_test (void)
     if (p->pw_uid != *np || strncmp (p->pw_name, "name", 4) != 0
 	|| atol (p->pw_name + 4) != *np)
       {
-	printf ("passwd entry %ju wrong (%s, %u)\n",
+	printf ("passwd entry %td wrong (%s, %u)\n",
 		np - pwdids, p->pw_name, p->pw_uid);
 	retval = 1;
 	break;

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix nss/tst-nss-test1.c format warning
  2014-11-26 22:47 Fix nss/tst-nss-test1.c format warning Joseph Myers
@ 2014-11-27  0:45 ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2014-11-27  0:45 UTC (permalink / raw)
  To: Joseph Myers, libc-alpha

This looks good as well.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-27  0:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26 22:47 Fix nss/tst-nss-test1.c format warning Joseph Myers
2014-11-27  0:45 ` Paul Eggert

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).