summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuriy Chernyshov <georgthegreat@gmail.com>2022-03-22 01:21:09 +0300
committerStefan Behnel <stefan_ml@behnel.de>2022-03-21 23:26:03 +0100
commitef14c148ca2774e34350a270f52049142fcb1e1a (patch)
tree16d3ab7cc1df80d92890bea1e35e5aa825ddbfc0
parent2e38e2386b376bc2690df1da149e483cb824fea8 (diff)
downloadcython-ef14c148ca2774e34350a270f52049142fcb1e1a.tar.gz
Do not redefine _USE_MATH_DEFINES in generated code (GH-4690)
Unconditionally adding `/D_USE_MATH_DEFINES` via cmdline triggers `-Wmacro-redefined` in cython-generated code.
-rw-r--r--Cython/Utility/ModuleSetupCode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index f9009be09..738c17315 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -963,8 +963,10 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj
/////////////// MathInitCode ///////////////
-#if defined(WIN32) || defined(MS_WINDOWS)
- #define _USE_MATH_DEFINES
+#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
+ #if !defined(_USE_MATH_DEFINES)
+ #define _USE_MATH_DEFINES
+ #endif
#endif
#include <math.h>