aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2019-07-10 21:49:32 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2019-07-10 21:49:32 -0400
commit00db9531969db8b6ab984da996d0411fad938589 (patch)
treeac820f7c702db640479041c599395c19c1bcb54a /gdb
parentf2478a7e8b145a55c343bc7a62c53b021062229e (diff)
downloadbinutils-00db9531969db8b6ab984da996d0411fad938589.zip
binutils-00db9531969db8b6ab984da996d0411fad938589.tar.gz
binutils-00db9531969db8b6ab984da996d0411fad938589.tar.bz2
Make value_must_coerce_to_target return a bool
... and move comment to header file. gdb/ChangeLog: * valops.c (value_must_coerce_to_target): Change return type to bool. * value.h (value_must_coerce_to_target): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/valops.c11
-rw-r--r--gdb/value.h5
3 files changed, 15 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0121791..49ccba7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2019-07-10 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * valops.c (value_must_coerce_to_target): Change return type to
+ bool.
+ * value.h (value_must_coerce_to_target): Likewise.
+
2019-07-10 Simon Marchi <simon.marchi@efficios.com>
* breakpoint.c (is_hardware_watchpoint): Remove
diff --git a/gdb/valops.c b/gdb/valops.c
index 82b54561..0f6ff7b 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1343,10 +1343,9 @@ address_of_variable (struct symbol *var, const struct block *b)
return val;
}
-/* Return one if VAL does not live in target memory, but should in order
- to operate on it. Otherwise return zero. */
+/* See value.h. */
-int
+bool
value_must_coerce_to_target (struct value *val)
{
struct type *valtype;
@@ -1355,7 +1354,7 @@ value_must_coerce_to_target (struct value *val)
if (VALUE_LVAL (val) != not_lval
&& VALUE_LVAL (val) != lval_internalvar
&& VALUE_LVAL (val) != lval_xcallable)
- return 0;
+ return false;
valtype = check_typedef (value_type (val));
@@ -1364,9 +1363,9 @@ value_must_coerce_to_target (struct value *val)
case TYPE_CODE_ARRAY:
return TYPE_VECTOR (valtype) ? 0 : 1;
case TYPE_CODE_STRING:
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}
diff --git a/gdb/value.h b/gdb/value.h
index f96b095..9f55408 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -793,7 +793,10 @@ extern struct value *value_ptradd (struct value *arg1, LONGEST arg2);
extern LONGEST value_ptrdiff (struct value *arg1, struct value *arg2);
-extern int value_must_coerce_to_target (struct value *arg1);
+/* Return true if VAL does not live in target memory, but should in order
+ to operate on it. Otherwise return false. */
+
+extern bool value_must_coerce_to_target (struct value *arg1);
extern struct value *value_coerce_to_target (struct value *arg1);