summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-07-14 15:00:15 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-07-14 15:00:15 +0000
commit71cdc39fa1270989b8ec7e38f010bc8ef8a6f265 (patch)
treeefaa2a30ee12e5106bec12cac54474d47f71200c
parent4634fda269b6bc0edab4d35b6fa9afd06be98f78 (diff)
downloadgdb-71cdc39fa1270989b8ec7e38f010bc8ef8a6f265.tar.gz
gdb/
Code cleanup - constify struct lval_funcs. * dwarf2loc.c (pieced_value_funcs): Make it const. * infrun.c (siginfo_value_funcs): Likewise. * opencl-lang.c (opencl_value_funcs): Likewise. * valops.c (value_assign, value_ind): Make the funcs variable const. * value.c (struct value): Make location.computed.funcs target const. Rearrange the comments. (allocate_computed_value): Make the funcs parameter target const. (value_computed_funcs): Return the funcs target const. (value_free, value_copy, set_value_component_location): Make the funcs variable const. * value.h (allocate_computed_value): Make the funcs parameter target const. (value_computed_funcs): Return the funcs target const. * windows-tdep.c (tlb_value_funcs): Make it const.
-rw-r--r--gdb/ChangeLog18
-rw-r--r--gdb/dwarf2loc.c2
-rw-r--r--gdb/infrun.c2
-rw-r--r--gdb/opencl-lang.c2
-rw-r--r--gdb/valops.c4
-rw-r--r--gdb/value.c17
-rw-r--r--gdb/value.h6
-rw-r--r--gdb/windows-tdep.c2
8 files changed, 37 insertions, 16 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b2d01eefc21..f0cc5011ad7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,21 @@
+2011-07-14 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup - constify struct lval_funcs.
+ * dwarf2loc.c (pieced_value_funcs): Make it const.
+ * infrun.c (siginfo_value_funcs): Likewise.
+ * opencl-lang.c (opencl_value_funcs): Likewise.
+ * valops.c (value_assign, value_ind): Make the funcs variable const.
+ * value.c (struct value): Make location.computed.funcs target const.
+ Rearrange the comments.
+ (allocate_computed_value): Make the funcs parameter target const.
+ (value_computed_funcs): Return the funcs target const.
+ (value_free, value_copy, set_value_component_location): Make the funcs
+ variable const.
+ * value.h (allocate_computed_value): Make the funcs parameter target
+ const.
+ (value_computed_funcs): Return the funcs target const.
+ * windows-tdep.c (tlb_value_funcs): Make it const.
+
2011-07-14 Hui Zhu <teawater@gmail.com>
* remote.c (remote_get_trace_status): Initialize p.
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 01e95da19ea..7c8ffbe9b94 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1051,7 +1051,7 @@ free_pieced_value_closure (struct value *v)
}
/* Functions for accessing a variable described by DW_OP_piece. */
-static struct lval_funcs pieced_value_funcs = {
+static const struct lval_funcs pieced_value_funcs = {
read_pieced_value,
write_pieced_value,
check_pieced_value_validity,
diff --git a/gdb/infrun.c b/gdb/infrun.c
index a656cbf4bbb..2b4525e213e 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6394,7 +6394,7 @@ siginfo_value_write (struct value *v, struct value *fromval)
error (_("Unable to write siginfo"));
}
-static struct lval_funcs siginfo_value_funcs =
+static const struct lval_funcs siginfo_value_funcs =
{
siginfo_value_read,
siginfo_value_write
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 22d16112ab8..79ad5f6590a 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -354,7 +354,7 @@ lval_func_free_closure (struct value *v)
}
}
-static struct lval_funcs opencl_value_funcs =
+static const struct lval_funcs opencl_value_funcs =
{
lval_func_read,
lval_func_write,
diff --git a/gdb/valops.c b/gdb/valops.c
index ae1121201cf..d9cdc134174 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1377,7 +1377,7 @@ value_assign (struct value *toval, struct value *fromval)
case lval_computed:
{
- struct lval_funcs *funcs = value_computed_funcs (toval);
+ const struct lval_funcs *funcs = value_computed_funcs (toval);
funcs->write (toval, fromval);
}
@@ -1740,7 +1740,7 @@ value_ind (struct value *arg1)
if (VALUE_LVAL (arg1) == lval_computed)
{
- struct lval_funcs *funcs = value_computed_funcs (arg1);
+ const struct lval_funcs *funcs = value_computed_funcs (arg1);
if (funcs->indirect)
{
diff --git a/gdb/value.c b/gdb/value.c
index f308f3d2c8f..5a8cc1f2634 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -194,8 +194,11 @@ struct value
for them to use. */
struct
{
- struct lval_funcs *funcs; /* Functions to call. */
- void *closure; /* Closure for those functions to use. */
+ /* Functions to call. */
+ const struct lval_funcs *funcs;
+
+ /* Closure for those functions to use. */
+ void *closure;
} computed;
} location;
@@ -716,7 +719,7 @@ allocate_repeat_value (struct type *type, int count)
struct value *
allocate_computed_value (struct type *type,
- struct lval_funcs *funcs,
+ const struct lval_funcs *funcs,
void *closure)
{
struct value *v = allocate_value_lazy (type);
@@ -1059,7 +1062,7 @@ set_value_pointed_to_offset (struct value *value, int val)
value->pointed_to_offset = val;
}
-struct lval_funcs *
+const struct lval_funcs *
value_computed_funcs (struct value *v)
{
gdb_assert (VALUE_LVAL (v) == lval_computed);
@@ -1175,7 +1178,7 @@ value_free (struct value *val)
if (VALUE_LVAL (val) == lval_computed)
{
- struct lval_funcs *funcs = val->location.computed.funcs;
+ const struct lval_funcs *funcs = val->location.computed.funcs;
if (funcs->free_closure)
funcs->free_closure (val);
@@ -1319,7 +1322,7 @@ value_copy (struct value *arg)
value_incref (val->parent);
if (VALUE_LVAL (val) == lval_computed)
{
- struct lval_funcs *funcs = val->location.computed.funcs;
+ const struct lval_funcs *funcs = val->location.computed.funcs;
if (funcs->copy_closure)
val->location.computed.closure = funcs->copy_closure (val);
@@ -1359,7 +1362,7 @@ set_value_component_location (struct value *component,
component->location = whole->location;
if (whole->lval == lval_computed)
{
- struct lval_funcs *funcs = whole->location.computed.funcs;
+ const struct lval_funcs *funcs = whole->location.computed.funcs;
if (funcs->copy_closure)
component->location.computed.closure = funcs->copy_closure (whole);
diff --git a/gdb/value.h b/gdb/value.h
index 307983170c0..3bcd839e237 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -204,14 +204,14 @@ struct lval_funcs
and closure CLOSURE. */
extern struct value *allocate_computed_value (struct type *type,
- struct lval_funcs *funcs,
- void *closure);
+ const struct lval_funcs *funcs,
+ void *closure);
extern struct value *allocate_optimized_out_value (struct type *type);
/* If VALUE is lval_computed, return its lval_funcs structure. */
-extern struct lval_funcs *value_computed_funcs (struct value *value);
+extern const struct lval_funcs *value_computed_funcs (struct value *value);
/* If VALUE is lval_computed, return its closure. The meaning of the
returned value depends on the functions VALUE uses. */
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 6e0d17e71ae..5e80aaffae0 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -256,7 +256,7 @@ tlb_value_write (struct value *v, struct value *fromval)
error (_("Impossible to change the Thread Local Base"));
}
-static struct lval_funcs tlb_value_funcs =
+static const struct lval_funcs tlb_value_funcs =
{
tlb_value_read,
tlb_value_write