Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 31 Mar 2016 10:49:22 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Defining __STDC_ISO_10646__, __STDC_IEC_559__ and so on
 with musl?

On Thu, Mar 31, 2016 at 04:35:48PM +0200, Szabolcs Nagy wrote:
> * Masanori Ogino <masanori.ogino@...il.com> [2016-03-31 20:34:22 +0900]:
> > The C standard specifies some predefined macros to determine
> > implementation-dependent characteristics, e.g. __STDC_ISO_10646__.
> > However, it seems that those macros are omitted with musl-based
> > toolchains. (I read cross-musl patches and tested with Gentoo's musl
> > toolchain.)
> > 
> > glibc handles them using a small header file named stdc-predef.h and a
> 
> yes, this is the right approach we just never got
> around adding it. i think it should contain
> 
> #if __GCC_IEC_559 > 0
> #define __STDC_IEC_559__ 1
> #endif
> 
> #if __GCC_IEC_559_COMPLEX > 0
> #define __STDC_IEC_559_COMPLEX__ 1
> #endif

This one is wrong; GCC lies that it supports Annex G, but lacks
pure imaginary types and _Imaginary_I, one of the main things you
would use this macro to assume the availability of.

> #define __STDC_ISO_10646__ 201505L

I don't think our Unicode coverage is up to that point yet; it needs
to be updated.

But the general idea is right, yes.

> > hook to GCC. (glibc has the header separately and GCC treats it
> > specially since the macros should be defined even if the source code
> > doesn't include any headers.)
> > 
> > Could we provide the macros with similar approaches or patches to GCC
> > to just define them?
> > 
> 
> i think we don't have to modify gcc,
> on *-linux* targets t-glibc is included
> which does the stdc-predef.h include magic.

Yes, this is the way I've always wanted to do it. We _could_ include
spec patches in musl-cross* for adding stdc-predef.h to pre-4.8 GCC
versions we support, though.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.