From patchwork Sat Feb 9 00:40:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Baldwin X-Patchwork-Id: 31384 Received: (qmail 78250 invoked by alias); 9 Feb 2019 00:50:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 78215 invoked by uid 89); 9 Feb 2019 00:50:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, SPF_HELO_PASS, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=bell X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Feb 2019 00:50:42 +0000 Received: from ralph.com (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 573BB10B682 for ; Fri, 8 Feb 2019 19:42:37 -0500 (EST) From: John Baldwin To: gdb-patches@sourceware.org Subject: [PATCH v2 05/11] Remove code disabled since at least 1999 from lookup_struct_elt_type. Date: Fri, 8 Feb 2019 16:40:08 -0800 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-IsSubscribed: yes Update the comment above the function to reflect the code removal and document the existing behavior. gdb/ChangeLog: * gdbtypes.c (lookup_struct_elt_type): Update comment and remove disabled code block. --- gdb/ChangeLog | 5 +++++ gdb/gdbtypes.c | 21 +++------------------ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 621b9af800..cebd63bcb5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-02-08 John Baldwin + + * gdbtypes.c (lookup_struct_elt_type): Update comment and + remove disabled code block. + 2019-02-08 John Baldwin * gdbarch.sh (get_thread_local_address): New method. diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index d1ca304a92..e4acb0e985 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1644,8 +1644,7 @@ lookup_template_type (char *name, struct type *type, return (SYMBOL_TYPE (sym)); } -/* Given a type TYPE, lookup the type of the component of type named - NAME. +/* Given a type TYPE, lookup the type of the component named NAME. TYPE can be either a struct or union, or a pointer or reference to a struct or union. If it is a pointer or reference, its target @@ -1653,8 +1652,8 @@ lookup_template_type (char *name, struct type *type, as specified for the definitions of the expression element types STRUCTOP_STRUCT and STRUCTOP_PTR. - If NOERR is nonzero, return zero if NAME is not suitably defined. - If NAME is the name of a baseclass type, return that type. */ + If NOERR is nonzero, return NULL if there is no component named + NAME. */ struct type * lookup_struct_elt_type (struct type *type, const char *name, int noerr) @@ -1678,20 +1677,6 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr) type_name.c_str ()); } -#if 0 - /* FIXME: This change put in by Michael seems incorrect for the case - where the structure tag name is the same as the member name. - I.e. when doing "ptype bell->bar" for "struct foo { int bar; int - foo; } bell;" Disabled by fnf. */ - { - char *type_name; - - type_name = TYPE_NAME (type); - if (type_name != NULL && strcmp (type_name, name) == 0) - return type; - } -#endif - for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--) { const char *t_field_name = TYPE_FIELD_NAME (type, i);