Re: definition for _attribute() in remote.c
- From
Philip Oakley <philipoakley@iee.org>
- Date
- Apr 25, 2016, 21:34 UTC
- Message-ID
- <F23050BD4C62408D97A64B1D885007A8@PhilipOakley>
- In-Reply-To
- <20160425211030.GA10309@sigill.intra.peff.net>
From: "Jeff King" <peff@peff.net>
Show 32 quoted lines
> On Mon, Apr 25, 2016 at 10:02:38PM +0100, Philip Oakley wrote: > >> I'm looking at getting Git for Windows to compile via Visual Studio >> (https://github.com/git-for-windows/git/pull/256). >> >> However the use of __attribute() in remote.c at L1662 >> (https://github.com/git-for-windows/git/blob/master/remote.c#L1662) has >> got >> me confused in that I can't see how the regular definition of >> __attribute() >> is #included in this case. A definition is given in >> git\compat\regex\regex_internal.h but doesn't appear to be on remote.c's >> include path. >> >> The line was introduced by 3a429d0 (remote.c: report specific errors from >> branch_get_upstream, 2015-05-21) which appears to be later than the >> previous >> MSVC testers had looked at. > > It should be handled in git-compat-util.h, which is included by cache.h, > which is included by remote.c. > > There we have: > > #ifndef __GNUC__ > #ifndef __attribute__ > #define __attribute__(x) > #endif > #endif > > which should make it a noop on compilers which don't know about it. Is > VS (or another file) setting __GNUC__?
It's not the __attribute__ definition (a Gnu C ism), rather its the __attribute variant, which has a definition in regex_internal.h, and is used in the regex code. It's that one that's used in remote.c that I can't fathom (i.e. how it worked in normally)
regex_internal.h#L160-164 #ifdef __GNUC__ # define __attribute(arg) __attribute__ (arg) #else # define __attribute(arg) #endif
thus when the compilation get to remote.c#L1662 it fails to find that definition.
Should that line use the gnu extension name?
-- Philip