mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
gdb: don't show deprecated aliases
I don't think it's very useful to show deprecated aliases to the
user. It encourages the user to use them, when the goal is the
opposite.
For example, before:
(gdb) help set index-cache enabled
set index-cache enabled, set index-cache off, set index-cache on
alias set index-cache off = set index-cache enabled off
alias set index-cache on = set index-cache enabled on
Enable the index cache.
When on, enable the use of the index cache.
(gdb) help set index-cache on
Warning: 'set index-cache on', an alias for the command 'set index-cache enabled', is deprecated.
Use 'set index-cache enabled on'.
set index-cache enabled, set index-cache off, set index-cache on
alias set index-cache off = set index-cache enabled off
alias set index-cache on = set index-cache enabled on
Enable the index cache.
When on, enable the use of the index cache.
After:
(gdb) help set index-cache enabled
Enable the index cache.
When on, enable the use of the index cache.
(gdb) help set index-cache on
Warning: 'set index-cache on', an alias for the command 'set index-cache enabled', is deprecated.
Use 'set index-cache enabled on'.
Enable the index cache.
When on, enable the use of the index cache.
Change-Id: I989b618a5ad96ba975367e9d16db95523cd57a4c
This commit is contained in:
@@ -1345,7 +1345,7 @@ fput_aliases_definition_styled (const cmd_list_element &cmd,
|
||||
struct ui_file *stream)
|
||||
{
|
||||
for (const cmd_list_element &alias : cmd.aliases)
|
||||
if (!alias.default_args.empty ())
|
||||
if (!alias.cmd_deprecated && !alias.default_args.empty ())
|
||||
fput_alias_definition_styled (alias, stream);
|
||||
}
|
||||
|
||||
@@ -1361,17 +1361,40 @@ fput_command_names_styled (const cmd_list_element &c,
|
||||
bool always_fput_c_name, const char *postfix,
|
||||
struct ui_file *stream)
|
||||
{
|
||||
if (always_fput_c_name || !c.aliases.empty ())
|
||||
/* First, check if we are going to print something. That is, either if
|
||||
ALWAYS_FPUT_C_NAME is true or if there exists at least one non-deprecated
|
||||
alias. */
|
||||
|
||||
auto print_alias = [] (const cmd_list_element &alias)
|
||||
{
|
||||
return !alias.cmd_deprecated;
|
||||
};
|
||||
|
||||
bool print_something = always_fput_c_name;
|
||||
if (!print_something)
|
||||
for (const cmd_list_element &alias : c.aliases)
|
||||
{
|
||||
if (!print_alias (alias))
|
||||
continue;
|
||||
|
||||
print_something = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (print_something)
|
||||
fput_command_name_styled (c, stream);
|
||||
|
||||
for (const cmd_list_element &alias : c.aliases)
|
||||
{
|
||||
if (!print_alias (alias))
|
||||
continue;
|
||||
|
||||
fputs_filtered (", ", stream);
|
||||
wrap_here (" ");
|
||||
fput_command_name_styled (alias, stream);
|
||||
}
|
||||
|
||||
if (always_fput_c_name || !c.aliases.empty ())
|
||||
if (print_something)
|
||||
fputs_filtered (postfix, stream);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user