Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/3] gdb.base/fileio.c: Fix several -Wmaybe-uninitialized warnings
Date: Thu, 18 May 2017 11:09:00 -0000	[thread overview]
Message-ID: <1495105747-21675-3-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <9eedfbd7-9f36-2fe4-7a13-00e0b2261629@redhat.com>

 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/gdb.base/fileio.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
index 415f2d0..7f482a3 100644
--- a/gdb/testsuite/gdb.base/fileio.c
+++ b/gdb/testsuite/gdb.base/fileio.c
@@ -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;
-- 
2.5.5


  parent reply	other threads:[~2017-05-18 11:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17 13:46 [PATCH OBV] Add nowarnings in gdb.base/fileio.exp Yao Qi
2017-05-17 14:17 ` Pedro Alves
2017-05-18  8:34   ` Yao Qi
2017-05-18 11:06     ` Pedro Alves
2017-05-18 11:09       ` [PATCH 2/3] gdb.base/fileio.c: Fix several -Wreturn-type warnings Pedro Alves
2017-05-18 11:09       ` [PATCH 1/3] gdb.base/fileio.exp: Remove nowarnings Pedro Alves
2017-05-18 11:09       ` Pedro Alves [this message]
2017-05-18 11:30       ` [PATCH OBV] Add nowarnings in gdb.base/fileio.exp Yao Qi
2017-05-18 11:51         ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495105747-21675-3-git-send-email-palves@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox