gdb/ 2015-02-04 Jan Kratochvil * configure.ac <"${have_libpython}" != no>: Define Py_hash_t. * python/py-value.c (valpy_fetch_lazy): Use it. Remove cast to the return type. * config.in: Regenerate. * configure: Regenerate. diff --git a/gdb/configure.ac b/gdb/configure.ac index dfc6947..f335b7b 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1016,6 +1016,25 @@ if test "${have_libpython}" != no; then ]]), [python_has_threads=no], [python_has_threads=yes]) AC_MSG_RESULT(${python_has_threads}) CPPFLAGS="${saved_CPPFLAGS}" + + AC_CACHE_CHECK([for Py_hash_t], gdb_cv_Py_hash_t, + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PYTHON_CFLAGS" + old_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" + AC_TRY_COMPILE( + [#include ], + [Py_hash_t var;], + gdb_cv_Py_hash_t=yes, + gdb_cv_Py_hash_t=no + ) + CPPFLAGS="$old_CPPFLAGS" + CFLAGS="$old_CFLAGS" + ) + if test "x$gdb_cv_Py_hash_t" = "xno"; then + AC_DEFINE(Py_hash_t, long, + [Provide Python 3 Py_hash_t for Python 2.]) + fi else # Even if Python support is not compiled in, we need to have this file # included so that the "python" command, et.al., still exists. diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 4c4d36e..5a13777 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -895,10 +895,10 @@ valpy_fetch_lazy (PyObject *self, PyObject *args) /* Calculate and return the address of the PyObject as the value of the builtin __hash__ call. */ -static long +static Py_hash_t valpy_hash (PyObject *self) { - return (long) (intptr_t) self; + return (intptr_t) self; } enum valpy_opcode