From patchwork Tue May 17 20:18:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 12319 Received: (qmail 35385 invoked by alias); 17 May 2016 20:18:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 35045 invoked by uid 89); 17 May 2016 20:18:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL, BAYES_00, FSL_HELO_HOME, RCVD_IN_DNSWL_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY autolearn=no version=3.3.2 spammy=H*m:tromey, 1524, (unknown), *state X-HELO: gproxy6-pub.mail.unifiedlayer.com Received: from gproxy6-pub.mail.unifiedlayer.com (HELO gproxy6-pub.mail.unifiedlayer.com) (67.222.39.168) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Tue, 17 May 2016 20:18:28 +0000 Received: (qmail 14930 invoked by uid 0); 17 May 2016 20:18:27 -0000 Received: from unknown (HELO cmgw3) (10.0.90.84) by gproxy6.mail.unifiedlayer.com with SMTP; 17 May 2016 20:18:27 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id vYJQ1s00f2f2jeq01YJTEU; Tue, 17 May 2016 14:18:27 -0600 X-Authority-Analysis: v=2.1 cv=cYhB8BzM c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=PnD2wP_eR3oA:10 a=_v2sUkyEFrwA:10 a=yrkiwgmsf1kA:10 a=zstS-IiYAAAA:8 a=soqWP4MrXr4EexetN3YA:9 a=gn8GKCjGv5kunbX7:21 a=8qp2AxuS0WEPd4B0:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from [71.215.116.141] (port=57178 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1b2lRg-0007dG-0T; Tue, 17 May 2016 14:18:24 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI v3 8/8] Rename OP_F90_RANGE to OP_RANGE. Date: Tue, 17 May 2016 14:18:08 -0600 Message-Id: <1463516288-26778-9-git-send-email-tom@tromey.com> In-Reply-To: <1463516288-26778-1-git-send-email-tom@tromey.com> References: <1463516288-26778-1-git-send-email-tom@tromey.com> X-Identified-User: {36111:box522.bluehost.com:elynrobi:tromey.com} {sentby:smtp auth 71.215.116.141 authed with tom+tromey.com} This renames OP_F90_RANGE to OP_RANGE, and similarly renames the f90_range_type enum. 2016-05-17 Tom Tromey * 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. --- gdb/ChangeLog | 17 +++++++++++++++++ gdb/eval.c | 8 ++++---- gdb/expprint.c | 13 ++++++------- gdb/expression.h | 13 +++++++++++++ gdb/f-exp.y | 16 ++++++++-------- gdb/f-lang.h | 13 ------------- gdb/parse.c | 6 +++--- gdb/rust-exp.y | 11 +++++------ gdb/rust-lang.c | 13 ++++++------- gdb/std-operator.def | 5 +++-- 10 files changed, 65 insertions(+), 50 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3b4b9d3..b7a6351 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,22 @@ 2016-05-17 Tom Tromey + * 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 + * NEWS: Add Rust item. 2016-05-17 Tom Tromey diff --git a/gdb/eval.c b/gdb/eval.c index 5d32a3c..3f8ca66 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -406,8 +406,8 @@ value_f90_subarray (struct value *array, 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; @@ -1810,13 +1810,13 @@ evaluate_subexp_standard (struct type *expect_type, 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 { diff --git a/gdb/expprint.c b/gdb/expprint.c index db196a1..c37ecb0 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -29,7 +29,6 @@ #include "block.h" #include "objfiles.h" #include "valprint.h" -#include "f-lang.h" #include @@ -560,11 +559,11 @@ print_subexp_standard (struct expression *exp, int *pos, 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; @@ -1046,11 +1045,11 @@ dump_subexp_body_standard (struct expression *exp, 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; diff --git a/gdb/expression.h b/gdb/expression.h index 9986b20..4952d84 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -152,4 +152,17 @@ extern void dump_raw_expression (struct expression *, 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) */ diff --git a/gdb/f-exp.y b/gdb/f-exp.y index cd659a1..e3148a3 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -258,27 +258,27 @@ arglist : arglist ',' exp %prec ABOVE_COMMA /* 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 diff --git a/gdb/f-lang.h b/gdb/f-lang.h index 45df770..827785a 100644 --- a/gdb/f-lang.h +++ b/gdb/f-lang.h @@ -37,19 +37,6 @@ extern void f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, /* 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 diff --git a/gdb/parse.c b/gdb/parse.c index 4191fc6..2b00708 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -862,7 +862,7 @@ operator_length_standard (const struct expression *expr, int endpos, { int oplen = 1; int args = 0; - enum f90_range_type range_type; + enum range_type range_type; int i; if (endpos < 1) @@ -1004,9 +1004,9 @@ operator_length_standard (const struct expression *expr, int endpos, 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) diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y index f0c4e6c..c1a863c 100644 --- a/gdb/rust-exp.y +++ b/gdb/rust-exp.y @@ -26,7 +26,6 @@ #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" @@ -1787,7 +1786,7 @@ ast_range (const struct rust_op *lhs, const struct rust_op *rhs) { 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; @@ -2417,9 +2416,9 @@ convert_ast_to_expression (struct parser_state *state, } 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) { @@ -2437,9 +2436,9 @@ convert_ast_to_expression (struct parser_state *state, 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; diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 4278621..b8af166 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -25,7 +25,6 @@ #include "c-lang.h" #include "charset.h" #include "cp-support.h" -#include "f-lang.h" #include "gdbarch.h" #include "infcall.h" #include "objfiles.h" @@ -1172,12 +1171,12 @@ rust_evaluate_funcall (struct expression *exp, int *pos, enum noside noside) 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; @@ -1186,7 +1185,7 @@ rust_range (struct expression *exp, int *pos, enum noside noside) 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) @@ -1274,7 +1273,7 @@ rust_range (struct expression *exp, int *pos, enum noside noside) 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; @@ -1311,7 +1310,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, 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; @@ -1699,7 +1698,7 @@ which has only anonymous fields"), } break; - case OP_F90_RANGE: + case OP_RANGE: result = rust_range (exp, pos, noside); break; diff --git a/gdb/std-operator.def b/gdb/std-operator.def index 08f0d5b..6123957 100644 --- a/gdb/std-operator.def +++ b/gdb/std-operator.def @@ -292,8 +292,9 @@ OP (OP_NAME) /* 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.