On 01/30/15 06:00, Martell Malone wrote:
>
>     Correct
>
> Seems like the patch works as I intended :)
>
> I will do a patch to turn them back to functions without inline and
> hopefully this puts all the issues to rest :)

This will bring back previous problems again. I don't see how using
_POSIX_C_SOURCE would change it. Also, you still have an issue about
time32_t vs time64_t.

How about the attached patch? It ensures that
_POSIX_THREAD_SAFE_FUNCTIONS is defined if we declare *_r functions.
This conforms POSIX better and you may simply detect those functions in
the code using this macro. You said on IRC that all those changes are
needed because VLC maintainer wants mingw-w64 to be POSIX compatible,
would that make him happy?

Cheers,
Jacek
commit d466b776a7acbe561f17089e7877b53a585d03ce
Author: Jacek Caban <ja...@codeweavers.com>
Date:   Fri Jan 30 11:16:50 2015 +0100

    time.h: Ensure that _POSIX_THREAD_SAFE_FUNCTIONS is defined if we declare 
*_r functions.

diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h
index b551a27..4ff1b14 100644
--- a/mingw-w64-headers/crt/time.h
+++ b/mingw-w64-headers/crt/time.h
@@ -261,7 +261,11 @@ struct timezone {
 
 #pragma pack(pop)
 
-#if defined(_POSIX) || defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+#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 *__cdecl localtime_r(const time_t *_Time, struct tm 
*_Tm) {
   return localtime_s(_Tm, _Time) ? NULL : _Tm;
 }
@@ -274,7 +278,7 @@ __forceinline char *__cdecl ctime_r(const time_t *_Time, 
char *_Str) {
 __forceinline char *__cdecl asctime_r(const struct tm *_Tm, char * _Str) {
   return asctime_s(_Str, 0x7fffffff, _Tm) ? NULL : _Str;
 }
-#endif /* _POSIX */
+#endif
 
 /* Adding timespec definition.  */
 #include <sys/timeb.h>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to