From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4WwdMTd1cWn07w4AWB0awg (envelope-from ) for ; Wed, 21 Jan 2026 19:54:15 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=RlE4rnOE; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C43501E0AD; Wed, 21 Jan 2026 19:54:15 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no 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 24BD81E089 for ; Wed, 21 Jan 2026 19:54:15 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id D81614BC8973 for ; Thu, 22 Jan 2026 00:54:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D81614BC8973 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=RlE4rnOE Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id DB95E4BC0567 for ; Thu, 22 Jan 2026 00:51:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB95E4BC0567 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DB95E4BC0567 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769043075; cv=none; b=fxnJSbIQUCBe09Z9b0twubXEKCffDzPEQ0c02XaUm6Q/Yc0I/3rVvKoDvOaVswkrFddkZW5DxfHICsxvCCz4mQm5JVtHke9SIGT9C7feJBTHSDblforxGTdT2uLJ6tGjAJefv1Nax7kkrlG95fcFAqET1z9MnQNAvFX+/SgI2Yg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769043075; c=relaxed/simple; bh=Vb/tJgiZJYmlPFHI6nPoD9As5LFkXl2Cor27w8FEtXE=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=q1vaub6cLXj/iJ9FwquHNeBGHVfHvGUfDMCOBS4FBmWZShrz/x6xBsqc+aU9WP3zEbF/oSoys4x+tOi2muAzCJ6y6EL8WWk7A9sktaIekoE2ElhikqX3V9LkELAslcmia7IuxRE3lJSAhmI/jvt4BO2S2k7OnF+KMfE7MVHtxlY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB95E4BC0567 Received: from eig-obgw-6006b.ext.cloudfilter.net ([10.0.30.211]) by cmsmtp with ESMTPS id igU5vCANNaPqLiiuov1W0g; Thu, 22 Jan 2026 00:51:14 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id iiunv5afwvXvHiiunvp8rg; Thu, 22 Jan 2026 00:51:13 +0000 X-Authority-Analysis: v=2.4 cv=e4IGSbp/ c=1 sm=1 tr=0 ts=69717481 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=ItBw4LHWJt0A:10 a=ilqDGx9vaPlnxaBbbVMA:9 a=QEXdDO2ut3YA:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VITrnz4QAmeTcnffHkD+Jjoo+/X9BvcrkenN83rkMVw=; b=RlE4rnOEEs3wFzrmqf4e0dNUBA SUg01A00EGXgzZuOvXLeZ5KR7zOAx2jvBiVhpdh6YIRGhOLYyciYdzInvCVluznxQ6H4gA6jBBme/ H/OPepkpuoYORq5rjaSHskwQP; Received: from 97-122-114-32.hlrn.qwest.net ([97.122.114.32]:41752 helo=[192.168.122.1]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1viium-00000003Jvq-40p5; Wed, 21 Jan 2026 17:51:13 -0700 From: Tom Tromey Date: Wed, 21 Jan 2026 17:51:11 -0700 Subject: [PATCH 1/2] Remove cp_lookup_transparent_type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260121-cp-remove-junk-v1-1-0999e81d866d@tromey.com> References: <20260121-cp-remove-junk-v1-0-0999e81d866d@tromey.com> In-Reply-To: <20260121-cp-remove-junk-v1-0-0999e81d866d@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.114.32 X-Source-L: No X-Exim-ID: 1viium-00000003Jvq-40p5 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-114-32.hlrn.qwest.net ([192.168.122.1]) [97.122.114.32]:41752 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfINhwGRnruIa7SsgUV4YbbAnQAg2l5HdksgXsFbIc8Trihs7alKcY4LucUBAp3egnCdFIaod31fQeVro/APrtYBEC/9foSboH16Av3KSJbeMfxrRhOch afUGE7FuUEv8R/RT/8kK3aCRcyGJnOPWpU6RPV4d1HzKo2nWbrVUlHNCi6sl6IVLfEPRUo24/L0FC5n+aXgaFO3RyQpLH5KkUc8= 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 cp_lookup_transparent_type seems to be a workaround for bugs in very old compilers. A comment mentions that the bugs are fixed in GCC 3.4 -- released in 2004. I think this is long past due for removal, which this patch does. --- gdb/c-lang.c | 8 ------ gdb/cp-namespace.c | 78 ------------------------------------------------------ gdb/cp-support.h | 3 --- 3 files changed, 89 deletions(-) diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 8f5dcb0f29e..033a4b174e9 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -919,14 +919,6 @@ class cplus_language : public language_defn lai->set_bool_type (builtin->builtin_bool, "bool"); } - /* See language.h. */ - struct type *lookup_transparent_type (const char *name, - domain_search_flags flags) - const override - { - return cp_lookup_transparent_type (name, flags); - } - /* See language.h. */ unsigned int search_name_hash (const char *name) const override { diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index c7832088a91..2e3c539507c 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -44,10 +44,6 @@ static struct block_symbol const domain_search_flags domain, int basic_lookup, int is_in_anonymous); -static struct type *cp_lookup_transparent_type_loop (const char *name, - const char *scope, - int scope_len); - /* Check to see if SYMBOL refers to an object contained within an anonymous namespace; if so, add an appropriate using directive. */ @@ -966,80 +962,6 @@ cp_lookup_nested_symbol (struct type *parent_type, } } -/* The C++-version of lookup_transparent_type. */ - -/* FIXME: carlton/2004-01-16: The problem that this is trying to - address is that, unfortunately, sometimes NAME is wrong: it may not - include the name of namespaces enclosing the type in question. - lookup_transparent_type gets called when the type in question - is a declaration, and we're trying to find its definition; but, for - declarations, our type name deduction mechanism doesn't work. - There's nothing we can do to fix this in general, I think, in the - absence of debug information about namespaces (I've filed PR - gdb/1511 about this); until such debug information becomes more - prevalent, one heuristic which sometimes looks is to search for the - definition in namespaces containing the current namespace. - - We should delete this functions once the appropriate debug - information becomes more widespread. (GCC 3.4 will be the first - released version of GCC with such information.) */ - -struct type * -cp_lookup_transparent_type (const char *name, domain_search_flags flags) -{ - /* First, try the honest way of looking up the definition. */ - struct type *t = basic_lookup_transparent_type (name, flags); - const char *scope; - - if (t != NULL) - return t; - - /* If that doesn't work and we're within a namespace, look there - instead. */ - const block *block = get_selected_block (0); - if (block == nullptr) - return nullptr; - - scope = block->scope (); - - if (scope[0] == '\0') - return NULL; - - return cp_lookup_transparent_type_loop (name, scope, 0); -} - -/* Lookup the type definition associated to NAME in namespaces/classes - containing SCOPE whose name is strictly longer than LENGTH. LENGTH - must be the index of the start of a component of SCOPE. */ - -static struct type * -cp_lookup_transparent_type_loop (const char *name, - const char *scope, - int length) -{ - int scope_length = length + cp_find_first_component (scope + length); - char *full_name; - - /* If the current scope is followed by "::", look in the next - component. */ - if (scope[scope_length] == ':') - { - struct type *retval - = cp_lookup_transparent_type_loop (name, scope, - scope_length + 2); - - if (retval != NULL) - return retval; - } - - full_name = (char *) alloca (scope_length + 2 + strlen (name) + 1); - strncpy (full_name, scope, scope_length); - memcpy (full_name + scope_length, "::", 2); - strcpy (full_name + scope_length + 2, name); - - return basic_lookup_transparent_type (full_name); -} - /* This used to do something but was removed when it became obsolete. */ diff --git a/gdb/cp-support.h b/gdb/cp-support.h index c4579fe24c6..fb41a3c15b2 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -161,9 +161,6 @@ extern struct block_symbol const struct block *block, const domain_search_flags domain); -struct type *cp_lookup_transparent_type (const char *name, - domain_search_flags flags); - /* See description in cp-namespace.c. */ struct type *cp_find_type_baseclass_by_name (struct type *parent_type, -- 2.49.0