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