Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Turn -Wempty-body on in gdbserver?
@ 2012-11-26 11:03 Yao Qi
  2012-11-26 11:41 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: Yao Qi @ 2012-11-26 11:03 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Turn -Wempty-body on in gdbserver?
  2012-11-26 11:03 [PATCH] Turn -Wempty-body on in gdbserver? Yao Qi
@ 2012-11-26 11:41 ` Pedro Alves
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2012-11-26 11:41 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On 11/26/2012 11:02 AM, Yao Qi wrote:
> 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?

OK.  Thanks.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-26 11:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-26 11:03 [PATCH] Turn -Wempty-body on in gdbserver? Yao Qi
2012-11-26 11:41 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox