Re: [PATCH] git-compat-util: Avoid strcasecmp() being inlined
- From
Jeff King <peff@peff.net>
- Date
- Sep 11, 2013, 21:41 UTC
- Message-ID
- <20130911214116.GA12235@sigill.intra.peff.net>
- In-Reply-To
- <CAHGBnuN0pSmX7_mM6xpRqpF4qPVbP7oBK416NrTVM7tu=DZTjg@mail.gmail.com>
On Wed, Sep 11, 2013 at 09:59:53PM +0200, Sebastian Schuberth wrote:
Show 20 quoted lines
> On Wed, Sep 11, 2013 at 8:29 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>
> >> This is necessary so that read_mailmap() can obtain a pointer to the
> >> function.
> >
> > Hm, what platform has strcasecmp() as an inline function? Is this
> > allowed by POSIX? Even if it isn't, should we perhaps just work
> > around it by providing our own thin static function wrapper in
> > mailmap.c?
>
> I'm on Windows using MSYS / MinGW. Since MinGW runtime version 4.0,
> string.h contains the following code (see [1]):
>
> #ifndef __NO_INLINE__
> __CRT_INLINE int __cdecl __MINGW_NOTHROW
> strncasecmp (const char * __sz1, const char * __sz2, size_t __sizeMaxCompare)
> {return _strnicmp (__sz1, __sz2, __sizeMaxCompare);}
> #else
> #define strncasecmp _strnicmp
> #endifWhat is the error the compiler reports? Can it take the address of other inline functions? For example, can it compile:
inline int foo(void) { return 5; }
extern int bar(int (*cb)(void));
int call(void) { return bar(foo); }Just wondering if that is the root of the problem, or if maybe there is something else subtle going on. Also, does __CRT_INLINE just turn into "inline", or is there perhaps some other pre-processor magic going on?
-Peff