summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-01-04 03:00:43 -0800
committerGitHub <noreply@github.com>2021-01-04 06:00:43 -0500
commiteedeaef1f22d27264ce9b031da80fe2485e85e69 (patch)
tree19a9ae32270df4fc0377144577ed89dbaba909d6
parent76489dd2998ac70ffb300d612792a7238c03438c (diff)
downloadcpython-git-eedeaef1f22d27264ce9b031da80fe2485e85e69.tar.gz
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 df21f502fdccec234282bf0a211af979fd23def4) Co-authored-by: Joshua Root <jmr@macports.org>
-rw-r--r--Misc/NEWS.d/next/Build/2021-01-04-05-07-30.bpo-42692.OO11SN.rst1
-rw-r--r--Modules/posixmodule.c8
2 files changed, 8 insertions, 1 deletions
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 0000000000..91582b945b
--- /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 d2ce8339e6..5e33502721 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -56,7 +56,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, *)