Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
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))
Date: Tue, 24 Apr 2012 17:58:00 -0000	[thread overview]
Message-ID: <m31undrp8d.fsf@redhat.com> (raw)
In-Reply-To: <m3ty0at632.fsf@redhat.com>

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  <sergiodj@redhat.com>

	* 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<<EOF >>${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 <<EOF >>${otmp}
+  notify (${notify_args});
 }
 
 struct observer *


  parent reply	other threads:[~2012-04-24 17:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23 23:05 [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag) Sergio Durigan Junior
2012-04-24  3:33 ` Doug Evans
2012-04-24 18:02   ` Sergio Durigan Junior
2012-04-24 12:16 ` Pedro Alves
2012-04-24 17:38   ` Jan Kratochvil
2012-04-24 17:42   ` Tom Tromey
2012-04-24 17:51     ` Pedro Alves
2012-05-02  5:30       ` Sergio Durigan Junior
2012-05-02  6:17         ` Michael Eager
2012-05-02 10:55         ` Pedro Alves
2012-05-18 18:46           ` Sergio Durigan Junior
2012-05-18 19:13             ` Tom Tromey
2012-05-18 21:05               ` Sergio Durigan Junior
2012-04-24 17:53     ` Sergio Durigan Junior
2012-04-24 20:07       ` Tom Tromey
2012-04-24 18:10   ` Sergio Durigan Junior
2012-04-24 17:49 ` Tom Tromey
2012-04-24 18:11   ` Doug Evans
2012-04-24 20:30     ` Joel Brobecker
2012-04-24 17:58 ` Sergio Durigan Junior [this message]
2012-04-24 17:59   ` [PATCH] Refactor observer.sh to cleanup unused vars Tom Tromey
2012-04-24 18:11     ` Sergio Durigan Junior
2012-04-24 18:04   ` Pedro Alves
2012-05-14 11:37   ` [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) Jan Kratochvil

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=m31undrp8d.fsf@redhat.com \
    --to=sergiodj@redhat.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