aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-arch.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-07-21 13:41:54 -0600
committerTom Tromey <tom@tromey.com>2016-09-20 10:35:27 -0600
commit12c58cd4dc805cbac97a6d93c971c2496313dce4 (patch)
treebd8f42f27c92257815d2b0874c1a0e574534996c /gdb/python/py-arch.c
parent9f7efd5bf76aa5065298d13aefb109ecfd7a825a (diff)
downloadgdb-12c58cd4dc805cbac97a6d93c971c2496313dce4.zip
gdb-12c58cd4dc805cbac97a6d93c971c2496313dce4.tar.gz
gdb-12c58cd4dc805cbac97a6d93c971c2496313dce4.tar.bz2
Avoid -Wduplicated-cond warnings in gdb/python
I tried building gdb with -Wduplicated-cond. This patch fixes the simpler issue that was found. In Python 3, "int" and "long" are synonyms, so code like: else if (PyLong_Check (obj)) ... else if (PyInt_Check (obj)) .... will trigger this warning. The fix is to conditionalize the PyInt_Check branches on Python 2. Tested by rebuilding, with both version of Python, on x86-64 Fedora 24. 2016-09-20 Tom Tromey <tom@tromey.com> * python/py-value.c (convert_value_from_python): Make PyInt_Check conditional on Python 2. * python/py-arch.c (archpy_disassemble): Make PyInt_Check conditional on Python 2.
Diffstat (limited to 'gdb/python/py-arch.c')
-rw-r--r--gdb/python/py-arch.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/python/py-arch.c b/gdb/python/py-arch.c
index 0f7d432..4a2dcbf 100644
--- a/gdb/python/py-arch.c
+++ b/gdb/python/py-arch.c
@@ -141,10 +141,12 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
conversion process. */
if (PyLong_Check (end_obj))
end = PyLong_AsUnsignedLongLong (end_obj);
+#if PY_MAJOR_VERSION == 2
else if (PyInt_Check (end_obj))
/* If the end_pc value is specified without a trailing 'L', end_obj will
be an integer and not a long integer. */
end = PyInt_AsLong (end_obj);
+#endif
else
{
Py_DECREF (end_obj);