From patchwork Thu Jul 11 15:31:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33677 Received: (qmail 42067 invoked by alias); 11 Jul 2019 15:31:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 42056 invoked by uid 89); 11 Jul 2019 15:31:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.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_PASS autolearn=ham version=3.3.1 spammy=top.c, topc, UD:top.c, spe X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Jul 2019 15:31:38 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E40725604C; Thu, 11 Jul 2019 11:31:36 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id x6wLQpGiMRiT; Thu, 11 Jul 2019 11:31:36 -0400 (EDT) Received: from murgatroyd.Home (97-122-178-82.hlrn.qwest.net [97.122.178.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 8FD6311663F; Thu, 11 Jul 2019 11:31:36 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Remove init_cli_cmds Date: Thu, 11 Jul 2019 09:31:34 -0600 Message-Id: <20190711153134.5887-1-tromey@adacore.com> MIME-Version: 1.0 I noticed that init_cli_cmds only installs a command, and so doesn't need to be handled specially. This patch merges it into _initialize_cli_cmds. The help text is constructed dynamically, which is sometimes an indication that special treatment is needed; but in this case it is just to insert the value of "gdbinit", which is created at compile-time and not modified; so this doesn't affect the result. gdb/ChangeLog 2019-07-11 Tom Tromey * cli/cli-cmds.c (init_cli_cmds): Remove, merging contents into... (_initialize_cli_cmds): ...here. * top.c (gdb_init): Don't call init_cli_cmds. * cli/cli-cmds.h (init_cli_cmds): Don't declare. --- gdb/ChangeLog | 8 ++++++++ gdb/cli/cli-cmds.c | 9 +-------- gdb/cli/cli-cmds.h | 2 -- gdb/top.c | 1 - 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index e689c0ff64e..2ef28a5f277 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -2215,15 +2215,8 @@ Make \"spe\" an alias of \"set print elements\":\n\ alias spe = set print elements\n\ Make \"elms\" an alias of \"elements\" in the \"set print\" command:\n\ alias -a set print elms = set print elements")); -} - -void -init_cli_cmds (void) -{ - struct cmd_list_element *c; - char *source_help_text; - source_help_text = xstrprintf (_("\ + const char *source_help_text = xstrprintf (_("\ Read commands from a file named FILE.\n\ \n\ Usage: source [-s] [-v] FILE\n\ diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h index ac0591e2e89..5bfffde04a1 100644 --- a/gdb/cli/cli-cmds.h +++ b/gdb/cli/cli-cmds.h @@ -105,8 +105,6 @@ extern struct cmd_list_element *showchecklist; void init_cmd_lists (void); -void init_cli_cmds (void); - int is_complete_command (struct cmd_list_element *cmd); /* Exported to gdb/main.c */ diff --git a/gdb/top.c b/gdb/top.c index 68cf405f6e0..63754169405 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -2265,7 +2265,6 @@ gdb_init (char *argv0) initialize_progspace (); initialize_inferiors (); initialize_current_architecture (); - init_cli_cmds(); init_main (); /* But that omits this file! Do it now. */ initialize_stdin_serial ();