mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Sergey Dmitrouk <sdmitrouk@accesssoftek.com>
To: <musl@lists.openwall.com>
Subject: Re: wchar_t and -fshort-wchar
Date: Wed, 18 Feb 2015 16:04:29 +0200	[thread overview]
Message-ID: <20150218140429.GA13934@zx-spectrum.accesssoftek.com> (raw)
In-Reply-To: <20150218115412.GP32724@port70.net>

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 <sdmitrouk@accesssoftek.com> [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


  reply	other threads:[~2015-02-18 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-18 10:53 Sergey Dmitrouk
2015-02-18 11:54 ` Szabolcs Nagy
2015-02-18 14:04   ` Sergey Dmitrouk [this message]
2015-02-20  4:26 ` Rich Felker
2015-02-20  6:53   ` Sergey Dmitrouk
2015-02-20  7:27     ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150218140429.GA13934@zx-spectrum.accesssoftek.com \
    --to=sdmitrouk@accesssoftek.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).