On 2024-12-15 23:11, Manuela Friedrich wrote:
localtime.c
d:\devsrc\treasure_test\iana\tmp\private.h(872): warning C4005: 'max':
macro redefinition
C:\Program Files (x86)\Windows
Kits\10\include\10.0.16299.0\ucrt\stdlib.h(1300): note: see previous
definition of 'max'
d:\devsrc\treasure_test\iana\tmp\private.h(873): warning C4005: 'min':
macro redefinition
C:\Program Files (x86)\Windows
Kits\10\include\10.0.16299.0\ucrt\stdlib.h(1301): note: see previous
definition of 'min'
localtime.c(418): error C2065: 'utc': undeclared identifier
localtime.c(418): warning C4047: ':': 'const char *' differs in levels of
indirection from 'int'
localtime.c(1449): error C2065: 'utc': undeclared identifier
localtime.c(1449): warning C4047: 'function': 'const char *' differs in
levels of indirection from 'int'
localtime.c(1449): warning C4024: 'strcpy': different types for formal and
actual parameter 2
NMAKE : U1077: '"C:\Program Files (x86)\Microsoft Visual
Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64\cl.EXE"'
: return code '0x2'
Thanks for reporting these build glitches on MS-Windows. I installed the
attached patches; please give them a try, as I don't use that platform.From 7c90916644b9aea75cadcb594eca6b7c086b4a2d Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Mon, 16 Dec 2024 14:58:15 -0700
Subject: [PROPOSED 1/2] Define NOMINMAX for MS-Windows
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* private.h (NOMINMAX): Define in an attempt to port better to
MS-Windows. Problem reported by Manuela Friedrich.
While we’re at it, move all the feature-test macros before
the #include of <stdbool.h> on older platforms, since feature-test
macros are supposed be defined before any system #include.
---
private.h | 51 ++++++++++++++++++++++++++++++---------------------
1 file changed, 30 insertions(+), 21 deletions(-)
diff --git a/private.h b/private.h
index edc188a2..435190d3 100644
--- a/private.h
+++ b/private.h
@@ -37,6 +37,36 @@
# define SUPPORT_C89 1
#endif
+
+/* The following feature-test macros should be defined before
+ any #include of a system header. */
+
+/* Enable tm_gmtoff, tm_zone, and environ on GNUish systems. */
+#define _GNU_SOURCE 1
+/* Fix asctime_r on Solaris 11. */
+#define _POSIX_PTHREAD_SEMANTICS 1
+/* Enable strtoimax on pre-C99 Solaris 11. */
+#define __EXTENSIONS__ 1
+/* Prevent MS-Windows headers from defining min and max. */
+#define NOMINMAX 1
+
+/* On GNUish systems where time_t might be 32 or 64 bits, use 64.
+ On these platforms _FILE_OFFSET_BITS must also be 64; otherwise
+ setting _TIME_BITS to 64 does not work. The code does not
+ otherwise rely on _FILE_OFFSET_BITS being 64, since it does not
+ use off_t or functions like 'stat' that depend on off_t. */
+#ifndef _TIME_BITS
+# ifndef _FILE_OFFSET_BITS
+# define _FILE_OFFSET_BITS 64
+# endif
+# if _FILE_OFFSET_BITS == 64
+# define _TIME_BITS 64
+# endif
+#endif
+
+/* End of feature-test macro definitions. */
+
+
#ifndef __STDC_VERSION__
# define __STDC_VERSION__ 0
#endif
@@ -150,27 +180,6 @@
# define ctime_r _incompatible_ctime_r
#endif /* HAVE_INCOMPATIBLE_CTIME_R */
-/* Enable tm_gmtoff, tm_zone, and environ on GNUish systems. */
-#define _GNU_SOURCE 1
-/* Fix asctime_r on Solaris 11. */
-#define _POSIX_PTHREAD_SEMANTICS 1
-/* Enable strtoimax on pre-C99 Solaris 11. */
-#define __EXTENSIONS__ 1
-
-/* On GNUish systems where time_t might be 32 or 64 bits, use 64.
- On these platforms _FILE_OFFSET_BITS must also be 64; otherwise
- setting _TIME_BITS to 64 does not work. The code does not
- otherwise rely on _FILE_OFFSET_BITS being 64, since it does not
- use off_t or functions like 'stat' that depend on off_t. */
-#ifndef _TIME_BITS
-# ifndef _FILE_OFFSET_BITS
-# define _FILE_OFFSET_BITS 64
-# endif
-# if _FILE_OFFSET_BITS == 64
-# define _TIME_BITS 64
-# endif
-#endif
-
/*
** Nested includes
*/
--
2.47.1
From 7d776e798c330ba7794d7b67fb1ce6a0d082c275 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Mon, 16 Dec 2024 15:06:57 -0700
Subject: [PROPOSED 2/2] =?UTF-8?q?Port=20=E2=80=98utc=E2=80=99=20to=20MS-W?=
=?UTF-8?q?indows?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Problem reported by Manuela Friedrich.
* localtime.c (utc): Also define if (!USE_TIMEX_T || !defined
TM_GMTOFF) && !defined TZ_NAME, as is the case on MS-Windows.
---
localtime.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/localtime.c b/localtime.c
index 566d2347..3ee8a3e2 100644
--- a/localtime.c
+++ b/localtime.c
@@ -146,7 +146,7 @@ static const char wildabbr[] = WILDABBR;
static char const etc_utc[] = "Etc/UTC";
-#if defined TM_ZONE || ((!USE_TIMEX_T || !defined TM_GMTOFF) && defined TZ_NAME)
+#if !USE_TIMEX_T || defined TM_ZONE || !defined TM_GMTOFF
static char const *utc = etc_utc + sizeof "Etc/" - 1;
#endif
--
2.47.1