aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2023-08-31 09:37:44 +0200
committerTom de Vries <tdevries@suse.de>2023-08-31 09:37:44 +0200
commit959db212304e64751563bcaaacbdd28efd5016a7 (patch)
tree425a452907842c0bfd488b23a870148e4f731a41 /gdb/dwarf2
parent6d3c2d749be8fe1be7d7ba11596e40531cf3cf7c (diff)
downloadgdb-959db212304e64751563bcaaacbdd28efd5016a7.zip
gdb-959db212304e64751563bcaaacbdd28efd5016a7.tar.gz
gdb-959db212304e64751563bcaaacbdd28efd5016a7.tar.bz2
[gdb/symtab] Replace TYPE_ALLOC with TYPE_ZALLOC where required
Handle the remaining uses of TYPE_ALLOC, either by: - replacing with TYPE_ZALLOC, or - adding a comment explaining why zero-initialization is not necessary. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r--gdb/dwarf2/read.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index bc68c29..b45afa1 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -12376,8 +12376,8 @@ dwarf2_attach_fn_fields_to_type (struct field_info *fip, struct type *type,
ALLOCATE_CPLUS_STRUCT_TYPE (type);
TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *)
- TYPE_ALLOC (type,
- sizeof (struct fn_fieldlist) * fip->fnfieldlists.size ());
+ TYPE_ZALLOC (type,
+ sizeof (struct fn_fieldlist) * fip->fnfieldlists.size ());
for (int i = 0; i < fip->fnfieldlists.size (); i++)
{
@@ -12386,6 +12386,8 @@ dwarf2_attach_fn_fields_to_type (struct field_info *fip, struct type *type,
TYPE_FN_FIELDLIST_NAME (type, i) = nf.name;
TYPE_FN_FIELDLIST_LENGTH (type, i) = nf.fnfields.size ();
+ /* No need to zero-initialize, initialization is done by the copy in
+ the loop below. */
fn_flp->fn_fields = (struct fn_field *)
TYPE_ALLOC (type, sizeof (struct fn_field) * nf.fnfields.size ());
@@ -13088,6 +13090,8 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
int count = fi.typedef_field_list.size ();
ALLOCATE_CPLUS_STRUCT_TYPE (type);
+ /* No zero-initialization is needed, the elements are initialized by
+ the copy in the loop below. */
TYPE_TYPEDEF_FIELD_ARRAY (type)
= ((struct decl_field *)
TYPE_ALLOC (type,
@@ -13106,6 +13110,8 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
int count = fi.nested_types_list.size ();
ALLOCATE_CPLUS_STRUCT_TYPE (type);
+ /* No zero-initialization is needed, the elements are initialized by
+ the copy in the loop below. */
TYPE_NESTED_TYPES_ARRAY (type)
= ((struct decl_field *)
TYPE_ALLOC (type, sizeof (struct decl_field) * count));