From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19785 invoked by alias); 26 Nov 2012 11:03:40 -0000 Received: (qmail 19769 invoked by uid 22791); 26 Nov 2012 11:03:38 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 26 Nov 2012 11:03:30 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1TcwTJ-0004pC-Oe from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Mon, 26 Nov 2012 03:03:29 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 26 Nov 2012 03:03:29 -0800 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.1.289.1; Mon, 26 Nov 2012 03:03:26 -0800 From: Yao Qi To: Subject: [PATCH] Turn -Wempty-body on in gdbserver? Date: Mon, 26 Nov 2012 11:03:00 -0000 Message-ID: <1353927773-24944-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-11/txt/msg00646.txt.bz2 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 . 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 * 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