From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9079 invoked by alias); 17 Feb 2009 21:48:34 -0000 Received: (qmail 9066 invoked by uid 22791); 17 Feb 2009 21:48:32 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Feb 2009 21:48:26 +0000 Received: from wpaz13.hot.corp.google.com (wpaz13.hot.corp.google.com [172.24.198.77]) by smtp-out.google.com with ESMTP id n1HLmOQA018943; Tue, 17 Feb 2009 13:48:24 -0800 Received: from rv-out-0506.google.com (rvbf6.prod.google.com [10.140.82.6]) by wpaz13.hot.corp.google.com with ESMTP id n1HLmMhD022136; Tue, 17 Feb 2009 13:48:22 -0800 Received: by rv-out-0506.google.com with SMTP id f6so2568407rvb.51 for ; Tue, 17 Feb 2009 13:48:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.53.19 with SMTP id b19mr3168614wfa.154.1234907301954; Tue, 17 Feb 2009 13:48:21 -0800 (PST) In-Reply-To: <004301c97a33$0fa174d0$2ee45e70$@u-strasbg.fr> References: <004301c97a33$0fa174d0$2ee45e70$@u-strasbg.fr> Date: Tue, 17 Feb 2009 21:48:00 -0000 Message-ID: Subject: Re: [Build failure] tm struct tm_gmtoff field build error From: Cary Coutant To: Pierre Muller Cc: nickc@redhat.com, binutils@sourceware.org, gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-02/txt/msg00127.txt.bz2 > Trying to compile a "--enable-targets=all" GDB > on current cvs HEAD on cygwin, > I found a new error in src/bfd: > libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../purecvs/bfd -I. -I. > -I../../p > urecvs/bfd -I../../purecvs/bfd/../include -W -Wall -Wstrict-prototypes > -Wmissing > -prototypes -Werror -g -O2 -c ../../purecvs/bfd/vmsutil.c -o vmsutil.o > ../../purecvs/bfd/vmsutil.c: In function `vms_file_stats_name': > ../../purecvs/bfd/vmsutil.c:249: error: structure has no member named > `tm_gmtoff' Nick's follow-up patch on 1/21 still didn't fix the compilation problems. The non-VMS code in this routine seems a bit confused: struct stat buff; struct tm *ts; if ((stat (filename, &buff)) != 0) return 1; if (cdt) { ts = localtime (&buff.st_mtime); *cdt = (long long) ((buff.st_mtim.tv_sec * VMS_GRANULARITY_FACTOR) + (buff.st_mtim.tv_nsec / 100)) + VMS_EPOCH_OFFSET; } The call to localtime was apparently there originally to get the tm_gmtoff value -- after the 1/21 patch, the variable ts is not used. On top of that, st_mtime is misspelled twice, and, when spelled correctly, isn't a struct timeval, so it doesn't have tv_sec and tv_nsec fields. This appears to be an attempt to get sub-second granularity, but as far as I know, the stat() call does not provide it. I propose the following patch, but since I'm not sure what the code is really meant to be doing, I don't consider it obvious. -cary * vmsutil.c (vms_file_stats_name): Fix incorrect use of st_mtime in struct stat. Index: vmsutil.c =================================================================== RCS file: /cvs/src/src/bfd/vmsutil.c,v retrieving revision 1.2 diff -u -p -r1.2 vmsutil.c --- vmsutil.c 21 Jan 2009 11:58:05 -0000 1.2 +++ vmsutil.c 17 Feb 2009 21:32:30 -0000 @@ -237,16 +237,13 @@ vms_file_stats_name (const char *filenam return 0; #else struct stat buff; - struct tm *ts; if ((stat (filename, &buff)) != 0) return 1; if (cdt) { - ts = localtime (&buff.st_mtime); - *cdt = (long long) ((buff.st_mtim.tv_sec * VMS_GRANULARITY_FACTOR) - + (buff.st_mtim.tv_nsec / 100)) + *cdt = (long long) (buff.st_mtime * VMS_GRANULARITY_FACTOR) + VMS_EPOCH_OFFSET; }