-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mingw: avoid fallback for {local,gm}time_r() #3398
Conversation
mingw-w64's pthread_unistd.h had a bug that mistakenly (because there is no support for the *lockfile() functions required[1]) defined _POSIX_THREAD_SAFE_FUNCTIONS and that was being worked around since 3ecd153 (compat/mingw: support MSys2-based MinGW build, 2016-01-14). the bug was fixed in winphtreads, but as a sideeffect, leaves the reentrant functions from time.h not longer visible and therefore breaks the build. since the intention all along was to avoid using the fallback functions, formalize the use of POSIX by setting the corresponding feature flag and to make the intention clearer compile out the fallback functions. [1] https://unix.org/whitepapers/reentrant.html Signed-off-by: Carlo Marcelo Arenas Belón <[email protected]>
#if defined(__sun__) | ||
#ifdef __MINGW64__ | ||
#define _POSIX_C_SOURCE 1 | ||
#elif defined(__sun__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this break compiling Git with older mingw-w64? I ask because I have to do precisely that sometimes, e.g. when building MinGit backports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no; I obviously tested this change is safe both with the old (from SDK 1.0.8 as released) and new (currently updated) mingw-w64 headers and forgot to mention it.
I am doing an additional test with SDK 1.0.7 (even older releases won't install because of bintray or key issues), but I would be surprised that it wouldn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks for confirming!
Thank you @carenas! |
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw: avoid fallback for {local,gm}time_r()
mingw-w64's pthread_unistd.h had a bug that mistakenly (because there is
no support for the *lockfile() functions required[1]) defined
_POSIX_THREAD_SAFE_FUNCTIONS and that was being worked around since
3ecd153 (compat/mingw: support MSys2-based MinGW build, 2016-01-14).
the bug was fixed in winphtreads, but as a sideeffect, leaves the
reentrant functions from time.h not longer visible and therefore breaks
the build.
since the intention all along was to avoid using the fallback functions,
formalize the use of POSIX by setting the corresponding feature flag and
to make the intention clearer compile out the fallback functions.
[1] https://unix.org/whitepapers/reentrant.html
Signed-off-by: Carlo Marcelo Arenas Belón [email protected]
Thanks for taking the time to contribute to Git!
Those seeking to contribute to the Git for Windows fork should see
http://gitforwindows.org/#contribute on how to contribute Windows specific
enhancements.
If your contribution is for the core Git functions and documentation
please be aware that the Git community does not use the github.com issues
or pull request mechanism for their contributions.
Instead, we use the Git mailing list ([email protected]) for code and
documentation submissions, code reviews, and bug reports. The
mailing list is plain text only (anything with HTML is sent directly
to the spam folder).
Nevertheless, you can use GitGitGadget (https://gitgitgadget.github.io/)
to conveniently send your Pull Requests commits to our mailing list.
Please read the "guidelines for contributing" linked above!