[tz] [PROPOSED 1/4] Always define STD_INSPIRED
Paul Eggert
eggert at cs.ucla.edu
Wed Nov 30 19:25:49 UTC 2022
* private.h (STD_INSPIRED): Default to 0. All uses changed.
This is purely refactoring, so that STD_INSPIRED is more like
other macros in this file.
---
Makefile | 2 +-
localtime.c | 10 +++++-----
private.h | 7 +++++--
theory.html | 2 +-
4 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
index 2c09f94..f0cbf7f 100644
--- a/Makefile
+++ b/Makefile
@@ -363,7 +363,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# -DNETBSD_INSPIRED=0
# to the end of the "CFLAGS=" line. Otherwise, the functions
# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the
-# time library, and if STD_INSPIRED is also defined the functions
+# time library, and if STD_INSPIRED is also defined to nonzero the functions
# "posix2time_z" and "time2posix_z" are added as well.
# The functions ending in "_z" (or "_rz") are like their unsuffixed
# (or suffixed-by-"_r") counterparts, except with an extra first
diff --git a/localtime.c b/localtime.c
index 1d22d35..462d054 100644
--- a/localtime.c
+++ b/localtime.c
@@ -1697,7 +1697,7 @@ gmtime(const time_t *timep)
return gmtime_r(timep, &tm);
}
-#ifdef STD_INSPIRED
+#if STD_INSPIRED
struct tm *
offtime(const time_t *timep, long offset)
@@ -1706,7 +1706,7 @@ offtime(const time_t *timep, long offset)
return gmtsub(gmtptr, timep, offset, &tm);
}
-#endif /* defined STD_INSPIRED */
+#endif
/*
** Return the number of leap years through the end of the given year
@@ -2325,7 +2325,7 @@ mktime(struct tm *tmp)
return t;
}
-#ifdef STD_INSPIRED
+#if STD_INSPIRED
time_t
timelocal(struct tm *tmp)
{
@@ -2377,7 +2377,7 @@ leapcorr(struct state const *sp, time_t t)
** XXX--is the below the right way to conditionalize??
*/
-#ifdef STD_INSPIRED
+#if STD_INSPIRED
/* NETBSD_INSPIRED_EXTERN functions are exported to callers if
NETBSD_INSPIRED is defined, and are private otherwise. */
@@ -2462,7 +2462,7 @@ posix2time(time_t t)
return t;
}
-#endif /* defined STD_INSPIRED */
+#endif /* STD_INSPIRED */
#if TZ_TIME_T
diff --git a/private.h b/private.h
index 9cb9c24..b5fdf5a 100644
--- a/private.h
+++ b/private.h
@@ -691,7 +691,10 @@ extern long altzone;
** declarations if time_tz is defined.
*/
-#ifdef STD_INSPIRED
+#ifndef STD_INSPIRED
+# define STD_INSPIRED 0
+#endif
+#if STD_INSPIRED
# if TZ_TIME_T || !defined offtime
struct tm *offtime(time_t const *, long);
# endif
@@ -738,7 +741,7 @@ struct tm *localtime_rz(timezone_t restrict, time_t const *restrict,
time_t mktime_z(timezone_t restrict, struct tm *restrict);
timezone_t tzalloc(char const *);
void tzfree(timezone_t);
-# ifdef STD_INSPIRED
+# if STD_INSPIRED
# if TZ_TIME_T || !defined posix2time_z
time_t posix2time_z(timezone_t, time_t) ATTRIBUTE_REPRODUCIBLE;
# endif
diff --git a/theory.html b/theory.html
index 75e347f..f2b798b 100644
--- a/theory.html
+++ b/theory.html
@@ -1173,7 +1173,7 @@ The vestigial <abbr>API</abbr>s are:
</li>
<li>
The functions that are conditionally compiled
- if <code>STD_INSPIRED</code> is defined should, at this point, be
+ if <code>STD_INSPIRED</code> is nonzero should, at this point, be
looked on primarily as food for thought.
They are not in any sense "standard compatible" – some are
not, in fact, specified in <em>any</em> standard.
--
2.38.1
More information about the tz
mailing list