Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH] Turn -Wempty-body on in gdbserver?
Date: Mon, 26 Nov 2012 11:03:00 -0000	[thread overview]
Message-ID: <1353927773-24944-1-git-send-email-yao@codesourcery.com> (raw)

Hello,
When compile gdbserver with clang, I get the following warning,

 gdb/gdbserver/linux-low.c:662:28: error: if statement has empty body [-Werror,-Wempty-body]
            /* Errors ignored.  */;
                                  ^
and this reminds me that we turned '-Wempty-body' on in gdb by this
patch <http://sourceware.org/ml/gdb-patches/2012-10/msg00349.html>.
It is also justified to do the same in gdbserver.

Rebuild gdbserver for i686-pc-linux-gnu, arm-linux-gnueabi,
tic6x-uclinux, misp-linux-gnu and mingw32.  Is it OK?

gdb/gdbserver:

2012-11-26  Yao Qi  <yao@codesourcery.com>

	* configure.ac (build_warnings): Append '-Wempty-body'.
	* configure: Regenerated.
	* linux-low.c (linux_create_inferior): Use braces for empty 'if'
	body.
---
 gdb/gdbserver/configure    |    2 +-
 gdb/gdbserver/configure.ac |    2 +-
 gdb/gdbserver/linux-low.c  |    4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index b451a22..02d45da 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -4569,7 +4569,7 @@ if test "${ERROR_ON_WARNING}" = yes ; then
 fi
 
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
--Wformat-nonliteral -Wno-char-subscripts"
+-Wformat-nonliteral -Wno-char-subscripts -Wempty-body"
 
 WARN_CFLAGS=""
 if test "x$GCC" = xyes
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 46f5dc0..36ed82f 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -126,7 +126,7 @@ if test "${ERROR_ON_WARNING}" = yes ; then
 fi
 
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
--Wformat-nonliteral -Wno-char-subscripts"
+-Wformat-nonliteral -Wno-char-subscripts -Wempty-body"
 
 WARN_CFLAGS=""
 if test "x$GCC" = xyes
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 2de46d2..c697f6b 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -659,7 +659,9 @@ linux_create_inferior (char *program, char **allargs)
 	  dup2 (2, 1);
 	  if (write (2, "stdin/stdout redirected\n",
 		     sizeof ("stdin/stdout redirected\n") - 1) < 0)
-	    /* Errors ignored.  */;
+	    {
+	      /* Errors ignored.  */;
+	    }
 	}
 
       execv (program, allargs);
-- 
1.7.7.6


             reply	other threads:[~2012-11-26 11:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-26 11:03 Yao Qi [this message]
2012-11-26 11:41 ` 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=1353927773-24944-1-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.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