From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19552 invoked by alias); 16 Apr 2010 04:36:17 -0000 Received: (qmail 19539 invoked by uid 22791); 16 Apr 2010 04:36:15 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=BAYES_00,TW_LR X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Apr 2010 04:36:06 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 9CCFD2BAB0C; Fri, 16 Apr 2010 00:36:04 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id wXI9l86LZcxI; Fri, 16 Apr 2010 00:36:04 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 5A2622BAAFC; Fri, 16 Apr 2010 00:36:04 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 870D4F58C2; Thu, 15 Apr 2010 21:35:44 -0700 (PDT) Date: Fri, 16 Apr 2010 04:36:00 -0000 From: Joel Brobecker To: Pierre Muller Cc: 'Pedro Alves' , gdb-patches@sourceware.org Subject: Re: [RFC] Use macro for void typecast necessary for ncurses library. Message-ID: <20100416043544.GO19194@adacore.com> 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> <000901cadcec$365f5390$a31dfab0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="kXdP64Ggrk/fb43R" Content-Disposition: inline In-Reply-To: <000901cadcec$365f5390$a31dfab0$@muller@ics-cnrs.unistra.fr> User-Agent: Mutt/1.5.20 (2009-06-14) 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/msg00497.txt.bz2 --kXdP64Ggrk/fb43R Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 685 > > 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 --kXdP64Ggrk/fb43R Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="tui-cast-void.diff" Content-length: 2617 commit e0737f6d628f1aa573cc2d1fd827be90b5d48a09 Author: Joel Brobecker 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 + + * 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 * 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); --kXdP64Ggrk/fb43R--