From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13566 invoked by alias); 4 Mar 2013 17:08:12 -0000 Received: (qmail 13409 invoked by uid 22791); 4 Mar 2013 17:08:00 -0000 X-SWARE-Spam-Status: No, hits=-8.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga14.intel.com (HELO mga14.intel.com) (143.182.124.37) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Mar 2013 17:07:24 +0000 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 04 Mar 2013 09:06:23 -0800 X-ExtLoop1: 1 Received: from swsutil001.isw.intel.com ([10.237.237.11]) by AZSMGA002.ch.intel.com with ESMTP; 04 Mar 2013 09:06:22 -0800 Received: from ulslx001.iul.intel.com (ulslx001.iul.intel.com [172.28.207.63]) by swsutil001.isw.intel.com (8.13.6/8.13.6/MailSET/Hub) with ESMTP id r24H6Dwq004089; Mon, 4 Mar 2013 17:06:14 GMT Received: from ulslx001.iul.intel.com (localhost [127.0.0.1]) by ulslx001.iul.intel.com with ESMTP id r24H6DuY020082; Mon, 4 Mar 2013 18:06:13 +0100 Received: (from mmetzger@localhost) by ulslx001.iul.intel.com with id r24H6DXh020078; Mon, 4 Mar 2013 18:06:13 +0100 From: Markus Metzger To: jan.kratochvil@redhat.com Cc: gdb-patches@sourceware.org, markus.t.metzger@gmail.com Subject: [patch v9 11/23] target: add add_deprecated_target_alias Date: Mon, 04 Mar 2013 17:08:00 -0000 Message-Id: <1362416770-19750-12-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1362416770-19750-1-git-send-email-markus.t.metzger@intel.com> References: <1362416770-19750-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00105.txt.bz2 Add a new function to target.h to add an alias command for a target and mark it deprecated. This is useful when renaming targets. Approved by Jan Kratochvil. 2013-03-04 Markus Metzger * target.h (add_deprecated_target_alias): New. * target.c (add_deprecated_target_alias): New. --- gdb/target.c | 15 +++++++++++++++ gdb/target.h | 5 +++++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/gdb/target.c b/gdb/target.c index 9dfbe08..1771d3a 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -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 diff --git a/gdb/target.h b/gdb/target.h index c543118..1d73336 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1779,6 +1779,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 *); -- 1.7.1