From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24702 invoked by alias); 4 Jun 2010 21:19:34 -0000 Received: (qmail 24692 invoked by uid 22791); 4 Jun 2010 21:19:33 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Jun 2010 21:19:26 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o54LJ2xu013506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 4 Jun 2010 17:19:02 -0400 Received: from psique.localnet (vpn-227-130.phx2.redhat.com [10.3.227.130]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o54LJ1p9027602; Fri, 4 Jun 2010 17:19:01 -0400 From: Sergio Durigan Junior To: gdb-patches@sourceware.org Subject: [PATCH] Constify `struct expression' in operator_length Date: Fri, 04 Jun 2010 21:19:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.32.12-115.fc12.x86_64; KDE/4.4.2; x86_64; ; ) Cc: Joel Brobecker MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201006041819.00286.sergiodj@redhat.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-06/txt/msg00137.txt.bz2 Hello, Due to Joel's suggestion on , I decided to post this patch in order to constify the `struct expression' argument of the operator_length class of functions. Ok to apply? -- Sergio Durigan Junior Red Hat 2010-06-04 Sergio Durigan Junior * ada-lang.c (ada_operator_length): Constify `struct expression'. * parse.c (operator_length): Likewise. (operator_length_standard): Likewise. * parser-defs.h (operator_length): Likewise. (operator_length_standard): Likewise. (struct exp_descriptor ): Likewise. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index be0c53b..1d4c38b 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -11084,7 +11084,8 @@ ada_decode_assert_location (char *args, char **addr_string, OP_DEFN (OP_DISCRETE_RANGE, 1, 2, 0) static void -ada_operator_length (struct expression *exp, int pc, int *oplenp, int *argsp) +ada_operator_length (const struct expression *exp, int pc, int *oplenp, + int *argsp) { switch (exp->elts[pc - 1].opcode) { diff --git a/gdb/parse.c b/gdb/parse.c index 1c8b350..c885c6a 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -791,7 +791,8 @@ length_of_subexp (struct expression *expr, int endpos) operator takes. */ void -operator_length (struct expression *expr, int endpos, int *oplenp, int *argsp) +operator_length (const struct expression *expr, int endpos, int *oplenp, + int *argsp) { expr->language_defn->la_exp_desc->operator_length (expr, endpos, oplenp, argsp); @@ -800,7 +801,7 @@ operator_length (struct expression *expr, int endpos, int *oplenp, int *argsp) /* Default value for operator_length in exp_descriptor vectors. */ void -operator_length_standard (struct expression *expr, int endpos, +operator_length_standard (const struct expression *expr, int endpos, int *oplenp, int *argsp) { int oplen = 1; diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 864f789..bb79ae1 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -188,9 +188,10 @@ extern int dump_subexp (struct expression *, struct ui_file *, int); extern int dump_subexp_body_standard (struct expression *, struct ui_file *, int); -extern void operator_length (struct expression *, int, int *, int *); +extern void operator_length (const struct expression *, int, int *, int *); -extern void operator_length_standard (struct expression *, int, int *, int *); +extern void operator_length_standard (const struct expression *, int, int *, + int *); extern int operator_check_standard (struct expression *exp, int pos, int (*objfile_func) @@ -273,7 +274,7 @@ struct exp_descriptor /* Returns number of exp_elements needed to represent an operator and the number of subexpressions it takes. */ - void (*operator_length) (struct expression*, int, int*, int *); + void (*operator_length) (const struct expression*, int, int*, int *); /* Call TYPE_FUNC and OBJFILE_FUNC for any TYPE and OBJFILE found being referenced by the single operator of EXP at position POS. Operator