From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111470 invoked by alias); 6 Sep 2018 21:13:27 -0000 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 Received: (qmail 111332 invoked by uid 89); 6 Sep 2018 21:13:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=UD:command.h, clidecodec, commandh, cli-decode.c X-HELO: gateway33.websitewelcome.com Received: from gateway33.websitewelcome.com (HELO gateway33.websitewelcome.com) (192.185.146.130) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Sep 2018 21:13:25 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 450F5ABAF13 for ; Thu, 6 Sep 2018 16:13:24 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id y1aSfYHaOBcCXy1aZf0Kkv; Thu, 06 Sep 2018 16:13:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=JS8feF0z85xVzJWhOL8VKPcBzBxbg482UiaQfcFNVBU=; b=QmeXGPCJC3Mj06PCOQvNYdRFHu EjxMwm3Wkj1gtahwI4VcKl9FK6BzbNwEhqVV4WY2hNr+50+xVectlMu5Htnu5kF3ZRv//cKoPMgkI L5aolHl2oTboE2k16HWBrMqZt; Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:34550 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fy1aS-0013U4-9r; Thu, 06 Sep 2018 16:13:12 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC 2/8] Add a "context" argument to add_setshow_enum_cmd Date: Thu, 06 Sep 2018 21:13:00 -0000 Message-Id: <20180906211303.11029-3-tom@tromey.com> In-Reply-To: <20180906211303.11029-1-tom@tromey.com> References: <20180906211303.11029-1-tom@tromey.com> X-SW-Source: 2018-09/txt/msg00106.txt.bz2 This adds a "context" argument to add_setshow_enum_cmd. Now add_setshow_enum_cmd will call set_cmd_context on both of the new commands. This is used in a later patch. gdb/ChangeLog 2018-09-06 Tom Tromey * command.h (add_setshow_enum_cmd): Add "context" argument. * cli/cli-decode.c (add_setshow_enum_cmd): Add "context" argument. Call set_cmd_context. --- gdb/ChangeLog | 6 ++++++ gdb/cli/cli-decode.c | 10 +++++++--- gdb/command.h | 3 ++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 83dd67efe3f..4a75c41c910 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -495,16 +495,20 @@ add_setshow_enum_cmd (const char *name, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, - struct cmd_list_element **show_list) + struct cmd_list_element **show_list, + void *context) { - struct cmd_list_element *c; + struct cmd_list_element *c, *show; add_setshow_cmd_full (name, theclass, var_enum, var, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list, - &c, NULL); + &c, &show); c->enums = enumlist; + + set_cmd_context (c, context); + set_cmd_context (show, context); } const char * const auto_boolean_enums[] = { "on", "off", "auto", NULL }; diff --git a/gdb/command.h b/gdb/command.h index 3dde2475cb1..cf4def2bcdb 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -300,7 +300,8 @@ extern void add_setshow_enum_cmd (const char *name, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, - struct cmd_list_element **show_list); + struct cmd_list_element **show_list, + void *context = nullptr); extern void add_setshow_auto_boolean_cmd (const char *name, enum command_class theclass, -- 2.13.6