From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Joel Brobecker'" <brobecker@adacore.com>
Cc: "'Pedro Alves'" <pedro@codesourcery.com>, <gdb-patches@sourceware.org>
Subject: [RFC] Use macro for void typecast necessary for ncurses library.
Date: Thu, 15 Apr 2010 22:38:00 -0000 [thread overview]
Message-ID: <000901cadcec$365f5390$a31dfab0$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <20100415155258.GN19194@adacore.com>
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Joel Brobecker
> Envoyé : Thursday, April 15, 2010 5:53 PM
> À : Pierre Muller
> Cc : 'Pedro Alves'; gdb-patches@sourceware.org
> Objet : Re: [RFA] Fix compilation failure on cygwin due to ncurses
> macro.
>
> > Thus it should become:
> > /* We need to cast the return value of wstandout to void
> because
> > in 2009/08/29 patch to release "5.7" of ncurses library,
> > the wstandout macro expands to code that generates a unused-
> value
> > warning at compilation. */
> >
> > Is this correct?
>
> Sounds right to me - just one nit: I think it's "an unused-value"
> rather
> than "a unused...".
>
> 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.
I am unsure about:
- the name we should give to the macro.
- should the macro have a parameter?
- should I mention that it would also apply to uses of wattrset?
2010-04-16 Pierre Muller <muller@ics.u-strasbg.fr>
* gdb_curses.h (CURSES_CAST_TO_VOID): New macro, with
explaination about its use.
* tui/tui-regs.c (tui_display_register): Use new macro.
* tui/tui-stack.c (tui_show_locator_content): Likewise.
Index: gdb_curses.h
===================================================================
RCS file: /cvs/src/src/gdb/gdb_curses.h,v
retrieving revision 1.12
diff -u -p -r1.12 gdb_curses.h
--- gdb_curses.h 1 Jan 2010 07:31:32 -0000 1.12
+++ gdb_curses.h 15 Apr 2010 22:30:53 -0000
@@ -43,4 +43,12 @@
extern int tgetnum (const char *);
#endif
+
+/* We need to cast the return value of wstandout and wstandend to void
because
+ in 2009/08/29 patch to release "5.7" of ncurses library,
+ the wstandout/wstandend macros expands to code that generates an
unused-value
+ warning at compilation. */
+
+#define CURSES_CAST_TO_VOID (void)
+
#endif /* gdb_curses.h */
Index: tui/tui-regs.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-regs.c,v
retrieving revision 1.37
diff -u -p -r1.37 tui-regs.c
--- tui/tui-regs.c 13 Apr 2010 12:11:09 -0000 1.37
+++ tui/tui-regs.c 15 Apr 2010 22:30:54 -0000
@@ -541,7 +541,7 @@ tui_display_register (struct tui_data_el
int i;
if (data->highlight)
- (void) wstandout (win_info->handle);
+ CURSES_CAST_TO_VOID wstandout (win_info->handle);
wmove (win_info->handle, 0, 0);
for (i = 1; i < win_info->width; i++)
@@ -551,7 +551,7 @@ tui_display_register (struct tui_data_el
waddstr (win_info->handle, data->content);
if (data->highlight)
- (void) wstandend (win_info->handle);
+ CURSES_CAST_TO_VOID wstandend (win_info->handle);
tui_refresh_win (win_info);
}
}
Index: tui/tui-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-stack.c,v
retrieving revision 1.35
diff -u -p -r1.35 tui-stack.c
--- tui/tui-stack.c 13 Apr 2010 12:11:10 -0000 1.35
+++ tui/tui-stack.c 15 Apr 2010 22:30:54 -0000
@@ -256,10 +256,10 @@ tui_show_locator_content (void)
string = tui_make_status_line (&element->which_element.locator);
wmove (locator->handle, 0, 0);
- (void) wstandout (locator->handle);
+ CURSES_CAST_TO_VOID wstandout (locator->handle);
waddstr (locator->handle, string);
wclrtoeol (locator->handle);
- (void) wstandend (locator->handle);
+ CURSES_CAST_TO_VOID wstandend (locator->handle);
tui_refresh_win (locator);
wmove (locator->handle, 0, 0);
xfree (string);
next prev parent reply other threads:[~2010-04-15 22:38 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 ` Pierre Muller [this message]
2010-04-16 4:36 ` [RFC] Use macro for void typecast necessary for ncurses library Joel Brobecker
[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='000901cadcec$365f5390$a31dfab0$@muller@ics-cnrs.unistra.fr' \
--to=pierre.muller@ics-cnrs.unistra.fr \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
/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