From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4608 invoked by alias); 8 Feb 2013 15:30:50 -0000 Received: (qmail 4527 invoked by uid 22791); 8 Feb 2013 15:30:48 -0000 X-SWARE-Spam-Status: No, hits=-7.7 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 mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Feb 2013 15:30:44 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 08 Feb 2013 07:29:27 -0800 X-ExtLoop1: 1 Received: from swsutil001.isw.intel.com ([10.237.237.11]) by orsmga002.jf.intel.com with ESMTP; 08 Feb 2013 07:30:39 -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 r18FUbkb002885; Fri, 8 Feb 2013 15:30:37 GMT Received: from ulslx001.iul.intel.com (localhost [127.0.0.1]) by ulslx001.iul.intel.com with ESMTP id r18FUbOe027132; Fri, 8 Feb 2013 16:30:37 +0100 Received: (from mmetzger@localhost) by ulslx001.iul.intel.com with id r18FUb6F027128; Fri, 8 Feb 2013 16:30:37 +0100 From: markus.t.metzger@intel.com To: jan.kratochvil@redhat.com Cc: gdb-patches@sourceware.org, markus.t.metzger@gmail.com, Markus Metzger Subject: [rfc 1/5] target: add add_deprecated_target_alias Date: Fri, 08 Feb 2013 15:30:00 -0000 Message-Id: <1360337423-27095-2-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1360337423-27095-1-git-send-email-markus.t.metzger@intel.com> References: <1360337423-27095-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-02/txt/msg00212.txt.bz2 From: Markus Metzger 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. 2013-02-08 Markus Metzger * target.h (add_deprecated_target_alias): New. * target.c (add_deprecated_target_alias): New. --- gdb/target.c | 14 ++++++++++++++ gdb/target.h | 5 +++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/gdb/target.c b/gdb/target.c index 10f69dc..25f4629 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -434,6 +434,20 @@ 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. */ + 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.0.7