From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id D557F3858C36; Wed, 15 Feb 2023 22:09:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D557F3858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1676498968; bh=OuQbrQk+pe2COrm8Owv3i/UnruvL3KxSW/lXTlMYjd8=; h=From:To:Subject:Date:From; b=YK67Mq5bgCY6iTgSpdXaffiMzy+ZXxTFMfQ73RTtUzQ95WIN9o5K6rRTOKkLNREcl vbwYgyz5CEjx7Ly+jTijPidNNqa6lQpxkJ3wuXJYTlNSk8xo2WBwAX6ZFs8XLu5o9K PgDB2hp67TihItAe/TxCPLIZHZfBp6CNRDhjs29k= 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] Have value::bits_synthetic_pointer return bool X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 42c13555ff880d8efeb89430c559b553e09e5311 X-Git-Newrev: 19124154b94ef0846139034b7fe3b6f2af0525a2 Message-Id: <20230215220928.D557F3858C36@sourceware.org> Date: Wed, 15 Feb 2023 22:09:28 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D19124154b94e= f0846139034b7fe3b6f2af0525a2 commit 19124154b94ef0846139034b7fe3b6f2af0525a2 Author: Tom Tromey Date: Tue Feb 14 10:16:26 2023 -0700 Have value::bits_synthetic_pointer return bool =20 This changes value::bits_synthetic_pointer to return bool and fixes up some fallout from this. =20 Reviewed-By: Bruno Larsen Diff: --- gdb/dwarf2/expr.c | 6 +++--- gdb/opencl-lang.c | 10 +++++----- gdb/valprint.c | 2 +- gdb/value.c | 4 ++-- gdb/value.h | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 3f040e7b2d3..b48bab0b410 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -459,7 +459,7 @@ is_optimized_out_pieced_value (value *v) /* An implementation of an lval_funcs method to see whether a value is a synthetic pointer. */ =20 -static int +static bool check_pieced_synthetic_pointer (const value *value, LONGEST bit_offset, int bit_length) { @@ -490,10 +490,10 @@ check_pieced_synthetic_pointer (const value *value, L= ONGEST bit_offset, bit_length -=3D this_size_bits; =20 if (p->location !=3D DWARF_VALUE_IMPLICIT_POINTER) - return 0; + return false; } =20 - return 1; + return true; } =20 /* An implementation of an lval_funcs method to indirect through a diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 3e4a9c360b2..ae1a6d4446d 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -187,10 +187,10 @@ lval_func_write (struct value *v, struct value *fromv= al) } } =20 -/* Return nonzero if bits in V from OFFSET and LENGTH represent a +/* Return true if bits in V from OFFSET and LENGTH represent a synthetic pointer. */ =20 -static int +static bool lval_func_check_synthetic_pointer (const struct value *v, LONGEST offset, int length) { @@ -208,7 +208,7 @@ lval_func_check_synthetic_pointer (const struct value *= v, end++; =20 if (end > c->n) - return 0; + return false; =20 for (i =3D start; i < end; i++) { @@ -217,10 +217,10 @@ lval_func_check_synthetic_pointer (const struct value= *v, =20 if (!c->val->bits_synthetic_pointer (c->indices[i] * elsize + comp_o= ffset, comp_length)) - return 0; + return false; } =20 - return 1; + return true; } =20 static void * diff --git a/gdb/valprint.c b/gdb/valprint.c index 8c067693492..357db3815b0 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -566,7 +566,7 @@ generic_val_print_ref (struct type *type, { struct type *elttype =3D check_typedef (type->target_type ()); struct value *deref_val =3D NULL; - const int value_is_synthetic + const bool value_is_synthetic =3D original_value->bits_synthetic_pointer (TARGET_CHAR_BIT * embedded= _offset, TARGET_CHAR_BIT * type->length ()); const int must_coerce_ref =3D ((options->addressprint && value_is_synthe= tic) diff --git a/gdb/value.c b/gdb/value.c index bf285a9d50c..55e893eedfa 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1316,12 +1316,12 @@ value::mark_bits_optimized_out (LONGEST offset, LON= GEST length) insert_into_bit_range_vector (&m_optimized_out, offset, length); } =20 -int +bool value::bits_synthetic_pointer (LONGEST offset, LONGEST length) const { if (m_lval !=3D lval_computed || !m_location.computed.funcs->check_synthetic_pointer) - return 0; + return false; return m_location.computed.funcs->check_synthetic_pointer (this, offset, length); } diff --git a/gdb/value.h b/gdb/value.h index 4cb6fac4104..5536e00332e 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -475,7 +475,7 @@ public: /* Given a value, determine whether the bits starting at OFFSET and extending for LENGTH bits are a synthetic pointer. */ =20 - int bits_synthetic_pointer (LONGEST offset, LONGEST length) const; + bool bits_synthetic_pointer (LONGEST offset, LONGEST length) const; =20 /* Increase this value's reference count. */ void incref () @@ -924,8 +924,8 @@ struct lval_funcs =20 /* If non-NULL, this is used to determine whether the indicated bits of VALUE are a synthetic pointer. */ - int (*check_synthetic_pointer) (const struct value *value, - LONGEST offset, int length); + bool (*check_synthetic_pointer) (const struct value *value, + LONGEST offset, int length); =20 /* Return a duplicate of VALUE's closure, for use in a new value. This may simply return the same closure, if VALUE's is