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 06/12] gdb: remove TYPE_LOW_BOUND_UNDEFINED and TYPE_HIGH_BOUND_UNDEFINED
Date: Mon,  6 Jul 2020 09:38:27 -0400	[thread overview]
Message-ID: <20200706133833.145408-7-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_UNDEFINED,
	TYPE_HIGH_BOUND_UNDEFINED): Remove.  Update all callers
	to get the bound property's kind and check against
	PROP_UNDEFINED.

Change-Id: I6a7641ac1aa3fa7fca0c21f00556f185f2e2d68c
---
 gdb/ada-tasks.c | 4 ++--
 gdb/eval.c      | 3 ++-
 gdb/gdbtypes.c  | 7 ++++---
 gdb/gdbtypes.h  | 8 ++------
 4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 7870a7847ad6..27b458767a79 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -896,8 +896,8 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
 	      && eltype->code () == TYPE_CODE_PTR)
 	    idxtype = check_typedef (type->index_type ());
 	  if (idxtype != NULL
-	      && !TYPE_LOW_BOUND_UNDEFINED (idxtype)
-	      && !TYPE_HIGH_BOUND_UNDEFINED (idxtype))
+	      && idxtype->bounds ()->low.kind () != PROP_UNDEFINED
+	      && idxtype->bounds ()->high.kind () != PROP_UNDEFINED)
 	    {
 	      data->known_tasks_element = eltype;
 	      data->known_tasks_length =
diff --git a/gdb/eval.c b/gdb/eval.c
index 2191e190927e..dacd46da44fa 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -3212,7 +3212,8 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos,
 	  type = value_type (val);
 	  if (type->code () == TYPE_CODE_ARRAY
               && is_dynamic_type (type->index_type ())
-              && TYPE_HIGH_BOUND_UNDEFINED (type->index_type ()))
+              && (type->index_type ()->bounds ()->high.kind ()
+		  == PROP_UNDEFINED))
 	    return allocate_optimized_out_value (size_type);
 	}
       else
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 507d2f6dacbe..227f696b7363 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -5117,10 +5117,11 @@ recursive_dump_type (struct type *type, int spaces)
     {
       printfi_filtered (spaces, "low %s%s  high %s%s\n",
 			plongest (type->bounds ()->low.const_val ()),
-			TYPE_LOW_BOUND_UNDEFINED (type) ? " (undefined)" : "",
+			(type->bounds ()->low.kind () == PROP_UNDEFINED
+			 ? " (undefined)" : ""),
 			plongest (type->bounds ()->high.const_val ()),
-			TYPE_HIGH_BOUND_UNDEFINED (type) 
-			? " (undefined)" : "");
+			(type->bounds ()->high.kind () == PROP_UNDEFINED
+			 ? " (undefined)" : ""));
     }
 
   switch (TYPE_SPECIFIC_FIELD (type))
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 044af479727f..2d277ac688d0 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_LOW_BOUND_UNDEFINED(range_type) \
-  (TYPE_LOW_BOUND_KIND(range_type) == PROP_UNDEFINED)
-#define TYPE_HIGH_BOUND_UNDEFINED(range_type) \
-  (TYPE_HIGH_BOUND_KIND(range_type) == PROP_UNDEFINED)
 #define TYPE_HIGH_BOUND_KIND(range_type) \
   ((range_type)->bounds ()->high.kind ())
 #define TYPE_LOW_BOUND_KIND(range_type) \
@@ -1637,9 +1633,9 @@ extern bool set_type_align (struct type *, ULONGEST);
    index type.  */
 
 #define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \
-   TYPE_HIGH_BOUND_UNDEFINED((arraytype)->index_type ())
+   ((arraytype)->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED)
 #define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
-   TYPE_LOW_BOUND_UNDEFINED((arraytype)->index_type ())
+   ((arraytype)->index_type ()->bounds ()->low.kind () == PROP_UNDEFINED)
 
 #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
    ((arraytype)->index_type ()->bounds ()->high.const_val ())
-- 
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 ` Simon Marchi [this message]
2020-07-06 13:38 ` [PATCH 07/12] gdb: remove TYPE_LOW_BOUND_KIND and TYPE_HIGH_BOUND_KIND Simon Marchi
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-7-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