summaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorMartin Galvan <martin.galvan@tallertechnologies.com>2016-04-08 15:05:45 -0300
committerMartin Galvan <martin.galvan@tallertechnologies.com>2016-04-08 15:06:56 -0300
commit4bf7b526bed1c86b1f20b18e642865f446751e06 (patch)
tree5a133392fcfe9a0741a1a05a5d9ed06d2d2b8812 /gdb/value.c
parent136a43b762ce7bc692645cc0d9d50c934f9aa392 (diff)
value: Make accessor methods' parameters const-correct
I did a quick pass over value.c and value.h and made some of the accessor methods' pass-by-reference parameters const-correct. Besides the obvious benefits, this is required if we want to use them on values that are already declared as const (such as the parameters to lval_funcs). There's probably a lot more stuff that can be made const, here and elsewhere. gdb/ChangeLog: 2016-04-08 Martin Galvan <martin.galvan@tallertechnologies.com> * value.c (value_next): Make pass-by-reference parameters const-correct. (value_parent): Likewise. (value_enclosing_type): Likewise. (value_lazy): Likewise. (value_stack): Likewise. (value_embedded_offset): Likewise. (value_pointed_to_offset): Likewise. (value_raw_address): Likewise. (deprecated_value_modifiable): Likewise. (value_free_to_mark): Likewise. (value_release_to_mark): Likewise. (internalvar_name): Likewise. (readjust_indirect_value_type): Likewise. (value_initialized): Likewise. * value.h (value_next): Likewise. (value_parent): Likewise. (value_enclosing_type): Likewise. (value_lazy): Likewise. (value_stack): Likewise. (value_embedded_offset): Likewise. (value_pointed_to_offset): Likewise. (value_raw_address): Likewise. (deprecated_value_modifiable): Likewise. (value_free_to_mark): Likewise. (value_release_to_mark): Likewise. (internalvar_name): Likewise. (readjust_indirect_value_type): Likewise. (value_initialized): Likewise.
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 3b66946202..5aeed02e06 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1093,7 +1093,7 @@ allocate_optimized_out_value (struct type *type)
/* Accessor methods. */
struct value *
-value_next (struct value *value)
+value_next (const struct value *value)
{
return value->next;
}
@@ -1143,7 +1143,7 @@ set_value_bitsize (struct value *value, int bit)
}
struct value *
-value_parent (struct value *value)
+value_parent (const struct value *value)
{
return value->parent;
}
@@ -1179,7 +1179,7 @@ value_contents_all_raw (struct value *value)
}
struct type *
-value_enclosing_type (struct value *value)
+value_enclosing_type (const struct value *value)
{
return value->enclosing_type;
}
@@ -1388,7 +1388,7 @@ value_contents_copy (struct value *dst, int dst_offset,
}
int
-value_lazy (struct value *value)
+value_lazy (const struct value *value)
{
return value->lazy;
}
@@ -1400,7 +1400,7 @@ set_value_lazy (struct value *value, int val)
}
int
-value_stack (struct value *value)
+value_stack (const struct value *value)
{
return value->stack;
}
@@ -1481,7 +1481,7 @@ value_bits_synthetic_pointer (const struct value *value,
}
int
-value_embedded_offset (struct value *value)
+value_embedded_offset (const struct value *value)
{
return value->embedded_offset;
}
@@ -1493,7 +1493,7 @@ set_value_embedded_offset (struct value *value, int val)
}
int
-value_pointed_to_offset (struct value *value)
+value_pointed_to_offset (const struct value *value)
{
return value->pointed_to_offset;
}
@@ -1546,7 +1546,7 @@ value_address (const struct value *value)
}
CORE_ADDR
-value_raw_address (struct value *value)
+value_raw_address (const struct value *value)
{
if (value->lval == lval_internalvar
|| value->lval == lval_internalvar_component
@@ -1583,7 +1583,7 @@ deprecated_value_regnum_hack (struct value *value)
}
int
-deprecated_value_modifiable (struct value *value)
+deprecated_value_modifiable (const struct value *value)
{
return value->modifiable;
}
@@ -1644,7 +1644,7 @@ value_free (struct value *val)
/* Free all values allocated since MARK was obtained by value_mark
(except for those released). */
void
-value_free_to_mark (struct value *mark)
+value_free_to_mark (const struct value *mark)
{
struct value *val;
struct value *next;
@@ -1736,7 +1736,7 @@ release_value_or_incref (struct value *val)
/* Release all values up to mark */
struct value *
-value_release_to_mark (struct value *mark)
+value_release_to_mark (const struct value *mark)
{
struct value *val;
struct value *next;
@@ -2500,7 +2500,7 @@ clear_internalvar (struct internalvar *var)
}
char *
-internalvar_name (struct internalvar *var)
+internalvar_name (const struct internalvar *var)
{
return var->name;
}
@@ -3772,8 +3772,8 @@ coerce_ref_if_computed (const struct value *arg)
struct value *
readjust_indirect_value_type (struct value *value, struct type *enc_type,
- struct type *original_type,
- struct value *original_value)
+ const struct type *original_type,
+ const struct value *original_value)
{
/* Re-adjust type. */
deprecated_set_value_type (value, TYPE_TARGET_TYPE (original_type));
@@ -3878,7 +3878,7 @@ set_value_initialized (struct value *val, int status)
/* Return the initialized field in a value struct. */
int
-value_initialized (struct value *val)
+value_initialized (const struct value *val)
{
return val->initialized;
}