This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

obvious: don't declare unused variable unless it's needed


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]