public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [commit/Ada] remove param "dispp" from ada-lang.c::ada_lookup_struct_elt_type
Date: Sat, 26 Aug 2017 00:31:00 -0000	[thread overview]
Message-ID: <20170826003110.22458-1-brobecker@adacore.com> (raw)

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,
-- 
Joel

---
 gdb/ChangeLog  |  6 ++++++
 gdb/ada-lang.c | 43 ++++++++++++++-----------------------------
 2 files changed, 20 insertions(+), 29 deletions(-)

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  <brobecker@adacore.com>
+
+	* 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  <jan.kratochvil@redhat.com>
 
 	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);
         }
-- 
2.11.0

                 reply	other threads:[~2017-08-26  0:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170826003110.22458-1-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).