Skip to content

Commit eedeaef

Browse files
bpo-42692: fix __builtin_available check on older compilers (GH-23873) (GH-24090)
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 (cherry picked from commit df21f50) Co-authored-by: Joshua Root <[email protected]>
1 parent 76489dd commit eedeaef

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
@@ -56,7 +56,13 @@
5656
*/
5757
#if defined(__APPLE__)
5858

59-
#if defined(__has_builtin) && __has_builtin(__builtin_available)
59+
#if defined(__has_builtin)
60+
#if __has_builtin(__builtin_available)
61+
#define HAVE_BUILTIN_AVAILABLE 1
62+
#endif
63+
#endif
64+
65+
#ifdef HAVE_BUILTIN_AVAILABLE
6066
# define HAVE_FSTATAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
6167
# define HAVE_FACCESSAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
6268
# define HAVE_FCHMODAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)

0 commit comments

Comments
 (0)