Skip to content

Commit 8ca63f9

Browse files
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 015efdb) Co-authored-by: Felix Yan <[email protected]>
1 parent f323229 commit 8ca63f9

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Modules/_decimal/_decimal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@
5656

5757
#define BOUNDS_CHECK(x, MIN, MAX) x = (x < MIN || MAX < x) ? MAX : x
5858

59+
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
60+
#define UNUSED __attribute__((unused))
61+
#else
62+
#define UNUSED
63+
#endif
5964

6065
/* _Py_DEC_MINALLOC >= MPD_MINALLOC */
6166
#define _Py_DEC_MINALLOC 4

Modules/_decimal/libmpdec/mpdecimal.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ extern "C" {
6161
#define MPD_HIDE_SYMBOLS_END
6262
#endif
6363

64-
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
65-
#define UNUSED __attribute__((unused))
66-
#else
67-
#define UNUSED
68-
#endif
69-
7064
#if defined(_MSC_VER)
7165
#include "vccompat.h"
7266
#define EXTINLINE extern inline

0 commit comments

Comments
 (0)