From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id busxNdQ82WoSUQkAWB0awg (envelope-from ) for ; Wed, 21 Oct 2026 18:29:40 -0400 Received: by simark.ca (Postfix, from userid 112) id 6F8961E090; Wed, 21 Oct 2026 18:29:40 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C00F01E04D for ; Wed, 21 Oct 2026 18:29:39 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 16BC94BA23C2 for ; Wed, 21 Oct 2026 22:29:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16BC94BA23C2 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 37BBF4BA2E0F for ; Wed, 21 Oct 2026 22:29:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 37BBF4BA2E0F Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 37BBF4BA2E0F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792621755; cv=none; b=I44vV0SO3eE32QXuJJYQpzQ85v7q8f2XmX2RbZOifjJGn4K1vaCjk85O2j3E25eAkQZBhiYQTr43v/TMmfVwaLD8/ueaM2hWENSyGhj5AhkTea/n6Ndf+BDKcvvqJXausP/+cBK1nsJqEVpgdOuIE0O9UY+s8SBcoU/yN362V30= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792621755; c=relaxed/simple; bh=pUYa71zaN2diyrecvXIYYmgPt3wc1IKme8wlKZCIeM8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=UlcbMHyByKq2OiU1Rxr0MUzwNBHEi5fJjx7Ck1I9ZfDWYHswvP3PkdNErn1L3O683zlrB3gVYy68m9T7m9NgA/2aRhkxGexNx5pFVwidND2q1uy0FYuATV9SW9lMWEpTSx/ih7W2rLK6mudNV4+QMCaokytJqmfrif8lLZVwMB0= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37BBF4BA2E0F Received: by simark.ca (Postfix) id C8F691E050; Wed, 21 Oct 2026 18:29:14 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/2] gdb: remove set_width Date: Wed, 21 Oct 2026 18:28:59 -0400 Message-ID: <20261021222903.769497-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261021222903.769497-1-simon.marchi@efficios.com> References: <20261021222903.769497-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org set_width does not do anything useful anymore. What remains is: - Calling init_page_info if chars_per_line is 0. This can't happen: all callers call set_screen_size just before, which changes a chars_per_line of 0 to UINT_MAX. - Setting filtered_printing_initialized. This only matters the first time, when called from init_page_info, from gdb_init. The other callers (the "set width" command, set_screen_width_and_height and ~set_batch_flag_and_restore_page_info) can only run after that. Remove set_width, and set filtered_printing_initialized directly in init_page_info. The "set width" and "set height" callbacks are now identical, so replace them with a single set_screen_size_command. Change-Id: I3631223cd02c0ffe4b8e9ccef958e8ea8782d6aa --- gdb/utils.c | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/gdb/utils.c b/gdb/utils.c index f6ebda29784e..4d03ccd5c2da 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -87,9 +87,8 @@ void (*deprecated_error_begin_hook) (void); /* Prototypes for local functions */ static void set_screen_size (void); -static void set_width (void); -/* True once set_width has run and filtered printing can be used. */ +/* True once init_page_info has run and filtered printing can be used. */ static bool filtered_printing_initialized = false; @@ -1176,7 +1175,7 @@ init_page_info (void) rl_catch_sigwinch = 0; set_screen_size (); - set_width (); + filtered_printing_initialized = true; } set_batch_flag_and_restore_page_info::set_batch_flag_and_restore_page_info () @@ -1195,7 +1194,6 @@ set_batch_flag_and_restore_page_info::~set_batch_flag_and_restore_page_info () lines_per_page = m_save_lines_per_page; set_screen_size (); - set_width (); } /* An approximation of SQRT(INT_MAX) that is: @@ -1242,27 +1240,11 @@ set_screen_size (void) rl_set_screen_size (rows, cols); } -/* Initialize the page info if needed, and mark filtered printing as - initialized. */ +/* Callback for "set width" and "set height". */ static void -set_width () -{ - if (chars_per_line == 0) - init_page_info (); - - filtered_printing_initialized = true; -} - -static void -set_width_command (const char *args, int from_tty, struct cmd_list_element *c) -{ - set_screen_size (); - set_width (); -} - -static void -set_height_command (const char *args, int from_tty, struct cmd_list_element *c) +set_screen_size_command (const char *args, int from_tty, + cmd_list_element *c) { set_screen_size (); } @@ -1276,7 +1258,6 @@ set_screen_width_and_height (int width, int height) chars_per_line = width; set_screen_size (); - set_width (); } /* Import termcap variable UP (instead of readline private variable @@ -3678,7 +3659,7 @@ Set number of characters where GDB should wrap lines of its output."), _("\ Show number of characters where GDB should wrap lines of its output."), _("\ This affects where GDB wraps its output to fit the screen width.\n\ Setting this to \"unlimited\" or zero prevents GDB from wrapping its output."), - set_width_command, + set_screen_size_command, show_chars_per_line, &setlist, &showlist); @@ -3688,7 +3669,7 @@ Show number of lines in a page for GDB output pagination."), _("\ This affects the number of lines after which GDB will pause\n\ its output and ask you whether to continue.\n\ Setting this to \"unlimited\" or zero causes GDB never pause during output."), - set_height_command, + set_screen_size_command, show_lines_per_page, &setlist, &showlist); -- 2.56.0