From patchwork Tue Jun 28 20:58:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 13454 Received: (qmail 99463 invoked by alias); 28 Jun 2016 20:58:51 -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 99449 invoked by uid 89); 28 Jun 2016 20:58:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=1987, Hx-languages-length:3158, tabs, border X-HELO: gproxy7-pub.mail.unifiedlayer.com Received: from gproxy7-pub.mail.unifiedlayer.com (HELO gproxy7-pub.mail.unifiedlayer.com) (70.40.196.235) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Tue, 28 Jun 2016 20:58:40 +0000 Received: (qmail 24415 invoked by uid 0); 28 Jun 2016 20:58:37 -0000 Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy7.mail.unifiedlayer.com with SMTP; 28 Jun 2016 20:58:37 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id CLyZ1t00R2f2jeq01Lyccw; Tue, 28 Jun 2016 14:58:36 -0600 X-Authority-Analysis: v=2.1 cv=OPe0g0qB c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=PnD2wP_eR3oA:10 a=7XZj0uCbPdcA:10 a=pD_ry4oyNxEA:10 a=20KFwNOVAAAA:8 a=zstS-IiYAAAA:8 a=yIPcsSuZKnR8Wpes4yUA:9 a=e_O65bzb51kRm2y5VmPK:22 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from [75.171.172.174] (port=49782 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1bI05a-0003xF-AH; Tue, 28 Jun 2016 14:58:34 -0600 From: Tom Tromey To: Pedro Alves Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFA 2/6] Use ATTRIBUTE_UNUSED in some places References: <1465248812-23902-1-git-send-email-tom@tromey.com> <1465248812-23902-3-git-send-email-tom@tromey.com> <4e0f2f7a-6363-271d-2d91-4f8352d6509f@redhat.com> Date: Tue, 28 Jun 2016 14:58:31 -0600 In-Reply-To: <4e0f2f7a-6363-271d-2d91-4f8352d6509f@redhat.com> (Pedro Alves's message of "Tue, 28 Jun 2016 19:26:41 +0100") Message-ID: <87shvxt4i0.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.94 (gnu/linux) MIME-Version: 1.0 X-Identified-User: {36111:box522.bluehost.com:elynrobi:tromey.com} {sentby:smtp auth 75.171.172.174 authed with tom+tromey.com} X-Exim-ID: 1bI05a-0003xF-AH X-Source-Sender: (bapiya) [75.171.172.174]:49782 X-Source-Auth: tom+tromey.com X-Email-Count: 0 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== >>>>> "Pedro" == Pedro Alves writes: Pedro> I think we should use getcurx/getcury instead. I've split the patch into two. The inflow bits remain the same as what was posted. I can repost this if you want. This new patch replaces the uses of getyx with getcurx. Tom commit 2caa6df91fe83630faa615011a724748feee7a30 Author: Tom Tromey Date: Tue Jun 28 14:25:49 2016 -0600 Use getcurx in curses code As suggested by Pedro, this changes a few spots to use getcurx, rather than getyx. This avoids some unused variable warnings. 2016-06-28 Tom Tromey * tui/tui-winsource.c (tui_show_source_line): Use getcurx. * tui/tui-io.c (tui_puts): Use getcurx. (tui_redisplay_readline): Likewise. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 57631e8..eacc3fa 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2016-06-28 Tom Tromey + + * tui/tui-winsource.c (tui_show_source_line): Use getcurx. + * tui/tui-io.c (tui_puts): Use getcurx. + (tui_redisplay_readline): Likewise. + 2016-06-06 Tom Tromey * inflow.c (child_terminal_ours_1): Use ATTRIBUTE_UNUSED. diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index ed79b44..93bed88 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -172,9 +172,9 @@ tui_puts (const char *string) /* Expand TABs, since ncurses on MS-Windows doesn't. */ if (c == '\t') { - int line, col; + int col; - getyx (w, line, col); + col = getcurx (w); do { waddch (w, ' '); @@ -198,7 +198,7 @@ tui_redisplay_readline (void) { int prev_col; int height; - int col, line; + int col; int c_pos; int c_line; int in; @@ -230,7 +230,7 @@ tui_redisplay_readline (void) for (in = 0; prompt && prompt[in]; in++) { waddch (w, prompt[in]); - getyx (w, line, col); + col = getcurx (w); if (col <= prev_col) height++; prev_col = col; @@ -256,7 +256,7 @@ tui_redisplay_readline (void) else if (c == '\t') { /* Expand TABs, since ncurses on MS-Windows doesn't. */ - getyx (w, line, col); + col = getcurx (w); do { waddch (w, ' '); @@ -269,7 +269,7 @@ tui_redisplay_readline (void) } if (c == '\n') TUI_CMD_WIN->detail.command_info.start_line = getcury (w); - getyx (w, line, col); + col = getcurx (w); if (col < prev_col) height++; prev_col = col; diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 48975b6..09080b8 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -273,7 +273,7 @@ static void tui_show_source_line (struct tui_win_info *win_info, int lineno) { struct tui_win_element *line; - int x, y; + int x; line = win_info->generic.content[lineno - 1]; if (line->which_element.source.is_exec_point) @@ -285,11 +285,11 @@ tui_show_source_line (struct tui_win_info *win_info, int lineno) wattroff (win_info->generic.handle, A_STANDOUT); /* Clear to end of line but stop before the border. */ - getyx (win_info->generic.handle, y, x); + x = getcurx (win_info->generic.handle); while (x + 1 < win_info->generic.width) { waddch (win_info->generic.handle, ' '); - getyx (win_info->generic.handle, y, x); + x = getcurx (win_info->generic.handle); } }