From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id M4l3EW647mKg6SEAWB0awg (envelope-from ) for ; Sat, 06 Aug 2022 14:52:30 -0400 Received: by simark.ca (Postfix, from userid 112) id 3CE341EA05; Sat, 6 Aug 2022 14:52:30 -0400 (EDT) Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=Ha82la9I; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 500921E745 for ; Sat, 6 Aug 2022 14:52:29 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6C0A53858D28 for ; Sat, 6 Aug 2022 18:52:28 +0000 (GMT) Received: from gproxy2-pub.mail.unifiedlayer.com (gproxy2-pub.mail.unifiedlayer.com [69.89.18.3]) by sourceware.org (Postfix) with ESMTPS id 760693858D28 for ; Sat, 6 Aug 2022 18:52:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 760693858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw11.mail.unifiedlayer.com (unknown [10.0.90.126]) by progateway4.mail.pro1.eigbox.com (Postfix) with ESMTP id 464DD10049504 for ; Sat, 6 Aug 2022 18:52:04 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id KOu3orN6mq24iKOu3oqf4S; Sat, 06 Aug 2022 18:52:04 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=DaLSFthW c=1 sm=1 tr=0 ts=62eeb854 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=biHskzXt2R4A:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=ue3COMwX1-fx7hBw3MoA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=L0BRlja8zvx66/wuTiuiGQPDozCkQMyTJP+CKSds9xY=; b=Ha82la9IPaqxMAFwhtyrZYB9Km L8efZie4q33aw07jnem24GYYpvfLfh0h5dsf/kzHSLku7L+KRUodUnc4mNBl7jRndEctfwqmiSR3a 2/fpubloCCf4c3RunY6YSElFp; Received: from 71-211-185-228.hlrn.qwest.net ([71.211.185.228]:45540 helo=prentzel.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oKOu3-001sgH-B7; Sat, 06 Aug 2022 12:52:03 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH] Remove two initialization functions Date: Sat, 6 Aug 2022 12:52:01 -0600 Message-Id: <20220806185201.1522864-1-tom@tromey.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.185.228 X-Source-L: No X-Exim-ID: 1oKOu3-001sgH-B7 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-185-228.hlrn.qwest.net (prentzel.Home) [71.211.185.228]:45540 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" I noticed a couple of initialization functions that aren't really needed, and that currently require explicit calls in gdb_init. This patch removes these functions, simplifying gdb a little. Regression tested on x86-64 Fedora 34. --- gdb/cli/cli-cmds.c | 8 +------- gdb/cli/cli-cmds.h | 2 -- gdb/top.c | 23 +++++++---------------- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 18fb6e6d869..d5707192be0 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -76,7 +76,7 @@ static void filter_sals (std::vector &); /* See cli-cmds.h. */ -unsigned int max_user_call_depth; +unsigned int max_user_call_depth = 1024; /* Define all cmd_list_elements. */ @@ -2105,12 +2105,6 @@ filter_sals (std::vector &sals) sals.erase (from, sals.end ()); } -void -init_cmd_lists (void) -{ - max_user_call_depth = 1024; -} - static void show_info_verbose (struct ui_file *file, int from_tty, struct cmd_list_element *c, diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h index 770abecab8a..89ad0d199d2 100644 --- a/gdb/cli/cli-cmds.h +++ b/gdb/cli/cli-cmds.h @@ -151,8 +151,6 @@ extern unsigned int max_user_call_depth; /* Exported to gdb/top.c */ -void init_cmd_lists (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 453fa236db1..07e491440e4 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -2231,17 +2231,6 @@ show_startup_quiet (struct ui_file *file, int from_tty, value); } -static void -init_gdb_version_vars (void) -{ - struct internalvar *major_version_var = create_internalvar ("_gdb_major"); - struct internalvar *minor_version_var = create_internalvar ("_gdb_minor"); - int vmajor = 0, vminor = 0, vrevision = 0; - sscanf (version, "%d.%d.%d", &vmajor, &vminor, &vrevision); - set_internalvar_integer (major_version_var, vmajor); - set_internalvar_integer (minor_version_var, vminor + (vrevision > 0)); -} - static void init_main (void) { @@ -2405,6 +2394,13 @@ Usage: new-ui INTERPRETER TTY\n\ The first argument is the name of the interpreter to run.\n\ The second argument is the terminal the UI runs on."), &cmdlist); set_cmd_completer (c, interpreter_completer); + + struct internalvar *major_version_var = create_internalvar ("_gdb_major"); + struct internalvar *minor_version_var = create_internalvar ("_gdb_minor"); + int vmajor = 0, vminor = 0, vrevision = 0; + sscanf (version, "%d.%d.%d", &vmajor, &vminor, &vrevision); + set_internalvar_integer (major_version_var, vmajor); + set_internalvar_integer (minor_version_var, vminor + (vrevision > 0)); } /* See top.h. */ @@ -2423,8 +2419,6 @@ gdb_init () make_final_cleanup (do_chdir_cleanup, xstrdup (current_directory)); #endif - init_cmd_lists (); /* This needs to be done first. */ - init_page_info (); /* Here is where we call all the _initialize_foo routines. */ @@ -2454,9 +2448,6 @@ gdb_init () during startup. */ set_language (language_c); expected_language = current_language; /* Don't warn about the change. */ - - /* Create $_gdb_major and $_gdb_minor convenience variables. */ - init_gdb_version_vars (); } void _initialize_top (); -- 2.34.1