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.
This commit is contained in:
Nobuyoshi Nakada 2024-07-18 11:20:17 +09:00
parent d0c17cbd09
commit d11d615ba6
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465

4
file.c
View File

@ -2930,7 +2930,7 @@ utime_failed(struct apply_arg *aa)
# elif defined(__APPLE__) && \ # elif defined(__APPLE__) && \
(!defined(MAC_OS_X_VERSION_13_0) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_13_0)) (!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); typedef int utimensat_func(int, const char *, const struct timespec [2], int);
RBIMPL_WARNING_PUSH() RBIMPL_WARNING_PUSH()
@ -2945,7 +2945,7 @@ RBIMPL_WARNING_POP()
# define utimensat rb_utimensat() # define utimensat rb_utimensat()
# else /* __API_AVAILABLE macro does nothing on gcc */ # else /* __API_AVAILABLE macro does nothing on gcc */
__attribute__((weak)) int utimensat(int, const char *, const struct timespec [2], int); __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 */ # endif /* __APPLE__ && < MAC_OS_X_VERSION_13_0 */
static int static int