From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4935 invoked by alias); 15 Apr 2011 18:16:12 -0000 Received: (qmail 4922 invoked by uid 22791); 15 Apr 2011 18:16:11 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Apr 2011 18:15:31 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3FIFR7S010766 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Apr 2011 14:15:27 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3FIFQwP005976; Fri, 15 Apr 2011 14:15:26 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p3FIFPNt005183; Fri, 15 Apr 2011 14:15:25 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 0FA62379304; Fri, 15 Apr 2011 12:15:24 -0600 (MDT) From: Tom Tromey To: "Pierre Muller" Cc: Subject: Re: [RFA] Handle cygwin wchar_t specifics References: <5928.31498147479$1302882967@news.gmane.org> Date: Fri, 15 Apr 2011 18:16:00 -0000 In-Reply-To: <5928.31498147479$1302882967@news.gmane.org> (Pierre Muller's message of "Fri, 15 Apr 2011 17:55:12 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00226.txt.bz2 >>>>> "Pierre" == Pierre Muller writes: 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). Ok, I see the problem. I thought this: /* If __STDC_ISO_10646__ is defined, then the host wchar_t is UCS-4. 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: http://www.unicode.org/versions/components-4.0.0.html 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.) Anyway, it doesn't matter if this is a Cygwin bug, since GDB's assumption here is wrong anyway. Pierre> The patch below fixes this by Pierre> explicitly setting the UCS size to two for Windows targets. 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. Pierre> +#define wchar_size (&(((wchar_t) (0)) + 1) - &((char *) 0)) This doesn't seem to be used. Tom