From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25660 invoked by alias); 21 Feb 2005 22:02:49 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 25583 invoked from network); 21 Feb 2005 22:02:45 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 21 Feb 2005 22:02:45 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j1LM2job007279 for ; Mon, 21 Feb 2005 17:02:45 -0500 Received: from zenia.home.redhat.com (sebastian-int.corp.redhat.com [172.16.52.221]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j1LM2hK01394; Mon, 21 Feb 2005 17:02:44 -0500 To: gdb-patches@sources.redhat.com Subject: obvious: don't declare unused variable unless it's needed From: Jim Blandy Date: Tue, 22 Feb 2005 04:43:00 -0000 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-02/txt/msg00232.txt.bz2 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 * 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. */