]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42692: fix __builtin_available check on older compilers (GH-23873) (GH-24090)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 4 Jan 2021 11:00:43 +0000 (03:00 -0800)
committerGitHub <noreply@github.com>
Mon, 4 Jan 2021 11:00:43 +0000 (06:00 -0500)
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>
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 d2ce8339e61f069f74eb559cc2fcd49844fd47c1..5e33502721c1929bd1d2a6f0567a3fabfce0d3c1 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, *)