[RFA,2/6] Use ATTRIBUTE_UNUSED in some places
Commit Message
A few spots needed ATTRIBUTE_UNUSED to cope with the new warnings.
In the TUI this happens due to the odd way that "getyx" works -- it
essentially uses references, so a variable must be passed in, even if
the code doesn't need to use it.
The case in inflow.c is just a mass of ifdefs; and while the only use
of "result" is guarded by "#if 0", I thought it simplest to leave it
all in place.
2016-06-06 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_show_source_line): Use
ATTRIBUTE_UNUSED.
* tui/tui-io.c (tui_puts): Use ATTRIBUTE_UNUSED.
(tui_redisplay_readline): Likewise.
* inflow.c (child_terminal_ours_1): Use ATTRIBUTE_UNUSED.
---
gdb/ChangeLog | 8 ++++++++
gdb/inflow.c | 2 +-
gdb/tui/tui-io.c | 6 ++++--
gdb/tui/tui-winsource.c | 3 ++-
4 files changed, 15 insertions(+), 4 deletions(-)
Comments
On 06/06/2016 10:33 PM, Tom Tromey wrote:
> A few spots needed ATTRIBUTE_UNUSED to cope with the new warnings.
>
> In the TUI this happens due to the odd way that "getyx" works -- it
> essentially uses references, so a variable must be passed in, even if
> the code doesn't need to use it.
I think we should use getcurx/getcury instead.
>
> The case in inflow.c is just a mass of ifdefs; and while the only use
> of "result" is guarded by "#if 0", I thought it simplest to leave it
> all in place.
>
Agreed.
Thanks,
Pedro Alves
@@ -1,5 +1,13 @@
2016-06-06 Tom Tromey <tom@tromey.com>
+ * tui/tui-winsource.c (tui_show_source_line): Use
+ ATTRIBUTE_UNUSED.
+ * tui/tui-io.c (tui_puts): Use ATTRIBUTE_UNUSED.
+ (tui_redisplay_readline): Likewise.
+ * inflow.c (child_terminal_ours_1): Use ATTRIBUTE_UNUSED.
+
+2016-06-06 Tom Tromey <tom@tromey.com>
+
* corefile.c (reopen_exec_file): Only examine st.st_mtime if stat
succeeded.
@@ -419,7 +419,7 @@ child_terminal_ours_1 (int output_only)
pgrp. */
sighandler_t osigttou = NULL;
#endif
- int result;
+ int result ATTRIBUTE_UNUSED;
#ifdef SIGTTOU
if (job_control)
@@ -172,7 +172,8 @@ tui_puts (const char *string)
/* Expand TABs, since ncurses on MS-Windows doesn't. */
if (c == '\t')
{
- int line, col;
+ int line ATTRIBUTE_UNUSED;
+ int col;
getyx (w, line, col);
do
@@ -198,7 +199,8 @@ tui_redisplay_readline (void)
{
int prev_col;
int height;
- int col, line;
+ int col;
+ int line ATTRIBUTE_UNUSED;
int c_pos;
int c_line;
int in;
@@ -273,7 +273,8 @@ static void
tui_show_source_line (struct tui_win_info *win_info, int lineno)
{
struct tui_win_element *line;
- int x, y;
+ int x;
+ int y ATTRIBUTE_UNUSED;
line = win_info->generic.content[lineno - 1];
if (line->which_element.source.is_exec_point)