From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17598 invoked by alias); 7 May 2009 18:38:05 -0000 Received: (qmail 17586 invoked by uid 22791); 7 May 2009 18:38:04 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 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; Thu, 07 May 2009 18:37:58 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C91452BAB92; Thu, 7 May 2009 14:37:56 -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 wWnrzubX8rT4; Thu, 7 May 2009 14:37:56 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 92C262BAB91; Thu, 7 May 2009 14:37:56 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id D167BF5900; Thu, 7 May 2009 11:37:53 -0700 (PDT) Date: Thu, 07 May 2009 18:38:00 -0000 From: Joel Brobecker To: Mark Kettenis Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Fix typo in type of parameter "w" in print_wchar... Message-ID: <20090507183753.GE659@adacore.com> References: <20090425003658.GA32745@adacore.com> <200904250849.n3P8n5BU002469@brahms.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="4zI0WCX1RcnW9Hbu" Content-Disposition: inline In-Reply-To: <200904250849.n3P8n5BU002469@brahms.sibelius.xs4all.nl> User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2009-05/txt/msg00159.txt.bz2 --4zI0WCX1RcnW9Hbu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 553 > I think this is wrong. The type of a single wide character is wint_t > instead of wchar_t such that it can properly hold WEOF, much in the > same way as the "normal" character functions use int instead of char. Thanks for the hint, Mark. Does the following look correct to you? I've just tested that it also fixes the issue on AIX, and I got no regression on amd64-linux. 2009-05-07 Joel Brobecker * c-lang.c (print_wchar): Convert w into a gdb_wchar_t before pushing it on the output obstack. -- Joel --4zI0WCX1RcnW9Hbu Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="wchar.diff" Content-length: 544 diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 027e9b2..f95c98f 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -166,9 +166,11 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len, && w != LCST ('8') && w != LCST ('9')))) { + gdb_wchar_t wchar = (gdb_wchar_t) w; + if (w == gdb_btowc (quoter) || w == LCST ('\\')) obstack_grow_wstr (output, LCST ("\\")); - obstack_grow (output, &w, sizeof (gdb_wchar_t)); + obstack_grow (output, &wchar, sizeof (gdb_wchar_t)); } else { --4zI0WCX1RcnW9Hbu--