From 5e797fc32493b6c7458090fb920c384e4dc0e818 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 29 Nov 2022 13:50:51 -0800 Subject: [PROPOSED] Be more consistent about HAVE_* names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use HAVE_X more consistently to represent the feature of feature x, even if x’s name begins with an underscore. * private.h (HAVE__GENERIC): Rename from HAVE_GENERIC, since this represents _Generic. All uses changed. (HAVE___HAS_C_ATTRIBUTE): Rename from HAVE_HAS_C_ATTRIBUTE, since this represents __has_c_attribute. All uses changed. --- Makefile | 2 +- private.h | 30 +++++++++++++++--------------- zdump.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index afb9d53..2c09f94 100644 --- a/Makefile +++ b/Makefile @@ -211,7 +211,7 @@ LDLIBS= # -DHAVE_DECL_ENVIRON if declares 'environ' # -DHAVE_DECL_TIMEGM=0 if does not declare timegm # -DHAVE_DIRECT_H if mkdir needs (MS-Windows) -# -DHAVE_GENERIC=0 if _Generic does not work* +# -DHAVE__GENERIC=0 if _Generic does not work* # -DHAVE_GETRANDOM if getrandom works (e.g., GNU/Linux), # -DHAVE_GETRANDOM=0 to avoid using getrandom # -DHAVE_GETTEXT if gettext works (e.g., GNU/Linux, FreeBSD, Solaris), diff --git a/private.h b/private.h index 7a73eff..9cb9c24 100644 --- a/private.h +++ b/private.h @@ -52,19 +52,19 @@ # define HAVE_DECL_ASCTIME_R 1 #endif -#if !defined HAVE_GENERIC && defined __has_extension +#if !defined HAVE__GENERIC && defined __has_extension # if __has_extension(c_generic_selections) -# define HAVE_GENERIC 1 +# define HAVE__GENERIC 1 # else -# define HAVE_GENERIC 0 +# define HAVE__GENERIC 0 # endif #endif /* _Generic is buggy in pre-4.9 GCC. */ -#if !defined HAVE_GENERIC && defined __GNUC__ && !defined __STRICT_ANSI__ -# define HAVE_GENERIC (4 < __GNUC__ + (9 <= __GNUC_MINOR__)) +#if !defined HAVE__GENERIC && defined __GNUC__ && !defined __STRICT_ANSI__ +# define HAVE__GENERIC (4 < __GNUC__ + (9 <= __GNUC_MINOR__)) #endif -#ifndef HAVE_GENERIC -# define HAVE_GENERIC (201112 <= __STDC_VERSION__) +#ifndef HAVE__GENERIC +# define HAVE__GENERIC (201112 <= __STDC_VERSION__) #endif #if !defined HAVE_GETTEXT && defined __has_include @@ -435,12 +435,12 @@ typedef unsigned long uintmax_t; #if (defined __has_c_attribute \ && (202311 <= __STDC_VERSION__ || !defined __STRICT_ANSI__)) -# define HAVE_HAS_C_ATTRIBUTE true +# define HAVE___HAS_C_ATTRIBUTE true #else -# define HAVE_HAS_C_ATTRIBUTE false +# define HAVE___HAS_C_ATTRIBUTE false #endif -#if HAVE_HAS_C_ATTRIBUTE +#if HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute(fallthrough) # define ATTRIBUTE_FALLTHROUGH [[fallthrough]] # endif @@ -453,7 +453,7 @@ typedef unsigned long uintmax_t; # endif #endif -#if HAVE_HAS_C_ATTRIBUTE +#if HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute(maybe_unused) # define ATTRIBUTE_MAYBE_UNUSED [[maybe_unused]] # endif @@ -466,7 +466,7 @@ typedef unsigned long uintmax_t; # endif #endif -#if HAVE_HAS_C_ATTRIBUTE +#if HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute(noreturn) # define ATTRIBUTE_NORETURN [[noreturn]] # endif @@ -481,7 +481,7 @@ typedef unsigned long uintmax_t; # endif #endif -#if HAVE_HAS_C_ATTRIBUTE +#if HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute(reproducible) # define ATTRIBUTE_REPRODUCIBLE [[reproducible]] # endif @@ -494,7 +494,7 @@ typedef unsigned long uintmax_t; # endif #endif -#if HAVE_HAS_C_ATTRIBUTE +#if HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute(unsequenced) # define ATTRIBUTE_UNSEQUENCED [[unsequenced]] # endif @@ -780,7 +780,7 @@ time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_REPRODUCIBLE; This implementation assumes no padding if time_t is signed and either the compiler lacks support for _Generic or time_t is not one of the standard signed integer types. */ -#if HAVE_GENERIC +#if HAVE__GENERIC # define TIME_T_MIN \ _Generic((time_t) 0, \ signed char: SCHAR_MIN, short: SHRT_MIN, \ diff --git a/zdump.c b/zdump.c index 7acb3e2..a020102 100644 --- a/zdump.c +++ b/zdump.c @@ -1173,7 +1173,7 @@ abbr(struct tm const *tmp) static const char * tformat(void) { -#if HAVE_GENERIC +#if HAVE__GENERIC /* C11-style _Generic is more likely to return the correct format when distinct types have the same size. */ char const *fmt = -- 2.38.1