[PROPOSED 1/2] Don’t include <sys/type.h>
* private.h: Do not include <sys/types.h> for time_t. Including sys/types.h was added on 1989-04-10 to support pre-C89 platforms, but this is no longer needed now that we assume C89. --- private.h | 1 - 1 file changed, 1 deletion(-) diff --git a/private.h b/private.h index ffb9d48..baacdfb 100644 --- a/private.h +++ b/private.h @@ -179,7 +179,6 @@ #undef tzfree #include <stddef.h> -#include <sys/types.h> /* for time_t */ #include <string.h> #include <limits.h> /* for CHAR_BIT et al. */ #include <stdlib.h> -- 2.37.3
Last year tzcode stopped using functions relying on large file offsets, notably the ‘stat’ function. So do not enable large-file support, except on GNU/Linux where large-file support is a prerequisite for 64-bit timestamps on 32-bit hosts. * NEWS: Mention this. * private.h (_LARGE_FILES, _DARWIN_USE_64_BIT_INODE): Do not define; no longer needed. (_TIME_BITS): Do not default to 64 if the builder compiles with -D_FILE_OFFSET_BITS=32, as this combination does not work. --- NEWS | 8 ++++++++ private.h | 18 ++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index 2c905fd..582ab64 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,8 @@ Unreleased, experimental changes zic now supports links to links, and vanguard form uses this. Simplify four Ontario zones into one. Fix a Y2438 bug when reading TZif data. + Enable 64-bit time_t on 32-bit glibc platforms. + Omit large-file support when no longer needed. In C code, use some C23 features if available. Remove no-longer-needed workaround for Qt bug 53071. @@ -71,6 +73,12 @@ Unreleased, experimental changes To continue to limit time_t to 32 bits on these platforms, use "make CFLAGS='-D_TIME_BITS=32'". + In C code, do not enable large-file support on platforms like AIX + and macOS that no longer need it now that tzcode does not use + off_t or related functions like 'stat'. Large-file support is + still enabled by default on GNU/Linux, as it is needed for 64-bit + time_t support. + In C code, prefer C23 keywords to pre-C23 macros for alignof, bool, false, and true. Also, use the following C23 features if available: __has_include, unreachable. diff --git a/private.h b/private.h index baacdfb..deff90e 100644 --- a/private.h +++ b/private.h @@ -131,21 +131,15 @@ /* Enable strtoimax on pre-C99 Solaris 11. */ #define __EXTENSIONS__ 1 -/* Although tzcode does not call 'stat'-like functions directly, stdio - functions may call them. To avoid having them fail unnecessarily - with errno == EOVERFLOW, enable large files on GNUish systems ... */ +/* 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 _FILE_OFFSET_BITS # define _FILE_OFFSET_BITS 64 #endif -/* ... and on AIX ... */ -#define _LARGE_FILES 1 -/* ... and enable large inode numbers on Mac OS X 10.5 and later. */ -#define _DARWIN_USE_64_BIT_INODE 1 - -/* On GNUish systems where time_t might be 32 or 64 bits, use 64. - This supports a wider time range, and avoids having 'stat'-like - functions fail unnecessarily with errno == EOVERFLOW. */ -#ifndef _TIME_BITS +#if !defined _TIME_BITS && _FILE_OFFSET_BITS == 64 # define _TIME_BITS 64 #endif -- 2.37.3
participants (1)
-
Paul Eggert