mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 14:50:05 +00:00
Fix warnings in fwscanf / rewind tests.
This patch fixes "set but not used" warnings in the tests libio/bug-rewind.c and libio/bug-rewind2.c by checking the return values from fwscanf and making the tests fail if those values aren't as expected. Tested for x86_64. * libio/bug-rewind.c (do_test): Check fwscanf return values. * libio/bug-rewind2.c (do_test): Likewise.
This commit is contained in:
parent
bd5dadac87
commit
12da14a591
@ -1,5 +1,8 @@
|
|||||||
2014-11-26 Joseph Myers <joseph@codesourcery.com>
|
2014-11-26 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* libio/bug-rewind.c (do_test): Check fwscanf return values.
|
||||||
|
* libio/bug-rewind2.c (do_test): Likewise.
|
||||||
|
|
||||||
* debug/test-stpcpy_chk-ifunc.c: Remove file.
|
* debug/test-stpcpy_chk-ifunc.c: Remove file.
|
||||||
* debug/test-strcpy_chk-ifunc.c: Likewise.
|
* debug/test-strcpy_chk-ifunc.c: Likewise.
|
||||||
* wcsmbs/test-wcschr-ifunc.c: Likewise.
|
* wcsmbs/test-wcschr-ifunc.c: Likewise.
|
||||||
|
@ -52,9 +52,19 @@ do_test (void)
|
|||||||
|
|
||||||
rewind (fptr);
|
rewind (fptr);
|
||||||
ret1 = fwscanf (fptr, L"%c%c", &arg1, &arg2);
|
ret1 = fwscanf (fptr, L"%c%c", &arg1, &arg2);
|
||||||
|
if (ret1 != 2)
|
||||||
|
{
|
||||||
|
printf ("first fwscanf returned %d, expected 2\n", ret1);
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
rewind (fptr);
|
rewind (fptr);
|
||||||
ret2 = fwscanf (fptr, L"%c%n%c", &arg1, &num, &arg2);
|
ret2 = fwscanf (fptr, L"%c%n%c", &arg1, &num, &arg2);
|
||||||
|
if (ret2 != 2)
|
||||||
|
{
|
||||||
|
printf ("second fwscanf returned %d, expected 2\n", ret2);
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
if (arg2 != 'd')
|
if (arg2 != 'd')
|
||||||
{
|
{
|
||||||
|
@ -45,6 +45,11 @@ do_test (void)
|
|||||||
|
|
||||||
rewind (fp);
|
rewind (fp);
|
||||||
ret = fwscanf (fp, L"%c", dummy);
|
ret = fwscanf (fp, L"%c", dummy);
|
||||||
|
if (ret != 1)
|
||||||
|
{
|
||||||
|
printf ("fwscanf returned %d, expected 1\n", ret);
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
|
||||||
printf ("current pos = %ld\n", ftell (fp));
|
printf ("current pos = %ld\n", ftell (fp));
|
||||||
if (ftell (fp) != 1)
|
if (ftell (fp) != 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user