From: Tom de Vries Date: Thu, 31 Aug 2023 07:37:44 +0000 (+0200) Subject: [gdb/symtab] Replace TYPE_ALLOC + B_CLRALL with TYPE_ZALLOC X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6d3c2d749be8fe1be7d7ba11596e40531cf3cf7c;p=binutils-gdb.git [gdb/symtab] Replace TYPE_ALLOC + B_CLRALL with TYPE_ZALLOC I noticed some cases of TYPE_ALLOC followed by B_CLRALL. Replace these with TYPE_ZALLOC. Tested on x86_64-linux. Approved-By: Tom Tromey --- diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 7fe0e84cdda..bc68c290289 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -12064,16 +12064,13 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, ALLOCATE_CPLUS_STRUCT_TYPE (type); TYPE_FIELD_PRIVATE_BITS (type) = - (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields)); - B_CLRALL (TYPE_FIELD_PRIVATE_BITS (type), nfields); + (B_TYPE *) TYPE_ZALLOC (type, B_BYTES (nfields)); TYPE_FIELD_PROTECTED_BITS (type) = - (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields)); - B_CLRALL (TYPE_FIELD_PROTECTED_BITS (type), nfields); + (B_TYPE *) TYPE_ZALLOC (type, B_BYTES (nfields)); TYPE_FIELD_IGNORE_BITS (type) = - (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields)); - B_CLRALL (TYPE_FIELD_IGNORE_BITS (type), nfields); + (B_TYPE *) TYPE_ZALLOC (type, B_BYTES (nfields)); } /* If the type has baseclasses, allocate and clear a bit vector for @@ -12084,9 +12081,8 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, unsigned char *pointer; ALLOCATE_CPLUS_STRUCT_TYPE (type); - pointer = (unsigned char *) TYPE_ALLOC (type, num_bytes); + pointer = (unsigned char *) TYPE_ZALLOC (type, num_bytes); TYPE_FIELD_VIRTUAL_BITS (type) = pointer; - B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), fip->baseclasses.size ()); TYPE_N_BASECLASSES (type) = fip->baseclasses.size (); } diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 18fefd6929c..1269fc02d72 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -3067,19 +3067,17 @@ read_baseclasses (struct stab_field_info *fip, const char **pp, /* Some stupid compilers have trouble with the following, so break it up into simpler expressions. */ TYPE_FIELD_VIRTUAL_BITS (type) = (B_TYPE *) - TYPE_ALLOC (type, B_BYTES (TYPE_N_BASECLASSES (type))); + TYPE_ZALLOC (type, B_BYTES (TYPE_N_BASECLASSES (type))); #else { int num_bytes = B_BYTES (TYPE_N_BASECLASSES (type)); char *pointer; - pointer = (char *) TYPE_ALLOC (type, num_bytes); + pointer = (char *) TYPE_ZALLOC (type, num_bytes); TYPE_FIELD_VIRTUAL_BITS (type) = (B_TYPE *) pointer; } #endif /* 0 */ - B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), TYPE_N_BASECLASSES (type)); - for (i = 0; i < TYPE_N_BASECLASSES (type); i++) { newobj = OBSTACK_ZALLOC (&fip->obstack, struct stabs_nextfield); @@ -3295,16 +3293,13 @@ attach_fields_to_type (struct stab_field_info *fip, struct type *type, ALLOCATE_CPLUS_STRUCT_TYPE (type); TYPE_FIELD_PRIVATE_BITS (type) = - (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields)); - B_CLRALL (TYPE_FIELD_PRIVATE_BITS (type), nfields); + (B_TYPE *) TYPE_ZALLOC (type, B_BYTES (nfields)); TYPE_FIELD_PROTECTED_BITS (type) = - (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields)); - B_CLRALL (TYPE_FIELD_PROTECTED_BITS (type), nfields); + (B_TYPE *) TYPE_ZALLOC (type, B_BYTES (nfields)); TYPE_FIELD_IGNORE_BITS (type) = - (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields)); - B_CLRALL (TYPE_FIELD_IGNORE_BITS (type), nfields); + (B_TYPE *) TYPE_ZALLOC (type, B_BYTES (nfields)); } /* Copy the saved-up fields into the field vector. Start from the