]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.8] bpo-41302: Support system libmpdec 2.5 for Python 3.8 (GH-21488)
authorFelix Yan <felixonmars@archlinux.org>
Wed, 15 Jul 2020 20:22:23 +0000 (04:22 +0800)
committerGitHub <noreply@github.com>
Wed, 15 Jul 2020 20:22:23 +0000 (22:22 +0200)
Define UNUSED only when mpdecimal.h doesn't define it. This would support
building with system libmpdec 2.5 while retaining compatibility with system
libmpdec 2.4 or the vendored copy.

Tested to build fine with either system libmpdec or the vendored one.

Misc/NEWS.d/next/Build/2020-07-15-17-56-32.bpo-41302.S3o-x9.rst [new file with mode: 0644]
Modules/_decimal/_decimal.c

diff --git a/Misc/NEWS.d/next/Build/2020-07-15-17-56-32.bpo-41302.S3o-x9.rst b/Misc/NEWS.d/next/Build/2020-07-15-17-56-32.bpo-41302.S3o-x9.rst
new file mode 100644 (file)
index 0000000..2f13017
--- /dev/null
@@ -0,0 +1 @@
+Enable building Python 3.8 with libmpdec-2.5.0 to ease maintenance for Linux distributions. Patch by Felix Yan.
\ No newline at end of file
index df7c6e254bcf29f863886dc5038c4dcc215c6f5f..eb1f1a01feeca8374b1e67adb045e8b1953e86f1 100644 (file)
 
 #define BOUNDS_CHECK(x, MIN, MAX) x = (x < MIN || MAX < x) ? MAX : x
 
+#ifndef UNUSED
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+  #define UNUSED __attribute__((unused))
+#else
+  #define UNUSED
+#endif
+#endif
 
 /* _Py_DEC_MINALLOC >= MPD_MINALLOC */
 #define _Py_DEC_MINALLOC 4