SHA256
1
0
forked from pool/timezone
timezone/tzcode-revert-01-8c9cb9580.patch

61 lines
1.9 KiB
Diff

commit 8c9cb958078b470e352a58f7f2d756544051e59b
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri Feb 26 12:36:17 2016 -0800
Fix asctime_r warning with MS-Windows
Problem reported by Ian Abbott in:
http://mm.icann.org/pipermail/tz/2016-February/023291.html
* Makefile (CFLAGS): Add comment about new -D option.
* private.h (HAVE_DECL_ASCTIME_R): New macro.
(asctime_r): Depend on this, not on HAVE_POSIX_DECLS.
diff --git a/Makefile b/Makefile
index 20c2c98..5e2fb52 100644
--- a/Makefile
+++ b/Makefile
@@ -106,6 +106,7 @@ LDLIBS=
# Add the following to the end of the "CFLAGS=" line as needed.
# -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
+# -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
# -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
# -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS)
# -DHAVE_GETTEXT=1 if 'gettext' works (GNU, Linux, Solaris); also see LDLIBS
diff --git a/private.h b/private.h
index e23764d..941e91b 100644
--- a/private.h
+++ b/private.h
@@ -22,6 +22,10 @@
** You can override these in your C compiler options, e.g. '-DHAVE_GETTEXT=1'.
*/
+#ifndef HAVE_DECL_ASCTIME_R
+#define HAVE_DECL_ASCTIME_R 1
+#endif
+
#ifndef HAVE_GETTEXT
#define HAVE_GETTEXT 0
#endif /* !defined HAVE_GETTEXT */
@@ -386,17 +390,11 @@ time_t time(time_t *);
void tzset(void);
#endif
-/*
-** Some time.h implementations don't declare asctime_r.
-** Others might define it as a macro.
-** Fix the former without affecting the latter.
-** Similarly for timezone, daylight, and altzone.
-*/
+#if !HAVE_DECL_ASCTIME_R && !defined asctime_r
+extern char *asctime_r(struct tm const *restrict, char *restrict);
+#endif
#if !HAVE_POSIX_DECLS
-# ifndef asctime_r
-extern char * asctime_r(struct tm const *restrict, char *restrict);
-# endif
# ifdef USG_COMPAT
# ifndef timezone
extern long timezone;