Skip to content

Commit df21f50

Browse files
authored
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
1 parent b6fc0c4 commit df21f50

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix __builtin_available check on older compilers. Patch by Joshua Root.

Modules/posixmodule.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@
6161
*/
6262
#if defined(__APPLE__)
6363

64-
#if defined(__has_builtin) && __has_builtin(__builtin_available)
64+
#if defined(__has_builtin)
65+
#if __has_builtin(__builtin_available)
66+
#define HAVE_BUILTIN_AVAILABLE 1
67+
#endif
68+
#endif
69+
70+
#ifdef HAVE_BUILTIN_AVAILABLE
6571
# define HAVE_FSTATAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
6672
# define HAVE_FACCESSAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
6773
# define HAVE_FCHMODAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)

0 commit comments

Comments
 (0)