|
|
00db10 |
commit 12da14a59135fe331f294b91488c1bdf55b35b4e
|
|
|
00db10 |
Author: Joseph Myers <joseph@codesourcery.com>
|
|
|
00db10 |
Date: Wed Nov 26 12:54:39 2014 +0000
|
|
|
00db10 |
|
|
|
00db10 |
Fix warnings in fwscanf / rewind tests.
|
|
|
00db10 |
|
|
|
00db10 |
This patch fixes "set but not used" warnings in the tests
|
|
|
00db10 |
libio/bug-rewind.c and libio/bug-rewind2.c by checking the return
|
|
|
00db10 |
values from fwscanf and making the tests fail if those values aren't
|
|
|
00db10 |
as expected.
|
|
|
00db10 |
|
|
|
00db10 |
Tested for x86_64.
|
|
|
00db10 |
|
|
|
00db10 |
* libio/bug-rewind.c (do_test): Check fwscanf return values.
|
|
|
00db10 |
* libio/bug-rewind2.c (do_test): Likewise.
|
|
|
00db10 |
|
|
|
00db10 |
diff --git a/libio/bug-rewind.c b/libio/bug-rewind.c
|
|
|
00db10 |
index 4f8242df3d6d1f75..1734de285f30fff4 100644
|
|
|
00db10 |
--- a/libio/bug-rewind.c
|
|
|
00db10 |
+++ b/libio/bug-rewind.c
|
|
|
00db10 |
@@ -52,9 +52,19 @@ do_test (void)
|
|
|
00db10 |
|
|
|
00db10 |
rewind (fptr);
|
|
|
00db10 |
ret1 = fwscanf (fptr, L"%c%c", &arg1, &arg2);
|
|
|
00db10 |
+ if (ret1 != 2)
|
|
|
00db10 |
+ {
|
|
|
00db10 |
+ printf ("first fwscanf returned %d, expected 2\n", ret1);
|
|
|
00db10 |
+ return 3;
|
|
|
00db10 |
+ }
|
|
|
00db10 |
|
|
|
00db10 |
rewind (fptr);
|
|
|
00db10 |
ret2 = fwscanf (fptr, L"%c%n%c", &arg1, &num, &arg2);
|
|
|
00db10 |
+ if (ret2 != 2)
|
|
|
00db10 |
+ {
|
|
|
00db10 |
+ printf ("second fwscanf returned %d, expected 2\n", ret2);
|
|
|
00db10 |
+ return 4;
|
|
|
00db10 |
+ }
|
|
|
00db10 |
|
|
|
00db10 |
if (arg2 != 'd')
|
|
|
00db10 |
{
|
|
|
00db10 |
diff --git a/libio/bug-rewind2.c b/libio/bug-rewind2.c
|
|
|
00db10 |
index 51b574433029f835..496f628675b36fcc 100644
|
|
|
00db10 |
--- a/libio/bug-rewind2.c
|
|
|
00db10 |
+++ b/libio/bug-rewind2.c
|
|
|
00db10 |
@@ -45,6 +45,11 @@ do_test (void)
|
|
|
00db10 |
|
|
|
00db10 |
rewind (fp);
|
|
|
00db10 |
ret = fwscanf (fp, L"%c", dummy);
|
|
|
00db10 |
+ if (ret != 1)
|
|
|
00db10 |
+ {
|
|
|
00db10 |
+ printf ("fwscanf returned %d, expected 1\n", ret);
|
|
|
00db10 |
+ result = 1;
|
|
|
00db10 |
+ }
|
|
|
00db10 |
|
|
|
00db10 |
printf ("current pos = %ld\n", ftell (fp));
|
|
|
00db10 |
if (ftell (fp) != 1)
|