From owner-freebsd-arch@FreeBSD.ORG Tue Jun 19 15:47:43 2012 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 485771065673 for ; Tue, 19 Jun 2012 15:47:43 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id D6B3F8FC25 for ; Tue, 19 Jun 2012 15:47:42 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5JFlYoV018706 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 20 Jun 2012 01:47:35 +1000 Date: Wed, 20 Jun 2012 01:47:34 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andrew Turner In-Reply-To: <20120619234520.76121ece@fubar.geek.nz> Message-ID: <20120620011811.X2306@besplex.bde.org> References: <20120617171125.18836c93@fubar.geek.nz> <20120619234520.76121ece@fubar.geek.nz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: arch@FreeBSD.org Subject: Re: wchar_t change for ARM EABI X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jun 2012 15:47:43 -0000 On Tue, 19 Jun 2012, Andrew Turner wrote: > On Sun, 17 Jun 2012 17:11:25 +1200 > Andrew Turner wrote: > >> I have a patch at [1] to move the wchar_t type definition from >> to I would like feedback on. The >> need for this change is the ARM EABI requires wchar_t to be either an >> unsigned int or an unsigned short, with the former preferred. > > I have an updated patch at [1]. This moves __WCHAR_MIN/__WCHAR_MAX from > to as they are limits rather > than types. Does anybody see any issues with this? If not I'll update it > for all architectures and commit later in the week. I hoped to keep the types and limits closer together, especially for the types that are declared in . has mainly limits for basic (non-typedefed) types. The exceptions were just for size_t, ssize_t, off_t, and *quad_t (ugh). > [1] http://people.freebsd.org/~andrew/wchar_unsigned_1.diff % Index: sys/sys/_types.h % =================================================================== % --- sys/sys/_types.h (revision 237150) % +++ sys/sys/_types.h (working copy) % @@ -81,13 +81,12 @@ % * % * NOTE: rune_t is not covered by ANSI nor other standards, and should not % * be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and % - * rune_t must be the same type. Also, wint_t must be no narrower than % - * wchar_t, and should be able to hold all members of the largest % - * character set plus one extra value (WEOF), and must be at least 16 bits. % + * rune_t must be the same type. Also, wint_t should be able to hold all % + * members of the largest character set plus one extra value (WEOF), and % + * must be at least 16 bits. % */ This still says that wchar_t MUST be the same as rune_t... % typedef int __ct_rune_t; /* arg type for ctype funcs */ % typedef __ct_rune_t __rune_t; /* rune_t (see above) */ % -typedef __ct_rune_t __wchar_t; /* wchar_t (see above) */ ... but rune_t is still int, while wchar_t can be different (it is unsigned on arm_eabi). % typedef __ct_rune_t __wint_t; /* wint_t (see above) */ The above removes a MUST on wint_t instead, but wint_t hasn't been changed. Was that intended? The MUST is still satisfied, but isn't stated quite right, since the sign bit is normally counted as part of the width but probably shouldn't be in this requirement. % % typedef __uint32_t __dev_t; /* device number */ % ... % Index: sys/arm/include/_limits.h % =================================================================== % --- sys/arm/include/_limits.h (revision 237150) % +++ sys/arm/include/_limits.h (working copy) % @@ -78,6 +78,14 @@ % #define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */ % #define __QUAD_MIN __LLONG_MIN /* min value for a quad_t */ % % +#ifdef __ARM_EABI__ % +#define __WCHAR_MIN (0) Bogus parentheses. % +#define __WCHAR_MAX __UINT_MAX % +#else % +#define __WCHAR_MIN __INT_MIN % +#define __WCHAR_MAX __INT_MAX % +#endif % + These definitions are missing banal comments, unlike all the other definitions except the ones for __LONG_BIT and __WORD_BIT. (The one for __MINSIGSTKSZ is not missing, but is in an inconsistent style.) % #define __LONG_BIT 32 % #define __WORD_BIT 32 % Bruce