From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13379 invoked by alias); 16 Apr 2011 16:25:18 -0000 Received: (qmail 13367 invoked by uid 22791); 16 Apr 2011 16:25:16 -0000 X-SWARE-Spam-Status: No, hits=-6.4 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; Sat, 16 Apr 2011 16:24:59 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3GGOxDC024186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 16 Apr 2011 12:24:59 -0400 Received: from host1.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3GGOvMI024130 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 16 Apr 2011 12:24:59 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p3GGOvKh011029; Sat, 16 Apr 2011 18:24:57 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p3GGOuPq010970; Sat, 16 Apr 2011 18:24:56 +0200 Date: Sat, 16 Apr 2011 16:25:00 -0000 From: Jan Kratochvil To: Pierre Muller Cc: "'Tom Tromey'" , gdb-patches@sourceware.org Subject: Re: [RFA] Handle cygwin wchar_t specifics Message-ID: <20110416162455.GA5599@host1.jankratochvil.net> References: <5928.31498147479$1302882967@news.gmane.org> <005101cbfc50$193136b0$4b93a410$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <005101cbfc50$193136b0$4b93a410$@muller@ics-cnrs.unistra.fr> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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/msg00244.txt.bz2 On Sat, 16 Apr 2011 18:05:19 +0200, Pierre Muller wrote: > 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. I do not follow the platform specifics of the problem but this specific technical task is attached. On GNU/Linux I get in config.h: /* The size of `wchar_t', as computed by sizeof. */ #define SIZEOF_WCHAR_T 4 info '(autoconf)AC_CHECK_SIZEOF' Fro cross-compilation the default is 4, for some unknown error it is 0. HTH, Jan --- a/gdb/config.in +++ b/gdb/config.in @@ -804,6 +804,9 @@ /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG +/* The size of `wchar_t', as computed by sizeof. */ +#undef SIZEOF_WCHAR_T + /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'size_t'. */ #undef SIZE_T_SUFFIX --- a/gdb/configure +++ b/gdb/configure @@ -11637,6 +11637,44 @@ _ACEOF fi +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 +$as_echo_n "checking size of wchar_t... " >&6; } +if test "${ac_cv_sizeof_wchar_t+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" " +#include +#include + +"; then : + +else + if test "$ac_cv_type_wchar_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "cannot compute sizeof (wchar_t) +See \`config.log' for more details." "$LINENO" 5; }; } + else + ac_cv_sizeof_wchar_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_wchar_t" >&5 +$as_echo "$ac_cv_sizeof_wchar_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t +_ACEOF + + # ------------------------------------- # # Checks for compiler characteristics. # --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -976,6 +976,10 @@ AC_CHECK_TYPES(socklen_t, [], [], [#include #include ]) +AC_CHECK_SIZEOF([wchar_t], 4, [ +#include +#include +]) # ------------------------------------- # # Checks for compiler characteristics. #