aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-cmd-var.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-05-10 16:09:35 -0600
committerTom Tromey <tom@tromey.com>2023-05-25 19:00:02 -0600
commit9158e49a70386c3e883ad429d93fe31aa59c0918 (patch)
treee020360e60c608bfabdd498bb0e60ae7811a199a /gdb/mi/mi-cmd-var.c
parentfb7cd8ccfedbfe349c84ce0393da39b8b7ee9b94 (diff)
downloadgdb-9158e49a70386c3e883ad429d93fe31aa59c0918.zip
gdb-9158e49a70386c3e883ad429d93fe31aa59c0918.tar.gz
gdb-9158e49a70386c3e883ad429d93fe31aa59c0918.tar.bz2
Make MI commands const-correct
I've had this patch for a while now and figured I'd update it and send it. It changes MI commands to use a "const char * const" for their argv parameter. Regression tested on x86-64 Fedora 36. Acked-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/mi/mi-cmd-var.c')
-rw-r--r--gdb/mi/mi-cmd-var.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 36eea46..095790a 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -89,13 +89,13 @@ print_varobj (struct varobj *var, enum print_values print_values,
/* VAROBJ operations */
void
-mi_cmd_var_create (const char *command, char **argv, int argc)
+mi_cmd_var_create (const char *command, const char *const *argv, int argc)
{
struct ui_out *uiout = current_uiout;
CORE_ADDR frameaddr = 0;
struct varobj *var;
- char *frame;
- char *expr;
+ const char *frame;
+ const char *expr;
enum varobj_type var_type;
if (argc != 3)
@@ -140,9 +140,9 @@ mi_cmd_var_create (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_delete (const char *command, char **argv, int argc)
+mi_cmd_var_delete (const char *command, const char *const *argv, int argc)
{
- char *name;
+ const char *name;
struct varobj *var;
int numdel;
int children_only_p = 0;
@@ -214,7 +214,7 @@ mi_parse_format (const char *arg)
}
void
-mi_cmd_var_set_format (const char *command, char **argv, int argc)
+mi_cmd_var_set_format (const char *command, const char *const *argv, int argc)
{
enum varobj_display_formats format;
struct varobj *var;
@@ -240,7 +240,8 @@ mi_cmd_var_set_format (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_set_visualizer (const char *command, char **argv, int argc)
+mi_cmd_var_set_visualizer (const char *command, const char *const *argv,
+ int argc)
{
struct varobj *var;
@@ -256,7 +257,7 @@ mi_cmd_var_set_visualizer (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_set_frozen (const char *command, char **argv, int argc)
+mi_cmd_var_set_frozen (const char *command, const char *const *argv, int argc)
{
struct varobj *var;
bool frozen;
@@ -281,7 +282,7 @@ mi_cmd_var_set_frozen (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_show_format (const char *command, char **argv, int argc)
+mi_cmd_var_show_format (const char *command, const char *const *argv, int argc)
{
struct ui_out *uiout = current_uiout;
enum varobj_display_formats format;
@@ -300,7 +301,8 @@ mi_cmd_var_show_format (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_info_num_children (const char *command, char **argv, int argc)
+mi_cmd_var_info_num_children (const char *command, const char *const *argv,
+ int argc)
{
struct ui_out *uiout = current_uiout;
struct varobj *var;
@@ -360,7 +362,8 @@ mi_simple_type_p (struct type *type)
}
void
-mi_cmd_var_list_children (const char *command, char **argv, int argc)
+mi_cmd_var_list_children (const char *command, const char *const *argv,
+ int argc)
{
struct ui_out *uiout = current_uiout;
struct varobj *var;
@@ -416,7 +419,7 @@ mi_cmd_var_list_children (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_info_type (const char *command, char **argv, int argc)
+mi_cmd_var_info_type (const char *command, const char *const *argv, int argc)
{
struct ui_out *uiout = current_uiout;
struct varobj *var;
@@ -432,7 +435,8 @@ mi_cmd_var_info_type (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_info_path_expression (const char *command, char **argv, int argc)
+mi_cmd_var_info_path_expression (const char *command, const char *const *argv,
+ int argc)
{
struct ui_out *uiout = current_uiout;
struct varobj *var;
@@ -449,7 +453,8 @@ mi_cmd_var_info_path_expression (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_info_expression (const char *command, char **argv, int argc)
+mi_cmd_var_info_expression (const char *command, const char *const *argv,
+ int argc)
{
struct ui_out *uiout = current_uiout;
const struct language_defn *lang;
@@ -470,7 +475,8 @@ mi_cmd_var_info_expression (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_show_attributes (const char *command, char **argv, int argc)
+mi_cmd_var_show_attributes (const char *command, const char *const *argv,
+ int argc)
{
struct ui_out *uiout = current_uiout;
int attr;
@@ -494,7 +500,8 @@ mi_cmd_var_show_attributes (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_evaluate_expression (const char *command, char **argv, int argc)
+mi_cmd_var_evaluate_expression (const char *command, const char *const *argv,
+ int argc)
{
struct ui_out *uiout = current_uiout;
struct varobj *var;
@@ -502,7 +509,7 @@ mi_cmd_var_evaluate_expression (const char *command, char **argv, int argc)
enum varobj_display_formats format;
int formatFound;
int oind;
- char *oarg;
+ const char *oarg;
enum opt
{
@@ -561,7 +568,7 @@ mi_cmd_var_evaluate_expression (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_assign (const char *command, char **argv, int argc)
+mi_cmd_var_assign (const char *command, const char *const *argv, int argc)
{
struct ui_out *uiout = current_uiout;
struct varobj *var;
@@ -619,10 +626,10 @@ mi_cmd_var_update_iter (struct varobj *var, bool only_floating,
}
void
-mi_cmd_var_update (const char *command, char **argv, int argc)
+mi_cmd_var_update (const char *command, const char *const *argv, int argc)
{
struct ui_out *uiout = current_uiout;
- char *name;
+ const char *name;
enum print_values print_values;
if (argc != 1 && argc != 2)
@@ -741,7 +748,8 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
}
void
-mi_cmd_enable_pretty_printing (const char *command, char **argv, int argc)
+mi_cmd_enable_pretty_printing (const char *command, const char *const *argv,
+ int argc)
{
if (argc != 0)
error (_("-enable-pretty-printing: no arguments allowed"));
@@ -750,7 +758,8 @@ mi_cmd_enable_pretty_printing (const char *command, char **argv, int argc)
}
void
-mi_cmd_var_set_update_range (const char *command, char **argv, int argc)
+mi_cmd_var_set_update_range (const char *command, const char *const *argv,
+ int argc)
{
struct varobj *var;
int from, to;