From aa012cc86b48119bfff36c8fac7702ee0fe29b38 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 14 Apr 2013 19:56:05 +0200 Subject: [PATCH] clean up dependencies of memoryview utility code snippets a bit to get rid of some 'unused function' C compiler warnings --- Cython/Compiler/MemoryView.py | 3 +-- Cython/Utility/MemoryView.pyx | 2 +- Cython/Utility/MemoryView_C.c | 29 ++++++++++++++++++----------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Cython/Compiler/MemoryView.py b/Cython/Compiler/MemoryView.py index 6181f95..e18c57f 100644 --- a/Cython/Compiler/MemoryView.py +++ b/Cython/Compiler/MemoryView.py @@ -916,8 +916,7 @@ memviewslice_init_code = load_memview_c_utility( context=dict(context, BUF_MAX_NDIMS=Options.buffer_max_dims), requires=[memviewslice_declare_code, Buffer.acquire_utility_code, - atomic_utility, - Buffer.typeinfo_compare_code], + atomic_utility], ) memviewslice_index_helpers = load_memview_c_utility("MemviewSliceIndex") diff --git a/Cython/Utility/MemoryView.pyx b/Cython/Utility/MemoryView.pyx index 583037f..c5163ad 100644 --- a/Cython/Utility/MemoryView.pyx +++ b/Cython/Utility/MemoryView.pyx @@ -621,7 +621,7 @@ cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeIn return result @cname('__pyx_memoryview_check') -cdef bint memoryview_check(object o): +cdef inline bint memoryview_check(object o): return isinstance(o, memoryview) cdef tuple _unellipsify(object index, int ndim): diff --git a/Cython/Utility/MemoryView_C.c b/Cython/Utility/MemoryView_C.c index e7e4834..85a71f1 100644 --- a/Cython/Utility/MemoryView_C.c +++ b/Cython/Utility/MemoryView_C.c @@ -93,16 +93,6 @@ static CYTHON_INLINE {{memviewslice_name}} {{funcname}}(PyObject *); #define __Pyx_IS_C_CONTIG 1 #define __Pyx_IS_F_CONTIG 2 -static int __Pyx_ValidateAndInit_memviewslice( - int *axes_specs, - int c_or_f_flag, - int buf_flags, - int ndim, - __Pyx_TypeInfo *dtype, - __Pyx_BufFmt_StackElem stack[], - __Pyx_memviewslice *memviewslice, - PyObject *original_obj); - static int __Pyx_init_memviewslice( struct __pyx_memoryview_obj *memview, int ndim, @@ -129,6 +119,7 @@ static CYTHON_INLINE char *__pyx_memviewslice_index_full( /////////////// ObjectToMemviewSlice /////////////// +//@requires: MemviewSliceValidateAndInit static CYTHON_INLINE {{memviewslice_name}} {{funcname}}(PyObject *obj) { {{memviewslice_name}} result = {{memslice_init}}; @@ -158,7 +149,20 @@ __pyx_fail: } -////////// MemviewSliceInit ////////// +/////////////// MemviewSliceValidateAndInit.proto /////////////// + +static int __Pyx_ValidateAndInit_memviewslice( + int *axes_specs, + int c_or_f_flag, + int buf_flags, + int ndim, + __Pyx_TypeInfo *dtype, + __Pyx_BufFmt_StackElem stack[], + __Pyx_memviewslice *memviewslice, + PyObject *original_obj); + +/////////////// MemviewSliceValidateAndInit /////////////// +//@requires: Buffer.c::TypeInfoCompare static int __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) @@ -368,6 +372,9 @@ no_fail: return retval; } + +////////// MemviewSliceInit ////////// + static int __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, int ndim, -- 2.7.4