From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 5D9CB3858281; Mon, 10 Oct 2022 17:38:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D9CB3858281 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665423529; bh=GR129fgLtAPcvBWZAB23bOzqex7lxQjIfrxuJ0yc2+o=; h=From:To:Subject:Date:From; b=HR8Ib0nTGg0yaGBSIRiflo8TxpsrZsqCqZSc04vKe4XS554MOJhsmr0Af2UxLDkR5 pQ1Dok0dO1ZauvjsthdQdQkTo2VT1EJjE+7ybeFsh6MJ8zwLsYJcEDgD4q439uatSr jUrtWHTnP1Icz2tM/Gl05GDqPpgy9EPaewLvHqW0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Don't use wchar_printable in print_wchar X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 3a3bb6eb36a29e3201bfc4cc53e341f4f98e6cf1 X-Git-Newrev: 05328f9105ed738cc4fe96429abd33466e891699 Message-Id: <20221010173849.5D9CB3858281@sourceware.org> Date: Mon, 10 Oct 2022 17:38:49 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D05328f9105ed= 738cc4fe96429abd33466e891699 commit 05328f9105ed738cc4fe96429abd33466e891699 Author: Tom Tromey Date: Fri Feb 11 18:24:23 2022 -0700 Don't use wchar_printable in print_wchar =20 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, =20 *need_escapep =3D false; =20 - /* 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 !=3D LCST ('8') - && w !=3D LCST ('9')))) + if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w) + && w !=3D LCST ('8') + && w !=3D LCST ('9')))) { gdb_wchar_t wchar =3D w;