summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-07-18 11:20:17 +0900
committerNobuyoshi Nakada <[email protected]>2024-07-18 11:20:17 +0900
commitd11d615ba602e92a7279b7efdf595ba11ba3a663 (patch)
treebac86003738fd567e473b89485989cf7c18168f7 /file.c
parentd0c17cbd09e5455c203e8fd647e8967684562347 (diff)
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.
Diffstat (limited to 'file.c')
-rw-r--r--file.c4
1 files 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