diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2014-02-22 08:32:08 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2014-02-22 08:32:08 -0700 |
commit | bf5fd54026a54358dc1602446af8b406bb51d99c (patch) | |
tree | 3a9731d07b725122295c8ecc8e45de2d6bbc4475 | |
parent | dd857489fcaa745ea569c523249fe37537bfe280 (diff) | |
parent | 4dcfcc5f58140c5f09fde8fae90720e32f7d3096 (diff) | |
download | numpy-bf5fd54026a54358dc1602446af8b406bb51d99c.tar.gz |
Merge pull request #4349 from juliantaylor/warning-maint
MAINT: fix a bunch of compiler warnings
-rw-r--r-- | numpy/core/src/multiarray/arrayobject.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/descriptor.c | 4 | ||||
-rw-r--r-- | numpy/core/src/multiarray/dtype_transfer.c | 12 | ||||
-rw-r--r-- | numpy/core/src/multiarray/item_selection.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/mapping.c | 11 | ||||
-rw-r--r-- | numpy/core/src/multiarray/multiarraymodule.c | 5 | ||||
-rw-r--r-- | numpy/core/src/multiarray/number.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/refcount.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/scalarapi.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/scalartypes.c.src | 5 | ||||
-rw-r--r-- | numpy/core/src/private/npy_binsearch.h.src | 2 | ||||
-rw-r--r-- | numpy/core/src/private/ufunc_override.h | 3 | ||||
-rw-r--r-- | numpy/core/src/umath/loops.c.src | 4 | ||||
-rw-r--r-- | numpy/core/src/umath/simd.inc.src | 10 |
14 files changed, 39 insertions, 27 deletions
diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c index bf843f7f8..55b7c8023 100644 --- a/numpy/core/src/multiarray/arrayobject.c +++ b/numpy/core/src/multiarray/arrayobject.c @@ -1684,7 +1684,7 @@ array_alloc(PyTypeObject *type, Py_ssize_t NPY_UNUSED(nitems)) return obj; } -static PyObject * +static void array_free(PyObject * v) { /* avoid same deallocator as PyBaseObject, see gentype_free */ diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c index 77c74bce6..b68a5af1e 100644 --- a/numpy/core/src/multiarray/descriptor.c +++ b/numpy/core/src/multiarray/descriptor.c @@ -1578,7 +1578,7 @@ PyArray_DescrNew(PyArray_Descr *base) newdescr->subarray = PyArray_malloc(sizeof(PyArray_ArrayDescr)); if (newdescr->subarray == NULL) { Py_DECREF(newdescr); - return PyErr_NoMemory(); + return (PyArray_Descr *)PyErr_NoMemory(); } memcpy(newdescr->subarray, base->subarray, sizeof(PyArray_ArrayDescr)); Py_INCREF(newdescr->subarray->shape); @@ -2729,7 +2729,7 @@ PyArray_DescrNewByteorder(PyArray_Descr *self, char newendian) if (endian != NPY_IGNORE) { if (newendian == NPY_SWAP) { /* swap byteorder */ - if PyArray_ISNBO(endian) { + if (PyArray_ISNBO(endian)) { endian = NPY_OPPBYTE; } else { diff --git a/numpy/core/src/multiarray/dtype_transfer.c b/numpy/core/src/multiarray/dtype_transfer.c index abc114978..7a7379ad5 100644 --- a/numpy/core/src/multiarray/dtype_transfer.c +++ b/numpy/core/src/multiarray/dtype_transfer.c @@ -3060,14 +3060,16 @@ static void _strided_masked_wrapper_decsrcref_transfer_function( while (N > 0) { /* Skip masked values, still calling decsrcref for move_references */ - mask = npy_memchr((char *)mask, 0, mask_stride, N, &subloopsize, 1); + mask = (npy_bool*)npy_memchr((char *)mask, 0, mask_stride, N, + &subloopsize, 1); decsrcref_stransfer(NULL, 0, src, src_stride, subloopsize, src_itemsize, decsrcref_transferdata); dst += subloopsize * dst_stride; src += subloopsize * src_stride; N -= subloopsize; /* Process unmasked values */ - mask = npy_memchr((char *)mask, 0, mask_stride, N, &subloopsize, 0); + mask = (npy_bool*)npy_memchr((char *)mask, 0, mask_stride, N, + &subloopsize, 0); unmasked_stransfer(dst, dst_stride, src, src_stride, subloopsize, src_itemsize, unmasked_transferdata); dst += subloopsize * dst_stride; @@ -3095,12 +3097,14 @@ static void _strided_masked_wrapper_transfer_function( while (N > 0) { /* Skip masked values */ - mask = npy_memchr((char *)mask, 0, mask_stride, N, &subloopsize, 1); + mask = (npy_bool*)npy_memchr((char *)mask, 0, mask_stride, N, + &subloopsize, 1); dst += subloopsize * dst_stride; src += subloopsize * src_stride; N -= subloopsize; /* Process unmasked values */ - mask = npy_memchr((char *)mask, 0, mask_stride, N, &subloopsize, 0); + mask = (npy_bool*)npy_memchr((char *)mask, 0, mask_stride, N, + &subloopsize, 0); unmasked_stransfer(dst, dst_stride, src, src_stride, subloopsize, src_itemsize, unmasked_transferdata); dst += subloopsize * dst_stride; diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c index e5dd1c0ee..5294cebd0 100644 --- a/numpy/core/src/multiarray/item_selection.c +++ b/numpy/core/src/multiarray/item_selection.c @@ -1258,7 +1258,7 @@ PyArray_Partition(PyArrayObject *op, PyArrayObject * ktharray, int axis, NPY_SEL PyArray_PartitionFunc * part = get_partition_func(PyArray_TYPE(op), which); n = PyArray_NDIM(op); - if ((n == 0)) { + if (n == 0) { return 0; } if (axis < 0) { diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c index f3ed2bbd0..6d7e4ffe3 100644 --- a/numpy/core/src/multiarray/mapping.c +++ b/numpy/core/src/multiarray/mapping.c @@ -623,7 +623,7 @@ prepare_index(PyArrayObject *self, PyObject *index, } /* Normal case of an integer array */ - else if PyArray_ISINTEGER(arr) { + else if (PyArray_ISINTEGER(arr)) { if (PyArray_NDIM(arr) == 0) { /* * A 0-d integer array is an array scalar and can @@ -1046,7 +1046,7 @@ array_boolean_subscript(PyArrayObject *self, return NULL; } - if (PyArray_SetBaseObject(ret, tmp) < 0) { + if (PyArray_SetBaseObject(ret, (PyObject *)tmp) < 0) { Py_DECREF(ret); return NULL; } @@ -1468,7 +1468,7 @@ array_subscript(PyArrayObject *self, PyObject *op) */ if (index_type == HAS_FANCY && index_num == 1) { /* The array being indexed has one dimension and it is a fancy index */ - PyArrayObject *ind = indices[0].object; + PyArrayObject *ind = (PyArrayObject*)indices[0].object; /* Check if the index is simple enough */ if (PyArray_TRIVIALLY_ITERABLE(ind) && @@ -1838,7 +1838,7 @@ array_assign_subscript(PyArrayObject *self, PyObject *ind, PyObject *op) if (index_type == HAS_FANCY && index_num == 1 && tmp_arr) { /* The array being indexed has one dimension and it is a fancy index */ - PyArrayObject *ind = indices[0].object; + PyArrayObject *ind = (PyArrayObject*)indices[0].object; /* Check if the type is equivalent */ if (PyArray_EquivTypes(PyArray_DESCR(self), @@ -2593,7 +2593,8 @@ PyArray_MapIterNew(npy_index_info *indices , int index_num, int index_type, permute.len = mit->nd; permute.ptr = &PyArray_DIMS(extra_op)[ PyArray_NDIM(extra_op) - mit->nd]; - tmp_arr = PyArray_Newshape(extra_op, &permute, NPY_CORDER); + tmp_arr = (PyArrayObject*)PyArray_Newshape(extra_op, &permute, + NPY_CORDER); if (tmp_arr == NULL) { goto broadcast_error; } diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c index 1de3d6982..b3fdd040f 100644 --- a/numpy/core/src/multiarray/multiarraymodule.c +++ b/numpy/core/src/multiarray/multiarraymodule.c @@ -2092,7 +2092,7 @@ static PyObject * array_matrixproduct(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject* kwds) { int errval; - static PyObject *cached_npy_dot = NULL; + static PyUFuncObject *cached_npy_dot = NULL; PyObject *override = NULL; PyObject *v, *a, *o = NULL; char* kwlist[] = {"a", "b", "out", NULL }; @@ -2100,7 +2100,8 @@ array_matrixproduct(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject* kwds) if (cached_npy_dot == NULL) { module = PyImport_ImportModule("numpy.core.multiarray"); - cached_npy_dot = PyDict_GetItemString(PyModule_GetDict(module), "dot"); + cached_npy_dot = (PyUFuncObject*)PyDict_GetItemString( + PyModule_GetDict(module), "dot"); Py_INCREF(cached_npy_dot); Py_DECREF(module); diff --git a/numpy/core/src/multiarray/number.c b/numpy/core/src/multiarray/number.c index 935826380..a00f6729c 100644 --- a/numpy/core/src/multiarray/number.c +++ b/numpy/core/src/multiarray/number.c @@ -408,7 +408,7 @@ is_scalar_with_conversion(PyObject *o2, double* out_exponent) return NPY_FLOAT_SCALAR; } } - else if PyArray_IsScalar(o2, Integer) { + else if (PyArray_IsScalar(o2, Integer)) { return NPY_INTPOS_SCALAR; } else { /* IsScalar(o2, Floating) */ diff --git a/numpy/core/src/multiarray/refcount.c b/numpy/core/src/multiarray/refcount.c index b067cd948..eab11e933 100644 --- a/numpy/core/src/multiarray/refcount.c +++ b/numpy/core/src/multiarray/refcount.c @@ -70,7 +70,7 @@ PyArray_Item_XDECREF(char *data, PyArray_Descr *descr) NPY_COPY_PYOBJECT_PTR(&temp, data); Py_XDECREF(temp); } - else if PyDataType_HASFIELDS(descr) { + else if (PyDataType_HASFIELDS(descr)) { PyObject *key, *value, *title = NULL; PyArray_Descr *new; int offset; diff --git a/numpy/core/src/multiarray/scalarapi.c b/numpy/core/src/multiarray/scalarapi.c index 46b2f5b21..8bbfb41fa 100644 --- a/numpy/core/src/multiarray/scalarapi.c +++ b/numpy/core/src/multiarray/scalarapi.c @@ -634,7 +634,7 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base) copyswap = descr->f->copyswap; type = descr->typeobj; swap = !PyArray_ISNBO(descr->byteorder); - if PyTypeNum_ISSTRING(type_num) { + if (PyTypeNum_ISSTRING(type_num)) { /* Eliminate NULL bytes */ char *dptr = data; diff --git a/numpy/core/src/multiarray/scalartypes.c.src b/numpy/core/src/multiarray/scalartypes.c.src index f4fd75093..69600de39 100644 --- a/numpy/core/src/multiarray/scalartypes.c.src +++ b/numpy/core/src/multiarray/scalartypes.c.src @@ -2951,7 +2951,7 @@ long_arrtype_hash(PyObject *obj) * #Char = ,U# * #Word = ,Unsigned# */ -static npy_hash_t +static NPY_INLINE npy_hash_t @char@longlong_arrtype_hash(PyObject *obj) { PyObject * l = PyLong_From@Word@LongLong( @@ -3363,7 +3363,6 @@ gen_arrtype_subscript(PyObject *self, PyObject *key) * the data where N is the number of None's in <???>. */ PyObject *res, *ret; - int N; res = PyArray_FromScalar(self, NULL); @@ -3989,7 +3988,7 @@ initialize_numeric_types(void) PyGenericArrType_Type.tp_getset = gentype_getsets; PyGenericArrType_Type.tp_new = NULL; PyGenericArrType_Type.tp_alloc = gentype_alloc; - PyGenericArrType_Type.tp_free = gentype_free; + PyGenericArrType_Type.tp_free = (freefunc)gentype_free; PyGenericArrType_Type.tp_repr = gentype_repr; PyGenericArrType_Type.tp_str = gentype_str; PyGenericArrType_Type.tp_richcompare = gentype_richcompare; diff --git a/numpy/core/src/private/npy_binsearch.h.src b/numpy/core/src/private/npy_binsearch.h.src index c46a9c44a..3b2c59487 100644 --- a/numpy/core/src/private/npy_binsearch.h.src +++ b/numpy/core/src/private/npy_binsearch.h.src @@ -97,7 +97,7 @@ static PyArray_@Arg@BinSearchFunc *gen@arg@binsearch_map[] = { &npy_@arg@binsearch_right, }; -static PyArray_@Arg@BinSearchFunc* +static NPY_INLINE PyArray_@Arg@BinSearchFunc* get_@arg@binsearch_func(PyArray_Descr *dtype, NPY_SEARCHSIDE side) { static npy_intp num_funcs = sizeof(_@arg@binsearch_map) / diff --git a/numpy/core/src/private/ufunc_override.h b/numpy/core/src/private/ufunc_override.h index 380aef714..8ef29d1fd 100644 --- a/numpy/core/src/private/ufunc_override.h +++ b/numpy/core/src/private/ufunc_override.h @@ -3,6 +3,7 @@ #include <npy_config.h> #include "numpy/arrayobject.h" #include "common.h" +#include "numpy/ufuncobject.h" /* * Check a set of args for the `__numpy_ufunc__` method. If more than one of @@ -16,7 +17,7 @@ * result of the operation, if any. If *result is NULL, there is no override. */ static int -PyUFunc_CheckOverride(PyObject *ufunc, char *method, +PyUFunc_CheckOverride(PyUFuncObject *ufunc, char *method, PyObject *args, PyObject *kwds, PyObject **result, int nin) diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src index d6921efee..43419780e 100644 --- a/numpy/core/src/umath/loops.c.src +++ b/numpy/core/src/umath/loops.c.src @@ -2537,7 +2537,9 @@ OBJECT_sign(char **args, npy_intp *dimensions, npy_intp *steps, void *NPY_UNUSED PyObject **out = (PyObject **)op1; int v; PyObject *ret; - PyObject_Cmp(in1 ? in1 : Py_None, zero, &v); + if (PyObject_Cmp(in1 ? in1 : Py_None, zero, &v) == -1) { + return; + } ret = PyLong_FromLong(v); if (PyErr_Occurred()) { return; diff --git a/numpy/core/src/umath/simd.inc.src b/numpy/core/src/umath/simd.inc.src index 3a7c4f75b..bb894f561 100644 --- a/numpy/core/src/umath/simd.inc.src +++ b/numpy/core/src/umath/simd.inc.src @@ -274,10 +274,15 @@ run_binary_simd_@kind@_@TYPE@(char **args, npy_intp *dimensions, npy_intp *steps * # kind = logical_or, logical_and# */ +#if defined NPY_HAVE_SSE2_INTRINSICS static void sse2_binary_@kind@_BOOL(npy_bool * op, npy_bool * ip1, npy_bool * ip2, npy_intp n); +static void +sse2_reduce_@kind@_BOOL(npy_bool * op, npy_bool * ip, npy_intp n); +#endif + static NPY_INLINE int run_binary_simd_@kind@_BOOL(char **args, npy_intp *dimensions, npy_intp *steps) { @@ -292,9 +297,6 @@ run_binary_simd_@kind@_BOOL(char **args, npy_intp *dimensions, npy_intp *steps) } -static void -sse2_reduce_@kind@_BOOL(npy_bool * op, npy_bool * ip, npy_intp n); - static NPY_INLINE int run_reduce_simd_@kind@_BOOL(char **args, npy_intp *dimensions, npy_intp *steps) { @@ -314,8 +316,10 @@ run_reduce_simd_@kind@_BOOL(char **args, npy_intp *dimensions, npy_intp *steps) * # kind = absolute, logical_not# */ +#if defined NPY_HAVE_SSE2_INTRINSICS static void sse2_@kind@_BOOL(npy_bool *, npy_bool *, const npy_intp n); +#endif static NPY_INLINE int run_unary_simd_@kind@_BOOL(char **args, npy_intp *dimensions, npy_intp *steps) |