]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Constify parse_and_eval_type
authorTom Tromey <tom@tromey.com>
Sun, 13 Dec 2020 16:51:42 +0000 (09:51 -0700)
committerTom Tromey <tom@tromey.com>
Sun, 13 Dec 2020 16:51:42 +0000 (09:51 -0700)
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  <tom@tromey.com>

* 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
gdb/eval.c
gdb/gdbtypes.c
gdb/value.h

index 80dc1e0d982d51bcd69e6a3496d44213dd746226..e6c572dc2f657d0c8e12f3f8dfbeab753242602f 100644 (file)
@@ -1,3 +1,9 @@
+2020-12-13  Tom Tromey  <tom@tromey.com>
+
+       * 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  <andrew.burgess@embecosm.com>
 
        * NEWS: Mention new commands.
index 5eb6ce1a2638ae98fba114a5cfb25492f17446aa..3f58769477614b684a8f17b730e3ce343adedfd8 100644 (file)
@@ -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);
 
index 3e489fd1803b4857479374a7b4543059f713bff1..5de5bd5ae41e66023fcc453f75e7dd5507f32d9c 100644 (file)
@@ -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.  */
index d026c8ed950bed25dd006a4f5cd997e0cffdcc69..25937f3c29785617ca4c290b40bebc0b50d24cec 100644 (file)
@@ -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);