]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/rust-lang.c
gdb: Convert enum range_type to a bit field enum
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 5 May 2020 15:03:53 +0000 (16:03 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 22 Oct 2020 08:24:42 +0000 (09:24 +0100)
commit2f1b18db863d630b94f9454067597e0df648bf37
tree6c054ad0964abdaa5173dc34b530689069bf7fbd
parentc53dcd7785debc2e2a5b8b2dede45bbf32f2438d
gdb: Convert enum range_type to a bit field enum

The expression range_type enum represents the following ideas:

  - Lower bound is set to default,
  - Upper bound is set to default,
  - Upper bound is exclusive.

There are currently 6 entries in the enum to represent the combination
of all those ideas.

In a future commit I'd like to add stride information to the range,
this could in theory appear with any of the existing enum entries, so
this would take us to 12 enum entries.

This feels like its getting a little out of hand, so in this commit I
switch the range_type enum over to being a flags style enum.  There's
one entry to represent no flags being set, then 3 flags to represent
the 3 ideas above.  Adding stride information will require adding only
one more enum flag.

I've then gone through and updated the code to handle this change.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* expprint.c (print_subexp_standard): Update to reflect changes to
enum range_type.
(dump_subexp_body_standard): Likewise.
* expression.h (enum range_type): Convert to a bit field enum, and
make the enum unsigned.
* f-exp.y (subrange): Update to reflect changes to enum
range_type.
* f-lang.c (value_f90_subarray): Likewise.
* parse.c (operator_length_standard): Likewise.
* rust-exp.y (rust_parser::convert_ast_to_expression): Likewise.
* rust-lang.c (rust_range): Likewise.
(rust_compute_range): Likewise.
(rust_subscript): Likewise.
gdb/ChangeLog
gdb/expprint.c
gdb/expression.h
gdb/f-exp.y
gdb/f-lang.c
gdb/parse.c
gdb/rust-exp.y
gdb/rust-lang.c