diff options
author | Siva Chandra <sivachandra@chromium.org> | 2014-06-04 10:50:11 -0700 |
---|---|---|
committer | Siva Chandra <sivachandra@chromium.org> | 2014-06-10 11:52:12 -0700 |
commit | 5a6c770930a54585c6d4bd9257ce7636b469d7c1 (patch) | |
tree | cffd264fe5becaf1e6d325885c7e569e03ab2d1e /gdb/python/python-internal.h | |
parent | d9949a367352c66b7d90ca32bdbd5cac38c14b53 (diff) | |
download | gdb-5a6c770930a54585c6d4bd9257ce7636b469d7c1.zip gdb-5a6c770930a54585c6d4bd9257ce7636b469d7c1.tar.gz gdb-5a6c770930a54585c6d4bd9257ce7636b469d7c1.tar.bz2 |
Wrap PyObject_Get/HasAttrString in a function with second arg having const qualifier.
This is done to avoid errors when compiled with -Werror against Python-2.4
which did not have the const qualifier for the second argument of these
functions.
gdb/
* python/python-internal.h (gdb_PyObject_GetAttrString)
(gdb_PyObject_HasAttrString): New inline function definitions.
* py-value.c (get_field_flag): Remove the now unnecessary cast to
char * of the second argument to PyObject_GetAttrString.
Diffstat (limited to 'gdb/python/python-internal.h')
-rw-r--r-- | gdb/python/python-internal.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 9c06621..0198e9d 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -187,6 +187,32 @@ gdb_Py_DECREF (void *op) /* ARI: editCase function */ #undef Py_DECREF #define Py_DECREF(op) gdb_Py_DECREF (op) +/* The second argument to PyObject_GetAttrString was missing the 'const' + qualifier in Python-2.4. Hence, we wrap it in a function to avoid errors + when compiled with -Werror. */ + +static inline PyObject * +gdb_PyObject_GetAttrString (PyObject *obj, + const char *attr) /* ARI: editCase function */ +{ + return PyObject_GetAttrString (obj, (char *) attr); +} + +#define PyObject_GetAttrString(obj, attr) gdb_PyObject_GetAttrString (obj, attr) + +/* The second argument to PyObject_HasAttrString was also missing the 'const' + qualifier in Python-2.4. Hence, we wrap it also in a function to avoid + errors when compiled with -Werror. */ + +static inline int +gdb_PyObject_HasAttrString (PyObject *obj, + const char *attr) /* ARI: editCase function */ +{ + return PyObject_HasAttrString (obj, (char *) attr); +} + +#define PyObject_HasAttrString(obj, attr) gdb_PyObject_HasAttrString (obj, attr) + /* In order to be able to parse symtab_and_line_to_sal_object function a real symtab_and_line structure is needed. */ #include "symtab.h" |