]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Replace uses of "title" style with "command"
authorTom Tromey <tom@tromey.com>
Thu, 3 Oct 2024 22:25:05 +0000 (16:25 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 13 Dec 2024 03:18:23 +0000 (20:18 -0700)
Currently the "title" style is only used when printing command names.
The "title" name itself is probably a misnomer, but meanwhile this
patch changes the existing uses to instead use the new "command" style
for consistency.

The "title" style is not removed; see the next patch.

Reviewed-By: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/cli/cli-decode.c
gdb/cli/cli-script.c
gdb/testsuite/gdb.base/style.exp
gdb/testsuite/lib/gdb-utils.exp

index 295119494ce4e48d047a88ca7b63e4aa26c61c66..4fbbfcb6aeb9fd8709d6c235d103d7d23c30af8e 100644 (file)
@@ -1530,7 +1530,7 @@ add_com_suppress_notification (const char *name, enum command_class theclass,
                                        &cmdlist, suppress_notification);
 }
 
-/* Print the prefix of C followed by name of C in title style.  */
+/* Print the prefix of C followed by name of C in command style.  */
 
 static void
 fput_command_name_styled (const cmd_list_element &c, struct ui_file *stream)
@@ -1538,7 +1538,7 @@ fput_command_name_styled (const cmd_list_element &c, struct ui_file *stream)
   std::string prefixname
     = c.prefix == nullptr ? "" : c.prefix->prefixname ();
 
-  fprintf_styled (stream, title_style.style (), "%s%s",
+  fprintf_styled (stream, command_style.style (), "%s%s",
                  prefixname.c_str (), c.name);
 }
 
@@ -2509,21 +2509,21 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list)
 
       if (cmd->cmd_deprecated)
        gdb_printf (_("Warning: command '%ps' (%ps) is deprecated.\n"),
-                   styled_string (title_style.style (),
+                   styled_string (command_style.style (),
                                   tmp_cmd_str.c_str ()),
-                   styled_string (title_style.style (),
+                   styled_string (command_style.style (),
                                   tmp_alias_str.c_str ()));
       else
        gdb_printf (_("Warning: '%ps', an alias for the command '%ps', "
                      "is deprecated.\n"),
-                   styled_string (title_style.style (),
+                   styled_string (command_style.style (),
                                   tmp_alias_str.c_str ()),
-                   styled_string (title_style.style (),
+                   styled_string (command_style.style (),
                                   tmp_cmd_str.c_str ()));
     }
   else
     gdb_printf (_("Warning: command '%ps' is deprecated.\n"),
-               styled_string (title_style.style (),
+               styled_string (command_style.style (),
                               tmp_cmd_str.c_str ()));
 
   /* Now display a second line indicating what the user should use instead.
@@ -2536,7 +2536,7 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list)
     replacement = cmd->replacement;
   if (replacement != nullptr)
     gdb_printf (_("Use '%ps'.\n\n"),
-               styled_string (title_style.style (),
+               styled_string (command_style.style (),
                               replacement));
   else
     gdb_printf (_("No alternative known.\n\n"));
index 329f780f9160d7a2cba450085e6b8811bc859b4e..9131768e27ca79e9a6d56ea2ed0b54a5e93fada1 100644 (file)
@@ -1667,7 +1667,7 @@ show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name,
 
       gdb_printf (stream, "User %scommand \"",
                  c->is_prefix () ? "prefix" : "");
-      fprintf_styled (stream, title_style.style (), "%s%s",
+      fprintf_styled (stream, command_style.style (), "%s%s",
                      prefix, name);
       gdb_printf (stream, "\":\n");
       if (cmdlines)
index d29b2381923dec76646226792212778f30a7aa52..83e0faeebd07428b08ea311b4b6193547dd350a1 100644 (file)
@@ -238,8 +238,8 @@ proc run_style_tests { } {
            "The ${address_style_expr} foreground color is: ${color}" \
            "style name and style word styled using its own style in show style"
 
-       set aliases_expr [limited_style ".*aliases.*" title]
-       set breakpoints_expr [limited_style ".*breakpoints.*" title]
+       set aliases_expr [limited_style ".*aliases.*" command]
+       set breakpoints_expr [limited_style ".*breakpoints.*" command]
        gdb_test "help" \
            [multi_line \
                 "List of classes of commands:" \
@@ -248,10 +248,10 @@ proc run_style_tests { } {
                 "${breakpoints_expr} -- Making program stop at certain points\." \
                 ".*" \
                ] \
-           "help classes of commands styled with title"
+           "help classes of commands styled with command"
 
-       set taas_expr  [limited_style ".*taas.*" title]
-       set tfaas_expr  [limited_style ".*tfaas.*" title]
+       set taas_expr  [limited_style ".*taas.*" command]
+       set tfaas_expr  [limited_style ".*tfaas.*" command]
        set cut_for_thre_expr [limited_style "cut for 'thre" highlight]
        gdb_test "apropos -v cut for 'thre" \
            [multi_line \
@@ -301,7 +301,7 @@ proc run_style_tests { } {
        gdb_test_no_output "maintenance deprecate p \"new_p\"" \
            "maintenance deprecate p \"new_p\" /1/"
        gdb_test "p 5" \
-           "Warning: '[limited_style p title]', an alias for the command '[limited_style print title]', is deprecated.*Use '[limited_style new_p title]'.*" \
+           "Warning: '[limited_style p command]', an alias for the command '[limited_style print command]', is deprecated.*Use '[limited_style new_p command]'.*" \
            "p deprecated warning, with replacement"
 
        # Check that the version string is styled in the output of 'show
@@ -503,7 +503,7 @@ with_test_prefix "all styles enabled" {
 
 # Now, for each style in turn.  Disable that style only and run the
 # test again.  Things in that style should NOT now be styled.
-foreach style { title file function highlight variable \
+foreach style { command title file function highlight variable \
                    address metadata } {
     set currently_disabled_style $style
     with_test_prefix "disable style $style" {
index 33b56fb3f99dcf1ba02d492d358ebd509cd85f9d..34223e654edf87dbf4ecc3b94ab598f818088063 100644 (file)
@@ -69,6 +69,7 @@ proc string_list_to_regexp { args } {
 proc style {str style} {
     switch -exact -- $style {
        title { set style 1 }
+       command { set style 1 }
        file { set style 32 }
        function { set style 33 }
        highlight { set style 31 }