]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add a new function to target.h to add an alias command for a target and mark it
authorMarkus Metzger <mmetzger@sourceware.org>
Mon, 11 Mar 2013 08:39:38 +0000 (08:39 +0000)
committerMarkus Metzger <mmetzger@sourceware.org>
Mon, 11 Mar 2013 08:39:38 +0000 (08:39 +0000)
deprecated.  This is useful when renaming targets.

gdb/
* target.h (add_deprecated_target_alias): New.
* target.c (add_deprecated_target_alias): New.

gdb/ChangeLog
gdb/target.c
gdb/target.h

index 0691d64b264dceb365e23f0acd707b83afe82c33..8655973fc8cf915b838b542ef43b57eaf8ef4f4b 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-11  Markus Metzger  <markus.t.metzger@intel.com>
+
+       * target.h (add_deprecated_target_alias): New.
+       * target.c (add_deprecated_target_alias): New.
+
 2013-03-11  Markus Metzger  <markus.t.metzger@intel.com>
 
        * common/linux-btrace.c: Include sys/ptrace, sys/types, sys/wait.h,
index 524caec71223371cb710a12fd95429908315fdd3..dd201847ac2eb01aa483013814c0c3dba8248b6f 100644 (file)
@@ -434,6 +434,21 @@ information on the arguments for a particular protocol, type\n\
   add_cmd (t->to_shortname, no_class, t->to_open, t->to_doc, &targetlist);
 }
 
+/* See target.h.  */
+
+void
+add_deprecated_target_alias (struct target_ops *t, char *alias)
+{
+  struct cmd_list_element *c;
+  char *alt;
+
+  /* If we use add_alias_cmd, here, we do not get the deprecated warning,
+     see PR cli/15104.  */
+  c = add_cmd (alias, no_class, t->to_open, t->to_doc, &targetlist);
+  alt = xstrprintf ("target %s", t->to_shortname);
+  deprecate_cmd (c, alt);
+}
+
 /* Stub functions */
 
 void
index ceecca4f321d2c776fd33b253b27f50266a0b467..e98095e35f8d0d91bf8c09244cddebb11096256f 100644 (file)
@@ -1788,6 +1788,11 @@ int target_verify_memory (const gdb_byte *data,
 
 extern void add_target (struct target_ops *);
 
+/* Adds a command ALIAS for target T and marks it deprecated.  This is useful
+   for maintaining backwards compatibility when renaming targets.  */
+
+extern void add_deprecated_target_alias (struct target_ops *t, char *alias);
+
 extern void push_target (struct target_ops *);
 
 extern int unpush_target (struct target_ops *);