cython-devel

changeset 2819:3bc6d034486a

INLINE -> CYTHON_INLINE to avoid conflicts
author Robert Bradshaw <robertwb@math.washington.edu>
date Mon Jan 25 22:47:09 2010 -0800 (2 years ago)
parents e9490c8034e1
children 105c661599c9
files Cython/Compiler/Buffer.py Cython/Compiler/Builtin.py Cython/Compiler/ExprNodes.py Cython/Compiler/ModuleNode.py Cython/Compiler/Nodes.py Cython/Compiler/Optimize.py Cython/Compiler/PyrexTypes.py
line diff
1.1 --- a/Cython/Compiler/Buffer.py Sun Jan 24 16:47:16 2010 +0100 1.2 +++ b/Cython/Compiler/Buffer.py Mon Jan 25 22:47:09 2010 -0800 1.3 @@ -446,9 +446,9 @@ 1.4 proto.putln("#define %s(type, buf, %s) (type)(%s_imp(buf, %s))" % (name, macroargs, name, macroargs)) 1.5 1.6 funcargs = ", ".join(["Py_ssize_t i%d, Py_ssize_t s%d, Py_ssize_t o%d" % (i, i, i) for i in range(nd)]) 1.7 - proto.putln("static INLINE void* %s_imp(void* buf, %s);" % (name, funcargs)) 1.8 + proto.putln("static CYTHON_INLINE void* %s_imp(void* buf, %s);" % (name, funcargs)) 1.9 defin.putln(dedent(""" 1.10 - static INLINE void* %s_imp(void* buf, %s) { 1.11 + static CYTHON_INLINE void* %s_imp(void* buf, %s) { 1.12 char* ptr = (char*)buf; 1.13 """) % (name, funcargs) + "".join([dedent("""\ 1.14 ptr += s%d * i%d; 1.15 @@ -723,10 +723,10 @@ 1.16 } __Pyx_BufFmt_StackElem; 1.17 1.18 1.19 -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); 1.20 +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); 1.21 static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); 1.22 """, impl=""" 1.23 -static INLINE int __Pyx_IsLittleEndian(void) { 1.24 +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { 1.25 unsigned int n = 1; 1.26 return *(unsigned char*)(&n) != 0; 1.27 } 1.28 @@ -1123,7 +1123,7 @@ 1.29 } 1.30 } 1.31 1.32 -static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { 1.33 +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { 1.34 buf->buf = NULL; 1.35 buf->obj = NULL; 1.36 buf->strides = __Pyx_zeros; 1.37 @@ -1164,7 +1164,7 @@ 1.38 return -1; 1.39 } 1.40 1.41 -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { 1.42 +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { 1.43 if (info->buf == NULL) return; 1.44 if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; 1.45 __Pyx_ReleaseBuffer(info);
2.1 --- a/Cython/Compiler/Builtin.py Sun Jan 24 16:47:16 2010 +0100 2.2 +++ b/Cython/Compiler/Builtin.py Mon Jan 25 22:47:09 2010 -0800 2.3 @@ -294,19 +294,19 @@ 2.4 #define PySet_Pop(set) \\ 2.5 PyObject_CallMethod(set, (char *)"pop", NULL) 2.6 2.7 -static INLINE int PySet_Clear(PyObject *set) { 2.8 +static CYTHON_INLINE int PySet_Clear(PyObject *set) { 2.9 PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL); 2.10 if (!ret) return -1; 2.11 Py_DECREF(ret); return 0; 2.12 } 2.13 2.14 -static INLINE int PySet_Discard(PyObject *set, PyObject *key) { 2.15 +static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) { 2.16 PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key); 2.17 if (!ret) return -1; 2.18 Py_DECREF(ret); return 0; 2.19 } 2.20 2.21 -static INLINE int PySet_Add(PyObject *set, PyObject *key) { 2.22 +static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) { 2.23 PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key); 2.24 if (!ret) return -1; 2.25 Py_DECREF(ret); return 0;
3.1 --- a/Cython/Compiler/ExprNodes.py Sun Jan 24 16:47:16 2010 +0100 3.2 +++ b/Cython/Compiler/ExprNodes.py Mon Jan 25 22:47:09 2010 -0800 3.3 @@ -5385,8 +5385,8 @@ 3.4 3.5 contians_utility_code = UtilityCode( 3.6 proto=""" 3.7 -static INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; } 3.8 -static INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { 3.9 +static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; } 3.10 +static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { 3.11 return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b); 3.12 } 3.13 """) 3.14 @@ -6113,10 +6113,10 @@ 3.15 3.16 type_test_utility_code = UtilityCode( 3.17 proto = """ 3.18 -static INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ 3.19 -""", 3.20 -impl = """ 3.21 -static INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { 3.22 +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ 3.23 +""", 3.24 +impl = """ 3.25 +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { 3.26 if (unlikely(!type)) { 3.27 PyErr_Format(PyExc_SystemError, "Missing type object"); 3.28 return 0; 3.29 @@ -6197,7 +6197,7 @@ 3.30 getitem_int_utility_code = UtilityCode( 3.31 proto = """ 3.32 3.33 -static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { 3.34 +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { 3.35 PyObject *r; 3.36 if (!j) return NULL; 3.37 r = PyObject_GetItem(o, j); 3.38 @@ -6211,7 +6211,7 @@ 3.39 __Pyx_GetItemInt_%(type)s_Fast(o, i, size <= sizeof(long)) : \\ 3.40 __Pyx_GetItemInt_Generic(o, to_py_func(i))) 3.41 3.42 -static INLINE PyObject *__Pyx_GetItemInt_%(type)s_Fast(PyObject *o, Py_ssize_t i, int fits_long) { 3.43 +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_%(type)s_Fast(PyObject *o, Py_ssize_t i, int fits_long) { 3.44 if (likely(o != Py_None)) { 3.45 if (likely((0 <= i) & (i < Py%(type)s_GET_SIZE(o)))) { 3.46 PyObject *r = Py%(type)s_GET_ITEM(o, i); 3.47 @@ -6233,7 +6233,7 @@ 3.48 __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \\ 3.49 __Pyx_GetItemInt_Generic(o, to_py_func(i))) 3.50 3.51 -static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { 3.52 +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { 3.53 PyObject *r; 3.54 if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { 3.55 r = PyList_GET_ITEM(o, i); 3.56 @@ -6265,7 +6265,7 @@ 3.57 __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \\ 3.58 __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) 3.59 3.60 -static INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { 3.61 +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { 3.62 int r; 3.63 if (!j) return -1; 3.64 r = PyObject_SetItem(o, j, v); 3.65 @@ -6273,7 +6273,7 @@ 3.66 return r; 3.67 } 3.68 3.69 -static INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) { 3.70 +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) { 3.71 if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { 3.72 Py_INCREF(v); 3.73 Py_DECREF(PyList_GET_ITEM(o, i)); 3.74 @@ -6299,7 +6299,7 @@ 3.75 __Pyx_DelItemInt_Fast(o, i, size <= sizeof(long)) : \\ 3.76 __Pyx_DelItem_Generic(o, to_py_func(i))) 3.77 3.78 -static INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) { 3.79 +static CYTHON_INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) { 3.80 int r; 3.81 if (!j) return -1; 3.82 r = PyObject_DelItem(o, j); 3.83 @@ -6307,7 +6307,7 @@ 3.84 return r; 3.85 } 3.86 3.87 -static INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { 3.88 +static CYTHON_INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { 3.89 if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && likely(i >= 0)) 3.90 return PySequence_DelItem(o, i); 3.91 else { 3.92 @@ -6323,50 +6323,50 @@ 3.93 3.94 raise_noneattr_error_utility_code = UtilityCode( 3.95 proto = """ 3.96 -static INLINE void __Pyx_RaiseNoneAttributeError(const char* attrname); 3.97 +static CYTHON_INLINE void __Pyx_RaiseNoneAttributeError(const char* attrname); 3.98 """, 3.99 impl = ''' 3.100 -static INLINE void __Pyx_RaiseNoneAttributeError(const char* attrname) { 3.101 +static CYTHON_INLINE void __Pyx_RaiseNoneAttributeError(const char* attrname) { 3.102 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", attrname); 3.103 } 3.104 ''') 3.105 3.106 raise_noneindex_error_utility_code = UtilityCode( 3.107 proto = """ 3.108 -static INLINE void __Pyx_RaiseNoneIndexingError(void); 3.109 +static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void); 3.110 """, 3.111 impl = ''' 3.112 -static INLINE void __Pyx_RaiseNoneIndexingError(void) { 3.113 +static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) { 3.114 PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable"); 3.115 } 3.116 ''') 3.117 3.118 raise_none_iter_error_utility_code = UtilityCode( 3.119 proto = """ 3.120 -static INLINE void __Pyx_RaiseNoneNotIterableError(void); 3.121 +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); 3.122 """, 3.123 impl = ''' 3.124 -static INLINE void __Pyx_RaiseNoneNotIterableError(void) { 3.125 +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { 3.126 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); 3.127 } 3.128 ''') 3.129 3.130 raise_too_many_values_to_unpack = UtilityCode( 3.131 proto = """ 3.132 -static INLINE void __Pyx_RaiseTooManyValuesError(void); 3.133 +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); 3.134 """, 3.135 impl = ''' 3.136 -static INLINE void __Pyx_RaiseTooManyValuesError(void) { 3.137 +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { 3.138 PyErr_SetString(PyExc_ValueError, "too many values to unpack"); 3.139 } 3.140 ''') 3.141 3.142 raise_need_more_values_to_unpack = UtilityCode( 3.143 proto = """ 3.144 -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); 3.145 +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); 3.146 """, 3.147 impl = ''' 3.148 -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { 3.149 +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { 3.150 PyErr_Format(PyExc_ValueError, 3.151 #if PY_VERSION_HEX < 0x02050000 3.152 "need more than %d value%s to unpack", (int)index, 3.153 @@ -6464,10 +6464,10 @@ 3.154 3.155 int_pow_utility_code = UtilityCode( 3.156 proto=""" 3.157 -static INLINE %(type)s %(func_name)s(%(type)s, %(type)s); /* proto */ 3.158 +static CYTHON_INLINE %(type)s %(func_name)s(%(type)s, %(type)s); /* proto */ 3.159 """, 3.160 impl=""" 3.161 -static INLINE %(type)s %(func_name)s(%(type)s b, %(type)s e) { 3.162 +static CYTHON_INLINE %(type)s %(func_name)s(%(type)s b, %(type)s e) { 3.163 %(type)s t = b; 3.164 switch (e) { 3.165 case 3: 3.166 @@ -6494,10 +6494,10 @@ 3.167 3.168 div_int_utility_code = UtilityCode( 3.169 proto=""" 3.170 -static INLINE %(type)s __Pyx_div_%(type_name)s(%(type)s, %(type)s); /* proto */ 3.171 +static CYTHON_INLINE %(type)s __Pyx_div_%(type_name)s(%(type)s, %(type)s); /* proto */ 3.172 """, 3.173 impl=""" 3.174 -static INLINE %(type)s __Pyx_div_%(type_name)s(%(type)s a, %(type)s b) { 3.175 +static CYTHON_INLINE %(type)s __Pyx_div_%(type_name)s(%(type)s a, %(type)s b) { 3.176 %(type)s q = a / b; 3.177 %(type)s r = a - q*b; 3.178 q -= ((r != 0) & ((r ^ b) < 0)); 3.179 @@ -6507,10 +6507,10 @@ 3.180 3.181 mod_int_utility_code = UtilityCode( 3.182 proto=""" 3.183 -static INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s, %(type)s); /* proto */ 3.184 +static CYTHON_INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s, %(type)s); /* proto */ 3.185 """, 3.186 impl=""" 3.187 -static INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s a, %(type)s b) { 3.188 +static CYTHON_INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s a, %(type)s b) { 3.189 %(type)s r = a %% b; 3.190 r += ((r != 0) & ((r ^ b) < 0)) * b; 3.191 return r; 3.192 @@ -6519,10 +6519,10 @@ 3.193 3.194 mod_float_utility_code = UtilityCode( 3.195 proto=""" 3.196 -static INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s, %(type)s); /* proto */ 3.197 +static CYTHON_INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s, %(type)s); /* proto */ 3.198 """, 3.199 impl=""" 3.200 -static INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s a, %(type)s b) { 3.201 +static CYTHON_INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s a, %(type)s b) { 3.202 %(type)s r = fmod%(math_h_modifier)s(a, b); 3.203 r += ((r != 0) & ((r < 0) ^ (b < 0))) * b; 3.204 return r;
4.1 --- a/Cython/Compiler/ModuleNode.py Sun Jan 24 16:47:16 2010 +0100 4.2 +++ b/Cython/Compiler/ModuleNode.py Mon Jan 25 22:47:09 2010 -0800 4.3 @@ -2111,10 +2111,10 @@ 4.4 4.5 streq_utility_code = UtilityCode( 4.6 proto = """ 4.7 -static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/ 4.8 +static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/ 4.9 """, 4.10 impl = """ 4.11 -static INLINE int __Pyx_StrEq(const char *s1, const char *s2) { 4.12 +static CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) { 4.13 while (*s1 != '\\0' && *s1 == *s2) { s1++; s2++; } 4.14 return *s1 == *s2; 4.15 }
5.1 --- a/Cython/Compiler/Nodes.py Sun Jan 24 16:47:16 2010 +0100 5.2 +++ b/Cython/Compiler/Nodes.py Mon Jan 25 22:47:09 2010 -0800 5.3 @@ -1463,6 +1463,8 @@ 5.4 storage_class = "" 5.5 else: 5.6 storage_class = "static " 5.7 + if 'inline' in self.modifiers: 5.8 + self.modifiers[self.modifiers.index('inline')] = 'cython_inline' 5.9 code.putln("%s%s %s {" % ( 5.10 storage_class, 5.11 ' '.join(self.modifiers).upper(), # macro forms 5.12 @@ -4815,13 +4817,13 @@ 5.13 5.14 utility_function_predeclarations = \ 5.15 """ 5.16 -#ifndef INLINE 5.17 +#ifndef CYTHON_INLINE 5.18 #if defined(__GNUC__) 5.19 - #define INLINE __inline__ 5.20 + #define CYTHON_INLINE __inline__ 5.21 #elif defined(_MSC_VER) 5.22 - #define INLINE __inline 5.23 + #define CYTHON_INLINE __inline 5.24 #else 5.25 - #define INLINE 5.26 + #define CYTHON_INLINE 5.27 #endif 5.28 #endif 5.29 5.30 @@ -5009,11 +5011,11 @@ 5.31 5.32 restore_exception_utility_code = UtilityCode( 5.33 proto = """ 5.34 -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ 5.35 -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ 5.36 -""", 5.37 -impl = """ 5.38 -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { 5.39 +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ 5.40 +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ 5.41 +""", 5.42 +impl = """ 5.43 +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { 5.44 PyObject *tmp_type, *tmp_value, *tmp_tb; 5.45 PyThreadState *tstate = PyThreadState_GET(); 5.46 5.47 @@ -5028,7 +5030,7 @@ 5.48 Py_XDECREF(tmp_tb); 5.49 } 5.50 5.51 -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { 5.52 +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { 5.53 PyThreadState *tstate = PyThreadState_GET(); 5.54 *type = tstate->curexc_type; 5.55 *value = tstate->curexc_value; 5.56 @@ -5248,11 +5250,11 @@ 5.57 5.58 reset_exception_utility_code = UtilityCode( 5.59 proto = """ 5.60 -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ 5.61 +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ 5.62 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ 5.63 """, 5.64 impl = """ 5.65 -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { 5.66 +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { 5.67 PyThreadState *tstate = PyThreadState_GET(); 5.68 *type = tstate->exc_type; 5.69 *value = tstate->exc_value; 5.70 @@ -5351,10 +5353,10 @@ 5.71 5.72 raise_keyword_required_utility_code = UtilityCode( 5.73 proto = """ 5.74 -static INLINE void __Pyx_RaiseKeywordRequired(const char* func_name, PyObject* kw_name); /*proto*/ 5.75 -""", 5.76 -impl = """ 5.77 -static INLINE void __Pyx_RaiseKeywordRequired( 5.78 +static CYTHON_INLINE void __Pyx_RaiseKeywordRequired(const char* func_name, PyObject* kw_name); /*proto*/ 5.79 +""", 5.80 +impl = """ 5.81 +static CYTHON_INLINE void __Pyx_RaiseKeywordRequired( 5.82 const char* func_name, 5.83 PyObject* kw_name) 5.84 { 5.85 @@ -5396,11 +5398,11 @@ 5.86 5.87 keyword_string_check_utility_code = UtilityCode( 5.88 proto = """ 5.89 -static INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, 5.90 +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, 5.91 const char* function_name, int kw_allowed); /*proto*/ 5.92 """, 5.93 impl = """ 5.94 -static INLINE int __Pyx_CheckKeywordStrings( 5.95 +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( 5.96 PyObject *kwdict, 5.97 const char* function_name, 5.98 int kw_allowed)
6.1 --- a/Cython/Compiler/Optimize.py Sun Jan 24 16:47:16 2010 +0100 6.2 +++ b/Cython/Compiler/Optimize.py Mon Jan 25 22:47:09 2010 -0800 6.3 @@ -1583,7 +1583,7 @@ 6.4 6.5 append_utility_code = UtilityCode( 6.6 proto = """ 6.7 -static INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { 6.8 +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { 6.9 if (likely(PyList_CheckExact(L))) { 6.10 if (PyList_Append(L, x) < 0) return NULL; 6.11 Py_INCREF(Py_None); 6.12 @@ -1605,7 +1605,7 @@ 6.13 6.14 pop_utility_code = UtilityCode( 6.15 proto = """ 6.16 -static INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) { 6.17 +static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) { 6.18 if (likely(PyList_CheckExact(L)) 6.19 /* Check that both the size is positive and no reallocation shrinking needs to be done. */ 6.20 && likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) { 6.21 @@ -1721,7 +1721,7 @@ 6.22 6.23 tpnew_utility_code = UtilityCode( 6.24 proto = """ 6.25 -static INLINE PyObject* __Pyx_tp_new(PyObject* type_obj) { 6.26 +static CYTHON_INLINE PyObject* __Pyx_tp_new(PyObject* type_obj) { 6.27 return (PyObject*) (((PyTypeObject*)(type_obj))->tp_new( 6.28 (PyTypeObject*)(type_obj), %(TUPLE)s, NULL)); 6.29 }
7.1 --- a/Cython/Compiler/PyrexTypes.py Sun Jan 24 16:47:16 2010 +0100 7.2 +++ b/Cython/Compiler/PyrexTypes.py Mon Jan 25 22:47:09 2010 -0800 7.3 @@ -638,10 +638,10 @@ 7.4 7.5 c_int_from_py_function = UtilityCode( 7.6 proto=""" 7.7 -static INLINE %(type)s __Pyx_PyInt_As%(SignWord)s%(TypeName)s(PyObject *); 7.8 +static CYTHON_INLINE %(type)s __Pyx_PyInt_As%(SignWord)s%(TypeName)s(PyObject *); 7.9 """, 7.10 impl=""" 7.11 -static INLINE %(type)s __Pyx_PyInt_As%(SignWord)s%(TypeName)s(PyObject* x) { 7.12 +static CYTHON_INLINE %(type)s __Pyx_PyInt_As%(SignWord)s%(TypeName)s(PyObject* x) { 7.13 const %(type)s neg_one = (%(type)s)-1, const_zero = 0; 7.14 const int is_unsigned = neg_one > const_zero; 7.15 if (sizeof(%(type)s) < sizeof(long)) { 7.16 @@ -663,10 +663,10 @@ 7.17 7.18 c_long_from_py_function = UtilityCode( 7.19 proto=""" 7.20 -static INLINE %(type)s __Pyx_PyInt_As%(SignWord)s%(TypeName)s(PyObject *); 7.21 +static CYTHON_INLINE %(type)s __Pyx_PyInt_As%(SignWord)s%(TypeName)s(PyObject *); 7.22 """, 7.23 impl=""" 7.24 -static INLINE %(type)s __Pyx_PyInt_As%(SignWord)s%(TypeName)s(PyObject* x) { 7.25 +static CYTHON_INLINE %(type)s __Pyx_PyInt_As%(SignWord)s%(TypeName)s(PyObject* x) { 7.26 const %(type)s neg_one = (%(type)s)-1, const_zero = 0; 7.27 const int is_unsigned = neg_one > const_zero; 7.28 #if PY_VERSION_HEX < 0x03000000 7.29 @@ -704,10 +704,10 @@ 7.30 7.31 c_typedef_int_from_py_function = UtilityCode( 7.32 proto=""" 7.33 -static INLINE %(type)s __Pyx_PyInt_from_py_%(TypeName)s(PyObject *); 7.34 +static CYTHON_INLINE %(type)s __Pyx_PyInt_from_py_%(TypeName)s(PyObject *); 7.35 """, 7.36 impl=""" 7.37 -static INLINE %(type)s __Pyx_PyInt_from_py_%(TypeName)s(PyObject* x) { 7.38 +static CYTHON_INLINE %(type)s __Pyx_PyInt_from_py_%(TypeName)s(PyObject* x) { 7.39 const %(type)s neg_one = (%(type)s)-1, const_zero = 0; 7.40 const int is_unsigned = neg_one > const_zero; 7.41 if (sizeof(%(type)s) == sizeof(char)) { 7.42 @@ -751,10 +751,10 @@ 7.43 7.44 c_typedef_int_to_py_function = UtilityCode( 7.45 proto=""" 7.46 -static INLINE PyObject *__Pyx_PyInt_to_py_%(TypeName)s(%(type)s); 7.47 +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_%(TypeName)s(%(type)s); 7.48 """, 7.49 impl=""" 7.50 -static INLINE PyObject *__Pyx_PyInt_to_py_%(TypeName)s(%(type)s val) { 7.51 +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_%(TypeName)s(%(type)s val) { 7.52 const %(type)s neg_one = (%(type)s)-1, const_zero = 0; 7.53 const int is_unsigned = neg_one > const_zero; 7.54 if (sizeof(%(type)s) < sizeof(long)) { 7.55 @@ -1111,21 +1111,21 @@ 7.56 complex_from_parts_utility_code = UtilityCode( 7.57 proto_block='utility_code_proto', 7.58 proto=""" 7.59 -static INLINE %(type)s %(type_name)s_from_parts(%(real_type)s, %(real_type)s); 7.60 +static CYTHON_INLINE %(type)s %(type_name)s_from_parts(%(real_type)s, %(real_type)s); 7.61 """, 7.62 impl=""" 7.63 #if CYTHON_CCOMPLEX 7.64 #ifdef __cplusplus 7.65 - static INLINE %(type)s %(type_name)s_from_parts(%(real_type)s x, %(real_type)s y) { 7.66 + static CYTHON_INLINE %(type)s %(type_name)s_from_parts(%(real_type)s x, %(real_type)s y) { 7.67 return ::std::complex< %(real_type)s >(x, y); 7.68 } 7.69 #else 7.70 - static INLINE %(type)s %(type_name)s_from_parts(%(real_type)s x, %(real_type)s y) { 7.71 + static CYTHON_INLINE %(type)s %(type_name)s_from_parts(%(real_type)s x, %(real_type)s y) { 7.72 return x + y*(%(type)s)_Complex_I; 7.73 } 7.74 #endif 7.75 #else 7.76 - static INLINE %(type)s %(type_name)s_from_parts(%(real_type)s x, %(real_type)s y) { 7.77 + static CYTHON_INLINE %(type)s %(type_name)s_from_parts(%(real_type)s x, %(real_type)s y) { 7.78 %(type)s z; 7.79 z.real = x; 7.80 z.imag = y; 7.81 @@ -1177,65 +1177,65 @@ 7.82 /*#define __Pyx_c_abs%(m)s(z) (cabs%(m)s(z))*/ 7.83 #endif 7.84 #else 7.85 - static INLINE int __Pyx_c_eq%(m)s(%(type)s, %(type)s); 7.86 - static INLINE %(type)s __Pyx_c_sum%(m)s(%(type)s, %(type)s); 7.87 - static INLINE %(type)s __Pyx_c_diff%(m)s(%(type)s, %(type)s); 7.88 - static INLINE %(type)s __Pyx_c_prod%(m)s(%(type)s, %(type)s); 7.89 - static INLINE %(type)s __Pyx_c_quot%(m)s(%(type)s, %(type)s); 7.90 - static INLINE %(type)s __Pyx_c_neg%(m)s(%(type)s); 7.91 - static INLINE int __Pyx_c_is_zero%(m)s(%(type)s); 7.92 - static INLINE %(type)s __Pyx_c_conj%(m)s(%(type)s); 7.93 - /*static INLINE %(real_type)s __Pyx_c_abs%(m)s(%(type)s);*/ 7.94 + static CYTHON_INLINE int __Pyx_c_eq%(m)s(%(type)s, %(type)s); 7.95 + static CYTHON_INLINE %(type)s __Pyx_c_sum%(m)s(%(type)s, %(type)s); 7.96 + static CYTHON_INLINE %(type)s __Pyx_c_diff%(m)s(%(type)s, %(type)s); 7.97 + static CYTHON_INLINE %(type)s __Pyx_c_prod%(m)s(%(type)s, %(type)s); 7.98 + static CYTHON_INLINE %(type)s __Pyx_c_quot%(m)s(%(type)s, %(type)s); 7.99 + static CYTHON_INLINE %(type)s __Pyx_c_neg%(m)s(%(type)s); 7.100 + static CYTHON_INLINE int __Pyx_c_is_zero%(m)s(%(type)s); 7.101 + static CYTHON_INLINE %(type)s __Pyx_c_conj%(m)s(%(type)s); 7.102 + /*static CYTHON_INLINE %(real_type)s __Pyx_c_abs%(m)s(%(type)s);*/ 7.103 #endif 7.104 """, 7.105 impl=""" 7.106 #if CYTHON_CCOMPLEX 7.107 #else 7.108 - static INLINE int __Pyx_c_eq%(m)s(%(type)s a, %(type)s b) { 7.109 + static CYTHON_INLINE int __Pyx_c_eq%(m)s(%(type)s a, %(type)s b) { 7.110 return (a.real == b.real) && (a.imag == b.imag); 7.111 } 7.112 - static INLINE %(type)s __Pyx_c_sum%(m)s(%(type)s a, %(type)s b) { 7.113 + static CYTHON_INLINE %(type)s __Pyx_c_sum%(m)s(%(type)s a, %(type)s b) { 7.114 %(type)s z; 7.115 z.real = a.real + b.real; 7.116 z.imag = a.imag + b.imag; 7.117 return z; 7.118 } 7.119 - static INLINE %(type)s __Pyx_c_diff%(m)s(%(type)s a, %(type)s b) { 7.120 + static CYTHON_INLINE %(type)s __Pyx_c_diff%(m)s(%(type)s a, %(type)s b) { 7.121 %(type)s z; 7.122 z.real = a.real - b.real; 7.123 z.imag = a.imag - b.imag; 7.124 return z; 7.125 } 7.126 - static INLINE %(type)s __Pyx_c_prod%(m)s(%(type)s a, %(type)s b) { 7.127 + static CYTHON_INLINE %(type)s __Pyx_c_prod%(m)s(%(type)s a, %(type)s b) { 7.128 %(type)s z; 7.129 z.real = a.real * b.real - a.imag * b.imag; 7.130 z.imag = a.real * b.imag + a.imag * b.real; 7.131 return z; 7.132 } 7.133 - static INLINE %(type)s __Pyx_c_quot%(m)s(%(type)s a, %(type)s b) { 7.134 + static CYTHON_INLINE %(type)s __Pyx_c_quot%(m)s(%(type)s a, %(type)s b) { 7.135 %(type)s z; 7.136 %(real_type)s denom = b.real * b.real + b.imag * b.imag; 7.137 z.real = (a.real * b.real + a.imag * b.imag) / denom; 7.138 z.imag = (a.imag * b.real - a.real * b.imag) / denom; 7.139 return z; 7.140 } 7.141 - static INLINE %(type)s __Pyx_c_neg%(m)s(%(type)s a) { 7.142 + static CYTHON_INLINE %(type)s __Pyx_c_neg%(m)s(%(type)s a) { 7.143 %(type)s z; 7.144 z.real = -a.real; 7.145 z.imag = -a.imag; 7.146 return z; 7.147 } 7.148 - static INLINE int __Pyx_c_is_zero%(m)s(%(type)s a) { 7.149 + static CYTHON_INLINE int __Pyx_c_is_zero%(m)s(%(type)s a) { 7.150 return (a.real == 0) && (a.imag == 0); 7.151 } 7.152 - static INLINE %(type)s __Pyx_c_conj%(m)s(%(type)s a) { 7.153 + static CYTHON_INLINE %(type)s __Pyx_c_conj%(m)s(%(type)s a) { 7.154 %(type)s z; 7.155 z.real = a.real; 7.156 z.imag = -a.imag; 7.157 return z; 7.158 } 7.159 /* 7.160 - static INLINE %(real_type)s __Pyx_c_abs%(m)s(%(type)s z) { 7.161 + static CYTHON_INLINE %(real_type)s __Pyx_c_abs%(m)s(%(type)s z) { 7.162 #if HAVE_HYPOT 7.163 return hypot%(m)s(z.real, z.imag); 7.164 #else 7.165 @@ -2127,8 +2127,8 @@ 7.166 #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) 7.167 7.168 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) 7.169 -static INLINE int __Pyx_PyObject_IsTrue(PyObject*); 7.170 -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); 7.171 +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); 7.172 +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); 7.173 7.174 #if !defined(T_PYSSIZET) 7.175 #if PY_VERSION_HEX < 0x02050000 7.176 @@ -2192,9 +2192,9 @@ 7.177 #endif 7.178 #endif 7.179 7.180 -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); 7.181 -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); 7.182 -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); 7.183 +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); 7.184 +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); 7.185 +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); 7.186 7.187 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) 7.188 7.189 @@ -2203,13 +2203,13 @@ 7.190 type_conversion_functions = """ 7.191 /* Type Conversion Functions */ 7.192 7.193 -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { 7.194 +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { 7.195 if (x == Py_True) return 1; 7.196 else if ((x == Py_False) | (x == Py_None)) return 0; 7.197 else return PyObject_IsTrue(x); 7.198 } 7.199 7.200 -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { 7.201 +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { 7.202 PyNumberMethods *m; 7.203 const char *name = NULL; 7.204 PyObject *res = NULL; 7.205 @@ -2255,7 +2255,7 @@ 7.206 return res; 7.207 } 7.208 7.209 -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { 7.210 +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { 7.211 Py_ssize_t ival; 7.212 PyObject* x = PyNumber_Index(b); 7.213 if (!x) return -1; 7.214 @@ -2264,7 +2264,7 @@ 7.215 return ival; 7.216 } 7.217 7.218 -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { 7.219 +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { 7.220 #if PY_VERSION_HEX < 0x02050000 7.221 if (ival <= LONG_MAX) 7.222 return PyInt_FromLong((long)ival); 7.223 @@ -2278,7 +2278,7 @@ 7.224 #endif 7.225 } 7.226 7.227 -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { 7.228 +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { 7.229 unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); 7.230 if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { 7.231 return (size_t)-1;