[Python-checkins] bpo-42692: fix __builtin_available check on older compilers (GH-23873)

miss-islington webhook-mailer at python.org
Mon Jan 4 05:37:06 EST 2021


https://github.com/python/cpython/commit/df21f502fdccec234282bf0a211af979fd23def4
commit: df21f502fdccec234282bf0a211af979fd23def4
branch: master
author: Joshua Root <jmr at macports.org>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-01-04T02:36:58-08:00
summary:

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

files:
A Misc/NEWS.d/next/Build/2021-01-04-05-07-30.bpo-42692.OO11SN.rst
M Modules/posixmodule.c

diff --git a/Misc/NEWS.d/next/Build/2021-01-04-05-07-30.bpo-42692.OO11SN.rst b/Misc/NEWS.d/next/Build/2021-01-04-05-07-30.bpo-42692.OO11SN.rst
new file mode 100644
index 0000000000000..91582b945b803
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2021-01-04-05-07-30.bpo-42692.OO11SN.rst
@@ -0,0 +1 @@
+Fix __builtin_available check on older compilers. Patch by Joshua Root.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 13e3963bf510f..4468fd08e17a5 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -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, *)



More information about the Python-checkins mailing list