This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Fix typo in type of parameter "w" in print_wchar...
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 7 May 2009 11:37:53 -0700
- Subject: Re: [RFA] Fix typo in type of parameter "w" in print_wchar...
- References: <20090425003658.GA32745@adacore.com> <200904250849.n3P8n5BU002469@brahms.sibelius.xs4all.nl>
> 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 <brobecker@adacore.com>
* c-lang.c (print_wchar): Convert w into a gdb_wchar_t before
pushing it on the output obstack.
--
Joel
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
{