bpo-42692: fix __builtin_available check on older compilers (GH-23873)

A compiler that doesn't define `__has_builtin` will error out when it is
used on the same line as the check for it.

Automerge-Triggered-By: GH:ronaldoussoren
This commit is contained in:
Joshua Root 2021-01-04 21:36:58 +11:00 committed by GitHub
parent b6fc0c406e
commit df21f502fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix __builtin_available check on older compilers. Patch by Joshua Root.

View File

@ -61,7 +61,13 @@
*/
#if defined(__APPLE__)
#if defined(__has_builtin) && __has_builtin(__builtin_available)
#if defined(__has_builtin)
#if __has_builtin(__builtin_available)
#define HAVE_BUILTIN_AVAILABLE 1
#endif
#endif
#ifdef HAVE_BUILTIN_AVAILABLE
# define HAVE_FSTATAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
# define HAVE_FACCESSAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
# define HAVE_FCHMODAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)