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

Re: [PATCH] Use mingw.h declarations for gmtime_r/localtime_r on msys2

From
Mike Hommey <mh@glandium.org>
Date
Nov 19, 2021, 07:23 UTC
Message-ID
<20211119072357.oxl5caye742blz5j@glandium.org>
In-Reply-To
<CAPUEspjZmwoOWSJHBrykOfNEv=zLi2nQLs1EkUPTPr-nSNf08Q@mail.gmail.com>
On Thu, Nov 18, 2021 at 09:38:00PM -0800, Carlo Arenas wrote:
Show 9 quoted lines
> On Thu, Nov 18, 2021 at 1:05 AM Mike Hommey <mh@glandium.org> wrote:
> > Oh my bad, I overlooked an important part of the build log: it was a
> > mingw32 build, not minwg64. Mingw64 builds fine without
> > -D_POSIX_THREAD_SAFE_FUNCTIONS=200112L. Mingw32 requires it (because
> > the ifdefs are for mingw64)
> 
> Can you confirm the version of the winpthread library in your SDK? and
> output of your headers, or something that could back up that statement
> of "ifdefs are for mingw64"?.

The ifdef around gmtime_r and localtime_r in mingw.h is for __MINGW64_VERSION_MAJOR. The ifdef around _POSIX_C_SOURCE in git-compat-util.h is for __MINGW64__. I'd imagine that plays a role.

winpthreads version on my system is 9.0.0.6246.ae63cde27-1.
The /mingw32/i686-w64-mingw32/include/time.h section related to gtime_r
and localtime_r starts with:
```
#if defined(_POSIX_C_SOURCE) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS)
#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
#endif
#ifdef _POSIX_THREAD_SAFE_FUNCTIONS
__forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) {
  return localtime_s(_Tm, _Time) ? NULL : _Tm;
}
__forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) {
  return gmtime_s(_Tm, _Time) ? NULL : _Tm;
}
```
Mike
Previous: Carlo ArenasNext: Carlo Arenas
Message 10 of 11 in “Use mingw.h declarations for gmtime_r/localtime_r on msys2”
  1. Use mingw.h declarations for gmtime_r/localtime_r on msys2Mike Hommey, Oct 5, 2021
  2. Carlo ArenasOct 5, 2021
  3. Mike HommeyOct 5, 2021
  4. Mike HommeyNov 18, 2021
  5. Carlo ArenasNov 18, 2021
  6. Mike HommeyNov 18, 2021
  7. Carlo ArenasNov 18, 2021
  8. Mike HommeyNov 18, 2021
  9. Carlo ArenasNov 19, 2021
  10. Mike HommeyNov 19, 2021
  11. Carlo ArenasNov 19, 2021

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.