summaryrefslogtreecommitdiffstats
path: root/Modules/_decimal
diff options
context:
space:
mode:
authorFelix Yan <felixonmars@archlinux.org>2020-07-15 12:14:11 (GMT)
committerGitHub <noreply@github.com>2020-07-15 12:14:11 (GMT)
commit015efdbef7454a522e88cd79ba2b4cd77a5fb2a2 (patch)
tree2a7242f42cb583fcd7623fbbcf426e8e08eed6f8 /Modules/_decimal
parent5a8d121a1f3ef5ad7c105ee378cc79a3eac0c7d4 (diff)
downloadcpython-015efdbef7454a522e88cd79ba2b4cd77a5fb2a2.zip
cpython-015efdbef7454a522e88cd79ba2b4cd77a5fb2a2.tar.gz
cpython-015efdbef7454a522e88cd79ba2b4cd77a5fb2a2.tar.bz2
bpo-41302: Fix build with system libmpdec (GH-21481)
Move definition of UNUSED from modified headers of libmpdec to _decimal.c itself. This makes the vendored source closer to the standalone library and fixes build with --with-system-libmpdec. Tested to build fine with either system libmpdec or the vendored one.
Diffstat (limited to 'Modules/_decimal')
-rw-r--r--Modules/_decimal/_decimal.c5
-rw-r--r--Modules/_decimal/libmpdec/mpdecimal.h6
2 files changed, 5 insertions, 6 deletions
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index ff7c647..fb4e020 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -56,6 +56,11 @@
#define BOUNDS_CHECK(x, MIN, MAX) x = (x < MIN || MAX < x) ? MAX : x
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
+ #define UNUSED __attribute__((unused))
+#else
+ #define UNUSED
+#endif
/* _Py_DEC_MINALLOC >= MPD_MINALLOC */
#define _Py_DEC_MINALLOC 4
diff --git a/Modules/_decimal/libmpdec/mpdecimal.h b/Modules/_decimal/libmpdec/mpdecimal.h
index 35ce429..5a24396 100644
--- a/Modules/_decimal/libmpdec/mpdecimal.h
+++ b/Modules/_decimal/libmpdec/mpdecimal.h
@@ -61,12 +61,6 @@ extern "C" {
#define MPD_HIDE_SYMBOLS_END
#endif
-#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
- #define UNUSED __attribute__((unused))
-#else
- #define UNUSED
-#endif
-
#if defined(_MSC_VER)
#include "vccompat.h"
#define EXTINLINE extern inline