From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5294 invoked by alias); 16 Apr 2011 16:05:51 -0000 Received: (qmail 5285 invoked by uid 22791); 16 Apr 2011 16:05:49 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_05,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.152) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 16 Apr 2011 16:05:35 +0000 Received: from md2.u-strasbg.fr (md2.u-strasbg.fr [IPv6:2001:660:2402::187]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p3GG5QO9036288 ; Sat, 16 Apr 2011 18:05:26 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [130.79.204.10]) by md2.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p3GG5P2e045888 ; Sat, 16 Apr 2011 18:05:26 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p3GG5Owt076197 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Sat, 16 Apr 2011 18:05:25 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Tom Tromey'" Cc: References: <5928.31498147479$1302882967@news.gmane.org> In-Reply-To: Subject: RE: [RFA] Handle cygwin wchar_t specifics Date: Sat, 16 Apr 2011 16:05:00 -0000 Message-ID: <005101cbfc50$193136b0$4b93a410$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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: 2011-04/txt/msg00241.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Tom Tromey > Envoy=E9=A0: vendredi 15 avril 2011 20:15 > =C0=A0: Pierre Muller > Cc=A0: gdb-patches@sourceware.org > Objet=A0: Re: [RFA] Handle cygwin wchar_t specifics >=20 > >>>>> "Pierre" =3D=3D Pierre Muller writes: >=20 > Pierre> because of this, GDB uses "UCS-4LE" > Pierre> for the macro INTERMEDIATE_ENCODING on Cygwin > Pierre> (while "wchar_t" it uses for mingw32, which works well). >=20 > Ok, I see the problem. I thought this: >=20 > /* If __STDC_ISO_10646__ is defined, then the host wchar_t is UCS-4. >=20 > But this is not true! For some values of __STDC_ISO_10646__, a 2 byte > wide character type suffices. In particular, Cygwin's value of 200305 > means that it corresponds to Unicode 4.0.0: >=20 > http://www.unicode.org/versions/components-4.0.0.html >=20 > I think this might be a Cygwin bug, but it is pretty hard to wade > through the ISO / Unicode differences and other assorted standardese to > see. (The reason I think it might be a bug is that Unicode 4.0.0 > defines some characters > 0xFFFF.) >=20 > Anyway, it doesn't matter if this is a Cygwin bug, since GDB's > assumption here is wrong anyway. OK.=20 > Pierre> The patch below fixes this by > Pierre> explicitly setting the UCS size to two for Windows targets. >=20 > I think in the __STDC_ISO_10646__ case, we should just explicitly use > sizeof (wchar_t) somewhere to choose the intermediate encoding. I think > this will be more robust than testing some host define. Yes, but the problem is that it is not possible to use sizeof inside a #if conditions :( =20 > Pierre> +#define wchar_size (&(((wchar_t) (0)) + 1) - &((char *) 0)) >=20 > This doesn't seem to be used. I googled around to see if there is a workaround to this limitation of not being able to use sizeof inside conditionals and then forgot to remove it... Do you know of any way to get the size of wchar_t? I suspect we will need to add this to the configure scripts... But I am still very bad on that part. Help most welcome, Pierre