From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id CE3423858D37; Mon, 13 Feb 2023 22:29:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE3423858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676327340; bh=NZ13XpTWZxUAzZuqWIB2g8aOTsB1PZ3TUHPtfZ4UnBY=; h=From:To:Subject:Date:From; b=LDJlmy8HUq9BxWY9OR+E6SAedCqSjzJp8OpKMOus1dYe8EG7rGE/j7WaBjymBV5yC EDv0HCrGiCYgfa9KigRH+ErYEmo90rTL2H8KezKv3eVXj8DbYI0BMUgEBt3oYbETsI iXoRftZREE5bGd5zBeOC7sHeeWZL7yZ+jvzWm7q0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Turn more deprecated_* functions into methods X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 9feb2d07debe7d04a33cbd90f895d529b7a04f41 X-Git-Newrev: f29de665046c1b1a2feabf8d3d584b3b89699e10 Message-Id: <20230213222900.CE3423858D37@sourceware.org> Date: Mon, 13 Feb 2023 22:29:00 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df29de665046c= 1b1a2feabf8d3d584b3b89699e10 commit f29de665046c1b1a2feabf8d3d584b3b89699e10 Author: Tom Tromey Date: Tue Jan 31 12:46:20 2023 -0700 Turn more deprecated_* functions into methods =20 This changes deprecated_value_internalvar_hack, deprecated_value_internalvar_hack, and deprecated_value_regnum_hack into methods on value. =20 Approved-By: Simon Marchi Diff: --- gdb/value.c | 18 ++++++------------ gdb/value.h | 16 ++++++++++------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/gdb/value.c b/gdb/value.c index 5917ba53c9a..471a98f277b 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1429,24 +1429,18 @@ value::set_address (CORE_ADDR addr) m_location.address =3D addr; } =20 -struct internalvar ** -deprecated_value_internalvar_hack (struct value *value) -{ - return &value->m_location.internalvar; -} - struct frame_id * -deprecated_value_next_frame_id_hack (struct value *value) +value::deprecated_next_frame_id_hack () { - gdb_assert (value->m_lval =3D=3D lval_register); - return &value->m_location.reg.next_frame_id; + gdb_assert (m_lval =3D=3D lval_register); + return &m_location.reg.next_frame_id; } =20 int * -deprecated_value_regnum_hack (struct value *value) +value::deprecated_regnum_hack () { - gdb_assert (value->m_lval =3D=3D lval_register); - return &value->m_location.reg.regnum; + gdb_assert (m_lval =3D=3D lval_register); + return &m_location.reg.regnum; } =20 =0C diff --git a/gdb/value.h b/gdb/value.h index 6422cfb0df0..788a3d8514e 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -338,6 +338,13 @@ struct value /* Set the address of a value. */ void set_address (CORE_ADDR); =20 + struct internalvar **deprecated_internalvar_hack () + { return &m_location.internalvar; } + + struct frame_id *deprecated_next_frame_id_hack (); + + int *deprecated_regnum_hack (); + =20 /* Type of value; either not an lval, or one of the various different possible kinds of lval. */ @@ -692,19 +699,16 @@ extern void set_value_component_location (struct valu= e *component, #define VALUE_LVAL(val) (*((val)->deprecated_lval_hack ())) =20 /* Pointer to internal variable. */ -extern struct internalvar **deprecated_value_internalvar_hack (struct valu= e *); -#define VALUE_INTERNALVAR(val) (*deprecated_value_internalvar_hack (val)) +#define VALUE_INTERNALVAR(val) (*((val)->deprecated_internalvar_hack ())) =20 /* Frame ID of "next" frame to which a register value is relative. A register value is indicated by VALUE_LVAL being set to lval_register. So, if the register value is found relative to frame F, then the frame id of F->next will be stored in VALUE_NEXT_FRAME_ID. */ -extern struct frame_id *deprecated_value_next_frame_id_hack (struct value = *); -#define VALUE_NEXT_FRAME_ID(val) (*deprecated_value_next_frame_id_hack (va= l)) +#define VALUE_NEXT_FRAME_ID(val) (*((val)->deprecated_next_frame_id_hack (= ))) =20 /* Register number if the value is from a register. */ -extern int *deprecated_value_regnum_hack (struct value *); -#define VALUE_REGNUM(val) (*deprecated_value_regnum_hack (val)) +#define VALUE_REGNUM(val) (*((val)->deprecated_regnum_hack ())) =20 /* Return value after lval_funcs->coerce_ref (after check_typedef). Return NULL if lval_funcs->coerce_ref is not applicable for whatever reason. = */