public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Don't use wchar_printable in print_wchar
@ 2022-10-10 17:38 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2022-10-10 17:38 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=05328f9105ed738cc4fe96429abd33466e891699

commit 05328f9105ed738cc4fe96429abd33466e891699
Author: Tom Tromey <tom@tromey.com>
Date:   Fri Feb 11 18:24:23 2022 -0700

    Don't use wchar_printable in print_wchar
    
    print_wchar uses wchar_printable, but this isn't needed -- all the
    relevant cases are already handled by the 'switch'.  This changes the
    code to use gdb_iswprint, and removes a somewhat confusing comment
    related to this code.

Diff:
---
 gdb/valprint.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/gdb/valprint.c b/gdb/valprint.c
index 92d72521501..5a2f4dfc62a 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -2081,9 +2081,8 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig,
 
   *need_escapep = false;
 
-  /* iswprint implementation on Windows returns 1 for tab character.
-     In order to avoid different printout on this host, we explicitly
-     use wchar_printable function.  */
+  /* If any additional cases are added to this switch block, then the
+     function wchar_printable will likely need updating too.  */
   switch (w)
     {
       case LCST ('\a'):
@@ -2109,9 +2108,9 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig,
 	break;
       default:
 	{
-	  if (wchar_printable (w) && (!need_escape || (!gdb_iswdigit (w)
-						       && w != LCST ('8')
-						       && w != LCST ('9'))))
+	  if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w)
+						    && w != LCST ('8')
+						    && w != LCST ('9'))))
 	    {
 	      gdb_wchar_t wchar = w;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-10 17:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 17:38 [binutils-gdb] Don't use wchar_printable in print_wchar Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).