From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tim Wiederhake <tim.wiederhake@intel.com>
Cc: gdb-patches@sourceware.org,
Christoph Weinmann <christoph.t.weinmann@intel.com>
Subject: Re: [PATCH 4/5] Fortran: Change subrange enum to bit field.
Date: Fri, 15 Sep 2017 22:29:00 -0000 [thread overview]
Message-ID: <eac5767bfed4fd2c1b3f8376f773f250@polymtl.ca> (raw)
In-Reply-To: <1505134663-29374-5-git-send-email-tim.wiederhake@intel.com>
On 2017-09-11 14:57, Tim Wiederhake wrote:
> From: Christoph Weinmann <christoph.t.weinmann@intel.com>
>
> 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 <christoph.t.weinmann@intel.com>
> Tim Wiederhake <tim.wiederhake@intel.com>
>
> * 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
next prev parent reply other threads:[~2017-09-15 22:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-11 12:58 [PATCH 0/5] Fortran: Array strides Tim Wiederhake
2017-09-11 12:58 ` [PATCH 3/5] Fortran: Allow multi-dimensional subarrays Tim Wiederhake
2017-09-15 22:08 ` Simon Marchi
2017-09-11 12:58 ` [PATCH 1/5] Fortran: Move calc_f77_array_dims Tim Wiederhake
2017-09-15 20:22 ` Simon Marchi
2017-09-15 20:28 ` Simon Marchi
2017-09-11 12:58 ` [PATCH 5/5] Fortran: Enable parsing of stride parameter for subranges Tim Wiederhake
2017-09-11 12:58 ` [PATCH 4/5] Fortran: Change subrange enum to bit field Tim Wiederhake
2017-09-15 22:29 ` Simon Marchi [this message]
2017-09-11 12:58 ` [PATCH 2/5] Fortran: Move value_f90_subarray Tim Wiederhake
2017-09-15 20:27 ` 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=eac5767bfed4fd2c1b3f8376f773f250@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=christoph.t.weinmann@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=tim.wiederhake@intel.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