Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r3101:8c670d218355
Date: 2018-02-20 07:37 +0100
http://bitbucket.org/cffi/cffi/changeset/8c670d218355/

Log:    silence a gcc warning shown in some (recent?) versions of gcc

diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -3794,27 +3794,29 @@
 static int check_bytes_for_float_compatible(PyObject *io, double *out_value)
 {
     if (PyBytes_Check(io)) {
-        if (PyBytes_GET_SIZE(io) != 1) {
-            Py_DECREF(io);
-            return -1;
-        }
+        if (PyBytes_GET_SIZE(io) != 1)
+            goto error;
         *out_value = (unsigned char)PyBytes_AS_STRING(io)[0];
         return 1;
     }
     else if (PyUnicode_Check(io)) {
         char ignored[80];
         cffi_char32_t ordinal;
-        if (_my_PyUnicode_AsSingleChar32(io, &ordinal, ignored) < 0) {
-            Py_DECREF(io);
-            return -1;
-        }
+        if (_my_PyUnicode_AsSingleChar32(io, &ordinal, ignored) < 0)
+            goto error;
         /* the signness of the 32-bit version of wide chars should not
          * matter here, because 'ordinal' comes from a normal Python
          * unicode string */
         *out_value = ordinal;
         return 1;
     }
+    *out_value = 0;   /* silence a gcc warning if this function is inlined */
     return 0;
+
+ error:
+    Py_DECREF(io);
+    *out_value = 0;   /* silence a gcc warning if this function is inlined */
+    return -1;
 }
 
 static PyObject *do_cast(CTypeDescrObject *ct, PyObject *ob)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to