[tz] [PROPOSED] SUPPORT_C89 now defaults to 1, not 0
Paul Eggert
eggert at cs.ucla.edu
Sat Jun 8 19:18:14 UTC 2024
Although POSIX requires this, I didn’t notice it until today.
* Makefile, NEWS, localtime.c: Mention this.
* private.h (SUPPORT_C89): Default to 1, not 0.
---
Makefile | 5 +++--
NEWS | 4 ++++
localtime.c | 5 +++--
private.h | 17 ++++++++++-------
4 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile
index 97a88535..c00eb317 100644
--- a/Makefile
+++ b/Makefile
@@ -263,8 +263,9 @@ LDLIBS=
# -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
-# -DSUPPORT_C89 if the tzcode library should support C89 callers+
-# However, this might trigger latent bugs in C99-or-later callers.
+# -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.
# -DSUPPORT_POSIX2008 if the library should support older POSIX callers+
# However, this might cause problems in POSIX.1-2024-or-later callers.
# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
diff --git a/NEWS b/NEWS
index 6b71212c..5238cb9e 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Unreleased, experimental changes
The code now conforms to RFC 8536 for early timestamps.
Support POSIX.1-2024, which removes asctime_r and ctime_r.
Assume POSIX.2-1992 or later for shell scripts.
+ SUPPORT_C89 now defaults to 1.
Improve historical data for Portugal and possessions.
Changes to data
@@ -60,6 +61,9 @@ Unreleased, experimental changes
can overrun user buffers. If you still need them, add
-DSUPPORT_POSIX2008 to CFLAGS.
+ The SUPPORT_C89 option now defaults to 1 instead of 0, fixing a
+ POSIX-conformance bug introduced in 2023a.
+
tzselect now assumes POSIX.2-1992 or later, as practical porting
targets now all support this. Also, tzselect uses some features
from POSIX.1-2024 if available.
diff --git a/localtime.c b/localtime.c
index c9f0d1a8..7e3fd149 100644
--- a/localtime.c
+++ b/localtime.c
@@ -182,8 +182,9 @@ static int lcl_is_set;
** objects: a broken-down time structure and an array of char.
** Thanks to Paul Eggert for noting this.
**
-** This requirement was removed in C99, so support it only if requested,
-** as support is more likely to lead to bugs in badly written programs.
+** Although this requirement was removed in C99 it is still present in POSIX.
+** Follow the requirement if SUPPORT_C89, even though this is more likely to
+** trigger latent bugs in programs.
*/
#if SUPPORT_C89
diff --git a/private.h b/private.h
index 0c91a252..19d7f7d6 100644
--- a/private.h
+++ b/private.h
@@ -19,19 +19,22 @@
/* PORT_TO_C89 means the code should work even if the underlying
compiler and library support only C89 plus C99's 'long long'
- and perhaps a few other extensions to C89. SUPPORT_C89 means the
- tzcode library should support C89 callers in addition to the usual
- support for C99-and-later callers; however, C89 support can trigger
- latent bugs in C99-and-later callers. These macros are obsolescent,
- and the plan is to remove them along with any code needed only when
- they are nonzero. A good time to do that might be in the year 2029
+ and perhaps a few other extensions to C89.
+
+ This macro is obsolescent, and the plan is to remove it along with
+ associated code. A good time to do that might be in the year 2029
because RHEL 7 (whose GCC defaults to C89) extended life cycle
support (ELS) is scheduled to end on 2028-06-30. */
#ifndef PORT_TO_C89
# define PORT_TO_C89 0
#endif
+
+/* SUPPORT_C89 means the tzcode library should support C89 callers
+ in addition to the usual support for C99-and-later callers.
+ This defaults to 1 as POSIX requires, even though that can trigger
+ latent bugs in callers. */
#ifndef SUPPORT_C89
-# define SUPPORT_C89 0
+# define SUPPORT_C89 1
#endif
#ifndef __STDC_VERSION__
--
2.43.0
More information about the tz
mailing list