]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: don't handle old == nullptr in add_alias_cmd
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 17 May 2021 18:01:01 +0000 (14:01 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 17 May 2021 18:01:01 +0000 (14:01 -0400)
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/ChangeLog
gdb/cli/cli-decode.c

index c9f5181a7e1a9285b52df2cedffa5355c349b23d..4ff50087f7558c49201766e2fb98b3f697814e7b 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-17  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * cli/cli-decode.c (add_alias_cmd): Don't handle old == 0.
+
 2021-05-17  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * cli/cli-decode.h (prefixname): Make const, move implementation
index a3b153f06e4877b2fe38be1e2ddab05b423e8474..1bfc9477905a8c581d78f49177272dcdf10ffd8c 100644 (file)
@@ -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);