From patchwork Wed Jul 16 05:15:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 2071 Received: (qmail 10348 invoked by alias); 16 Jul 2014 05:19:55 -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 10208 invoked by uid 89); 16 Jul 2014 05:19:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Jul 2014 05:19:49 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1X7Hd4-0004TO-HV from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Tue, 15 Jul 2014 22:19:46 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 15 Jul 2014 22:19:46 -0700 Received: from qiyao.dyndns.org.com (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Tue, 15 Jul 2014 22:19:45 -0700 From: Yao Qi To: Subject: [PATCH 2/4] Remove operator BINOP_RANGE Date: Wed, 16 Jul 2014 13:15:40 +0800 Message-ID: <1405487742-32613-3-git-send-email-yao@codesourcery.com> In-Reply-To: <1405487742-32613-1-git-send-email-yao@codesourcery.com> References: <1405487742-32613-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes BINOP_RANGE was added by the following commit for chill language. commit badefd2800f5ee2dc6a0eef870771af9dc29bba7 Author: Per Bothner Date: Wed Nov 29 22:59:31 1995 +0000 * expression.h (enum exp_opcode): Add BINOP_RANGE. * expprint.c (dump_expression): Support BINOP_RANGE. * eval.c (evaluate_subexp_standard): Handle BINOP_RANGE (as error). (case MULTI_SUBSCRIPT): Fix broken f77 value->int ad hoc conversion. * ch-lang.c (chill_op_print_tab): Support BINOP_RANGE. (evaluate_subexp_chill): Error on BINOP_COMMA. Chill language is no longer supported, so we can remove BINOP_RANGE too. This patch is to remove BINOP_RANGE. gdb: 2014-07-15 Yao Qi * std-operator.def: Remove BINOP_RANGE. * breakpoint.c (watchpoint_exp_is_const): Update. * expprint.c (dump_subexp_body_standard): Likewise. * eval.c (init_array_element): Remove dead code. (evaluate_subexp_standard): Likewise. --- gdb/breakpoint.c | 1 - gdb/eval.c | 48 ++++-------------------------------------------- gdb/expprint.c | 1 - gdb/std-operator.def | 4 ---- 4 files changed, 4 insertions(+), 50 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index bad375b..1c6070f 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -10602,7 +10602,6 @@ watchpoint_exp_is_const (const struct expression *exp) case BINOP_MAX: case BINOP_INTDIV: case BINOP_CONCAT: - case BINOP_RANGE: case TERNOP_COND: case TERNOP_SLICE: diff --git a/gdb/eval.c b/gdb/eval.c index 949b2f8..f075096 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -369,22 +369,6 @@ init_array_element (struct value *array, struct value *element, return init_array_element (array, element, exp, pos, noside, low_bound, high_bound); } - else if (exp->elts[*pos].opcode == BINOP_RANGE) - { - LONGEST low, high; - - (*pos)++; - low = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); - high = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); - if (low < low_bound || high > high_bound) - error (_("tuple range index out of range")); - for (index = low; index <= high; index++) - { - memcpy (value_contents_raw (array) - + (index - low_bound) * element_size, - value_contents (element), element_size); - } - } else { index = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); @@ -903,11 +887,6 @@ evaluate_subexp_standard (struct type *expect_type, struct value *element; int index_pc = 0; - if (exp->elts[*pos].opcode == BINOP_RANGE) - { - index_pc = ++(*pos); - evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP); - } element = evaluate_subexp (element_type, exp, pos, noside); if (value_type (element) != element_type) element = value_cast (element_type, element); @@ -958,22 +937,10 @@ evaluate_subexp_standard (struct type *expect_type, struct type *range_low_type, *range_high_type; struct value *elem_val; - if (exp->elts[*pos].opcode == BINOP_RANGE) - { - (*pos)++; - elem_val = evaluate_subexp (element_type, exp, pos, noside); - range_low_type = value_type (elem_val); - range_low = value_as_long (elem_val); - elem_val = evaluate_subexp (element_type, exp, pos, noside); - range_high_type = value_type (elem_val); - range_high = value_as_long (elem_val); - } - else - { - elem_val = evaluate_subexp (element_type, exp, pos, noside); - range_low_type = range_high_type = value_type (elem_val); - range_low = range_high = value_as_long (elem_val); - } + elem_val = evaluate_subexp (element_type, exp, pos, noside); + range_low_type = range_high_type = value_type (elem_val); + range_low = range_high = value_as_long (elem_val); + /* Check types of elements to avoid mixture of elements from different types. Also check if type of element is "compatible" with element type of powerset. */ @@ -2127,13 +2094,6 @@ evaluate_subexp_standard (struct type *expect_type, } } - case BINOP_RANGE: - evaluate_subexp (NULL_TYPE, exp, pos, noside); - evaluate_subexp (NULL_TYPE, exp, pos, noside); - if (noside == EVAL_SKIP) - goto nosideret; - error (_("':' operator used in invalid context")); - case BINOP_SUBSCRIPT: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside); diff --git a/gdb/expprint.c b/gdb/expprint.c index a966203..4e73791 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -802,7 +802,6 @@ dump_subexp_body_standard (struct expression *exp, case BINOP_ASSIGN_MODIFY: case BINOP_VAL: case BINOP_CONCAT: - case BINOP_RANGE: case BINOP_END: case STRUCTOP_MEMBER: case STRUCTOP_MPTR: diff --git a/gdb/std-operator.def b/gdb/std-operator.def index 16014e0..c33a287 100644 --- a/gdb/std-operator.def +++ b/gdb/std-operator.def @@ -87,10 +87,6 @@ OP (BINOP_VAL) the second operand with itself that many times. */ OP (BINOP_CONCAT) -/* This is the "colon operator" used various places in (the - deleted) Chill. */ -OP (BINOP_RANGE) - /* This must be the highest BINOP_ value, for expprint.c. */ OP (BINOP_END)