This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA 2/6] Use ATTRIBUTE_UNUSED in some places
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tom at tromey dot com>
- Date: Mon, 6 Jun 2016 15:33:28 -0600
- Subject: [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>
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(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 649bb0b..fbd7051 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 4c80dbd..9b94b29 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -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)
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 3fa32db..35025ce 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -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;
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 48975b6..48bfbe4 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -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)
--
2.5.5