From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25252 invoked by alias); 15 Sep 2017 22:29:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25234 invoked by uid 89); 15 Sep 2017 22:29:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=RANGE X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Sep 2017 22:29:18 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v8FMTClB027996 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 15 Sep 2017 18:29:17 -0400 Received: by simark.ca (Postfix, from userid 112) id 1FB921ECEE; Fri, 15 Sep 2017 18:29:12 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 523661E984; Fri, 15 Sep 2017 18:29:01 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 15 Sep 2017 22:29:00 -0000 From: Simon Marchi To: Tim Wiederhake Cc: gdb-patches@sourceware.org, Christoph Weinmann Subject: Re: [PATCH 4/5] Fortran: Change subrange enum to bit field. In-Reply-To: <1505134663-29374-5-git-send-email-tim.wiederhake@intel.com> References: <1505134663-29374-1-git-send-email-tim.wiederhake@intel.com> <1505134663-29374-5-git-send-email-tim.wiederhake@intel.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 15 Sep 2017 22:29:12 +0000 X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00428.txt.bz2 On 2017-09-11 14:57, Tim Wiederhake wrote: > From: Christoph Weinmann > > Change Fortran subrange enum for subrange expressions to represent a > bitfield > for easier manipulation. Consequently also change occurences and > evaluation > of said enum. The behaviour of GDB is unchanged. Good idea, I think it makes sense. It might be useful if this enum was an "enum flags" in some cases (like to avoid having to cast when doing bitwise or), but it may not help in other. For example, I am not sure the case (SUBARRAY_LOW_BOUND | SUBARRAY_HIGH_BOUND): would work. You can try it if you want, but otherwise I'm fine with the current version. > xxxx-yy-zz Christoph Weinmann > Tim Wiederhake > > * expprint.c (print_subexp_standard): Use bitfield instead of enum. > (dump_subexp_body_standard): Same. > * f-exp.y (subrange): Same. > * f-lang.c (f90_value_subarray): Same. > * parse.c (operator_length_standard): Same. > * rust-exp.y: Same. > * rust-lang.c (rust_range, rust_compute_range, rust_subscript): Same. > * expression.h (enum range_type): Turn into a bitfield. > > > --- > gdb/expprint.c | 20 ++++++++------------ > gdb/expression.h | 15 ++++++--------- > gdb/f-exp.y | 11 ++++++----- > gdb/f-lang.c | 8 ++++---- > gdb/parse.c | 21 ++++++++------------- > gdb/rust-exp.y | 12 +++--------- > gdb/rust-lang.c | 17 ++++++++--------- > 7 files changed, 43 insertions(+), 61 deletions(-) > > diff --git a/gdb/expprint.c b/gdb/expprint.c > index 9e04f24..19d1c88 100644 > --- a/gdb/expprint.c > +++ b/gdb/expprint.c > @@ -581,12 +581,10 @@ print_subexp_standard (struct expression *exp, > int *pos, > *pos += 2; > > fputs_filtered ("RANGE(", stream); > - if (range_type == HIGH_BOUND_DEFAULT > - || range_type == NONE_BOUND_DEFAULT) > + if ((range_type & SUBARRAY_LOW_BOUND) != 0) > print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); > fputs_filtered ("..", stream); > - if (range_type == LOW_BOUND_DEFAULT > - || range_type == NONE_BOUND_DEFAULT) > + if ((range_type & SUBARRAY_HIGH_BOUND) != 0) > print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); > fputs_filtered (")", stream); > return; > @@ -1093,16 +1091,16 @@ dump_subexp_body_standard (struct expression > *exp, > > switch (range_type) > { > - case BOTH_BOUND_DEFAULT: > + case SUBARRAY_NO_BOUND: > fputs_filtered ("Range '..'", stream); > break; > - case LOW_BOUND_DEFAULT: > + case SUBARRAY_HIGH_BOUND: > fputs_filtered ("Range '..EXP'", stream); > break; > - case HIGH_BOUND_DEFAULT: > + case SUBARRAY_LOW_BOUND: > fputs_filtered ("Range 'EXP..'", stream); > break; > - case NONE_BOUND_DEFAULT: > + case (SUBARRAY_LOW_BOUND | SUBARRAY_HIGH_BOUND): > fputs_filtered ("Range 'EXP..EXP'", stream); > break; > default: > @@ -1110,11 +1108,9 @@ dump_subexp_body_standard (struct expression > *exp, > break; > } > > - if (range_type == HIGH_BOUND_DEFAULT > - || range_type == NONE_BOUND_DEFAULT) > + if ((range_type & SUBARRAY_LOW_BOUND) != 0) > elt = dump_subexp (exp, stream, elt); > - if (range_type == LOW_BOUND_DEFAULT > - || range_type == NONE_BOUND_DEFAULT) > + if ((range_type & SUBARRAY_HIGH_BOUND) != 0) > elt = dump_subexp (exp, stream, elt); > } > break; > diff --git a/gdb/expression.h b/gdb/expression.h > index 9e4ddf5..c794198 100644 > --- a/gdb/expression.h > +++ b/gdb/expression.h > @@ -155,17 +155,14 @@ extern void dump_raw_expression (struct > expression *, > struct ui_file *, const char *); > extern void dump_prefix_expression (struct expression *, struct > ui_file *); > > -/* In an OP_RANGE expression, either bound could be empty, indicating > - that its value is by default that of the corresponding bound of the > - array or string. So we have four sorts of subrange. This > - enumeration type is to identify this. */ > - > +/* Flags to indicate which boundarys are set in an OP_RANGE > expression. Values boundarys -> boundaries Thanks, Simon