Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: Tom Tromey <tromey@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)
Date: Wed, 02 May 2012 10:55:00 -0000	[thread overview]
Message-ID: <4FA11295.6050103@redhat.com> (raw)
In-Reply-To: <m3lilbywt7.fsf@redhat.com>

On 05/02/2012 06:30 AM, Sergio Durigan Junior wrote:

> Ok, sorry for taking so long to respond, this patch is huge and I was
> doing something else...
> 
> Well, here's the "obvious" patch that I came up with.  It contains only
> declarations of variables, not assignments to them.


No it doesn't.  ;-)

> 
> I know it's "obvious", but I prefer to ask than to apologize, so: is it
> OK to apply?
> 
> Of course, if you really want some rationale to the changes below, I
> will need to dive into the code and see why those variables are not
> used.
> 
> OK to apply?


> index aedda41..a7b67c5 100644
> --- a/gdb/gcore.c
> +++ b/gdb/gcore.c
> @@ -472,13 +472,12 @@ objfile_find_memory_regions (find_memory_region_ftype func, void *obfd)
>    /* Call callback function for each objfile section.  */
>    ALL_OBJSECTIONS (objfile, objsec)
>      {
> -      bfd *ibfd = objfile->obfd;
>        asection *isec = objsec->the_bfd_section;
> -      flagword flags = bfd_get_section_flags (ibfd, isec);
> +      flagword flags = bfd_get_section_flags (objfile->obfd, isec);
>
>        if ((flags & SEC_ALLOC) || (flags & SEC_LOAD))
>  	{
> -	  int size = bfd_section_size (ibfd, isec);
> +	  int size = bfd_section_size (objfile->obfd, isec);
>  	  int ret;
>
>  	  ret = (*func) (obj_section_addr (objsec), size,

As I've pointed out before, this needs a rationale.  (IMO, we should fix
the macro).  Several other places in the patch do this.

On 05/02/2012 06:30 AM, Sergio Durigan Junior wrote:
> @@ -238,8 +237,12 @@ m32r_supply_register (struct regcache *regcache, char *regname,
>        monitor_supply_register (regcache, regno, val);
>        if (regno == PSW_REGNUM)
>  	{
> +#if defined SM_REGNUM || defined BSM_REGNUM || defined IE_REGNUM \
> +    || defined BIE_REGNUM || defined COND_REGNUM  || defined CBR_REGNUM \
> +    || defined BPC_REGNUM || defined BCARRY_REGNUM
>  	  unsigned long psw = strtoul (val, NULL, 16);
>  	  char *zero = "00000000", *one = "00000001";
> +#endif

This doesn't fit in the category, but okay.  :-)

Could you wrap the multiline predicate in parenthesis though, please?

#if (defined SM_REGNUM || defined BSM_REGNUM || defined IE_REGNUM \
    || defined ...)


The rest looked good to me.

-- 
Pedro Alves


  parent reply	other threads:[~2012-05-02 10:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23 23:05 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 [this message]
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 ` [PATCH] Refactor observer.sh to cleanup unused vars (was: [RFC/PATCH] Clean up unused variables (and prepare for `-Wunused-variable' flag)) Sergio Durigan Junior
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=4FA11295.6050103@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    --cc=tromey@redhat.com \
    /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