Skip to content

Commit c15f774

Browse files
committed
MAINT: remove a bunch of compiler warnings
there is a memset warning remaining when built with -flto, though its not clear where exactly it comes from.
1 parent 7a3926c commit c15f774

12 files changed

+20
-18
lines changed

numpy/core/code_generators/generate_ufunc_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
3838
%s
3939
40-
static int
40+
static NPY_INLINE int
4141
_import_umath(void)
4242
{
4343
PyObject *numpy = PyImport_ImportModule("numpy.core.umath");

numpy/core/src/multiarray/compiled_base.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *args)
12711271
PyObject *str;
12721272
char *docstr;
12731273
static char *msg = "already has a docstring";
1274-
PyObject *tp_dict;
1274+
PyObject *tp_dict = PyArrayDescr_Type.tp_dict;
12751275
PyObject *myobj;
12761276
static PyTypeObject *PyMemberDescr_TypePtr = NULL;
12771277
static PyTypeObject *PyGetSetDescr_TypePtr = NULL;
@@ -1283,7 +1283,6 @@ arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *args)
12831283
}
12841284

12851285
if (PyGetSetDescr_TypePtr == NULL) {
1286-
tp_dict = PyArrayDescr_Type.tp_dict;
12871286
/* Get "subdescr" */
12881287
myobj = PyDict_GetItemString(tp_dict, "fields");
12891288
if (myobj != NULL) {

numpy/core/src/multiarray/conversion_utils.c

+1
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,7 @@ PyArray_PyIntAsIntp_ErrMsg(PyObject *o, const char * msg)
903903
return -1;
904904
}
905905

906+
goto overflow_check; /* silence unused warning */
906907
overflow_check:
907908
#if (NPY_SIZEOF_LONG < NPY_SIZEOF_INTP)
908909
#if (NPY_SIZEOF_LONGLONG > NPY_SIZEOF_INTP)

numpy/core/src/multiarray/lowlevel_strided_loops.c.src

+4-2
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,11 @@ static NPY_GCC_OPT_3 void
199199
npy_intp N, npy_intp NPY_UNUSED(src_itemsize),
200200
NpyAuxData *NPY_UNUSED(data))
201201
{
202-
# if @elsize@ != 16
202+
#if @elsize@ != 16
203+
# if !(@elsize@ == 1 && @dst_contig@)
203204
@type@ temp;
204-
# else
205+
# endif
206+
#else
205207
npy_uint64 temp0, temp1;
206208
#endif
207209
#if @is_aligned@ && @elsize@ != 16

numpy/core/src/multiarray/mapping.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,7 @@ array_subscript(PyArrayObject *self, PyObject *op)
14211421
{
14221422
int index_type;
14231423
int index_num;
1424-
int i, ndim, fancy_ndim, fancy;
1424+
int i, ndim, fancy_ndim;
14251425
/*
14261426
* Index info array. We can have twice as many indices as dimensions
14271427
* (because of None). The + 1 is to not need to check as much.

numpy/core/src/multiarray/multiarraymodule.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2394,7 +2394,7 @@ array_matmul(PyObject *NPY_UNUSED(m), PyObject *args, PyObject* kwds)
23942394
return NULL;
23952395
}
23962396

2397-
errval = PyUFunc_CheckOverride(matmul, "__call__",
2397+
errval = PyUFunc_CheckOverride((PyUFuncObject*)matmul, "__call__",
23982398
args, kwds, &override, 2);
23992399
if (errval) {
24002400
return NULL;
@@ -2512,7 +2512,7 @@ array_matmul(PyObject *NPY_UNUSED(m), PyObject *args, PyObject* kwds)
25122512

25132513
/* If no output was supplied, possibly convert to a scalar */
25142514
if (ret != NULL && out == NULL) {
2515-
ret = PyArray_Return((PyArrayObject *)ret);
2515+
return PyArray_Return((PyArrayObject *)ret);
25162516
}
25172517
return (PyObject *)ret;
25182518

numpy/core/src/multiarray/scalartypes.c.src

+1-1
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,7 @@ voidtype_setfield(PyVoidScalarObject *self, PyObject *args, PyObject *kwds)
17011701
}
17021702

17031703
/* 1. Convert to 0-d array and use getfield */
1704-
arr = PyArray_FromScalar(self, NULL);
1704+
arr = PyArray_FromScalar((PyObject*)self, NULL);
17051705
if (arr == NULL) {
17061706
Py_DECREF(getfield_args);
17071707
return NULL;

numpy/core/src/multiarray/ucsnarrow.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ PyUnicode_FromUCS4(char *src, Py_ssize_t size, int swap, int align)
136136
/* produce PyUnicode object */
137137
#ifdef Py_UNICODE_WIDE
138138
{
139-
ret = (PyUnicodeObject *)PyUnicode_FromUnicode(buf, (Py_ssize_t) ucs4len);
139+
ret = (PyUnicodeObject *)PyUnicode_FromUnicode((Py_UNICODE*)buf,
140+
(Py_ssize_t) ucs4len);
140141
if (ret == NULL) {
141142
goto fail;
142143
}

numpy/core/src/npymath/npy_math_complex.c.src

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@
3333
*/
3434
#include "npy_math_common.h"
3535
#include "npy_math_private.h"
36+
#include <numpy/utils.h>
3637

3738

3839
#define raise_inexact() do { volatile npy_float junk = 1 + tiny; } while(0)
3940

4041

41-
static npy_float tiny = 3.9443045e-31f;
42+
static __COMP_NPY_UNUSED npy_float tiny = 3.9443045e-31f;
4243

4344

4445
/**begin repeat
@@ -183,6 +184,8 @@ npy_carg@c@(@ctype@ z)
183184
#define SCALED_CEXP_LOWERL 11357.216553474703895L
184185
#define SCALED_CEXP_UPPERL 22756.021937783004509L
185186

187+
#ifndef HAVE_CEXP@C@
188+
186189
static
187190
@ctype@
188191
_npy_scaled_cexp@c@(@type@ x, @type@ y, npy_int expt)
@@ -209,7 +212,6 @@ _npy_scaled_cexp@c@(@type@ x, @type@ y, npy_int expt)
209212
npy_ldexp@c@(mant * mantsin, expt + exsin));
210213
}
211214

212-
#ifndef HAVE_CEXP@C@
213215
@ctype@
214216
npy_cexp@c@(@ctype@ z)
215217
{

numpy/core/src/umath/scalarmath.c.src

+1-1
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@ static PyObject *
14171417
* #func = (PyLong_FromLongLong, PyLong_FromUnsignedLongLong)*5,
14181418
* PyLong_FromDouble*7, PyFloat_FromDouble*17#
14191419
*/
1420-
static PyObject *
1420+
static NPY_INLINE PyObject *
14211421
@name@_@which@(PyObject *obj)
14221422
{
14231423
#if @cmplx@

numpy/core/src/umath/test_rational.c.src

+1-1
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ pyrational_str(PyObject* self) {
543543
}
544544
}
545545

546-
static long
546+
static npy_hash_t
547547
pyrational_hash(PyObject* self) {
548548
rational x = ((PyRational*)self)->r;
549549
/* Use a fairly weak hash as Python expects */

numpy/linalg/lapack_litemodule.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,6 @@ static struct PyMethodDef lapack_lite_module_methods[] = {
314314
{ NULL,NULL,0, NULL}
315315
};
316316

317-
static char lapack_lite_module_documentation[] = "";
318-
319317

320318
#if PY_MAJOR_VERSION >= 3
321319
static struct PyModuleDef moduledef = {
@@ -346,8 +344,7 @@ initlapack_lite(void)
346344
m = PyModule_Create(&moduledef);
347345
#else
348346
m = Py_InitModule4("lapack_lite", lapack_lite_module_methods,
349-
lapack_lite_module_documentation,
350-
(PyObject*)NULL,PYTHON_API_VERSION);
347+
"", (PyObject*)NULL,PYTHON_API_VERSION);
351348
#endif
352349
if (m == NULL) {
353350
return RETVAL;

0 commit comments

Comments
 (0)