From: Joel Brobecker <brobecker@adacore.com>
To: Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
Cc: 'Pedro Alves' <pedro@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [RFC] Use macro for void typecast necessary for ncurses library.
Date: Fri, 16 Apr 2010 04:36:00 -0000 [thread overview]
Message-ID: <20100416043544.GO19194@adacore.com> (raw)
In-Reply-To: <000901cadcec$365f5390$a31dfab0$@muller@ics-cnrs.unistra.fr>
[-- Attachment #1: Type: text/plain, Size: 685 bytes --]
> > Suggestion (which you are free to ignore): Would it make sense to
> > define
> > a new function or macro to have the cast (and therefore the comment) in
> > only one place?
> Here is an implementation of your idea.
Argh - I didn't realize that two "routines" where involved. For some
reason, when I looked at the initial patch, I only noticed wstandout,
and I thought it was used 4 times.
For the record - my idea was to define a macro such as unchecked_wstandout
that contains the cast, but if we have to do it for at least 2 routines,
there is no real benefit.
I ended up checking in the attached patch. Sorry about the screwup,
and thanks for giving it a try...
--
Joel
[-- Attachment #2: tui-cast-void.diff --]
[-- Type: text/x-diff, Size: 2617 bytes --]
commit e0737f6d628f1aa573cc2d1fd827be90b5d48a09
Author: Joel Brobecker <brobecker@adacore.com>
Date: Thu Apr 15 21:32:52 2010 -0700
* tui/tui-regs.c (tui_display_register): Add comment about
a couple of casts.
* tui/tui-stack.c (tui_show_locator_content): Ditto.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0a8f5b1..7c2ec94 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-16 Joel Brobecker <brobecker@adacore.com>
+
+ * tui/tui-regs.c (tui_display_register): Add comment about
+ a couple of casts.
+ * tui/tui-stack.c (tui_show_locator_content): Ditto.
+
2010-04-15 Stan Shebs <stan@codesourcery.com>
* frame.c: Include tracepoint.h.
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 8cbd338..a339bea 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -541,6 +541,11 @@ tui_display_register (struct tui_data_element *data,
int i;
if (data->highlight)
+ /* We ignore the return value, casting it to void in order to avoid
+ a compiler warning. The warning itself was introduced by a patch
+ to ncurses 5.7 dated 2009-08-29, changing this macro to expand
+ to code that causes the compiler to generate an unused-value
+ warning. */
(void) wstandout (win_info->handle);
wmove (win_info->handle, 0, 0);
@@ -551,6 +556,11 @@ tui_display_register (struct tui_data_element *data,
waddstr (win_info->handle, data->content);
if (data->highlight)
+ /* We ignore the return value, casting it to void in order to avoid
+ a compiler warning. The warning itself was introduced by a patch
+ to ncurses 5.7 dated 2009-08-29, changing this macro to expand
+ to code that causes the compiler to generate an unused-value
+ warning. */
(void) wstandend (win_info->handle);
tui_refresh_win (win_info);
}
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 1630bea..d6b514d 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -256,6 +256,11 @@ tui_show_locator_content (void)
string = tui_make_status_line (&element->which_element.locator);
wmove (locator->handle, 0, 0);
+ /* We ignore the return value from wstandout and wstandend, casting
+ them to void in order to avoid a compiler warning. The warning
+ itself was introduced by a patch to ncurses 5.7 dated 2009-08-29,
+ changing these macro to expand to code that causes the compiler
+ to generate an unused-value warning. */
(void) wstandout (locator->handle);
waddstr (locator->handle, string);
wclrtoeol (locator->handle);
next prev parent reply other threads:[~2010-04-16 4:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-13 8:56 [RFA] Fix compilation failure on cygwin due to ncurses macro Pierre Muller
2010-04-13 11:38 ` Pedro Alves
2010-04-13 12:13 ` Pierre Muller
2010-04-13 15:07 ` Joel Brobecker
2010-04-13 15:17 ` Pierre Muller
2010-04-13 15:26 ` Joel Brobecker
2010-04-14 11:08 ` Pierre Muller
2010-04-14 16:00 ` Joel Brobecker
2010-04-14 16:30 ` Pierre Muller
2010-04-14 16:33 ` Joel Brobecker
2010-04-14 16:39 ` Pedro Alves
2010-04-15 8:09 ` Pierre Muller
2010-04-15 15:53 ` Joel Brobecker
2010-04-15 22:38 ` [RFC] Use macro for void typecast necessary for ncurses library Pierre Muller
2010-04-16 4:36 ` Joel Brobecker [this message]
[not found] ` <9120.2086922296$1271371097@news.gmane.org>
2010-04-20 15:45 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100416043544.GO19194@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
--cc=pierre.muller@ics-cnrs.unistra.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox