mailing list of musl libc
 help / color / mirror / code / Atom feed
* Defining __STDC_ISO_10646__, __STDC_IEC_559__ and so on with musl?
@ 2016-03-31 11:34 Masanori Ogino
  2016-03-31 14:35 ` Szabolcs Nagy
  0 siblings, 1 reply; 6+ messages in thread
From: Masanori Ogino @ 2016-03-31 11:34 UTC (permalink / raw)
  To: musl

Hello,

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
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?

-- 
Masanori Ogino


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Defining __STDC_ISO_10646__, __STDC_IEC_559__ and so on with musl?
  2016-03-31 11:34 Defining __STDC_ISO_10646__, __STDC_IEC_559__ and so on with musl? Masanori Ogino
@ 2016-03-31 14:35 ` Szabolcs Nagy
  2016-03-31 14:48   ` Christian Neukirchen
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Szabolcs Nagy @ 2016-03-31 14:35 UTC (permalink / raw)
  To: musl

* Masanori Ogino <masanori.ogino@gmail.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

#define __STDC_ISO_10646__ 201505L

> 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.

> -- 
> Masanori Ogino


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Defining __STDC_ISO_10646__, __STDC_IEC_559__ and so on with musl?
  2016-03-31 14:35 ` Szabolcs Nagy
@ 2016-03-31 14:48   ` Christian Neukirchen
  2016-03-31 14:54     ` Masanori Ogino
  2016-03-31 14:49   ` Rich Felker
  2016-03-31 14:50   ` Masanori Ogino
  2 siblings, 1 reply; 6+ messages in thread
From: Christian Neukirchen @ 2016-03-31 14:48 UTC (permalink / raw)
  To: musl

Szabolcs Nagy <nsz@port70.net> writes:

> * Masanori Ogino <masanori.ogino@gmail.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
>
> #define __STDC_ISO_10646__ 201505L

What about clang? I don't see similar predefined macros there.

-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Defining __STDC_ISO_10646__, __STDC_IEC_559__ and so on with musl?
  2016-03-31 14:35 ` Szabolcs Nagy
  2016-03-31 14:48   ` Christian Neukirchen
@ 2016-03-31 14:49   ` Rich Felker
  2016-03-31 14:50   ` Masanori Ogino
  2 siblings, 0 replies; 6+ messages in thread
From: Rich Felker @ 2016-03-31 14:49 UTC (permalink / raw)
  To: musl

On Thu, Mar 31, 2016 at 04:35:48PM +0200, Szabolcs Nagy wrote:
> * Masanori Ogino <masanori.ogino@gmail.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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Defining __STDC_ISO_10646__, __STDC_IEC_559__ and so on with musl?
  2016-03-31 14:35 ` Szabolcs Nagy
  2016-03-31 14:48   ` Christian Neukirchen
  2016-03-31 14:49   ` Rich Felker
@ 2016-03-31 14:50   ` Masanori Ogino
  2 siblings, 0 replies; 6+ messages in thread
From: Masanori Ogino @ 2016-03-31 14:50 UTC (permalink / raw)
  To: musl

2016-03-31 23:35 GMT+09:00 Szabolcs Nagy <nsz@port70.net>:
> * Masanori Ogino <masanori.ogino@gmail.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

OK, I will try. I hit a problem with such macros, so I sent a mail. :)

> #if __GCC_IEC_559 > 0
> #define __STDC_IEC_559__ 1
> #endif
>
> #if __GCC_IEC_559_COMPLEX > 0
> #define __STDC_IEC_559_COMPLEX__ 1
> #endif
>
> #define __STDC_ISO_10646__ 201505L

ISO/IEC 10646:2014/Amd 1:2015, right?

>> 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.

OK.

-- 
Masanori Ogino


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Defining __STDC_ISO_10646__, __STDC_IEC_559__ and so on with musl?
  2016-03-31 14:48   ` Christian Neukirchen
@ 2016-03-31 14:54     ` Masanori Ogino
  0 siblings, 0 replies; 6+ messages in thread
From: Masanori Ogino @ 2016-03-31 14:54 UTC (permalink / raw)
  To: musl

2016-03-31 23:48 GMT+09:00 Christian Neukirchen <chneukirchen@gmail.com>:
> What about clang? I don't see similar predefined macros there.

Yes, Clang does not use stdc-predef.h unless it is included somewhere,
so there is another issue... (I also hit this problem before but
haven't written a patch yet.)

-- 
Masanori Ogino


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-31 14:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-31 11:34 Defining __STDC_ISO_10646__, __STDC_IEC_559__ and so on with musl? Masanori Ogino
2016-03-31 14:35 ` Szabolcs Nagy
2016-03-31 14:48   ` Christian Neukirchen
2016-03-31 14:54     ` Masanori Ogino
2016-03-31 14:49   ` Rich Felker
2016-03-31 14:50   ` Masanori Ogino

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).