[binutils-gdb] gdb, dwarf: update code style in read_tag_pointer_type
Tankut Baris Aktemur via Gdb-cvs <[email protected]> Thu, 30 Jul 2026 16:50:14 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Da43228481e49= 294815f544651ca167f2409f118b commit a43228481e49294815f544651ca167f2409f118b Author: Tankut Baris Aktemur <[email protected]> Date: Thu Jul 30 18:44:51 2026 +0200 gdb, dwarf: update code style in read_tag_pointer_type =20 Update the code style in read_tag_pointer_type to match current practices. =20 The declared type of `byte_size` is changed to ULONGEST because we are reading an unsigned constant. =20 Approved-By: Tom Tromey <[email protected]> Diff: --- gdb/dwarf2/read.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 38c498b1901..7db76140319 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -12001,10 +12001,6 @@ read_tag_pointer_type (struct die_info *die, struc= t dwarf2_cu *cu) { struct gdbarch *gdbarch =3D cu->per_objfile->objfile->arch (); unit_head *cu_header =3D &cu->header; - struct type *type; - struct attribute *attr_byte_size; - struct attribute *attr_address_class; - int byte_size; struct type *target_type; =20 /* In Ada, it's possible to create a self-referential pointer type. @@ -12020,23 +12016,24 @@ read_tag_pointer_type (struct die_info *die, stru= ct dwarf2_cu *cu) target_type =3D die_type (die, cu); =20 /* The die_type call above may have already set the type for this DIE. = */ - type =3D get_die_type (die, cu); - if (type) + type *type =3D get_die_type (die, cu); + if (type !=3D nullptr) return type; =20 type =3D lookup_pointer_type (target_type); =20 - attr_byte_size =3D dwarf2_attr (die, DW_AT_byte_size, cu); - if (attr_byte_size) + ULONGEST byte_size; + if (attribute *attr_byte_size =3D dwarf2_attr (die, DW_AT_byte_size, cu); + attr_byte_size !=3D nullptr) byte_size =3D (attr_byte_size->unsigned_constant () .value_or (cu_header->addr_size)); else byte_size =3D cu_header->addr_size; =20 - attr_address_class =3D dwarf2_attr (die, DW_AT_address_class, cu); ULONGEST addr_class; - if (attr_address_class) - addr_class =3D (attr_address_class->unsigned_constant () + if (attribute *attr_aclass =3D dwarf2_attr (die, DW_AT_address_class, cu= ); + attr_aclass !=3D nullptr) + addr_class =3D (attr_aclass->unsigned_constant () .value_or (DW_ADDR_none)); else addr_class =3D DW_ADDR_none; @@ -12060,7 +12057,7 @@ read_tag_pointer_type (struct die_info *die, struct= dwarf2_cu *cu) } else if (type->length () !=3D byte_size) { - complaint (_("invalid pointer size %d"), byte_size); + complaint (_("invalid pointer size %s"), pulongest (byte_size)); } else if (TYPE_RAW_ALIGN (type) !=3D alignment) {