From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28326 invoked by alias); 19 Apr 2011 17:50:52 -0000 Received: (qmail 28312 invoked by uid 22791); 19 Apr 2011 17:50:50 -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; Tue, 19 Apr 2011 17:50:35 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3JHoVFg011764 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 19 Apr 2011 13:50:31 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3JHoUUV017347; Tue, 19 Apr 2011 13:50:30 -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 p3JHoTXx015925; Tue, 19 Apr 2011 13:50:29 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 2399937930B; Tue, 19 Apr 2011 11:50:29 -0600 (MDT) From: Tom Tromey To: "Pierre Muller" Cc: Subject: Re: [RFC-v5] Handle cygwin wchar_t specifics References: <5928.31498147479$1302882967@news.gmane.org> <005101cbfc50$193136b0$4b93a410$%muller@ics-cnrs.unistra.fr> <20110416162455.GA5599@host1.jankratochvil.net> <000001cbfc7d$3f67f440$be37dcc0$%muller@ics-cnrs.unistra.fr> <83zknpoacd.fsf@gnu.org> <21014.6501930014$1303139687@news.gmane.org> <34716.7311156683$1303204711@news.gmane.org> <16656.7281041809$1303221408@news.gmane.org> Date: Tue, 19 Apr 2011 17:50:00 -0000 In-Reply-To: <16656.7281041809$1303221408@news.gmane.org> (Pierre Muller's message of "Tue, 19 Apr 2011 15:56:14 +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/msg00332.txt.bz2 >>>>> "Pierre" == Pierre Muller writes: Tom> I don't think DEFAULT_INTERMEDIATE_ENCODING is needed. Pierre> I assumed you ment: not necessary if PHONY_ICONV is defined, Pierre> and this is what I changed below. Pierre> (I would personally have favored to completely remove Pierre> INTERMEDIATE_ENCODING macro and call the function directly.) Sorry, that isn't what I meant. All this new code is needed only in the __STDC_ISO_10646__ case. All other cases are already handled ok. So, I think it is best to only introduce new code along the __STDC_ISO_10646__ branches. Thus far your patches have touched all the other branches -- but there is no reason to do that, and I think it just makes it more complicated without an associated benefit. Pierre> +#ifdef __STDC_ISO_10646__ Pierre> + if (sizeof (gdb_wchar_t) == 2) You might as well unify the 2 and 4 byte cases like I said earlier, and just die for any other value. You can use a static assert trick to make it die during compilation, which I think is better than dying at runtime. E.g.: extern char your_platform_is_bogus[(sizeof (gdb_wchar_t) == 2 || sizeof (gdb_wchar_t) == 4) ? 1 : -1]; Pierre> + /* Check that the name is in the list of handled charsets. */ Pierre> + for (i = 0; charset_enum[i]; i++) I don't think this is really needed either. Or, if you really want to do the check, do it by calling iconv_open at initialization, and then just make gdb die early -- whatever platform does this is really messed up. Pierre> + /* if gdb_wchar_t is not of size 2, or if "UTF-16XE" and "UCS-2XE" are Pierre> + not known, use DEFAULT_INTERMEDIATE_ENCODING macro. */ Pierre> + return DEFAULT_INTERMEDIATE_ENCODING; I don't think this will generally do the right thing. For example, your patch defines DEFAULT_INTERMEDIATE_ENCODING to "UCS-4LE" in the !WORDS_BIGENDIAN case. But we already know that gdb_wchar_t has 2 bytes. So I think this will just result in the same bug as today. Tom