diff options
author | Robert Bradshaw <robertwb@gmail.com> | 2016-05-17 15:21:30 -0700 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2016-07-15 08:14:07 +0200 |
commit | 9b42c5a12fed2270b6af2eb32299467456ee15cf (patch) | |
tree | c1903aa7e4b4fef85c3b68714ba122fb35c71313 | |
parent | 31a4969fed691f27805e37122fb3f7b85dfe8d9d (diff) | |
download | cython-9b42c5a12fed2270b6af2eb32299467456ee15cf.tar.gz |
Work around missing Cygwin truncl.
-rw-r--r-- | Cython/Compiler/Optimize.py | 7 | ||||
-rw-r--r-- | Cython/Utility/ModuleSetupCode.c | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 1b4e41b4d..9681bf7f0 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -2085,8 +2085,13 @@ class OptimizeBuiltinCalls(Visitor.NodeRefCleanupMixin, elif node.type.assignable_from(func_arg.type) or func_arg.type.is_float: return ExprNodes.TypecastNode(node.pos, operand=func_arg, type=node.type) elif func_arg.type.is_float and node.type.is_numeric: + if func_arg.type.math_h_modifier == 'l': + # Work around missing Cygwin definition. + truncl = '__Pyx_truncl' + else: + truncl = 'trunc' + func_arg.type.math_h_modifier return ExprNodes.PythonCapiCallNode( - node.pos, 'trunc' + func_arg.type.math_h_modifier, + node.pos, truncl, func_type=self.float_float_func_types[func_arg.type], args=[func_arg], py_name='int', diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index d5e72c777..ac4ad20b8 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -311,6 +311,12 @@ static CYTHON_INLINE float __PYX_NAN() { } #endif +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + /////////////// UtilityFunctionPredeclarations.proto /////////////// |