Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* obvious: don't declare unused variable unless it's needed
@ 2005-02-22  4:43 Jim Blandy
  0 siblings, 0 replies; only message in thread
From: Jim Blandy @ 2005-02-22  4:43 UTC (permalink / raw)
  To: gdb-patches


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.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-02-21 22:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-22  4:43 obvious: don't declare unused variable unless it's needed Jim Blandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox