From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 82FDE3857037 for ; Mon, 6 Jul 2020 13:38:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 82FDE3857037 X-ASG-Debug-ID: 1594042724-0c856e6bfb360360001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id nKpoN2TPmkENJBhN (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 06 Jul 2020 09:38:44 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.localdomain (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) by smtp.ebox.ca (Postfix) with ESMTP id A7007441D64; Mon, 6 Jul 2020 09:38:44 -0400 (EDT) From: Simon Marchi X-Barracuda-Effective-Source-IP: 173-246-6-90.qc.cable.ebox.net[173.246.6.90] X-Barracuda-Apparent-Source-IP: 173.246.6.90 X-Barracuda-RBL-IP: 173.246.6.90 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 08/12] gdb: remove TYPE_ARRAY_{UPPER, LOWER}_BOUND_IS_UNDEFINED Date: Mon, 6 Jul 2020 09:38:29 -0400 X-ASG-Orig-Subj: [PATCH 08/12] gdb: remove TYPE_ARRAY_{UPPER, LOWER}_BOUND_IS_UNDEFINED Message-Id: <20200706133833.145408-9-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200706133833.145408-1-simon.marchi@polymtl.ca> References: <20200706133833.145408-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1594042724 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 6520 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 2.90 X-Barracuda-Spam-Status: No, SCORE=2.90 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=TVD_SUBJ_WIPE_DEBT X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.83013 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 2.90 TVD_SUBJ_WIPE_DEBT TVD_SUBJ_WIPE_DEBT X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_QUARANTINE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TVD_SUBJ_WIPE_DEBT, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Jul 2020 13:38:47 -0000 From: Simon Marchi Remove the macros, use the various equivalent getters instead. gdb/ChangeLog: * gdbtypes.h (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED, TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED): Remove. Update all callers to use the equivalent accessor methods instead. Change-Id: Ifb4c36f440b82533bde5d15a5cbb2fc91f467292 --- gdb/c-varobj.c | 2 +- gdb/f-typeprint.c | 4 ++-- gdb/f-valprint.c | 4 ++-- gdb/gdbtypes.h | 5 ----- gdb/m2-typeprint.c | 2 +- gdb/p-typeprint.c | 2 +- gdb/valarith.c | 9 +++++---- gdb/valops.c | 3 ++- 8 files changed, 14 insertions(+), 17 deletions(-) diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c index a0b84936b023..2bcfe8672eb7 100644 --- a/gdb/c-varobj.c +++ b/gdb/c-varobj.c @@ -192,7 +192,7 @@ c_number_of_children (const struct varobj *var) { case TYPE_CODE_ARRAY: if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0 - && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) + && (type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED)) children = TYPE_LENGTH (type) / TYPE_LENGTH (target); else /* If we don't know how many elements there are, don't display diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index f09a4b1f21bf..df83a481386a 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -223,7 +223,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, /* Make sure that, if we have an assumed size array, we print out a warning and print the upperbound as '*'. */ - if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) + if (type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED) fprintf_filtered (stream, "*"); else { @@ -408,7 +408,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show, case TYPE_CODE_STRING: /* Strings may have dynamic upperbounds (lengths) like arrays. */ - if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) + if (type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED) fprintfi_filtered (level, stream, "character*(*)"); else { diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 6ed1c340c760..05f98bc35052 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -46,7 +46,7 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; LONGEST f77_get_lowerbound (struct type *type) { - if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type)) + if (type->index_type ()->bounds ()->low.kind () == PROP_UNDEFINED) error (_("Lower bound may not be '*' in F77")); return TYPE_ARRAY_LOWER_BOUND_VALUE (type); @@ -55,7 +55,7 @@ f77_get_lowerbound (struct type *type) LONGEST f77_get_upperbound (struct type *type) { - if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) + if (type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED) { /* We have an assumed size array on our hands. Assume that upper_bound == lower_bound so that we show at least 1 element. diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 9be97054cfa5..83432b6fc778 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1628,11 +1628,6 @@ extern bool set_type_align (struct type *, ULONGEST); /* Accessors for struct range_bounds data attached to an array type's index type. */ -#define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \ - ((arraytype)->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED) -#define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \ - ((arraytype)->index_type ()->bounds ()->low.kind () == PROP_UNDEFINED) - #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ ((arraytype)->index_type ()->bounds ()->high.const_val ()) diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c index 39f0e8e29610..474e58725c7f 100644 --- a/gdb/m2-typeprint.c +++ b/gdb/m2-typeprint.c @@ -226,7 +226,7 @@ static void m2_array (struct type *type, struct ui_file *stream, { fprintf_filtered (stream, "ARRAY ["); if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0 - && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) + && type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED) { if (type->index_type () != 0) { diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index c453df4b003c..5a32667603b7 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -274,7 +274,7 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream, fprintf_filtered (stream, "("); fprintf_filtered (stream, "array "); if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0 - && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) + && type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED) fprintf_filtered (stream, "[%s..%s] ", plongest (TYPE_ARRAY_LOWER_BOUND_VALUE (type)), plongest (TYPE_ARRAY_UPPER_BOUND_VALUE (type))); diff --git a/gdb/valarith.c b/gdb/valarith.c index a5779a3aff97..0b1f43f2e009 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -200,12 +200,13 @@ value_subscripted_rvalue (struct value *array, LONGEST index, LONGEST lowerbound } LONGEST elt_offs = elt_size * (index - lowerbound); + bool array_upper_bound_undefined + = array_type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED; if (index < lowerbound - || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) - && elt_offs >= type_length_units (array_type)) - || (VALUE_LVAL (array) != lval_memory - && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type))) + || (!array_upper_bound_undefined + && elt_offs >= type_length_units (array_type)) + || (VALUE_LVAL (array) != lval_memory && array_upper_bound_undefined)) { if (type_not_associated (array_type)) error (_("no such vector element (vector not associated)")); diff --git a/gdb/valops.c b/gdb/valops.c index afdb429dc377..cfa0f5415d2e 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -388,7 +388,8 @@ value_cast (struct type *type, struct value *arg2) struct type *element_type = TYPE_TARGET_TYPE (type); unsigned element_length = TYPE_LENGTH (check_typedef (element_type)); - if (element_length > 0 && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) + if (element_length > 0 + && type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED) { struct type *range_type = type->index_type (); int val_length = TYPE_LENGTH (type2); -- 2.27.0