S390: Get rid of
diff mbox

Message ID m6ep46$p04$2@ger.gmane.org
State New
Headers show

Commit Message

Stefan Liebler Dec. 12, 2014, 1:04 p.m. UTC
Hi,

on 31bit s390 i get the following warning/error:
tst-widetext.c: In function ‘do_test’:
tst-widetext.c:295:5: error: format ‘%Zd’ expects argument of type 
‘signed size_t’, but argument 3 has type ‘int’ [-Werror=format=]
      __LINE__, wcp - wc2buf, wcsize);
      ^

This patch adds a cast to ssize_t in order to disable the warning.

Ok to commit?

Bye
Stefan

---
2014-12-12  Stefan Liebler  <stli@linux.vnet.ibm.com>

	* libio/tst-widetext.c (do_test):
	Cast argument to ssize_t to disable format warning.

Comments

Roland McGrath Dec. 12, 2014, 9:10 p.m. UTC | #1
I think %td is the right format for ptrdiff_t.

Patch
diff mbox

diff --git a/libio/tst-widetext.c b/libio/tst-widetext.c
index acab72b..a591159 100644
--- a/libio/tst-widetext.c
+++ b/libio/tst-widetext.c
@@ -292,7 +292,7 @@  do_test (void)
       if (fgetws (wcp, &wc2buf[wcsize] - wcp + 1, fp) == NULL)
 	{
 	  printf ("%u: short read using fgetws (only %Zd of %Zd)\n",
-		  __LINE__, wcp - wc2buf, wcsize);
+		  __LINE__, (ssize_t) (wcp - wc2buf), wcsize);
 	  status = 1;
 	  break;
 	}