From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28437 invoked by alias); 18 Apr 2011 17:18:15 -0000 Received: (qmail 28425 invoked by uid 22791); 18 Apr 2011 17:18:13 -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; Mon, 18 Apr 2011 17:17:51 +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 p3IHHj0k001791 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 18 Apr 2011 13:17:45 -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 p3IHHjNm030740; Mon, 18 Apr 2011 13:17:45 -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 p3IHHi1i014540; Mon, 18 Apr 2011 13:17:44 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 3BDB137930B; Mon, 18 Apr 2011 11:17:44 -0600 (MDT) From: Tom Tromey To: "Pierre Muller" Cc: "'Eli Zaretskii'" , , Subject: Re: [RFA-v3] 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> Date: Mon, 18 Apr 2011 17:18:00 -0000 In-Reply-To: <21014.6501930014$1303139687@news.gmane.org> (Pierre Muller's message of "Mon, 18 Apr 2011 17:14: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/msg00283.txt.bz2 >>>>> "Pierre" == Pierre Muller writes: Pierre> This patch also changes the intermediate_encoding for mingw hosts, Pierre> from "wchar_t" to "UTF-16LE", but this seems to work nicely Pierre> for both mingw32 and mingw64 (and only if iconv is found, Pierre> otherwise gdb_wchar_t is simply char and phony functions are used). Pierre> -#define INTERMEDIATE_ENCODING host_charset () Pierre> +#define DEFAULT_INTERMEDIATE_ENCODING host_charset () This changes the behavior if the gdb user changes the host encoding. This is an unusual situation, admittedly, but it seems to me that it is just as easy to only introduce the `intermediate_encoding' global in the UTF-{16,32} case. Pierre> + intermediate_encoding = DEFAULT_INTERMEDIATE_ENCODING; Pierre> +# if defined (USE_WIN32API) || defined (__CYGWIN__) Pierre> + if (sizeof (gdb_wchar_t) == 2) Pierre> + intermediate_encoding = "UTF-16LE"; Pierre> +# endif Here, instead of a special case for __CYGWIN__, and instead of hard-coding the endian-ness, just use the same code for all __STDC_ISO_10646__ platforms. Maybe something like: intermediate_encoding = xstrprintf ("UTF-%d%s", 8 * sizeof (wchar_t), WORDS_BIGENDIAN ? "BE" : "LE"); Tom