On 2024-12-18 00:34, Manuela Friedrich wrote:
unresolved external symbol S_ISREG

OK, let's try again. I installed the first attached patch, which I hope fixes that.


CFLAGSW  = ... -Dssize_t=__int64 ...

This doesn't feel right, as ssize_t is the type returned by 'read', and from what I can see on microsoft.com that type is int even on 64-bit MS-Windows. POSIX allows ssize_t to have fewer bits than size_t, so this behavior of MS-Windows conforms to POSIX.

I installed the second attached patch to adjust the suggested definition of ssize_t in the commentary, and you might want to adjust your tools.ini accordingly.
From 352dcdf9e341a073b603402067b5e988ca01a978 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Wed, 18 Dec 2024 14:55:47 -0700
Subject: [PROPOSED 1/2] Port S_ISREG to ancient UNIX, recent MS-Windows

Problem reported by Manuela Friedrich in:
https://lists.iana.org/hyperkitty/list/tz@iana.org/message/UENBDOSR45XSRJG5PXLJHMKZ27JANTDS/
* localtime.c (S_ISREG): Define a default that should work on
ancient UNIX and recent MS-Windows.
(tzloadbody) [HAVE_SYS_STAT_H && !S_ISREG]: Do not use stat.
---
 localtime.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/localtime.c b/localtime.c
index 3ee8a3e2..441c5edd 100644
--- a/localtime.c
+++ b/localtime.c
@@ -22,6 +22,10 @@
 #if HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
+#if !defined S_ISREG && defined S_IFREG
+/* Ancient UNIX or recent MS-Windows.  */
+# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
+#endif
 
 #if defined THREAD_SAFE && THREAD_SAFE
 # include <pthread.h>
@@ -566,7 +570,7 @@ tzloadbody(char const *name, struct state *sp, char tzloadflags,
 	     no portable way to fix the races.  */
 	  if (access(name, R_OK) < 0)
 	    return errno;
-#if HAVE_SYS_STAT_H
+#ifdef S_ISREG
 	  {
 	    struct stat st;
 	    if (stat(name, &st) < 0)
-- 
2.47.1

From cb537f200180123db117f2855e3f9c73e518ed8f Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Wed, 18 Dec 2024 15:04:43 -0700
Subject: [PROPOSED 2/2] Suggest -Dssize_t=int, not long

* Makefile: In commentary, suggest that -Dssize_t=int should be good
enough for MS-Windows, as no uses involve anything outside of int
range.
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 8faab6ff..ffdbfe3b 100644
--- a/Makefile
+++ b/Makefile
@@ -263,7 +263,7 @@ LDLIBS=
 #	feature (integers at least 64 bits wide) and maybe more.
 #  -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
 #	with external linkage, e.g., applications cannot define 'localtime'.
-#  -Dssize_t=long on hosts like MS-Windows that lack ssize_t
+#  -Dssize_t=int on hosts like MS-Windows that lack ssize_t
 #  -DSUPPORT_C89=0 if the tzcode library should not support C89 callers
 #	Although -DSUPPORT_C89=0 might work around latent bugs in callers,
 #	it does not conform to POSIX.
-- 
2.47.1

Reply via email to