git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-compat-util: Avoid strcasecmp() being inlined

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Sep 12, 2013, 09:36 UTC
Message-ID
<CAHGBnuP3iX9pqm5kK9_WjAXr5moDuJ1jxtUkXwKEt2jjLTcLkQ@mail.gmail.com>
In-Reply-To
<20130911214116.GA12235@sigill.intra.peff.net>
On Wed, Sep 11, 2013 at 11:41 PM, Jeff King <peff@peff.net> wrote:
Show 12 quoted lines
>> 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
>> #endif
>
> What is the error the compiler reports? Can it take the address of other
The error message of GCC 4.8.1 is:
    LINK git-credential-store.exe
libgit.a(mailmap.o): In function `read_mailmap':
C:\mingwGitDevEnv\git/mailmap.c:238: undefined reference to `strcasecmp'
collect2.exe: error: ld returned 1 exit status
make: *** [git-credential-store.exe] Error 1
So it's a linker error, not a compiler error.
Show 5 quoted lines
> 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); }
I had to modify the example slightly to:

inline int foo(void) { return 5; } extern int bar(int (*cb)(void)) { return cb(); } int main(void) { return bar(foo); }

And this compiles.
> 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?
This is the function definition from string.h after preprocessing:
extern __inline__ int __attribute__((__cdecl__)) __attribute__ ((__nothrow__))
strncasecmp (const char * __sz1, const char * __sz2, size_t __sizeMaxCompare)
  {return _strnicmp (__sz1, __sz2, __sizeMaxCompare);}
-- 
Sebastian Schuberth
Previous: Jeff KingNext: John Keeping
Message 7 of 48 in “git-compat-util: Avoid strcasecmp() being inlined”
  1. git-compat-util: Avoid strcasecmp() being inlinedSebastian Schuberth, Sep 11, 2013
  2. Jonathan NiederSep 11, 2013
  3. Jeff KingSep 11, 2013
  4. Piotr KrukowieckiSep 19, 2013
  5. Sebastian SchuberthSep 11, 2013
  6. Jeff KingSep 11, 2013
  7. Sebastian SchuberthSep 12, 2013
  8. John KeepingSep 12, 2013
  9. Junio C HamanoSep 12, 2013
  10. Jeff KingSep 12, 2013
  11. Junio C HamanoSep 12, 2013
  12. Jonathan NiederSep 12, 2013
  13. Sebastian SchuberthSep 12, 2013
  14. Junio C HamanoSep 12, 2013
  15. Sebastian SchuberthSep 13, 2013
  16. Junio C HamanoSep 13, 2013
  17. Sebastian SchuberthSep 13, 2013
  18. Jonathan NiederSep 12, 2013
  19. Jeff KingSep 12, 2013
  20. Sebastian SchuberthSep 12, 2013
  21. Jeff KingSep 12, 2013
  22. Junio C HamanoSep 12, 2013
  23. Sebastian SchuberthSep 13, 2013
  24. Junio C HamanoSep 13, 2013
  25. Sebastian SchuberthSep 13, 2013
  26. Linus TorvaldsSep 13, 2013
  27. Sebastian SchuberthSep 13, 2013
  28. Junio C HamanoSep 13, 2013
  29. Sebastian SchuberthSep 13, 2013
  30. Junio C HamanoSep 13, 2013
  31. Junio C HamanoSep 13, 2013
  32. Sebastian SchuberthSep 15, 2013
  33. Junio C HamanoSep 17, 2013
  34. Sebastian SchuberthSep 17, 2013
  35. Junio C HamanoSep 17, 2013
  36. Sebastian SchuberthSep 18, 2013
  37. Linus TorvaldsSep 18, 2013
  38. Jonathan NiederSep 12, 2013
  39. Sebastian SchuberthSep 19, 2013
  40. Junio C HamanoSep 11, 2013
  41. Piotr KrukowieckiSep 19, 2013
  42. Jeff KingSep 19, 2013
  43. Junio C HamanoSep 19, 2013
  44. Jeff KingSep 19, 2013
  45. Junio C HamanoSep 19, 2013
  46. Jeff KingSep 20, 2013
  47. Piotr KrukowieckiSep 20, 2013
  48. Jeff KingSep 24, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.