From patchwork Thu Jul 4 17:02:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33570 Received: (qmail 109405 invoked by alias); 4 Jul 2019 17:03:54 -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 106780 invoked by uid 89); 4 Jul 2019 17:03:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.9 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.1 spammy=mistakes, defensive X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.123) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 Jul 2019 17:03:29 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway32.websitewelcome.com (Postfix) with ESMTP id F249419882 for ; Thu, 4 Jul 2019 12:03:27 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id j58phF0R790onj58phBMe4; Thu, 04 Jul 2019 12:03:27 -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=xFVG13DrsdPV6dwOEDp9fkN2Gnn4fijkdWh9UjjuI7s=; b=qaaguh5H9eFB25xu+GE1bzhz6i HDLpMiAJUu+J4B+ETHArGjUCxMHWiwbXq4MgWwHDZUj39xjMfKROmae1dJesv0pdHsFS5YQxWCzGV Ru4i4f4zTXana0/9Ds9ABxMsv; Received: from 174-29-58-150.hlrn.qwest.net ([174.29.58.150]:34696 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1hj58p-002sIW-Of; Thu, 04 Jul 2019 12:03:27 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 38/61] Remove the win_type parameter from tui_gen_win_info::reset Date: Thu, 4 Jul 2019 11:02:48 -0600 Message-Id: <20190704170311.15982-39-tom@tromey.com> In-Reply-To: <20190704170311.15982-1-tom@tromey.com> References: <20190704170311.15982-1-tom@tromey.com> tui_gen_win_info::reset has a window type parameter that is only used for an assertion. This made sense as a defensive measure when window creation was more dynamic -- it ensured that one did not make mistakes. However, there's no need for it any more, so this removes it. 2019-07-04 Tom Tromey * tui/tui-source.c (tui_source_window_base::reset): Remove win_type parameter. * tui/tui-layout.c (make_command_window, make_source_window) (make_disasm_window, make_data_window) (show_source_disasm_command, show_data, tui_gen_win_info::reset) (reset_locator, show_source_or_disasm_and_command): Update. * tui/tui-data.h (struct tui_gen_win_info) : Remove win_type parameter. (struct tui_source_window_base) : Likewise. --- gdb/ChangeLog | 12 ++++++++++++ gdb/tui/tui-data.h | 11 ++++------- gdb/tui/tui-layout.c | 42 +++++++++++++++--------------------------- gdb/tui/tui-source.c | 7 +++---- 4 files changed, 34 insertions(+), 38 deletions(-) diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 39c7f0c9d2f..3c34bd31961 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -58,11 +58,9 @@ public: return ""; } - /* Reset this window. WIN_TYPE must match the existing type of this - window (it is only passed for self-test purposes). The other - parameters are used to set the window's size and position. */ - virtual void reset (enum tui_win_type win_type, - int height, int width, + /* Reset this window. The parameters are used to set the window's + size and position. */ + virtual void reset (int height, int width, int origin_x, int origin_y); /* Window handle. */ @@ -393,8 +391,7 @@ public: virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0; - void reset (enum tui_win_type win_type, - int height, int width, + void reset (int height, int width, int origin_x, int origin_y) override; /* Does the locator belong to this window? */ diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index ab849a9813d..79c7996d19b 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -518,7 +518,7 @@ static struct tui_win_info * make_command_window (int height, int origin_y) { struct tui_win_info *result = new tui_cmd_window (); - result->reset (CMD_WIN, height, tui_term_width (), 0, origin_y); + result->reset (height, tui_term_width (), 0, origin_y); tui_make_window (result, DONT_BOX_WINDOW); return result; } @@ -530,7 +530,7 @@ static struct tui_win_info * make_source_window (int height, int origin_y) { tui_win_info *result = new tui_source_window (); - result->reset (SRC_WIN, height, tui_term_width (), 0, origin_y); + result->reset (height, tui_term_width (), 0, origin_y); result->make_visible (true); return result; } @@ -542,7 +542,7 @@ static struct tui_win_info * make_disasm_window (int height, int origin_y) { tui_win_info *result = new tui_disasm_window (); - result->reset (SRC_WIN, height, tui_term_width (), 0, origin_y); + result->reset (height, tui_term_width (), 0, origin_y); result->make_visible (true); return result; } @@ -552,7 +552,7 @@ static tui_win_info * make_data_window (int height, int origin_y) { tui_win_info *result = new tui_data_window (); - result->reset (DATA_WIN, height, tui_term_width (), 0, origin_y); + result->reset (height, tui_term_width (), 0, origin_y); result->make_visible (true); return result; } @@ -595,8 +595,7 @@ show_source_disasm_command (void) tui_win_list[SRC_WIN] = make_source_window (src_height, 0); else { - TUI_SRC_WIN->reset (TUI_SRC_WIN->type, - src_height, + TUI_SRC_WIN->reset (src_height, tui_term_width (), 0, 0); @@ -620,14 +619,12 @@ show_source_disasm_command (void) } else { - locator->reset (LOCATOR_WIN, - 2 /* 1 */ , + locator->reset (2 /* 1 */ , tui_term_width (), 0, (src_height + asm_height) - 1); TUI_DISASM_WIN->m_has_locator = true; - TUI_DISASM_WIN->reset (TUI_DISASM_WIN->type, - asm_height, + TUI_DISASM_WIN->reset (asm_height, tui_term_width (), 0, src_height - 1); @@ -644,8 +641,7 @@ show_source_disasm_command (void) = make_command_window (cmd_height, tui_term_height () - cmd_height); else { - TUI_CMD_WIN->reset (TUI_CMD_WIN->type, - TUI_CMD_WIN->height, + TUI_CMD_WIN->reset (TUI_CMD_WIN->height, TUI_CMD_WIN->width, 0, TUI_CMD_WIN->origin.y); @@ -702,14 +698,12 @@ show_data (enum tui_layout_type new_layout) else { base = (tui_source_window_base *) tui_win_list[win_type]; - tui_win_list[win_type]->reset (tui_win_list[win_type]->type, - src_height, + tui_win_list[win_type]->reset (src_height, tui_term_width (), 0, data_height - 1); tui_make_visible (tui_win_list[win_type]); - locator->reset (LOCATOR_WIN, - 2 /* 1 */ , + locator->reset (2 /* 1 */ , tui_term_width (), 0, total_height - 1); @@ -723,14 +717,11 @@ show_data (enum tui_layout_type new_layout) } void -tui_gen_win_info::reset (enum tui_win_type win_type, - int height_, int width_, +tui_gen_win_info::reset (int height_, int width_, int origin_x_, int origin_y_) { int h = height_; - gdb_assert (type == win_type); - width = width_; height = h; if (h > 1) @@ -750,7 +741,7 @@ reset_locator (tui_gen_win_info *win_info, int height, int width, int origin_x, int origin_y) { - win_info->reset (LOCATOR_WIN, height, width, origin_x, origin_y); + win_info->reset (height, width, origin_x, origin_y); tui_make_window (win_info, DONT_BOX_WINDOW); } @@ -794,14 +785,12 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type) else { base = (tui_source_window_base *) *win_info_ptr; - locator->reset (LOCATOR_WIN, - 2 /* 1 */ , + locator->reset (2 /* 1 */ , tui_term_width (), 0, src_height - 1); base->m_has_locator = true; - (*win_info_ptr)->reset ((*win_info_ptr)->type, - src_height - 1, + (*win_info_ptr)->reset (src_height - 1, tui_term_width (), 0, 0); @@ -820,8 +809,7 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type) } else { - TUI_CMD_WIN->reset (TUI_CMD_WIN->type, - TUI_CMD_WIN->height, + TUI_CMD_WIN->reset (TUI_CMD_WIN->height, TUI_CMD_WIN->width, TUI_CMD_WIN->origin.x, TUI_CMD_WIN->origin.y); diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 873612fecce..e171101e7fb 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -293,11 +293,10 @@ tui_source_window::location_matches_p (struct bp_location *loc, int line_no) } void -tui_source_window_base::reset (enum tui_win_type win_type, - int height, int width, +tui_source_window_base::reset (int height, int width, int origin_x, int origin_y) { - tui_gen_win_info::reset (win_type, height, width - 3, + tui_gen_win_info::reset (height, width - 3, origin_x + 3, origin_y); - execution_info->reset (EXEC_INFO_WIN, height, 3, origin_x, origin_y); + execution_info->reset (height, 3, origin_x, origin_y); }