This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Turn -Wempty-body on in gdbserver?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]