mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Silence expression result unused warnings with clang.
The PyObject_INIT() macros returns obj: ../cpython/Objects/methodobject.c:32:23: warning: expression result unused [-Wunused-value] PyObject_INIT(op, &PyCFunction_Type); ^~ ../cpython/Include/objimpl.h:139:69: note: expanded from macro 'PyObject_INIT' ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) ^ 1 warning generated.
This commit is contained in:
parent
47f02e5e17
commit
d3afe781b1
7 changed files with 9 additions and 9 deletions
|
@ -107,7 +107,7 @@ PyBytes_FromStringAndSize(const char *str, Py_ssize_t size)
|
||||||
op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + size);
|
op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + size);
|
||||||
if (op == NULL)
|
if (op == NULL)
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
PyObject_INIT_VAR(op, &PyBytes_Type, size);
|
(void)PyObject_INIT_VAR(op, &PyBytes_Type, size);
|
||||||
op->ob_shash = -1;
|
op->ob_shash = -1;
|
||||||
if (str != NULL)
|
if (str != NULL)
|
||||||
Py_MEMCPY(op->ob_sval, str, size);
|
Py_MEMCPY(op->ob_sval, str, size);
|
||||||
|
@ -155,7 +155,7 @@ PyBytes_FromString(const char *str)
|
||||||
op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + size);
|
op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + size);
|
||||||
if (op == NULL)
|
if (op == NULL)
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
PyObject_INIT_VAR(op, &PyBytes_Type, size);
|
(void)PyObject_INIT_VAR(op, &PyBytes_Type, size);
|
||||||
op->ob_shash = -1;
|
op->ob_shash = -1;
|
||||||
Py_MEMCPY(op->ob_sval, str, size+1);
|
Py_MEMCPY(op->ob_sval, str, size+1);
|
||||||
/* share short strings */
|
/* share short strings */
|
||||||
|
@ -749,7 +749,7 @@ bytes_repeat(PyBytesObject *a, Py_ssize_t n)
|
||||||
op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + nbytes);
|
op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + nbytes);
|
||||||
if (op == NULL)
|
if (op == NULL)
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
PyObject_INIT_VAR(op, &PyBytes_Type, size);
|
(void)PyObject_INIT_VAR(op, &PyBytes_Type, size);
|
||||||
op->ob_shash = -1;
|
op->ob_shash = -1;
|
||||||
op->ob_sval[size] = '\0';
|
op->ob_sval[size] = '\0';
|
||||||
if (Py_SIZE(a) == 1 && n > 0) {
|
if (Py_SIZE(a) == 1 && n > 0) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ PyMethod_New(PyObject *func, PyObject *self)
|
||||||
im = free_list;
|
im = free_list;
|
||||||
if (im != NULL) {
|
if (im != NULL) {
|
||||||
free_list = (PyMethodObject *)(im->im_self);
|
free_list = (PyMethodObject *)(im->im_self);
|
||||||
PyObject_INIT(im, &PyMethod_Type);
|
(void)PyObject_INIT(im, &PyMethod_Type);
|
||||||
numfree--;
|
numfree--;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -217,7 +217,7 @@ PyComplex_FromCComplex(Py_complex cval)
|
||||||
op = (PyComplexObject *) PyObject_MALLOC(sizeof(PyComplexObject));
|
op = (PyComplexObject *) PyObject_MALLOC(sizeof(PyComplexObject));
|
||||||
if (op == NULL)
|
if (op == NULL)
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
PyObject_INIT(op, &PyComplex_Type);
|
(void)PyObject_INIT(op, &PyComplex_Type);
|
||||||
op->cval = cval;
|
op->cval = cval;
|
||||||
return (PyObject *) op;
|
return (PyObject *) op;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ PyFloat_FromDouble(double fval)
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
}
|
}
|
||||||
/* Inline PyObject_New */
|
/* Inline PyObject_New */
|
||||||
PyObject_INIT(op, &PyFloat_Type);
|
(void)PyObject_INIT(op, &PyFloat_Type);
|
||||||
op->ob_fval = fval;
|
op->ob_fval = fval;
|
||||||
return (PyObject *) op;
|
return (PyObject *) op;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5089,7 +5089,7 @@ _PyLong_Init(void)
|
||||||
assert(v->ob_digit[0] == abs(ival));
|
assert(v->ob_digit[0] == abs(ival));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PyObject_INIT(v, &PyLong_Type);
|
(void)PyObject_INIT(v, &PyLong_Type);
|
||||||
}
|
}
|
||||||
Py_SIZE(v) = size;
|
Py_SIZE(v) = size;
|
||||||
v->ob_digit[0] = abs(ival);
|
v->ob_digit[0] = abs(ival);
|
||||||
|
|
|
@ -29,7 +29,7 @@ PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
|
||||||
op = free_list;
|
op = free_list;
|
||||||
if (op != NULL) {
|
if (op != NULL) {
|
||||||
free_list = (PyCFunctionObject *)(op->m_self);
|
free_list = (PyCFunctionObject *)(op->m_self);
|
||||||
PyObject_INIT(op, &PyCFunction_Type);
|
(void)PyObject_INIT(op, &PyCFunction_Type);
|
||||||
numfree--;
|
numfree--;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -787,7 +787,7 @@ PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
|
||||||
Py_INCREF(type);
|
Py_INCREF(type);
|
||||||
|
|
||||||
if (type->tp_itemsize == 0)
|
if (type->tp_itemsize == 0)
|
||||||
PyObject_INIT(obj, type);
|
(void)PyObject_INIT(obj, type);
|
||||||
else
|
else
|
||||||
(void) PyObject_INIT_VAR((PyVarObject *)obj, type, nitems);
|
(void) PyObject_INIT_VAR((PyVarObject *)obj, type, nitems);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue