Re: [PATCH] Create USE_ST_TIMESPEC and turn it on for Darwin
- From
Brian Gernhardt <benji@silverinsanity.com>
- Date
- Mar 8, 2009, 21:21 UTC
- Message-ID
- <70A401B0-C10D-4B4D-9DCC-D0968CE5EAF7@silverinsanity.com>
- In-Reply-To
- <7vhc23kaay.fsf@gitster.siamese.dyndns.org>
On Mar 8, 2009, at 4:51 PM, Junio C Hamano wrote:
Show 15 quoted lines
> I think this patch moves things in the right direction, but there are > other uses of "st_[cm]tim.tv_nsec" that do not use the > ST_[CM]TIME_NSEC > macro. > > $ git grep -n -e 'st_[cm]tim\.' --cached -- '*.[ch]' > builtin-fetch-pack.c:810: || st.st_mtim.tv_nsec != mtime.nsec > git-compat-util.h:396:#define ST_CTIME_NSEC(st) ((unsigned int) > ((st).st_ctim.tv_nsec)) > git-compat-util.h:397:#define ST_MTIME_NSEC(st) ((unsigned int) > ((st).st_mtim.tv_nsec)) > read-cache.c:207: if (ce->ce_mtime.nsec != (unsigned int)st- > >st_mtim.tv_nsec) > read-cache.c:209: if (trust_ctime && ce->ce_ctime.nsec != (unsigned > int)st->st_ctim.tv_nsec)
Interesting. I couldn't use git-grep due to other problems, but thought any other tim/timespec issues would have stopped my compilation. Looking at the code, this is because everything other than the #defines in git-compat-util.h are surrounded by USE_NSEC which is not defined on my machine.
However, I noticed another breakage entirely. Namely, that USE_NSEC is not defined anywhere. There's a comment in the Makefile that says "define USE_NSEC below", but there is no code that checks for USE_NSEC and sets the appropriate compiler switch. Trivial patch to follow.
> Probably we should apply the following patch as a fix, and then > apply your > enhancement to support st_[cm]timespec systems?
Your patch looks sane to me.
~~ Brian