From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 7E5A83858D28 for ; Wed, 30 Aug 2023 19:13:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7E5A83858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B333B21842 for ; Wed, 30 Aug 2023 19:13:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1693422786; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L0OgGBMsHBttQgnsZOg84EcjVSNoxBX/9fs3rvioFP0=; b=v5bHj+jo7Cdd7xXjIin5fdPdSixWon/mTrcPTGgiRBPy2QA78wfDxepg0f8IP/2UmlUCVH grob/F37H2Tx+vK4o2uCw3cLkj3PIXU6lWa6EfCBhhNBwVxF43UfG4FWnWeUVZYsAKNNth Y/vca6QYFupOWvDR+ZY0FD0gMYbIJ88= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1693422786; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L0OgGBMsHBttQgnsZOg84EcjVSNoxBX/9fs3rvioFP0=; b=KzyKX8aSSPhpgsjs8Tj6kINNYxa/8TWkpiC6GLBIGbdMQrFhFkW4PIoYu1ON+IMqUblvMm 3/oe/jLK2foli0CQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A0E4E1353E for ; Wed, 30 Aug 2023 19:13:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GClNJsKU72Q2IQAAMHmgww (envelope-from ) for ; Wed, 30 Aug 2023 19:13:06 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 5/6] [gdb/symtab] Replace TYPE_ALLOC + B_CLRALL with TYPE_ZALLOC Date: Wed, 30 Aug 2023 21:13:35 +0200 Message-Id: <20230830191336.15885-5-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230830191336.15885-1-tdevries@suse.de> References: <20230830191336.15885-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: I noticed some cases of TYPE_ALLOC followed by B_CLRALL. Replace these with TYPE_ZALLOC. Tested on x86_64-linux. --- gdb/dwarf2/read.c | 12 ++++-------- gdb/stabsread.c | 15 +++++---------- 2 files changed, 9 insertions(+), 18 deletions(-) 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 -- 2.35.3