From f5756acc153e2605a0468b461ff4f6b0942a68b7 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 13 Dec 2020 09:51:42 -0700 Subject: Constify parse_and_eval_type I noticed that the argumen to parse_and_eval_type could be "const". This patch implements this change. I wonder if this could be removed. It's only called via check_stub_method_group, which seems questionable to me. However, I didn't look into doing this. gdb/ChangeLog 2020-12-13 Tom Tromey * gdbtypes.c (safe_parse_type): Make argument const. * value.h (parse_and_eval_type): Make argument const. * eval.c (parse_and_eval_type): Make argument const. --- gdb/ChangeLog | 6 ++++++ gdb/eval.c | 2 +- gdb/gdbtypes.c | 2 +- gdb/value.h | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 80dc1e0..e6c572d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-12-13 Tom Tromey + + * gdbtypes.c (safe_parse_type): Make argument const. + * value.h (parse_and_eval_type): Make argument const. + * eval.c (parse_and_eval_type): Make argument const. + 2020-12-13 Andrew Burgess * NEWS: Mention new commands. diff --git a/gdb/eval.c b/gdb/eval.c index 5eb6ce1..3f58769 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -3096,7 +3096,7 @@ evaluate_subexp_for_cast (expression *exp, int *pos, /* Parse a type expression in the string [P..P+LENGTH). */ struct type * -parse_and_eval_type (char *p, int length) +parse_and_eval_type (const char *p, int length) { char *tmp = (char *) alloca (length + 4); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 3e489fd..5de5bd5 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3002,7 +3002,7 @@ check_typedef (struct type *type) occurs, silently return a void type. */ static struct type * -safe_parse_type (struct gdbarch *gdbarch, char *p, int length) +safe_parse_type (struct gdbarch *gdbarch, const char *p, int length) { struct ui_file *saved_gdb_stderr; struct type *type = NULL; /* Initialize to keep gcc happy. */ diff --git a/gdb/value.h b/gdb/value.h index d026c8e..25937f3 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -939,7 +939,7 @@ extern struct value *parse_and_eval (const char *exp); extern struct value *parse_to_comma_and_eval (const char **expp); -extern struct type *parse_and_eval_type (char *p, int length); +extern struct type *parse_and_eval_type (const char *p, int length); extern CORE_ADDR parse_and_eval_address (const char *exp); -- cgit v1.1