From patchwork Sat Aug 26 00:31:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 22360 Received: (qmail 106158 invoked by alias); 26 Aug 2017 00:31:28 -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 106080 invoked by uid 89); 26 Aug 2017 00:31:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=76977 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 26 Aug 2017 00:31:14 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 39F6C56091 for ; Fri, 25 Aug 2017 20:31:13 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id YPZFhQ9MnInD for ; Fri, 25 Aug 2017 20:31:13 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 215F656092 for ; Fri, 25 Aug 2017 20:31:13 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id A4E2C89029; Fri, 25 Aug 2017 20:31:12 -0400 (EDT) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [commit/Ada] remove param "dispp" from ada-lang.c::ada_lookup_struct_elt_type Date: Fri, 25 Aug 2017 20:31:10 -0400 Message-Id: <20170826003110.22458-1-brobecker@adacore.com> Hello, This function is always called with DISPP set to NULL, so there is no need for this parameter anymore. This patch removes it, and eliminates some dead code associated to that. gdb/ChangeLog: * ada-lang.c (ada_lookup_struct_elt_type): Remove parameter "dispp". Update all callers accordingly. Remove all code blocks handling the case where DISPP is not NULL. Tested on x86_64-linux, no regression. Pushed to master. Thanks, diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ff402163de..39ff4edde1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2017-08-25 Joel Brobecker + + * ada-lang.c (ada_lookup_struct_elt_type): Remove parameter "dispp". + Update all callers accordingly. Remove all code blocks handling + the case where DISPP is not NULL. + 2017-08-24 Jan Kratochvil PR symtab/22003 diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 476f7009b8..cbb846c9e5 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -152,7 +152,7 @@ static struct symbol *find_old_style_renaming_symbol (const char *, const struct block *); static struct type *ada_lookup_struct_elt_type (struct type *, const char *, - int, int, int *); + int, int); static struct value *evaluate_subexp_type (struct expression *, int *); @@ -6695,7 +6695,7 @@ ada_is_ignored_field (struct type *type, int field_num) int ada_is_tagged_type (struct type *type, int refok) { - return (ada_lookup_struct_elt_type (type, "_tag", refok, 1, NULL) != NULL); + return (ada_lookup_struct_elt_type (type, "_tag", refok, 1) != NULL); } /* True iff TYPE represents the type of X'Tag */ @@ -6721,7 +6721,7 @@ ada_is_tag_type (struct type *type) struct type * ada_tag_type (struct value *val) { - return ada_lookup_struct_elt_type (value_type (val), "_tag", 1, 0, NULL); + return ada_lookup_struct_elt_type (value_type (val), "_tag", 1, 0); } /* Return 1 if TAG follows the old scheme for Ada tags (used for Ada 95, @@ -7066,7 +7066,7 @@ ada_variant_discrim_type (struct type *var_type, struct type *outer_type) { const char *name = ada_variant_discrim_name (var_type); - return ada_lookup_struct_elt_type (outer_type, name, 1, 1, NULL); + return ada_lookup_struct_elt_type (outer_type, name, 1, 1); } /* Assuming that TYPE is the type of a variant wrapper, and FIELD_NUM is a @@ -7597,7 +7597,7 @@ type_as_string (struct type *type) static struct type * ada_lookup_struct_elt_type (struct type *type, const char *name, int refok, - int noerr, int *dispp) + int noerr) { int i; @@ -7631,29 +7631,19 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok, { const char *t_field_name = TYPE_FIELD_NAME (type, i); struct type *t; - int disp; if (t_field_name == NULL) continue; else if (field_name_match (t_field_name, name)) - { - if (dispp != NULL) - *dispp += TYPE_FIELD_BITPOS (type, i) / 8; - return TYPE_FIELD_TYPE (type, i); - } + return TYPE_FIELD_TYPE (type, i); else if (ada_is_wrapper_field (type, i)) { - disp = 0; t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (type, i), name, - 0, 1, &disp); + 0, 1); if (t != NULL) - { - if (dispp != NULL) - *dispp += disp + TYPE_FIELD_BITPOS (type, i) / 8; - return t; - } + return t; } else if (ada_is_variant_part (type, i)) @@ -7669,21 +7659,17 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok, generates these for unchecked variant types. Revisit if the compiler changes this practice. */ const char *v_field_name = TYPE_FIELD_NAME (field_type, j); - disp = 0; + if (v_field_name != NULL && field_name_match (v_field_name, name)) t = TYPE_FIELD_TYPE (field_type, j); else t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (field_type, j), - name, 0, 1, &disp); + name, 0, 1); if (t != NULL) - { - if (dispp != NULL) - *dispp += disp + TYPE_FIELD_BITPOS (type, i) / 8; - return t; - } + return t; } } @@ -7711,8 +7697,7 @@ is_unchecked_variant (struct type *var_type, struct type *outer_type) { const char *discrim_name = ada_variant_discrim_name (var_type); - return (ada_lookup_struct_elt_type (outer_type, discrim_name, 0, 1, NULL) - == NULL); + return (ada_lookup_struct_elt_type (outer_type, discrim_name, 0, 1) == NULL); } @@ -11372,7 +11357,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, { type = ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string, - 1, 1, NULL); + 1, 1); /* If the field is not found, check if it exists in the extension of this object's type. This means that we @@ -11392,7 +11377,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, else type = ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string, 1, - 0, NULL); + 0); return value_zero (ada_aligned_type (type), lval_memory); }