This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch libgfortran]: Fix build of libgfortran for mingw and improve POSIX ctime_r implementation


Hello,

recent changes lead to a build failure for mingw targets in gfortran.
Following patch solves this.

ChangeLog

2011-01-29  Kai Tietz

        * intrinsics/ctime.c (ctime_r): Improve implementation.

Tested for x86_64-w64-mingw32. Ok for apply?

Regards,
Kai

Index: intrinsics/ctime.c
===================================================================
--- intrinsics/ctime.c  (revision 169388)
+++ intrinsics/ctime.c  (working copy)
@@ -42,11 +42,17 @@


 #ifndef HAVE_CTIME_R
+/* Make sure we don't see here a macro.  */
+#undef ctime_r
+
 static char *
 ctime_r (const time_t * timep, char * buf __attribute__((unused)))
 {
 #ifdef HAVE_CTIME
-  return ctime (timep);
+  char *tmp = ctime (timep);
+  if (tmp)
+    tmp = strcpy (buf, tmp);
+  return tmp;
 #else
   return NULL;
 #endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]