From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1944 invoked by alias); 28 Aug 2009 16:17:02 -0000 Received: (qmail 1936 invoked by uid 22791); 28 Aug 2009 16:17:01 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,HK_OBFDOM,J_CHICKENPOX_92,SPF_HELO_PASS,SPF_PASS 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, 28 Aug 2009 16:16:56 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7SGGscO032745 for ; Fri, 28 Aug 2009 12:16:54 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7SGGrw5027436; Fri, 28 Aug 2009 12:16:54 -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 n7SGGq3O004444; Fri, 28 Aug 2009 12:16:53 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 5FE6937814C; Fri, 28 Aug 2009 10:16:52 -0600 (MDT) From: Tom Tromey To: gdb-patches@sourceware.org Subject: Re: Iconv / Solaris References: <20090827020639.GA13935@caradoc.them.org> <20090827170851.GA25905@caradoc.them.org> <20090827203609.GA13388@caradoc.them.org> Reply-To: Tom Tromey Date: Fri, 28 Aug 2009 17:00:00 -0000 In-Reply-To: (Tom Tromey's message of "Thu, 27 Aug 2009 19:01:22 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (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: 2009-08/txt/msg00518.txt.bz2 >>>>> "Tom" == Tom Tromey writes: Tom> I can write a patch tomorrow. Please try the appended. You will have to re-run autoheader and autoconf. I took the opportunity to add more text to the comment in gdb_wchar.h, in the hopes that this would make it more clear. If this works for you, I will check it in. Tom 2009-08-28 Tom Tromey * gdb_wchar.h: Update comments. Use DISABLE_ICONV. * configure, config.in: Rebuild. * configure.ac (DISABLE_ICONV): Define when needed. * configure.host: Set gdb_host_wchar_iconv. Index: configure.ac =================================================================== RCS file: /cvs/src/src/gdb/configure.ac,v retrieving revision 1.105 diff -u -r1.105 configure.ac --- configure.ac 22 Aug 2009 17:08:09 -0000 1.105 +++ configure.ac 28 Aug 2009 16:15:22 -0000 @@ -788,6 +788,12 @@ ttrace wborder setlocale iconvlist libiconvlist btowc]) AM_LANGINFO_CODESET +# An additional check for whether iconv is ok for us to use. +if test "$gdb_host_wchar_iconv" = no; then + AC_DEFINE([DISABLE_ICONV], 1, + [Define if host iconv is unsuitable for use by gdb]) +fi + # Check the return and argument types of ptrace. No canned test for # this, so roll our own. gdb_ptrace_headers=' Index: configure.host =================================================================== RCS file: /cvs/src/src/gdb/configure.host,v retrieving revision 1.103 diff -u -r1.103 configure.host --- configure.host 11 Jan 2009 13:15:56 -0000 1.103 +++ configure.host 28 Aug 2009 16:15:22 -0000 @@ -8,6 +8,8 @@ # gdb_host_double_format host's double floatformat, or 0 # gdb_host_long_double_format host's long double floatformat, or 0 # gdb_host_obs host-specific .o files to include +# gdb_host_wchar_iconv "no" if iconv_open will not accept +# "wchar_t" as an argument. # Map host cpu into the config cpu subdirectory name. # The default is $host_cpu. @@ -207,3 +209,15 @@ gdb_host_long_double_format=0 ;; esac + + +# Per-host iconv setting. + +# Default to "yes". +gdb_host_wchar_iconv=yes + +case "${host}" in +*-*-solaris*) + gdb_host_wchar_iconv=no + ;; +esac Index: gdb_wchar.h =================================================================== RCS file: /cvs/src/src/gdb/gdb_wchar.h,v retrieving revision 1.2 diff -u -r1.2 gdb_wchar.h --- gdb_wchar.h 15 Apr 2009 22:20:31 -0000 1.2 +++ gdb_wchar.h 28 Aug 2009 16:15:22 -0000 @@ -21,18 +21,33 @@ /* We handle three different modes here. - Capable systems have the full suite: wchar_t support and iconv + 1. Capable systems have the full suite: wchar_t support and iconv (perhaps via GNU libiconv). On these machines, full functionality - is available. + is available. In this case, the intermediate character set is + "wchar_t". - DJGPP is known to have libiconv but not wchar_t support. On + 2. DJGPP is known to have libiconv but not wchar_t support. On systems like this, we use the narrow character functions. The full functionality is available to the user, but many characters (those - outside the narrow range) will be displayed as escapes. + outside the narrow range) will be displayed as escapes. In this + case, the intermediate character set uses the host encoding. - Finally, some systems do not have iconv. Here we provide a phony - iconv which only handles a single character set, and we provide - wrappers for the wchar_t functionality we use. */ + We also end up in this scenario if the host iconv is not fully + suitable. Solaris falls into this category both because iconv_open + does not accept "wchar_t" as an argument, but also because wchar_t + does not have a fixed encoding. + + 3. Finally, some systems do not have iconv. Here we provide a + phony iconv which only handles a single character set, and we + provide wrappers for the wchar_t functionality we use. This is + what the "PHONY_ICONV" define means, below. In this case, the + intermediate character set uses the host encoding, and limited + functionality is available to the user. + + It is possible that you may run into a system that does not support + "wchar_t" as an argument to iconv_open, but where + __STDC_ISO_10646__ is defined. If you have such a system, we can + add a fourth case where we fix the intermediate encoding. */ #define INTERMEDIATE_ENCODING "wchar_t" @@ -40,14 +55,17 @@ #if defined (HAVE_ICONV) #include #else -/* This define is used elsewhere so we don't need to duplicate the - same checking logic in multiple places. */ +/* Case 3. This define is used elsewhere so we don't need to + duplicate the same checking logic in multiple places. */ #define PHONY_ICONV #endif /* We use "btowc" as a sentinel to detect functioning wchar_t support. */ -#if defined (HAVE_ICONV) && defined (HAVE_WCHAR_H) && defined (HAVE_BTOWC) +#if defined (HAVE_ICONV) && defined (HAVE_WCHAR_H) && defined (HAVE_BTOWC) \ + && !defined (DISABLE_ICONV) + +/* Case 1. */ #include #include @@ -65,6 +83,8 @@ #else +/* Case 2 and case 3, depending on whether PHONY_ICONV is defined. */ + typedef char gdb_wchar_t; typedef int gdb_wint_t;