]> granicus.if.org Git - python/commitdiff
Silence expression result unused warnings with clang.
authorChristian Heimes <christian@cheimes.de>
Wed, 4 Dec 2013 08:27:47 +0000 (09:27 +0100)
committerChristian Heimes <christian@cheimes.de>
Wed, 4 Dec 2013 08:27:47 +0000 (09:27 +0100)
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.

Objects/bytesobject.c
Objects/classobject.c
Objects/complexobject.c
Objects/floatobject.c
Objects/longobject.c
Objects/methodobject.c
Objects/typeobject.c

index 8217b1eab30a47673f6dd51cd27f1aef9f1795ba..63c67f8479697ae91b492de8d322f8a03b50bd1d 100644 (file)
@@ -107,7 +107,7 @@ PyBytes_FromStringAndSize(const char *str, Py_ssize_t size)
     op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + size);
     if (op == NULL)
         return PyErr_NoMemory();
-    PyObject_INIT_VAR(op, &PyBytes_Type, size);
+    (void)PyObject_INIT_VAR(op, &PyBytes_Type, size);
     op->ob_shash = -1;
     if (str != NULL)
         Py_MEMCPY(op->ob_sval, str, size);
@@ -155,7 +155,7 @@ PyBytes_FromString(const char *str)
     op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + size);
     if (op == NULL)
         return PyErr_NoMemory();
-    PyObject_INIT_VAR(op, &PyBytes_Type, size);
+    (void)PyObject_INIT_VAR(op, &PyBytes_Type, size);
     op->ob_shash = -1;
     Py_MEMCPY(op->ob_sval, str, size+1);
     /* share short strings */
@@ -749,7 +749,7 @@ bytes_repeat(PyBytesObject *a, Py_ssize_t n)
     op = (PyBytesObject *)PyObject_MALLOC(PyBytesObject_SIZE + nbytes);
     if (op == NULL)
         return PyErr_NoMemory();
-    PyObject_INIT_VAR(op, &PyBytes_Type, size);
+    (void)PyObject_INIT_VAR(op, &PyBytes_Type, size);
     op->ob_shash = -1;
     op->ob_sval[size] = '\0';
     if (Py_SIZE(a) == 1 && n > 0) {
index 272f575dbac859530d1592a742648994076854ae..0c0bd47fbb76274e0c9643840aa328752fb0bff8 100644 (file)
@@ -52,7 +52,7 @@ PyMethod_New(PyObject *func, PyObject *self)
     im = free_list;
     if (im != NULL) {
         free_list = (PyMethodObject *)(im->im_self);
-        PyObject_INIT(im, &PyMethod_Type);
+        (void)PyObject_INIT(im, &PyMethod_Type);
         numfree--;
     }
     else {
index 60a388fa24155d6d8277c412ed6ea47c0d13c332..a5b76f0460055b4a006681f48fee71175b2becbc 100644 (file)
@@ -217,7 +217,7 @@ PyComplex_FromCComplex(Py_complex cval)
     op = (PyComplexObject *) PyObject_MALLOC(sizeof(PyComplexObject));
     if (op == NULL)
         return PyErr_NoMemory();
-    PyObject_INIT(op, &PyComplex_Type);
+    (void)PyObject_INIT(op, &PyComplex_Type);
     op->cval = cval;
     return (PyObject *) op;
 }
index 29c3b32763c27aaf57c30e22a8f91f7c2925897a..05b76795532063b70b753d8a3840b9225c2ad2a9 100644 (file)
@@ -119,7 +119,7 @@ PyFloat_FromDouble(double fval)
             return PyErr_NoMemory();
     }
     /* Inline PyObject_New */
-    PyObject_INIT(op, &PyFloat_Type);
+    (void)PyObject_INIT(op, &PyFloat_Type);
     op->ob_fval = fval;
     return (PyObject *) op;
 }
index a5c0d1b33f392b5890f8ff1a2cf59ea1007f7abb..68a667e7714c1abbd858eb7c7eec370368dd63a3 100644 (file)
@@ -5089,7 +5089,7 @@ _PyLong_Init(void)
             assert(v->ob_digit[0] == abs(ival));
         }
         else {
-            PyObject_INIT(v, &PyLong_Type);
+            (void)PyObject_INIT(v, &PyLong_Type);
         }
         Py_SIZE(v) = size;
         v->ob_digit[0] = abs(ival);
index 55a7d6a35eaf06544f7f2f901893c79395d82be7..6179aeebd0ca627e2cf3e85799ea601571b71f35 100644 (file)
@@ -29,7 +29,7 @@ PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
     op = free_list;
     if (op != NULL) {
         free_list = (PyCFunctionObject *)(op->m_self);
-        PyObject_INIT(op, &PyCFunction_Type);
+        (void)PyObject_INIT(op, &PyCFunction_Type);
         numfree--;
     }
     else {
index 8b2ea1c1a667fa93c2319f4db3dacb24eadef962..530670f3619d8eabb25c0ac5c4be2a923d4742e9 100644 (file)
@@ -787,7 +787,7 @@ PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
         Py_INCREF(type);
 
     if (type->tp_itemsize == 0)
-        PyObject_INIT(obj, type);
+        (void)PyObject_INIT(obj, type);
     else
         (void) PyObject_INIT_VAR((PyVarObject *)obj, type, nitems);