diff options
author | Tom Tromey <tromey@adacore.com> | 2020-12-15 08:07:32 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-12-15 08:07:32 -0700 |
commit | 0e5ad4426a0b186290b845852ba9dac112388cbc (patch) | |
tree | 721887ddeca2e38709d17d047df4edca4fa6a6f6 /gdb/cli | |
parent | 7bed846687589e1346626e8bc9f2948340ef454b (diff) | |
download | gdb-0e5ad4426a0b186290b845852ba9dac112388cbc.zip gdb-0e5ad4426a0b186290b845852ba9dac112388cbc.tar.gz gdb-0e5ad4426a0b186290b845852ba9dac112388cbc.tar.bz2 |
Highlight deprecated commands using title style
After Andrew's latest patch, I noticed that the deprecation warnings
could use the (so-called) title style when printing command names.
This patch implements this idea.
gdb/ChangeLog
2020-12-15 Tom Tromey <tromey@adacore.com>
* cli/cli-decode.c (deprecated_cmd_warning): Use title style for
command names.
gdb/testsuite/ChangeLog
2020-12-15 Tom Tromey <tromey@adacore.com>
* gdb.base/style.exp: Add deprecation tests.
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-decode.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 13260ac..fb2856d 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -1939,16 +1939,23 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list) tmp_alias_str += std::string (alias->name); if (cmd->cmd_deprecated) - printf_filtered (_("Warning: command '%s' (%s) is deprecated.\n"), - tmp_cmd_str.c_str (), tmp_alias_str.c_str ()); + printf_filtered (_("Warning: command '%ps' (%ps) is deprecated.\n"), + styled_string (title_style.style (), + tmp_cmd_str.c_str ()), + styled_string (title_style.style (), + tmp_alias_str.c_str ())); else - printf_filtered (_("Warning: '%s', an alias for the command '%s', " + printf_filtered (_("Warning: '%ps', an alias for the command '%ps', " "is deprecated.\n"), - tmp_alias_str.c_str (), tmp_cmd_str.c_str ()); + styled_string (title_style.style (), + tmp_alias_str.c_str ()), + styled_string (title_style.style (), + tmp_cmd_str.c_str ())); } else - printf_filtered (_("Warning: command '%s' is deprecated.\n"), - tmp_cmd_str.c_str ()); + printf_filtered (_("Warning: command '%ps' is deprecated.\n"), + styled_string (title_style.style (), + tmp_cmd_str.c_str ())); /* Now display a second line indicating what the user should use instead. If it is only the alias that is deprecated, we want to indicate the @@ -1959,7 +1966,9 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list) else replacement = cmd->replacement; if (replacement != nullptr) - printf_filtered (_("Use '%s'.\n\n"), replacement); + printf_filtered (_("Use '%ps'.\n\n"), + styled_string (title_style.style (), + replacement)); else printf_filtered (_("No alternative known.\n\n")); |