2016-05-17 Tom Tromey <tom@tromey.com>
+ * std-operator.def (OP_RANGE): Rename from OP_F90_RANGE.
+ * rust-lang.c: Don't include f-lang.h.
+ (rust_range, rust_compute_range, rust_subscript)
+ (rust_evaluate_subexp): Update.
+ * rust-exp.y: Don't include f-lang.h.
+ (ast_range, convert_ast_to_expression): Update.
+ * parse.c (operator_length_standard): Update.
+ * f-lang.h (enum f90_range_type): Move to expression.h.
+ * f-exp.y: Use OP_RANGE.
+ * expression.h (enum range_type): New enum; renamed from
+ f90_range_type.
+ * expprint.c: Don't include f-lang.h.
+ (print_subexp_standard, dump_subexp_body_standard): Use OP_RANGE.
+ * eval.c (value_f90_subarray, evaluate_subexp_standard): Update.
+
+2016-05-17 Tom Tromey <tom@tromey.com>
+
* NEWS: Add Rust item.
2016-05-17 Tom Tromey <tom@tromey.com>
int pc = (*pos) + 1;
LONGEST low_bound, high_bound;
struct type *range = check_typedef (TYPE_INDEX_TYPE (value_type (array)));
- enum f90_range_type range_type
- = (enum f90_range_type) longest_to_int (exp->elts[pc].longconst);
+ enum range_type range_type
+ = (enum range_type) longest_to_int (exp->elts[pc].longconst);
*pos += 3;
switch (code)
{
case TYPE_CODE_ARRAY:
- if (exp->elts[*pos].opcode == OP_F90_RANGE)
+ if (exp->elts[*pos].opcode == OP_RANGE)
return value_f90_subarray (arg1, exp, pos, noside);
else
goto multi_f77_subscript;
case TYPE_CODE_STRING:
- if (exp->elts[*pos].opcode == OP_F90_RANGE)
+ if (exp->elts[*pos].opcode == OP_RANGE)
return value_f90_subarray (arg1, exp, pos, noside);
else
{
#include "block.h"
#include "objfiles.h"
#include "valprint.h"
-#include "f-lang.h"
#include <ctype.h>
return;
}
- case OP_F90_RANGE:
+ case OP_RANGE:
{
- enum f90_range_type range_type;
+ enum range_type range_type;
- range_type = (enum f90_range_type)
+ range_type = (enum range_type)
longest_to_int (exp->elts[pc + 1].longconst);
*pos += 2;
elt += 2;
}
break;
- case OP_F90_RANGE:
+ case OP_RANGE:
{
- enum f90_range_type range_type;
+ enum range_type range_type;
- range_type = (enum f90_range_type)
+ range_type = (enum range_type)
longest_to_int (exp->elts[elt].longconst);
elt += 2;
struct ui_file *, 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. */
+
+enum range_type
+ {
+ BOTH_BOUND_DEFAULT, /* "(:)" */
+ LOW_BOUND_DEFAULT, /* "(:high)" */
+ HIGH_BOUND_DEFAULT, /* "(low:)" */
+ NONE_BOUND_DEFAULT /* "(low:high)" */
+ };
+
#endif /* !defined (EXPRESSION_H) */
/* There are four sorts of subrange types in F90. */
subrange: exp ':' exp %prec ABOVE_COMMA
- { write_exp_elt_opcode (pstate, OP_F90_RANGE);
+ { write_exp_elt_opcode (pstate, OP_RANGE);
write_exp_elt_longcst (pstate, NONE_BOUND_DEFAULT);
- write_exp_elt_opcode (pstate, OP_F90_RANGE); }
+ write_exp_elt_opcode (pstate, OP_RANGE); }
;
subrange: exp ':' %prec ABOVE_COMMA
- { write_exp_elt_opcode (pstate, OP_F90_RANGE);
+ { write_exp_elt_opcode (pstate, OP_RANGE);
write_exp_elt_longcst (pstate, HIGH_BOUND_DEFAULT);
- write_exp_elt_opcode (pstate, OP_F90_RANGE); }
+ write_exp_elt_opcode (pstate, OP_RANGE); }
;
subrange: ':' exp %prec ABOVE_COMMA
- { write_exp_elt_opcode (pstate, OP_F90_RANGE);
+ { write_exp_elt_opcode (pstate, OP_RANGE);
write_exp_elt_longcst (pstate, LOW_BOUND_DEFAULT);
- write_exp_elt_opcode (pstate, OP_F90_RANGE); }
+ write_exp_elt_opcode (pstate, OP_RANGE); }
;
subrange: ':' %prec ABOVE_COMMA
- { write_exp_elt_opcode (pstate, OP_F90_RANGE);
+ { write_exp_elt_opcode (pstate, OP_RANGE);
write_exp_elt_longcst (pstate, BOTH_BOUND_DEFAULT);
- write_exp_elt_opcode (pstate, OP_F90_RANGE); }
+ write_exp_elt_opcode (pstate, OP_RANGE); }
;
complexnum: exp ',' exp
/* Language-specific data structures */
-/* In F90 subrange 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 in F90. This enumeration type
- is to identify this. */
-
-enum f90_range_type
- {
- BOTH_BOUND_DEFAULT, /* "(:)" */
- LOW_BOUND_DEFAULT, /* "(:high)" */
- HIGH_BOUND_DEFAULT, /* "(low:)" */
- NONE_BOUND_DEFAULT /* "(low:high)" */
- };
-
/* A common block. */
struct common_block
{
int oplen = 1;
int args = 0;
- enum f90_range_type range_type;
+ enum range_type range_type;
int i;
if (endpos < 1)
oplen = 2;
break;
- case OP_F90_RANGE:
+ case OP_RANGE:
oplen = 3;
- range_type = (enum f90_range_type)
+ range_type = (enum range_type)
longest_to_int (expr->elts[endpos - 2].longconst);
switch (range_type)
#include "block.h"
#include "charset.h"
#include "cp-support.h"
-#include "f-lang.h"
#include "gdb_obstack.h"
#include "gdb_regex.h"
#include "rust-lang.h"
{
struct rust_op *result = OBSTACK_ZALLOC (&work_obstack, struct rust_op);
- result->opcode = OP_F90_RANGE;
+ result->opcode = OP_RANGE;
result->left.op = lhs;
result->right.op = rhs;
}
break;
- case OP_F90_RANGE:
+ case OP_RANGE:
{
- enum f90_range_type kind = BOTH_BOUND_DEFAULT;
+ enum range_type kind = BOTH_BOUND_DEFAULT;
if (operation->left.op != NULL)
{
kind = NONE_BOUND_DEFAULT;
}
}
- write_exp_elt_opcode (state, OP_F90_RANGE);
+ write_exp_elt_opcode (state, OP_RANGE);
write_exp_elt_longcst (state, kind);
- write_exp_elt_opcode (state, OP_F90_RANGE);
+ write_exp_elt_opcode (state, OP_RANGE);
}
break;
#include "c-lang.h"
#include "charset.h"
#include "cp-support.h"
-#include "f-lang.h"
#include "gdbarch.h"
#include "infcall.h"
#include "objfiles.h"
return result;
}
-/* A helper for rust_evaluate_subexp that handles OP_F90_RANGE. */
+/* A helper for rust_evaluate_subexp that handles OP_RANGE. */
static struct value *
rust_range (struct expression *exp, int *pos, enum noside noside)
{
- enum f90_range_type kind;
+ enum range_type kind;
struct value *low = NULL, *high = NULL;
struct value *addrval, *result;
CORE_ADDR addr;
struct type *temp_type;
const char *name;
- kind = (enum f90_range_type) longest_to_int (exp->elts[*pos + 1].longconst);
+ kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst);
*pos += 3;
if (kind == HIGH_BOUND_DEFAULT || kind == NONE_BOUND_DEFAULT)
static void
rust_compute_range (struct type *type, struct value *range,
LONGEST *low, LONGEST *high,
- enum f90_range_type *kind)
+ enum range_type *kind)
{
int i;
struct type *rhstype;
LONGEST low, high, high_bound;
/* Initialized to appease the compiler. */
- enum f90_range_type kind = BOTH_BOUND_DEFAULT;
+ enum range_type kind = BOTH_BOUND_DEFAULT;
int want_slice = 0;
++*pos;
}
break;
- case OP_F90_RANGE:
+ case OP_RANGE:
result = rust_range (exp, pos, noside);
break;
/* An Objective C Foundation Class NSString constant. */
OP (OP_OBJC_NSSTRING)
-/* A F90 array range operator (for "exp:exp", "exp:", ":exp" and ":"). */
-OP (OP_F90_RANGE)
+/* An array range operator (in Fortran 90, for "exp:exp", "exp:",
+ ":exp" and ":"). */
+OP (OP_RANGE)
/* OP_DECFLOAT is followed by a type pointer in the next exp_element
and a dec long constant value in the following exp_element.