[tz] USG_COMPAT and POSIX and XOPEN macros
Andras Farkas
deepbluemistake at gmail.com
Sat Nov 30 15:31:49 UTC 2019
On Fri, Nov 29, 2019 at 2:55 PM Paul Eggert <eggert at cs.ucla.edu> wrote:
> On 11/23/19 10:35 PM, Andras Farkas wrote:
> > so I can actually test
> > tzcode like this, should I patch the tz github repo, or the 2019c
> > tarball?
> I forgot to push that patch to GitHub. I just now pushed it, so you should be
> able to use GitHub master now, without having to apply the patch.
Thanks!
However, on FreeBSD (thinking back to the connections between this
thread and another thread) compilation fails with:
CFLAGS= -DUSG_COMPAT=2 -DHAVE_POSIX_DECLS=0
I suggest something like the attached diff, which makes compilation
succeed, while fitting in line with what the internal macros are
currently doing.
-------------- next part --------------
--- tz-masterold/private.h 2019-11-30 10:07:16.860120000 -0500
+++ tz-masternew/private.h 2019-11-30 10:12:23.464122000 -0500
@@ -132,11 +132,17 @@
** Nested includes
*/
-/* Avoid clashes with NetBSD by renaming NetBSD's declarations. */
+/*
+ * Avoid clashes with NetBSD by renaming NetBSD's declarations.
+ * Also, when providing timezone for USG_COMPAT, avoid clashes with the Unix v7 timezone(3) function, which is still available on FreeBSD.
+ */
#define localtime_rz sys_localtime_rz
#define mktime_z sys_mktime_z
#define posix2time_z sys_posix2time_z
#define time2posix_z sys_time2posix_z
+#if 2 <= USG_COMPAT + (TZ_TIME_T || !HAVE_POSIX_DECLS)
+# define timezone sys_timezone
+#endif
#define timezone_t sys_timezone_t
#define tzalloc sys_tzalloc
#define tzfree sys_tzfree
@@ -145,6 +151,9 @@
#undef mktime_z
#undef posix2time_z
#undef time2posix_z
+#if 2 <= USG_COMPAT + (TZ_TIME_T || !HAVE_POSIX_DECLS)
+# undef timezone
+#endif
#undef timezone_t
#undef tzalloc
#undef tzfree
More information about the tz
mailing list