From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27057 invoked by alias); 28 Nov 2018 00:14:42 -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 27041 invoked by uid 89); 28 Nov 2018 00:14:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=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=U*tom, HX-HELO:sk:gateway, tom@tromey.com, D*tromey.com X-HELO: gateway31.websitewelcome.com Received: from gateway31.websitewelcome.com (HELO gateway31.websitewelcome.com) (192.185.144.29) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Nov 2018 00:14:39 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 1A746E4D4 for ; Tue, 27 Nov 2018 18:14:38 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id RnV0gwv3TaSeyRnV0g9a4w; Tue, 27 Nov 2018 18:14:38 -0600 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=WGJs8bBAw3JSey+iFsxbs5CxVMNyQC2iXAwRks5u+E0=; b=nHLUw8BslQuibgN0bphop5NN9q J8DZ7IYypCKFC86vgEaXtowykd4Tya0WBBzOH16jkh7rTlKInwoGyQTqICmBN7j42G8biCa+CtrKr qEyQ+Uzg0JC1Ho0ciWC1/zldC; Received: from 97-122-190-66.hlrn.qwest.net ([97.122.190.66]:33804 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gRnUz-004MMp-S5; Tue, 27 Nov 2018 18:14:37 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 02/16] Add a "context" argument to add_setshow_enum_cmd Date: Wed, 28 Nov 2018 00:14:00 -0000 Message-Id: <20181128001435.12703-3-tom@tromey.com> In-Reply-To: <20181128001435.12703-1-tom@tromey.com> References: <20181128001435.12703-1-tom@tromey.com> X-SW-Source: 2018-11/txt/msg00492.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-11-27 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 5d798e877e..e7b7a110fc 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -531,16 +531,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 e3d55c2dcb..68514409ec 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -314,7 +314,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.17.2