On 2024-12-17 07:53, Manuela Friedrich wrote:
It's worth noticing that I had to add -DHAVE_SYS_STAT_H=0 to the tools.ini
file we use on Windows.

Thanks for mentioning that, but unfortunately I don't know why -DHAVE_SYS_STAT_H=0 was needed (I don't use MS-Windows).

Some fumbling with Microsoft documentation eventually led me to <https://learn.microsoft.com/en-us/cpp/c-runtime-library/compatibility?view=msvc-170> which hints (but does not say) that by default MS-Windows <sys/stat.h> doesn't define the 'stat' function if you use some compilation options. I installed the attached patch to try to work around this portability problem. Does this patch fix things so that -DHAVE_SYS_STAT_H=0 need not be added to tools.ini? If not, what problems do you observe?

With the patch, do you see warnings when compiling? Does compiling with -D_CRT_SECURE_NO_WARNINGS cut down on the number of warnings?

What's in your tools.ini file for building tzcode?
From 3411494cc728e9bd2954a55ffddd134ed5b43bfe Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Tue, 17 Dec 2024 11:15:01 -0700
Subject: [PROPOSED] Define _CRT_DECLARE_NONSTDC_NAMES for MS-Windows

* private.h (_CRT_DECLARE_NONSTDC_NAMES): Define
in a further attempt to port better to MS-Windows.
Problem reported by Manuela Friedrich.
---
 private.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/private.h b/private.h
index 435190d3..de816077 100644
--- a/private.h
+++ b/private.h
@@ -47,6 +47,8 @@
 #define _POSIX_PTHREAD_SEMANTICS 1
 /* Enable strtoimax on pre-C99 Solaris 11.  */
 #define __EXTENSIONS__ 1
+/* Cause MS-Windows headers to define POSIX names.  */
+#define _CRT_DECLARE_NONSTDC_NAMES 1
 /* Prevent MS-Windows headers from defining min and max.  */
 #define NOMINMAX 1
 
-- 
2.47.1

Reply via email to