From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 932 invoked by alias); 1 Feb 2013 21:54:41 -0000 Received: (qmail 918 invoked by uid 22791); 1 Feb 2013 21:54:39 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,KHOP_SPAMHAUS_DROP,KHOP_THREADED,MISSING_HEADERS,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from na3sys009aog111.obsmtp.com (HELO na3sys009aog111.obsmtp.com) (74.125.149.205) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Feb 2013 21:54:33 +0000 Received: from mx20.qnx.com ([72.1.200.103]) (using TLSv1) by na3sys009aob111.postini.com ([74.125.148.12]) with SMTP ID DSNKUQw5mXZySSmD6ekumL7g0JGFCkCm2j/t@postini.com; Fri, 01 Feb 2013 13:54:33 PST Received: by mx20.qnx.com (Postfix, from userid 500) id C7E0821114; Fri, 1 Feb 2013 16:54:32 -0500 (EST) Received: from exhts.ott.qnx.com (exch2 [10.222.2.136]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mx20.qnx.com (Postfix) with ESMTPS id 8CF9321108 for ; Fri, 1 Feb 2013 16:54:32 -0500 (EST) Received: from [10.222.96.215] (10.222.2.5) by exch2.ott.qnx.com (10.222.2.136) with Microsoft SMTP Server id 14.2.318.4; Fri, 1 Feb 2013 16:54:32 -0500 Message-ID: <510C3998.5050309@qnx.com> Date: Fri, 01 Feb 2013 21:54:00 -0000 From: Aleksandar Ristovski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 CC: "gdb-patches@sourceware.org" Subject: Re: [patch] cleanup: Wunused corefile.c References: <510AC74E.1010709@qnx.com> <87vcad5cf1.fsf@fleche.redhat.com> <510AD43E.3040405@qnx.com> <87boc34z0o.fsf@fleche.redhat.com> <510C3418.4040802@qnx.com> In-Reply-To: <510C3418.4040802@qnx.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-02/txt/msg00040.txt.bz2 On 13-02-01 04:31 PM, Aleksandar Ristovski wrote: > On 13-02-01 02:25 PM, Tom Tromey wrote: >> >> I understand, but I think the hard part of this work is also the most >> useful part. What I mean is that it is certainly valuable to get all >> the simple cases fixed; but going through the trickier cases and writing >> proper fixes is the real benefit of enabling this warning -- finding and >> fixing real bugs. Making these warnings disappear is contrary to that. >> > > I agree and I don't agree. I'm not shy from hard work, but I simply have > limited time resources for contributing back to FSF. > > I really believe making warnings disappear and turning on Wunused by > default would make a big difference worth "obscuring" a bug or two (they > are already obscure as we are not aware of them). Once Wunused is on by > default, there will not be creeping in of unused stuff any more. > > > But here is revised patch for corefile.c. Not that it represents any > hard work or anything, but since I was at... > > > Thanks, > > Aleksandar Ristovski > QNX Software Systems > > > > ChangeLog: > Aleksandar Ristovski > > * corefile.c (reopen_exec_file): Check return value from stat. > Sorry it should have been errno for strerror not res: Index: gdb/corefile.c =================================================================== RCS file: /cvs/src/src/gdb/corefile.c,v retrieving revision 1.71 diff -u -p -r1.71 corefile.c --- gdb/corefile.c 14 Jan 2013 21:03:54 -0000 1.71 +++ gdb/corefile.c 1 Feb 2013 21:48:42 -0000 @@ -149,7 +149,11 @@ reopen_exec_file (void) cleanups = make_cleanup (xfree, filename); res = stat (filename, &st); - if (exec_bfd_mtime && exec_bfd_mtime != st.st_mtime) + if (res != 0 && info_verbose) + warning (_("File %s could not be stat-ed (%s)\n"), filename, + strerror (errno)); + + if (res == 0 && exec_bfd_mtime && exec_bfd_mtime != st.st_mtime) exec_file_attach (filename, 0); else /* If we accessed the file since last opening it, close it now;