[PATCH 2/7] gdb: don't handle old == nullptr in add_alias_cmd
Simon Marchi
simon.marchi@polymtl.ca
Fri May 14 19:38:45 GMT 2021
I don't think this can ever happen, that we add an alias command and
pass a nullptr old (target) command. Remove the "if" handling this,
replace with an assert.
gdb/ChangeLog:
* cli/cli-decode.c (add_alias_cmd): Don't handle old == 0.
Change-Id: Ibb39e8dc4e0c465fa42e6826215f30a0a0aef932
---
gdb/cli/cli-decode.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index a3b153f06e48..1bfc9477905a 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -310,18 +310,7 @@ add_alias_cmd (const char *name, cmd_list_element *old,
enum command_class theclass, int abbrev_flag,
struct cmd_list_element **list)
{
- if (old == 0)
- {
- struct cmd_list_element *prehook, *prehookee, *posthook, *posthookee;
- struct cmd_list_element *aliases = delete_cmd (name, list,
- &prehook, &prehookee,
- &posthook, &posthookee);
-
- /* If this happens, it means a programmer error somewhere. */
- gdb_assert (!aliases && !prehook && !prehookee
- && !posthook && ! posthookee);
- return 0;
- }
+ gdb_assert (old != nullptr);
struct cmd_list_element *c = add_cmd (name, theclass, old->doc, list);
--
2.31.1
More information about the Gdb-patches
mailing list