From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7077 Path: news.gmane.org!not-for-mail From: Sergey Dmitrouk Newsgroups: gmane.linux.lib.musl.general Subject: Re: wchar_t and -fshort-wchar Date: Wed, 18 Feb 2015 16:04:29 +0200 Message-ID: <20150218140429.GA13934@zx-spectrum.accesssoftek.com> References: <20150218105337.GA8567@zx-spectrum> <20150218115412.GP32724@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: ger.gmane.org 1424268279 9620 80.91.229.3 (18 Feb 2015 14:04:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Feb 2015 14:04:39 +0000 (UTC) To: Original-X-From: musl-return-7090-gllmg-musl=m.gmane.org@lists.openwall.com Wed Feb 18 15:04:39 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YO5F0-0007Rn-L0 for gllmg-musl@m.gmane.org; Wed, 18 Feb 2015 15:04:38 +0100 Original-Received: (qmail 7646 invoked by uid 550); 18 Feb 2015 14:04:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 7574 invoked from network); 18 Feb 2015 14:04:32 -0000 Content-Disposition: inline In-Reply-To: <20150218115412.GP32724@port70.net> Xref: news.gmane.org gmane.linux.lib.musl.general:7077 Archived-At: OK, I see, thanks for the explanation. I agree there are problems with short wchar_t, but in my specific case they are mostly irrelevant (no need for dynamic loader or conversions that involve code points with values above 0xffff). I mainly wanted to inform you about this build issue, in case you would like to do something about it. On Wed, Feb 18, 2015 at 03:54:13AM -0800, Szabolcs Nagy wrote: > * Sergey Dmitrouk [2015-02-18 12:53:37 +0200]: > > musl seems to build fine with -fshort-wchar, but when client applications > > that cannot possibly work > > wchar_t is assumed to be a unicode code point so short wchar_t is broken > > > are built against musl all uses of wide character literals fail due to wide > > type defined internally by a compiler differs from the type of `wchar_t` in > > musl headers. > > > > I faced this on ARM where `wchar_t` is defined as `unsigned int` by > > musl but it's `unsigned short` from compilers point of view. I'd expect > > similar issues with other targets. > > > > http://arminfo.emea.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf > > says > > "The preferred type of wchar_t is unsigned int. However, > a virtual platform may elect to use unsigned short instead. > A platform standard must document its choice" > > on musl/glibc/.. the platform standard is unsigned int > > > Would it make sense to use `__WCHAR_TYPE__` for `wchar_t` when it's > > available (it's already used for i386, but for different reason)? > > Presumably, as compiler is responsible for creating wide literals, libc > > would better agree with it on the type. > > > > Of course, this makes sense only if you intend to support builds with > > `-fshort-wchar` flag, which are not very common I believe. > > > > this is an abi change so a different loader path name etc should be > used then (you should create a new subarch in musl's terminology) > > but i'm not sure how you plan to fix up mb to wc functions for > such a subarch.. > > > Best regards, > > Sergey