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