Add a "context" argument to add_setshow_enum_cmd
authorTom Tromey <tom@tromey.com>
Thu, 6 Sep 2018 20:03:38 +0000 (14:03 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 28 Dec 2018 19:49:47 +0000 (12:49 -0700)
This adds a "context" argument to add_setshow_enum_cmd.  Now
add_setshow_enum_cmd will call set_cmd_context on both of the new
commands.  This is used in a later patch.

gdb/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>

* command.h (add_setshow_enum_cmd): Add "context" argument.
* cli/cli-decode.c (add_setshow_enum_cmd): Add "context"
argument.  Call set_cmd_context.

gdb/ChangeLog
gdb/cli/cli-decode.c
gdb/command.h

index e942084354526d6adf7efbb857e629a8d52d7b86..06162753a2dd0a12ef9fcef918b63d6c5df2a026 100644 (file)
@@ -1,3 +1,9 @@
+2018-12-28  Tom Tromey  <tom@tromey.com>
+
+       * command.h (add_setshow_enum_cmd): Add "context" argument.
+       * cli/cli-decode.c (add_setshow_enum_cmd): Add "context"
+       argument.  Call set_cmd_context.
+
 2018-12-28  Tom Tromey  <tom@tromey.com>
 
        * utils.c (filter_initialized): New global.
index 5d798e877e8ca5e49cd3a81f6ecada7e86c9958e..e7b7a110fcf8f3e82ca5edc9d49958d3f24a9a9b 100644 (file)
@@ -531,16 +531,20 @@ add_setshow_enum_cmd (const char *name,
                      cmd_const_sfunc_ftype *set_func,
                      show_value_ftype *show_func,
                      struct cmd_list_element **set_list,
-                     struct cmd_list_element **show_list)
+                     struct cmd_list_element **show_list,
+                     void *context)
 {
-  struct cmd_list_element *c;
+  struct cmd_list_element *c, *show;
 
   add_setshow_cmd_full (name, theclass, var_enum, var,
                        set_doc, show_doc, help_doc,
                        set_func, show_func,
                        set_list, show_list,
-                       &c, NULL);
+                       &c, &show);
   c->enums = enumlist;
+
+  set_cmd_context (c, context);
+  set_cmd_context (show, context);
 }
 
 const char * const auto_boolean_enums[] = { "on", "off", "auto", NULL };
index e3d55c2dcbac1cfc79912c2e62abe0a6da906161..68514409ecd1cc85c077bd53f07caad22e6a9111 100644 (file)
@@ -314,7 +314,8 @@ extern void add_setshow_enum_cmd (const char *name,
                                  cmd_const_sfunc_ftype *set_func,
                                  show_value_ftype *show_func,
                                  struct cmd_list_element **set_list,
-                                 struct cmd_list_element **show_list);
+                                 struct cmd_list_element **show_list,
+                                 void *context = nullptr);
 
 extern void add_setshow_auto_boolean_cmd (const char *name,
                                          enum command_class theclass,
This page took 0.051526 seconds and 4 git commands to generate.