From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GQIWEbevsWnABSQAWB0awg (envelope-from ) for ; Wed, 11 Mar 2026 14:08:55 -0400 Received: by simark.ca (Postfix, from userid 112) id 3DBFE1E089; Wed, 11 Mar 2026 14:08:55 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [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 8E9AF1E089 for ; Wed, 11 Mar 2026 14:08:53 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 427164B920FD for ; Wed, 11 Mar 2026 18:08:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 427164B920FD Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 12F224BAD171 for ; Wed, 11 Mar 2026 18:08:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 12F224BAD171 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 12F224BAD171 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773252508; cv=none; b=flY+h/pEpcLV1ix5V1iRwV6ZBEYxIz7GeZIpwxUGOwfbc9ZU//S0P/nwO/SmXquxlMsy5bTsdLo1OVOinsBmTi6IlMFxXFsa0RSPzuq7EeI1rvI7nLnLV9sO/qi7ajMmgF3+lAUmsR1kVN30y1+q2CDADTzjxyTazUsDhdvEDpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773252508; c=relaxed/simple; bh=O1ZaJ7ty8O8b7MZI2BVh2rqaKCJ/17R3aOQFb8FhWMc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Q2PO11ozRyCPmMbSmPBZmoGCl5mjfv/I36V/UJWxx01hSyJpXhhim3irXpE1dTAiNa53RTmq8RsZ2YXc9M6qs6SdktJem64edH/Qe+Jhfyhq06bcNBuWlJo2/vFtdA53mux1TXpeFwd+PBcf0RyarjuBa9wW3DCAIQOBYwTWmqU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12F224BAD171 Received: by simark.ca (Postfix) id 7A8AD1E09A; Wed, 11 Mar 2026 14:08:26 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 01/23] gdb/dwarf: change die_needs_namespace to return bool Date: Wed, 11 Mar 2026 14:05:26 -0400 Message-ID: <20260311180825.720803-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260311180825.720803-1-simon.marchi@efficios.com> References: <20260311180825.720803-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Change the return type to bool, and do some other trivial refactoring: - remove unnecessary `attr` variable, which I don't think helps code readability - change an `if (cond) return false; return true` pattern to be just one return expression. Change-Id: I647c3ad73af94bb76c4b59f580bbdfd1eef45888 --- gdb/dwarf2/read.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 25ea7644ed08..d52f0651de1b 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -4980,11 +4980,9 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) needs to have the name of the scope prepended to the name listed in the die. */ -static int +static bool die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu) { - struct attribute *attr; - if (tag_is_type (die->tag) && die->tag != DW_TAG_template_type_param) { /* Historically GNAT emitted some types in funny scopes. For @@ -4997,7 +4995,7 @@ die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu) . DW_AT_name: natural To detect this, we look up the DIE tree for a node that has - a name; and if that name is fully qualified, we return 0 + a name; and if that name is fully qualified, we return false here. */ if (cu->lang () == language_ada) { @@ -5013,7 +5011,7 @@ die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu) } } } - return 1; + return true; } switch (die->tag) @@ -5024,7 +5022,7 @@ die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu) case DW_TAG_entry_point: case DW_TAG_member: case DW_TAG_imported_declaration: - return 1; + return true; case DW_TAG_module: /* We don't need the namespace for Fortran modules, but we do @@ -5046,22 +5044,21 @@ die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu) spec_cu); } - attr = dwarf2_attr (die, DW_AT_external, cu); - if (attr == NULL && die->parent->tag != DW_TAG_namespace + if (dwarf2_attr (die, DW_AT_external, cu) == nullptr + && die->parent->tag != DW_TAG_namespace && die->parent->tag != DW_TAG_module) - return 0; + return false; + /* A variable in a lexical block of some kind does not need a namespace, even though in C++ such variables may be external and have a mangled name. */ - if (die->parent->tag == DW_TAG_lexical_block - || die->parent->tag == DW_TAG_try_block - || die->parent->tag == DW_TAG_catch_block - || die->parent->tag == DW_TAG_subprogram) - return 0; - return 1; + return (die->parent->tag != DW_TAG_lexical_block + && die->parent->tag != DW_TAG_try_block + && die->parent->tag != DW_TAG_catch_block + && die->parent->tag != DW_TAG_subprogram); default: - return 0; + return false; } } -- 2.53.0