From d11d615ba602e92a7279b7efdf595ba11ba3a663 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 18 Jul 2024 11:20:17 +0900 Subject: [PATCH] Fix `utimesat` availability condition As `__has_attribute` macro is always defined in internal/compilers.h, gcc warns `-Wunguarded-availability-new` as unknown option. Check if the warning option is usable instead. --- file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/file.c b/file.c index 7bb858ae15..97172257c0 100644 --- a/file.c +++ b/file.c @@ -2930,7 +2930,7 @@ utime_failed(struct apply_arg *aa) # elif defined(__APPLE__) && \ (!defined(MAC_OS_X_VERSION_13_0) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_13_0)) -# if defined(__has_attribute) && __has_attribute(availability) +# if __has_attribute(availability) && __has_warning("-Wunguarded-availability-new") typedef int utimensat_func(int, const char *, const struct timespec [2], int); RBIMPL_WARNING_PUSH() @@ -2945,7 +2945,7 @@ RBIMPL_WARNING_POP() # define utimensat rb_utimensat() # else /* __API_AVAILABLE macro does nothing on gcc */ __attribute__((weak)) int utimensat(int, const char *, const struct timespec [2], int); -# endif /* defined(__has_attribute) && __has_attribute(availability) */ +# endif /* utimesat availability */ # endif /* __APPLE__ && < MAC_OS_X_VERSION_13_0 */ static int