Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: obvious: don't declare unused variable unless it's needed
Date: Tue, 22 Feb 2005 04:43:00 -0000	[thread overview]
Message-ID: <vt23bvph8rw.fsf@zenia.home> (raw)


This avoids some warnings, allowing us to compile with -Werror.

Also note that compiler probably can't optimize out the declaration
even though the variable is unused, since its initializer contains a
call through a function pointer, which it must assume could have side
effects.

Committed as obvious.

2005-02-21  Jim Blandy  <jimb@redhat.com>

	* callback.c (os_fstat): Don't declare 't' unless it's used.

Index: sim/common/callback.c
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/common/callback.c,v
retrieving revision 1.34
diff -c -p -r1.34 callback.c
*** sim/common/callback.c	21 Feb 2005 09:12:38 -0000	1.34
--- sim/common/callback.c	21 Feb 2005 21:55:30 -0000
*************** os_fstat (p, fd, buf)
*** 534,540 ****
--- 534,542 ----
  
    if (p->ispipe[fd])
      {
+ #if defined (HAVE_STRUCT_STAT_ST_ATIME) || defined (HAVE_STRUCT_STAT_ST_CTIME) || defined (HAVE_STRUCT_STAT_ST_MTIME)
        time_t t = (*p->time) (p, NULL);
+ #endif
  
        /* We have to fake the struct stat contents, since the pipe is
  	 made up in the simulator.  */


                 reply	other threads:[~2005-02-21 22:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=vt23bvph8rw.fsf@zenia.home \
    --to=jimb@redhat.com \
    --cc=gdb-patches@sources.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