Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Fix typo in type of parameter "w" in print_wchar...
Date: Thu, 07 May 2009 18:38:00 -0000	[thread overview]
Message-ID: <20090507183753.GE659@adacore.com> (raw)
In-Reply-To: <200904250849.n3P8n5BU002469@brahms.sibelius.xs4all.nl>

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

> 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

[-- Attachment #2: wchar.diff --]
[-- Type: text/x-diff, Size: 544 bytes --]

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
     {

  reply	other threads:[~2009-05-07 18:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-25  0:37 Joel Brobecker
2009-04-25  8:50 ` Mark Kettenis
2009-05-07 18:38   ` Joel Brobecker [this message]
2009-05-07 18:53     ` Mark Kettenis
2009-05-07 20:48       ` Joel Brobecker
2009-05-12  8:06     ` Joel Brobecker
2009-05-13  9:43       ` Joel Brobecker

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=20090507183753.GE659@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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