]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42692: fix __builtin_available check on older compilers (GH-23873)
authorJoshua Root <jmr@macports.org>
Mon, 4 Jan 2021 10:36:58 +0000 (21:36 +1100)
committerGitHub <noreply@github.com>
Mon, 4 Jan 2021 10:36:58 +0000 (02:36 -0800)
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
Misc/NEWS.d/next/Build/2021-01-04-05-07-30.bpo-42692.OO11SN.rst [new file with mode: 0644]
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 (file)
index 0000000..91582b9
--- /dev/null
@@ -0,0 +1 @@
+Fix __builtin_available check on older compilers. Patch by Joshua Root.
index 13e3963bf510f64727e7c3ccca857bff987df725..4468fd08e17a53d1fec847694df1d074a2a4975e 100644 (file)
  */
 #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, *)