summaryrefslogtreecommitdiffstats
path: root/Modules/_decimal
diff options
context:
space:
mode:
authorFelix Yan <felixonmars@archlinux.org>2020-07-15 20:22:23 (GMT)
committerGitHub <noreply@github.com>2020-07-15 20:22:23 (GMT)
commit16eea45fbd3b7c3d1b222b7eb7a5d7ee427f70bd (patch)
treee0d98312741fc2fdf81709303b984ed66d4c5db4 /Modules/_decimal
parentf8055fb0f1054fce6a21047da39b92ae32416b80 (diff)
downloadcpython-16eea45fbd3b7c3d1b222b7eb7a5d7ee427f70bd.zip
cpython-16eea45fbd3b7c3d1b222b7eb7a5d7ee427f70bd.tar.gz
cpython-16eea45fbd3b7c3d1b222b7eb7a5d7ee427f70bd.tar.bz2
[3.8] bpo-41302: Support system libmpdec 2.5 for Python 3.8 (GH-21488)
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.
Diffstat (limited to 'Modules/_decimal')
-rw-r--r--Modules/_decimal/_decimal.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index df7c6e2..eb1f1a0 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -58,6 +58,13 @@
#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