From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8506 invoked by alias); 15 Apr 2010 22:38:12 -0000 Received: (qmail 8490 invoked by uid 22791); 15 Apr 2010 22:38:10 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=BAYES_00,MSGID_MULTIPLE_AT,TW_LR X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.151) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 15 Apr 2010 22:38:03 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o3FMbJ1e087096 ; Fri, 16 Apr 2010 00:37:19 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [IPv6:2001:660:2402:d::10]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o3FMbIZ7017548 ; Fri, 16 Apr 2010 00:37:18 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o3FMbGFf089071 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Fri, 16 Apr 2010 00:37:17 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Joel Brobecker'" Cc: "'Pedro Alves'" , References: <003001cadae7$2e639860$8b2ac920$@muller@ics-cnrs.unistra.fr> <20100414155944.GK19194@adacore.com> <000001cadbef$a21bad70$e6530850$@muller@ics-cnrs.unistra.fr> <201004141738.22662.pedro@codesourcery.com> <000601cadc72$e751a330$b5f4e990$@muller@ics-cnrs.unistra.fr> <20100415155258.GN19194@adacore.com> In-Reply-To: <20100415155258.GN19194@adacore.com> Subject: [RFC] Use macro for void typecast necessary for ncurses library. Date: Thu, 15 Apr 2010 22:38:00 -0000 Message-ID: <000901cadcec$365f5390$a31dfab0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-04/txt/msg00482.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Joel Brobecker > Envoy=E9=A0: Thursday, April 15, 2010 5:53 PM > =C0=A0: Pierre Muller > Cc=A0: 'Pedro Alves'; gdb-patches@sourceware.org > Objet=A0: Re: [RFA] Fix compilation failure on cygwin due to ncurses > macro. >=20 > > 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? >=20 > Sounds right to me - just one nit: I think it's "an unused-value" > rather > than "a unused...". >=20 > 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 * 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =20 + +/* 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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; =20 if (data->highlight) - (void) wstandout (win_info->handle); + CURSES_CAST_TO_VOID wstandout (win_info->handle); =20=20=20=20=20=20=20 wmove (win_info->handle, 0, 0); for (i =3D 1; i < win_info->width; i++) @@ -551,7 +551,7 @@ tui_display_register (struct tui_data_el waddstr (win_info->handle, data->content); =20 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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) =20 string =3D 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);