[tz] [PATCH 1/2] Remove unused C macros
Paul Eggert
eggert at cs.ucla.edu
Sat Feb 13 19:02:59 UTC 2021
Also, pacify ‘gcc -Wunused-macros’, which was employed to find
these unused macros.
* localtime.c (NETBSD_INSPIRED_EXTERN):
Define only if STD_INSPIRED is defined.
* private.h (sys_time) [!TZ_TIME_T]:
Inspect LOCALTIME_IMPLEMENTATION.
* zdump.c (MAX_STRING_LENGTH):
* zic.c (PRIdZIC):
Remove these macros, which are no longer used.
---
localtime.c | 16 ++++++++--------
private.h | 7 ++++---
zdump.c | 4 ----
zic.c | 1 -
4 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/localtime.c b/localtime.c
index d3e406b..82a3b70 100644
--- a/localtime.c
+++ b/localtime.c
@@ -28,14 +28,6 @@ static int lock(void) { return 0; }
static void unlock(void) { }
#endif
-/* NETBSD_INSPIRED_EXTERN functions are exported to callers if
- NETBSD_INSPIRED is defined, and are private otherwise. */
-#if NETBSD_INSPIRED
-# define NETBSD_INSPIRED_EXTERN
-#else
-# define NETBSD_INSPIRED_EXTERN static
-#endif
-
#ifndef TZ_ABBR_MAX_LEN
#define TZ_ABBR_MAX_LEN 16
#endif /* !defined TZ_ABBR_MAX_LEN */
@@ -2247,6 +2239,14 @@ leapcorr(struct state const *sp, time_t t)
#ifdef STD_INSPIRED
+/* NETBSD_INSPIRED_EXTERN functions are exported to callers if
+ NETBSD_INSPIRED is defined, and are private otherwise. */
+# if NETBSD_INSPIRED
+# define NETBSD_INSPIRED_EXTERN
+# else
+# define NETBSD_INSPIRED_EXTERN static
+# endif
+
/*
** IEEE Std 1003.1 (POSIX) says that 536457599
** shall correspond to "Wed Dec 31 23:59:59 UTC 1986", which
diff --git a/private.h b/private.h
index 9efcd78..a919e4f 100644
--- a/private.h
+++ b/private.h
@@ -418,10 +418,11 @@ typedef unsigned long uintmax_t;
# define TZ_TIME_T 0
#endif
-#if TZ_TIME_T
-# ifdef LOCALTIME_IMPLEMENTATION
+#if defined LOCALTIME_IMPLEMENTATION && TZ_TIME_T
static time_t sys_time(time_t *x) { return time(x); }
-# endif
+#endif
+
+#if TZ_TIME_T
typedef time_tz tz_time_t;
diff --git a/zdump.c b/zdump.c
index b532fe3..57e363e 100644
--- a/zdump.c
+++ b/zdump.c
@@ -42,10 +42,6 @@
#define ZDUMP_HI_YEAR 2500
#endif /* !defined ZDUMP_HI_YEAR */
-#ifndef MAX_STRING_LENGTH
-#define MAX_STRING_LENGTH 1024
-#endif /* !defined MAX_STRING_LENGTH */
-
#define SECSPERNYEAR (SECSPERDAY * DAYSPERNYEAR)
#define SECSPERLYEAR (SECSPERNYEAR + SECSPERDAY)
#define SECSPER400YEARS (SECSPERNYEAR * (intmax_t) (300 + 3) \
diff --git a/zic.c b/zic.c
index b37cdc9..51977b2 100644
--- a/zic.c
+++ b/zic.c
@@ -21,7 +21,6 @@
typedef int_fast64_t zic_t;
#define ZIC_MIN INT_FAST64_MIN
#define ZIC_MAX INT_FAST64_MAX
-#define PRIdZIC PRIdFAST64
#define SCNdZIC SCNdFAST64
#ifndef ZIC_MAX_ABBR_LEN_WO_WARN
--
2.27.0
More information about the tz
mailing list