This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 2/6] Use ATTRIBUTE_UNUSED in some places
- From: Tom Tromey <tom at tromey dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Tue, 28 Jun 2016 14:58:31 -0600
- Subject: Re: [RFA 2/6] Use ATTRIBUTE_UNUSED in some places
- Authentication-results: sourceware.org; auth=none
- References: <1465248812-23902-1-git-send-email-tom at tromey dot com> <1465248812-23902-3-git-send-email-tom at tromey dot com> <4e0f2f7a-6363-271d-2d91-4f8352d6509f at redhat dot com>
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> 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 <tom@tromey.com>
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 <tom@tromey.com>
* 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 <tom@tromey.com>
+
+ * 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 <tom@tromey.com>
* 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);
}
}