From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ybiDHsVXhWmJnSoAWB0awg (envelope-from ) for ; Thu, 05 Feb 2026 21:53:57 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=lE1rm1uo; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 78FF01E0BA; Thu, 05 Feb 2026 21:53:57 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED,RDNS_NONE autolearn=no autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (unknown [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2793A1E089 for ; Thu, 05 Feb 2026 21:53:57 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id B69F84C92656 for ; Fri, 6 Feb 2026 02:53:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B69F84C92656 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=lE1rm1uo Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id D182548FE08B for ; Fri, 6 Feb 2026 02:52:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D182548FE08B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D182548FE08B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770346367; cv=none; b=qayWHyfTbaVwGAm80+rHfCTtmN2gcrRZ3c+ZMlRtjjCIjYveShEiC05vCG8gmRSOvrI9yzN+dJTu2h6l7ImYtdsfs1m8LzUg/ITegdN1a061OrJXBXqthe+dGIYUZoc2B4l1NKoT+iW/2Ux7zjjZmV2Fyp+j8lbG0U+rZ6fqa6w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770346367; c=relaxed/simple; bh=AJJytMHTaDWEHUrJyDxuDiu3LYpUpGkrDGIXE/l503s=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=SC2jJ8OS4lz8Sh8NS6H+2PZkdBT5FQIA+FhySdQpO523+e1TcSoLxjkguNrYT1s1keG+HcFfWeQqOxi57zuchePhlsuC/1gUeOTctSKQTVT58myWlL+kX/ZLpusHeFuyhUdrP6MrboTYKRpr/nuiH5A9wDdmQ07cyF8vRml9Qhs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D182548FE08B Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 6162qeAT076614 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 5 Feb 2026 21:52:45 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 6162qeAT076614 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1770346365; bh=FyzlqqfNOJHTVr3TRUnf81I65cvRCMUmrpEvAL0ydNA=; h=From:To:Cc:Subject:Date:From; b=lE1rm1uo2KP6IonryymV9dmVbzZ+Psw7NuV+mqMX0B+YuGtCJhcgFYbOiItT2uuDH wKzPl6Ei/4Y288iQVHTpZwLUDX+PLQC76a8SRfq2pLjR+tD1NVZhqYVcS8TnjlT93+ sf4yKYM7a2BtEgGowydiVqGTiDjqsJzYeRZZ+UF0Q4QL90eiO+n0PE/hMpaXLAPMt8 hiAF1UqxumErwHrDw1u9zisMB3dXa9BHcZwTmgs3PhgP5rz2rl3O6bmpmSJPfj49Tj +LwALDGx1vrV9b62c/ZdGBTmsixdo/ASj6bxOXRTk8GXppJOU0DWP6bvH5fNWbwaLe h+KKVHMZvp2kQ== Received: by simark.ca (Postfix) id 0A10E1E089; Thu, 05 Feb 2026 21:52:39 -0500 (EST) From: simon.marchi@polymtl.ca To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/2] gdb/block: remove block_iterator::d::block, remove union Date: Thu, 5 Feb 2026 21:52:30 -0500 Message-ID: <20260206025238.3467043-1-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 6 Feb 2026 02:52:40 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org From: Simon Marchi The block field is never used. The block is only used to grab a reference to the mdict, which is stored in the mdict_iterator. Remove it and remove the union. Leave the compunit_symtab field, whose name unfortunately conflicts with the method. Change-Id: I09dbc42f937eaba6c70598acca8ff355c4e5bdb9 --- gdb/block.c | 9 +++------ gdb/block.h | 13 ++++++------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/gdb/block.c b/gdb/block.c index 64ca59d44a1d..5aa58545393b 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -407,8 +407,6 @@ initialize_block_iterator (const struct block *block, which = STATIC_BLOCK; else { - iter->d.block = block; - /* A signal value meaning that we're iterating over a single block. */ iter->which = FIRST_LOCAL_BLOCK; @@ -428,14 +426,13 @@ initialize_block_iterator (const struct block *block, directly. */ if (cu->includes.empty ()) { - iter->d.block = block; /* A signal value meaning that we're iterating over a single block. */ iter->which = FIRST_LOCAL_BLOCK; } else { - iter->d.compunit_symtab = cu; + iter->compunit_symtab_ = cu; iter->which = which; } } @@ -446,9 +443,9 @@ compunit_symtab * block_iterator::compunit_symtab () const { if (this->idx == -1) - return this->d.compunit_symtab; + return this->compunit_symtab_; - auto &includes = this->d.compunit_symtab->includes; + auto &includes = this->compunit_symtab_->includes; if (this->idx < includes.size ()) return includes[this->idx]; diff --git a/gdb/block.h b/gdb/block.h index d9a8c4b6ff89..b84ca12c35a6 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -557,14 +557,13 @@ struct block_iterator iterates. Return nullptr if the iteration is finished. */ struct compunit_symtab *compunit_symtab () const; - /* If we're iterating over a single block, this holds the block. - Otherwise, it holds the canonical compunit. */ + /* If iterating on a global or static blocks, iteration starts from the + top-level CU and then continues with the global or static blocks of all + the included CUs. This field holds the compunit of the current block. - union - { - struct compunit_symtab *compunit_symtab; - const struct block *block; - } d; + This field is not private because block_iterator must remain trivial, + but treat it as private. */ + struct compunit_symtab *compunit_symtab_; /* If we're trying to match a name, this will be non-NULL. */ const lookup_name_info *name; base-commit: 1d688bb5f48a0feddf3ca3c60af2e91f4147dc36 -- 2.52.0