From 60ec353680cd371ff6a27d3211120880a6e09434 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 9 May 2017 21:56:31 -0700 Subject: [PATCH 5/6] New macro HAVE_STDBOOL_H * Makefile: Say "non-C99", not "pre-C99", since Microsoft compilers neither predate nor support C99. * private.h (HAVE_STDBOOL_H): New macro. Use it to decide whether to include . --- Makefile | 5 +++-- private.h | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e26eed8..ee37f62 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ LDLIBS= # -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares # ctime_r and asctime_r incompatibly with the POSIX standard # (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). -# -DHAVE_INTTYPES_H if you have a pre-C99 compiler with +# -DHAVE_INTTYPES_H if you have a non-C99 compiler with # -DHAVE_LINK=0 if your system lacks a link function # -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function # -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz @@ -123,7 +123,8 @@ LDLIBS= # localtime_rz can make zdump significantly faster, but is nonstandard. # -DHAVE_POSIX_DECLS=0 if your system's include files do not declare # functions like 'link' or variables like 'tzname' required by POSIX -# -DHAVE_STDINT_H if you have a pre-C99 compiler with +# -DHAVE_STDBOOL_H if you have a non-C99 compiler with +# -DHAVE_STDINT_H if you have a non-C99 compiler with # -DHAVE_STRFTIME_L if declares locale_t and strftime_l # This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise. # -DHAVE_STRDUP=0 if your system lacks the strdup function diff --git a/private.h b/private.h index 856c75d..e9eb211 100644 --- a/private.h +++ b/private.h @@ -43,6 +43,10 @@ #define HAVE_POSIX_DECLS 1 #endif +#ifndef HAVE_STDBOOL_H +#define HAVE_STDBOOL_H (199901 <= __STDC_VERSION__) +#endif + #ifndef HAVE_STRDUP #define HAVE_STRDUP 1 #endif @@ -504,12 +508,12 @@ time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_PURE; ** Finally, some convenience items. */ -#if __STDC_VERSION__ < 199901 +#if HAVE_STDBOOL_H +# include +#else # define true 1 # define false 0 # define bool int -#else -# include #endif #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT) -- 2.7.4