aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-symbol.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-09-03 16:28:54 -0600
committerTom Tromey <tom@tromey.com>2024-01-28 10:58:16 -0700
commit6771fc6f1d9d1fada270fd617a71c8b1ac1efc84 (patch)
treefe5647befab068ea739474c85cd6ddd9918282b7 /gdb/python/py-symbol.c
parentd4f48c1e26a550a8b3ba8312268b706454b00ee2 (diff)
downloadbinutils-6771fc6f1d9d1fada270fd617a71c8b1ac1efc84.zip
binutils-6771fc6f1d9d1fada270fd617a71c8b1ac1efc84.tar.gz
binutils-6771fc6f1d9d1fada270fd617a71c8b1ac1efc84.tar.bz2
Use a .def file for domain_enum
Future patches will change and reuse the names from domain_enum. This patch makes this less error-prone by having a single point to define these names, using the typical gdb ".def" file.
Diffstat (limited to 'gdb/python/py-symbol.c')
-rw-r--r--gdb/python/py-symbol.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 82ea5c5..52a25b6 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -670,20 +670,15 @@ gdbpy_initialize_symbols (void)
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMMON_BLOCK",
LOC_COMMON_BLOCK) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM_ADDR",
- LOC_REGPARM_ADDR) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_UNDEF_DOMAIN",
- UNDEF_DOMAIN) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_VAR_DOMAIN",
- VAR_DOMAIN) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_STRUCT_DOMAIN",
- STRUCT_DOMAIN) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LABEL_DOMAIN",
- LABEL_DOMAIN) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_MODULE_DOMAIN",
- MODULE_DOMAIN) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_COMMON_BLOCK_DOMAIN",
- COMMON_BLOCK_DOMAIN) < 0)
+ LOC_REGPARM_ADDR) < 0)
+ return -1;
+
+#define DOMAIN(X) \
+ if (PyModule_AddIntConstant (gdb_module, "SYMBOL_" #X "_DOMAIN", \
+ X ## _DOMAIN) < 0) \
return -1;
+#include "sym-domains.def"
+#undef DOMAIN
/* These remain defined for compatibility, but as they were never
correct, they are no longer documented. Eventually we can remove