From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 15 Jul 2020 13:01:10 +0000 (-0700) Subject: bpo-41302: Fix build with system libmpdec (GH-21481) X-Git-Tag: v3.9.0b5~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8ca63f95f769c31f65a996fe065ff6dcfb490bbe;p=thirdparty%2FPython%2Fcpython.git 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. (cherry picked from commit 015efdbef7454a522e88cd79ba2b4cd77a5fb2a2) Co-authored-by: Felix Yan --- diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c index ff7c647c2220..fb4e020f1260 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 108b76efa859..2815a8cde31d 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