aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-11-10 15:46:17 -0700
committerTom Tromey <tom@tromey.com>2020-11-10 15:46:18 -0700
commitcaaece0e2f523049d77ca1bafc1fea911f9c25c7 (patch)
treef9a3b69c7ad5b7ef69a046f621bc6317aa24d99c
parent8e20b4be65843c220260e4f0f5dd943f5570656b (diff)
downloadbinutils-caaece0e2f523049d77ca1bafc1fea911f9c25c7.zip
binutils-caaece0e2f523049d77ca1bafc1fea911f9c25c7.tar.gz
binutils-caaece0e2f523049d77ca1bafc1fea911f9c25c7.tar.bz2
Use "const" more in ax-gdb.c
This changes a few spots in ax-gdb.c to use a "const char *" rather than a non-const one. gdb/ChangeLog 2020-11-10 Tom Tromey <tom@tromey.com> * ax-gdb.c (gen_struct_elt_for_reference, gen_namespace_elt) (gen_maybe_namespace_elt, gen_aggregate_elt_ref, gen_expr): Use const.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/ax-gdb.c20
2 files changed, 16 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bd820d0..d275ee7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2020-11-10 Tom Tromey <tom@tromey.com>
+ * ax-gdb.c (gen_struct_elt_for_reference, gen_namespace_elt)
+ (gen_maybe_namespace_elt, gen_aggregate_elt_ref, gen_expr): Use
+ const.
+
+2020-11-10 Tom Tromey <tom@tromey.com>
+
* objc-lang.h (value_nsstring): Update.
* objc-lang.c (value_nsstring): Make "ptr" const.
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 01c4212..601c752 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -1537,10 +1537,10 @@ gen_struct_ref (struct agent_expr *ax, struct axs_value *value,
static int
gen_namespace_elt (struct agent_expr *ax, struct axs_value *value,
- const struct type *curtype, char *name);
+ const struct type *curtype, const char *name);
static int
gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
- const struct type *curtype, char *name);
+ const struct type *curtype, const char *name);
static void
gen_static_field (struct agent_expr *ax, struct axs_value *value,
@@ -1577,7 +1577,7 @@ gen_static_field (struct agent_expr *ax, struct axs_value *value,
static int
gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value,
- struct type *type, char *fieldname)
+ struct type *type, const char *fieldname)
{
struct type *t = type;
int i;
@@ -1622,7 +1622,7 @@ gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value,
static int
gen_namespace_elt (struct agent_expr *ax, struct axs_value *value,
- const struct type *curtype, char *name)
+ const struct type *curtype, const char *name)
{
int found = gen_maybe_namespace_elt (ax, value, curtype, name);
@@ -1641,7 +1641,7 @@ gen_namespace_elt (struct agent_expr *ax, struct axs_value *value,
static int
gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
- const struct type *curtype, char *name)
+ const struct type *curtype, const char *name)
{
const char *namespace_name = curtype->name ();
struct block_symbol sym;
@@ -1665,7 +1665,7 @@ gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
static int
gen_aggregate_elt_ref (struct agent_expr *ax, struct axs_value *value,
- struct type *type, char *field)
+ struct type *type, const char *field)
{
switch (type->code ())
{
@@ -1919,7 +1919,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
(*pc)++;
if ((*pc)[0].opcode == OP_INTERNALVAR)
{
- char *name = internalvar_name ((*pc)[1].internalvar);
+ const char *name = internalvar_name ((*pc)[1].internalvar);
struct trace_state_variable *tsv;
(*pc) += 3;
@@ -1946,7 +1946,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
(*pc)++;
if ((*pc)[0].opcode == OP_INTERNALVAR)
{
- char *name = internalvar_name ((*pc)[1].internalvar);
+ const char *name = internalvar_name ((*pc)[1].internalvar);
struct trace_state_variable *tsv;
(*pc) += 3;
@@ -2204,7 +2204,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
case STRUCTOP_PTR:
{
int length = (*pc)[1].longconst;
- char *name = &(*pc)[2].string;
+ const char *name = &(*pc)[2].string;
(*pc) += 4 + BYTES_TO_EXP_ELEM (length + 1);
gen_expr (exp, pc, ax, value);
@@ -2249,7 +2249,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
{
struct type *type = (*pc)[1].type;
int length = longest_to_int ((*pc)[2].longconst);
- char *name = &(*pc)[3].string;
+ const char *name = &(*pc)[3].string;
int found;
found = gen_aggregate_elt_ref (ax, value, type, name);