[binutils-gdb] gdb: don't handle old == nullptr in add_alias_cmd
Simon Marchi
simark@sourceware.org
Mon May 17 18:04:20 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ecd0a6b35d32aa6aca913e2d0348cfdf7e78d6c3
commit ecd0a6b35d32aa6aca913e2d0348cfdf7e78d6c3
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date: Mon May 17 14:01:01 2021 -0400
gdb: don't handle old == nullptr in add_alias_cmd
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
Diff:
---
gdb/ChangeLog | 4 ++++
gdb/cli/cli-decode.c | 13 +------------
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c9f5181a7e1..4ff50087f75 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index a3b153f06e4..1bfc9477905 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);
More information about the Gdb-cvs
mailing list