gdb: rename 'enum range_type' to 'enum range_flag'
To avoid confusion with other parts of GDB relating to types and ranges, rename this enum to make it clearer that it is a set of individual flags rather than an enumeration of different types of range. There should be no user visible changes after this commit. gdb/ChangeLog: * expprint.c (print_subexp_standard): Change enum range_type to range_flag and rename variables to match. (dump_subexp_body_standard): Likewise. * expression.h (enum range_type): Rename to... (enum range_flag): ...this. (range_types): Rename to... (range_flags): ...this. * f-lang.c (value_f90_subarray): Change enum range_type to range_flag and rename variables to match. * parse.c (operator_length_standard): Likewise. * rust-exp.y (rust_parser::convert_ast_to_expression): Change enum range_type to range_flag. * rust-lang.c (rust_evaluate_funcall): Likewise. (rust_range): Likewise. (rust_compute_range): Likewise. (rust_subscript): Likewise.
This commit is contained in:
parent
2f1b18db86
commit
f2d8e4c597
7 changed files with 46 additions and 27 deletions
|
@ -1,3 +1,22 @@
|
||||||
|
2020-10-22 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
|
* expprint.c (print_subexp_standard): Change enum range_type to
|
||||||
|
range_flag and rename variables to match.
|
||||||
|
(dump_subexp_body_standard): Likewise.
|
||||||
|
* expression.h (enum range_type): Rename to...
|
||||||
|
(enum range_flag): ...this.
|
||||||
|
(range_types): Rename to...
|
||||||
|
(range_flags): ...this.
|
||||||
|
* f-lang.c (value_f90_subarray): Change enum range_type to
|
||||||
|
range_flag and rename variables to match.
|
||||||
|
* parse.c (operator_length_standard): Likewise.
|
||||||
|
* rust-exp.y (rust_parser::convert_ast_to_expression): Change enum
|
||||||
|
range_type to range_flag.
|
||||||
|
* rust-lang.c (rust_evaluate_funcall): Likewise.
|
||||||
|
(rust_range): Likewise.
|
||||||
|
(rust_compute_range): Likewise.
|
||||||
|
(rust_subscript): Likewise.
|
||||||
|
|
||||||
2020-10-22 Andrew Burgess <andrew.burgess@embecosm.com>
|
2020-10-22 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
* expprint.c (print_subexp_standard): Update to reflect changes to
|
* expprint.c (print_subexp_standard): Update to reflect changes to
|
||||||
|
|
|
@ -579,19 +579,19 @@ print_subexp_standard (struct expression *exp, int *pos,
|
||||||
|
|
||||||
case OP_RANGE:
|
case OP_RANGE:
|
||||||
{
|
{
|
||||||
enum range_type range_type;
|
enum range_flag range_flag;
|
||||||
|
|
||||||
range_type = (enum range_type)
|
range_flag = (enum range_flag)
|
||||||
longest_to_int (exp->elts[pc + 1].longconst);
|
longest_to_int (exp->elts[pc + 1].longconst);
|
||||||
*pos += 2;
|
*pos += 2;
|
||||||
|
|
||||||
if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE)
|
if (range_flag & RANGE_HIGH_BOUND_EXCLUSIVE)
|
||||||
fputs_filtered ("EXCLUSIVE_", stream);
|
fputs_filtered ("EXCLUSIVE_", stream);
|
||||||
fputs_filtered ("RANGE(", stream);
|
fputs_filtered ("RANGE(", stream);
|
||||||
if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
|
if (!(range_flag & RANGE_LOW_BOUND_DEFAULT))
|
||||||
print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
|
print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
|
||||||
fputs_filtered ("..", stream);
|
fputs_filtered ("..", stream);
|
||||||
if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
|
if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT))
|
||||||
print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
|
print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
|
||||||
fputs_filtered (")", stream);
|
fputs_filtered (")", stream);
|
||||||
return;
|
return;
|
||||||
|
@ -1106,25 +1106,25 @@ dump_subexp_body_standard (struct expression *exp,
|
||||||
break;
|
break;
|
||||||
case OP_RANGE:
|
case OP_RANGE:
|
||||||
{
|
{
|
||||||
enum range_type range_type;
|
enum range_flag range_flag;
|
||||||
|
|
||||||
range_type = (enum range_type)
|
range_flag = (enum range_flag)
|
||||||
longest_to_int (exp->elts[elt].longconst);
|
longest_to_int (exp->elts[elt].longconst);
|
||||||
elt += 2;
|
elt += 2;
|
||||||
|
|
||||||
if (range_type & RANGE_HIGH_BOUND_EXCLUSIVE)
|
if (range_flag & RANGE_HIGH_BOUND_EXCLUSIVE)
|
||||||
fputs_filtered ("Exclusive", stream);
|
fputs_filtered ("Exclusive", stream);
|
||||||
fputs_filtered ("Range '", stream);
|
fputs_filtered ("Range '", stream);
|
||||||
if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
|
if (!(range_flag & RANGE_LOW_BOUND_DEFAULT))
|
||||||
fputs_filtered ("EXP", stream);
|
fputs_filtered ("EXP", stream);
|
||||||
fputs_filtered ("..", stream);
|
fputs_filtered ("..", stream);
|
||||||
if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
|
if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT))
|
||||||
fputs_filtered ("EXP", stream);
|
fputs_filtered ("EXP", stream);
|
||||||
fputs_filtered ("'", stream);
|
fputs_filtered ("'", stream);
|
||||||
|
|
||||||
if (!(range_type & RANGE_LOW_BOUND_DEFAULT))
|
if (!(range_flag & RANGE_LOW_BOUND_DEFAULT))
|
||||||
elt = dump_subexp (exp, stream, elt);
|
elt = dump_subexp (exp, stream, elt);
|
||||||
if (!(range_type & RANGE_HIGH_BOUND_DEFAULT))
|
if (!(range_flag & RANGE_HIGH_BOUND_DEFAULT))
|
||||||
elt = dump_subexp (exp, stream, elt);
|
elt = dump_subexp (exp, stream, elt);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -185,7 +185,7 @@ extern void dump_prefix_expression (struct expression *, struct ui_file *);
|
||||||
or inclusive. So we have six sorts of subrange. This enumeration
|
or inclusive. So we have six sorts of subrange. This enumeration
|
||||||
type is to identify this. */
|
type is to identify this. */
|
||||||
|
|
||||||
enum range_type : unsigned
|
enum range_flag : unsigned
|
||||||
{
|
{
|
||||||
/* This is a standard range. Both the lower and upper bounds are
|
/* This is a standard range. Both the lower and upper bounds are
|
||||||
defined, and the bounds are inclusive. */
|
defined, and the bounds are inclusive. */
|
||||||
|
@ -201,6 +201,6 @@ enum range_type : unsigned
|
||||||
RANGE_HIGH_BOUND_EXCLUSIVE = 1 << 2,
|
RANGE_HIGH_BOUND_EXCLUSIVE = 1 << 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEF_ENUM_FLAGS_TYPE (enum range_type, range_types);
|
DEF_ENUM_FLAGS_TYPE (enum range_flag, range_flags);
|
||||||
|
|
||||||
#endif /* !defined (EXPRESSION_H) */
|
#endif /* !defined (EXPRESSION_H) */
|
||||||
|
|
|
@ -126,17 +126,17 @@ value_f90_subarray (struct value *array,
|
||||||
int pc = (*pos) + 1;
|
int pc = (*pos) + 1;
|
||||||
LONGEST low_bound, high_bound;
|
LONGEST low_bound, high_bound;
|
||||||
struct type *range = check_typedef (value_type (array)->index_type ());
|
struct type *range = check_typedef (value_type (array)->index_type ());
|
||||||
enum range_type range_type
|
enum range_flag range_flag
|
||||||
= (enum range_type) longest_to_int (exp->elts[pc].longconst);
|
= (enum range_flag) longest_to_int (exp->elts[pc].longconst);
|
||||||
|
|
||||||
*pos += 3;
|
*pos += 3;
|
||||||
|
|
||||||
if (range_type & RANGE_LOW_BOUND_DEFAULT)
|
if (range_flag & RANGE_LOW_BOUND_DEFAULT)
|
||||||
low_bound = range->bounds ()->low.const_val ();
|
low_bound = range->bounds ()->low.const_val ();
|
||||||
else
|
else
|
||||||
low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
|
low_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
|
||||||
|
|
||||||
if (range_type & RANGE_HIGH_BOUND_DEFAULT)
|
if (range_flag & RANGE_HIGH_BOUND_DEFAULT)
|
||||||
high_bound = range->bounds ()->high.const_val ();
|
high_bound = range->bounds ()->high.const_val ();
|
||||||
else
|
else
|
||||||
high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
|
high_bound = value_as_long (evaluate_subexp (nullptr, exp, pos, noside));
|
||||||
|
|
|
@ -774,7 +774,7 @@ operator_length_standard (const struct expression *expr, int endpos,
|
||||||
{
|
{
|
||||||
int oplen = 1;
|
int oplen = 1;
|
||||||
int args = 0;
|
int args = 0;
|
||||||
enum range_type range_type;
|
enum range_flag range_flag;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (endpos < 1)
|
if (endpos < 1)
|
||||||
|
@ -918,15 +918,15 @@ operator_length_standard (const struct expression *expr, int endpos,
|
||||||
|
|
||||||
case OP_RANGE:
|
case OP_RANGE:
|
||||||
oplen = 3;
|
oplen = 3;
|
||||||
range_type = (enum range_type)
|
range_flag = (enum range_flag)
|
||||||
longest_to_int (expr->elts[endpos - 2].longconst);
|
longest_to_int (expr->elts[endpos - 2].longconst);
|
||||||
|
|
||||||
/* Assume the range has 2 arguments (low bound and high bound), then
|
/* Assume the range has 2 arguments (low bound and high bound), then
|
||||||
reduce the argument count if any bounds are set to default. */
|
reduce the argument count if any bounds are set to default. */
|
||||||
args = 2;
|
args = 2;
|
||||||
if (range_type & RANGE_LOW_BOUND_DEFAULT)
|
if (range_flag & RANGE_LOW_BOUND_DEFAULT)
|
||||||
--args;
|
--args;
|
||||||
if (range_type & RANGE_HIGH_BOUND_DEFAULT)
|
if (range_flag & RANGE_HIGH_BOUND_DEFAULT)
|
||||||
--args;
|
--args;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2492,7 +2492,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation,
|
||||||
|
|
||||||
case OP_RANGE:
|
case OP_RANGE:
|
||||||
{
|
{
|
||||||
enum range_type kind = (RANGE_HIGH_BOUND_DEFAULT
|
enum range_flag kind = (RANGE_HIGH_BOUND_DEFAULT
|
||||||
| RANGE_LOW_BOUND_DEFAULT);
|
| RANGE_LOW_BOUND_DEFAULT);
|
||||||
|
|
||||||
if (operation->left.op != NULL)
|
if (operation->left.op != NULL)
|
||||||
|
|
|
@ -1065,7 +1065,6 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside)
|
||||||
static struct value *
|
static struct value *
|
||||||
rust_range (struct expression *exp, int *pos, enum noside noside)
|
rust_range (struct expression *exp, int *pos, enum noside noside)
|
||||||
{
|
{
|
||||||
enum range_type kind;
|
|
||||||
struct value *low = NULL, *high = NULL;
|
struct value *low = NULL, *high = NULL;
|
||||||
struct value *addrval, *result;
|
struct value *addrval, *result;
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
|
@ -1074,7 +1073,8 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
|
||||||
struct type *temp_type;
|
struct type *temp_type;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst);
|
auto kind
|
||||||
|
= (enum range_flag) longest_to_int (exp->elts[*pos + 1].longconst);
|
||||||
*pos += 3;
|
*pos += 3;
|
||||||
|
|
||||||
if (!(kind & RANGE_LOW_BOUND_DEFAULT))
|
if (!(kind & RANGE_LOW_BOUND_DEFAULT))
|
||||||
|
@ -1164,7 +1164,7 @@ rust_range (struct expression *exp, int *pos, enum noside noside)
|
||||||
static void
|
static void
|
||||||
rust_compute_range (struct type *type, struct value *range,
|
rust_compute_range (struct type *type, struct value *range,
|
||||||
LONGEST *low, LONGEST *high,
|
LONGEST *low, LONGEST *high,
|
||||||
range_types *kind)
|
range_flags *kind)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1204,7 +1204,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside,
|
||||||
struct type *rhstype;
|
struct type *rhstype;
|
||||||
LONGEST low, high_bound;
|
LONGEST low, high_bound;
|
||||||
/* Initialized to appease the compiler. */
|
/* Initialized to appease the compiler. */
|
||||||
range_types kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT;
|
range_flags kind = RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT;
|
||||||
LONGEST high = 0;
|
LONGEST high = 0;
|
||||||
int want_slice = 0;
|
int want_slice = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue