From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1167 invoked by alias); 24 Apr 2012 17:53:24 -0000 Received: (qmail 1156 invoked by uid 22791); 24 Apr 2012 17:53:23 -0000 X-SWARE-Spam-Status: No, hits=-7.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Apr 2012 17:53:11 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3OHrAMi012098 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 24 Apr 2012 13:53:10 -0400 Received: from psique (ovpn-112-42.phx2.redhat.com [10.3.112.42]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3OHr7Eg012179 for ; Tue, 24 Apr 2012 13:53:09 -0400 From: Sergio Durigan Junior To: gdb-patches@sourceware.org Subject: [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) References: X-URL: http://www.redhat.com Date: Tue, 24 Apr 2012 17:58:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-04/txt/msg00814.txt.bz2 Hi, As requested by Pedro, this is the change to `observer.sh' made to cleanup the unused variable `args'. I noticed that the variable is only used as an argument for calling `notify', and in some cases `notify' doesn't take arguments, thus leading to an unused `args' hanging around. This patch removes it by conditionally declaring the variable. OK to apply? -- Sergio 2012-04-24 Sergio Durigan Junior * observer.sh: Conditionally declare `args', thus cleaning up unused cases. diff --git a/gdb/observer.sh b/gdb/observer.sh index b5c49ac..2ff8b64 100755 --- a/gdb/observer.sh +++ b/gdb/observer.sh @@ -136,8 +136,17 @@ static void observer_${event}_notification_stub (const void *data, const void *args_data) { observer_${event}_ftype *notify = (observer_${event}_ftype *) data; +EOF + + notify_args=`echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args->\1/g'` + + if test ! -z ${notify_args}; then + cat<>${otmp} const struct ${event}_args *args = args_data; - notify (`echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args->\1/g'`); +EOF + fi + cat <>${otmp} + notify (${notify_args}); } struct observer *