From 6765f094aa004ca84057d4721b94136266dd978c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 21 Feb 2023 15:12:38 -0800 Subject: [PROPOSED] Port UINTMAX_MAX to pre-C99 compilers Problem reported by Steven Shuriff * private.h (UINTMAX_MAX): Define if not already defined. --- NEWS | 3 +++ private.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index fc35046..f1bc788 100644 --- a/NEWS +++ b/NEWS @@ -43,6 +43,9 @@ Unreleased, experimental changes two new macros are transitional aids planned to be removed in a future version, when C99 or later will be required. + The code now builds again on pre-C99 platforms, if you compile + with -DPORT_TO_C89. This fixes a bug introduced in 2022f. + On C23-compatible platforms tzcode no longer uses syntax like 'static [[noreturn]] void usage(void);'. Instead, it uses '[[noreturn]] static void usage(void);' as strict C23 requires. diff --git a/private.h b/private.h index b638e9e..6317464 100644 --- a/private.h +++ b/private.h @@ -400,8 +400,10 @@ typedef unsigned long long uint_fast64_t; #ifndef UINTMAX_MAX # ifdef ULLONG_MAX typedef unsigned long long uintmax_t; +# define UINTMAX_MAX ULLONG_MAX # else typedef unsigned long uintmax_t; +# define UINTMAX_MAX ULONG_MAX # endif #endif -- 2.39.2