diff options
author | Tom Tromey <tromey@adacore.com> | 2022-10-12 08:40:34 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-10-31 12:47:36 -0600 |
commit | 4881fcd7c13056b0ee03c170bf54bb7f7a176051 (patch) | |
tree | 6e47e6650293f97e7b6da0963b6bb17a3781105c /gdb/python | |
parent | bc45f5366eaf4e93cfd675a07a8cc5bb5522b184 (diff) | |
download | gdb-4881fcd7c13056b0ee03c170bf54bb7f7a176051.zip gdb-4881fcd7c13056b0ee03c170bf54bb7f7a176051.tar.gz gdb-4881fcd7c13056b0ee03c170bf54bb7f7a176051.tar.bz2 |
Add missing TYPE_CODE_* constants to Python
A user noticed that TYPE_CODE_FIXED_POINT was not exported by the gdb
Python layer. This patch fixes the bug, and prevents future
occurences of this type of bug.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-type.c | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index 3e558de..928efac 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -74,7 +74,7 @@ extern PyTypeObject type_iterator_object_type struct pyty_code { /* The code. */ - enum type_code code; + int code; /* The name. */ const char *name; }; @@ -82,37 +82,14 @@ struct pyty_code /* Forward declarations. */ static PyObject *typy_make_iter (PyObject *self, enum gdbpy_iter_kind kind); -#define ENTRY(X) { X, #X } - static struct pyty_code pyty_codes[] = { - ENTRY (TYPE_CODE_BITSTRING), - ENTRY (TYPE_CODE_PTR), - ENTRY (TYPE_CODE_ARRAY), - ENTRY (TYPE_CODE_STRUCT), - ENTRY (TYPE_CODE_UNION), - ENTRY (TYPE_CODE_ENUM), - ENTRY (TYPE_CODE_FLAGS), - ENTRY (TYPE_CODE_FUNC), - ENTRY (TYPE_CODE_INT), - ENTRY (TYPE_CODE_FLT), - ENTRY (TYPE_CODE_VOID), - ENTRY (TYPE_CODE_SET), - ENTRY (TYPE_CODE_RANGE), - ENTRY (TYPE_CODE_STRING), - ENTRY (TYPE_CODE_ERROR), - ENTRY (TYPE_CODE_METHOD), - ENTRY (TYPE_CODE_METHODPTR), - ENTRY (TYPE_CODE_MEMBERPTR), - ENTRY (TYPE_CODE_REF), - ENTRY (TYPE_CODE_RVALUE_REF), - ENTRY (TYPE_CODE_CHAR), - ENTRY (TYPE_CODE_BOOL), - ENTRY (TYPE_CODE_COMPLEX), - ENTRY (TYPE_CODE_TYPEDEF), - ENTRY (TYPE_CODE_NAMESPACE), - ENTRY (TYPE_CODE_DECFLOAT), - ENTRY (TYPE_CODE_INTERNAL_FUNCTION), + /* This is kept for backward compatibility. */ + { -1, "TYPE_CODE_BITSTRING" }, + +#define OP(X) { X, #X }, +#include "type-codes.def" +#undef OP }; |