Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 07/12] gdb: remove TYPE_LOW_BOUND_KIND and TYPE_HIGH_BOUND_KIND
Date: Mon,  6 Jul 2020 09:38:28 -0400	[thread overview]
Message-ID: <20200706133833.145408-8-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20200706133833.145408-1-simon.marchi@polymtl.ca>

From: Simon Marchi <simon.marchi@efficios.com>

Remove the macros, use the getters of `struct dynamic_prop` instead.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_LOW_BOUND_KIND,
	TYPE_HIGH_BOUND_KIND): Remove.  Update all callers
	to use dynamic_prop::kind.

Change-Id: Icb1fc761f675bfac934209f8102392504d905c44
---
 gdb/c-typeprint.c                 | 4 ++--
 gdb/compile/compile-c-symbols.c   | 4 ++--
 gdb/compile/compile-c-types.c     | 6 +++---
 gdb/compile/compile-cplus-types.c | 6 +++---
 gdb/gdbtypes.h                    | 4 ----
 gdb/rust-lang.c                   | 4 ++--
 6 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index e10a4858a03c..9e408e15a1e2 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -780,8 +780,8 @@ c_type_print_varspec_suffix (struct type *type,
 	fprintf_filtered (stream, (is_vector ?
 				   " __attribute__ ((vector_size(" : "["));
 	/* Bounds are not yet resolved, print a bounds placeholder instead.  */
-	if (TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCEXPR
-	    || TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCLIST)
+	if (type->index_type ()->bounds ()->high.kind () == PROP_LOCEXPR
+	    || type->index_type ()->bounds ()->high.kind () == PROP_LOCLIST)
 	  fprintf_filtered (stream, "variable length");
 	else if (get_array_bounds (type, &low_bound, &high_bound))
 	  fprintf_filtered (stream, "%s", 
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index be2ca35dead9..f4e0783d4b89 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -501,8 +501,8 @@ generate_vla_size (compile_instance *compiler,
     {
     case TYPE_CODE_RANGE:
       {
-	if (TYPE_HIGH_BOUND_KIND (type) == PROP_LOCEXPR
-	    || TYPE_HIGH_BOUND_KIND (type) == PROP_LOCLIST)
+	if (type->bounds ()->high.kind () == PROP_LOCEXPR
+	    || type->bounds ()->high.kind () == PROP_LOCLIST)
 	  {
 	    const struct dynamic_prop *prop = &type->bounds ()->high;
 	    std::string name = c_get_range_decl_name (prop);
diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index 3c900a24a3a6..2b25783bb00c 100644
--- a/gdb/compile/compile-c-types.c
+++ b/gdb/compile/compile-c-types.c
@@ -44,15 +44,15 @@ convert_array (compile_c_instance *context, struct type *type)
 
   element_type = context->convert_type (TYPE_TARGET_TYPE (type));
 
-  if (TYPE_LOW_BOUND_KIND (range) != PROP_CONST)
+  if (range->bounds ()->low.kind () != PROP_CONST)
     return context->plugin ().error (_("array type with non-constant"
 				       " lower bound is not supported"));
   if (range->bounds ()->low.const_val () != 0)
     return context->plugin ().error (_("cannot convert array type with "
 				       "non-zero lower bound to C"));
 
-  if (TYPE_HIGH_BOUND_KIND (range) == PROP_LOCEXPR
-      || TYPE_HIGH_BOUND_KIND (range) == PROP_LOCLIST)
+  if (range->bounds ()->high.kind () == PROP_LOCEXPR
+      || range->bounds ()->high.kind () == PROP_LOCLIST)
     {
       gcc_type result;
 
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index 4084f87e5a35..02df7ab90e6e 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -456,7 +456,7 @@ compile_cplus_convert_array (compile_cplus_instance *instance,
   struct type *range = type->index_type ();
   gcc_type element_type = instance->convert_type (TYPE_TARGET_TYPE (type));
 
-  if (TYPE_LOW_BOUND_KIND (range) != PROP_CONST)
+  if (range->bounds ()->low.kind () != PROP_CONST)
     {
       const char *s = _("array type with non-constant"
 			" lower bound is not supported");
@@ -472,8 +472,8 @@ compile_cplus_convert_array (compile_cplus_instance *instance,
       return instance->plugin ().error (s);
     }
 
-  if (TYPE_HIGH_BOUND_KIND (range) == PROP_LOCEXPR
-      || TYPE_HIGH_BOUND_KIND (range) == PROP_LOCLIST)
+  if (range->bounds ()->high.kind () == PROP_LOCEXPR
+      || range->bounds ()->high.kind () == PROP_LOCLIST)
     {
       if (TYPE_VECTOR (type))
 	{
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 2d277ac688d0..9be97054cfa5 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1594,10 +1594,6 @@ extern unsigned type_align (struct type *);
    space in struct type.  */
 extern bool set_type_align (struct type *, ULONGEST);
 
-#define TYPE_HIGH_BOUND_KIND(range_type) \
-  ((range_type)->bounds ()->high.kind ())
-#define TYPE_LOW_BOUND_KIND(range_type) \
-  ((range_type)->bounds ()->low.kind ())
 #define TYPE_BIT_STRIDE(range_type) \
   ((range_type)->bounds ()->stride.const_val () \
    * ((range_type)->bounds ()->flag_is_byte_stride ? 8 : 1))
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 31126a24b153..cedb15f555d3 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -813,8 +813,8 @@ rust_internal_print_type (struct type *type, const char *varstring,
 				  stream, show - 1, level, flags, false,
 				  podata);
 
-	if (TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCEXPR
-	    || TYPE_HIGH_BOUND_KIND (type->index_type ()) == PROP_LOCLIST)
+	if (type->index_type ()->bounds ()->high.kind () == PROP_LOCEXPR
+	    || type->index_type ()->bounds ()->high.kind () == PROP_LOCLIST)
 	  fprintf_filtered (stream, "; variable length");
 	else if (get_array_bounds (type, &low_bound, &high_bound))
 	  fprintf_filtered (stream, "; %s",
-- 
2.27.0



  parent reply	other threads:[~2020-07-06 13:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06 13:38 [PATCH 00/12] More type macros removal Simon Marchi
2020-07-06 13:38 ` [PATCH 01/12] gdb: add type::bounds / type::set_bounds Simon Marchi
2020-07-06 13:38 ` [PATCH 02/12] gdb: remove TYPE_RANGE_DATA macro Simon Marchi
2020-07-06 13:38 ` [PATCH 03/12] gdb: make get_discrete_bounds check for non-constant range bounds Simon Marchi
2020-07-06 13:38 ` [PATCH 04/12] gdb: add accessors to struct dynamic_prop Simon Marchi
2020-07-06 13:38 ` [PATCH 05/12] gdb: remove TYPE_HIGH_BOUND and TYPE_LOW_BOUND Simon Marchi
2020-07-06 13:38 ` [PATCH 06/12] gdb: remove TYPE_LOW_BOUND_UNDEFINED and TYPE_HIGH_BOUND_UNDEFINED Simon Marchi
2020-07-06 13:38 ` Simon Marchi [this message]
2020-07-06 13:38 ` [PATCH 08/12] gdb: remove TYPE_ARRAY_{UPPER, LOWER}_BOUND_IS_UNDEFINED Simon Marchi
2020-07-06 13:38 ` [PATCH 09/12] gdb: remove TYPE_ARRAY_{LOWER,UPPER}_BOUND_VALUE Simon Marchi
2020-07-06 13:50 ` [PATCH 00/12] More type macros removal Simon Marchi
2020-07-11 22:27   ` Tom Tromey
2020-07-11 23:05     ` Simon Marchi
2020-07-13  3:15 ` Simon Marchi

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=20200706133833.145408-8-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    /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