]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb.base/fileio.c: Fix several -Wmaybe-uninitialized warnings
authorPedro Alves <palves@redhat.com>
Thu, 18 May 2017 10:40:08 +0000 (11:40 +0100)
committerPedro Alves <palves@redhat.com>
Thu, 18 May 2017 11:56:38 +0000 (12:56 +0100)
 src/gdb/testsuite/gdb.base/fileio.c: In function ‘test_write’:
 src/gdb/testsuite/gdb.base/fileio.c:158:5: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      printf ("write 1: ret = %d, errno = %d\n", ret, errno);
      ^

gdb/ChangeLog:
2017-05-18  Pedro Alves  <palves@redhat.com>

* gdb.base/fileio.c (test_write, test_read, test_close)
(test_fstat): Don't print 'ret' in the fail path.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/fileio.c

index 428056ea851848d5fd16bedc7381308daa256280..c127f1adc5e6ca8dfd2b507d55ce34cc4b55c37f 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-18  Pedro Alves  <palves@redhat.com>
+
+       * gdb.base/fileio.c (test_write, test_read, test_close)
+       (test_fstat): Don't print 'ret' in the fail path.
+
 2017-05-18  Pedro Alves  <palves@redhat.com>
 
        * gdb.base/fileio.c (stop, test_open, test_write, test_read)
index 415f2d0c1b7905adce88dfd32838d7ca227a4e2d..7f482a34d39af89d559ed74008d381d691d46c2c 100644 (file)
@@ -157,7 +157,7 @@ test_write (void)
       close (fd);
     }
   else
-    printf ("write 1: ret = %d, errno = %d\n", ret, errno);
+    printf ("write 1: errno = %d\n", errno);
   stop ();
   /* Write using invalid file descriptor */
   errno = 0;
@@ -177,7 +177,7 @@ test_write (void)
       close (fd);
     }
   else
-    printf ("write 3: ret = %d, errno = %d\n", ret, errno);
+    printf ("write 3: errno = %d\n", errno);
   stop ();
 }
 
@@ -203,7 +203,7 @@ test_read (void)
       close (fd);
     }
   else
-    printf ("read 1: ret = %d, errno = %d\n", ret, errno);
+    printf ("read 1: errno = %d\n", errno);
   stop ();
   /* Read using invalid file descriptor */
   errno = 0;
@@ -271,7 +271,7 @@ test_close (void)
               ret == 0 ? "OK" : "");
     }
   else
-    printf ("close 1: ret = %d, errno = %d\n", ret, errno);
+    printf ("close 1: errno = %d\n", errno);
   stop ();
   /* Close an invalid file descriptor */
   errno = 0;
@@ -337,7 +337,7 @@ test_fstat (void)
       close (fd);
     }
   else
-    printf ("fstat 1: ret = %d, errno = %d\n", ret, errno);
+    printf ("fstat 1: errno = %d\n", errno);
   stop ();
   /* Fstat using invalid file descriptor */
   errno = 0;