summaryrefslogtreecommitdiffstats
path: root/Include/pyport.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-11-13 14:38:17 (GMT)
committerGitHub <noreply@github.com>2020-11-13 14:38:17 (GMT)
commitb3b98082c5431e77c64cab2c85525a804436b505 (patch)
tree5ef06418d69d6515b65e049e96e92ea5aadee0ea /Include/pyport.h
parentd96a7a83133250377219227b5cfab4dbdddc5d3a (diff)
downloadcpython-b3b98082c5431e77c64cab2c85525a804436b505.zip
cpython-b3b98082c5431e77c64cab2c85525a804436b505.tar.gz
cpython-b3b98082c5431e77c64cab2c85525a804436b505.tar.bz2
bpo-41617: Add _Py__has_builtin() macro (GH-23260)
Fix building pycore_bitutils.h internal header on old clang version without __builtin_bswap16() (ex: Xcode 4.6.3 on Mac OS X 10.7). Add a new private _Py__has_builtin() macro to check for availability of a preprocessor builtin function. Co-Authored-By: Joshua Root <jmr@macports.org> Co-authored-by: Joshua Root <jmr@macports.org>
Diffstat (limited to 'Include/pyport.h')
-rw-r--r--Include/pyport.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index 79fc7c4..6687849 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -869,4 +869,16 @@ extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler;
# define _Py_NO_RETURN
#endif
+
+// Preprocessor check for a builtin preprocessor function. Always return 0
+// if __has_builtin() macro is not defined.
+//
+// __has_builtin() is available on clang and GCC 10.
+#ifdef __has_builtin
+# define _Py__has_builtin(x) __has_builtin(x)
+#else
+# define _Py__has_builtin(x) 0
+#endif
+
+
#endif /* Py_PYPORT_H */