mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH v2] Add stdc-predef.h.
@ 2016-04-05  2:23 Masanori Ogino
  2016-06-01  8:21 ` Masanori Ogino
  0 siblings, 1 reply; 8+ messages in thread
From: Masanori Ogino @ 2016-04-05  2:23 UTC (permalink / raw)
  To: musl; +Cc: Masanori Ogino

Note that GCC does not support the "Annex G" complex arithmetic even
though __GCC_IEC_559_COMPLEX is defined. Thus, we leave
__STDC_IEC_559_COMPLEX__ undefined for now.

Reference: http://www.openwall.com/lists/musl/2016/03/31/2

Signed-off-by: Masanori Ogino <masanori.ogino@gmail.com>
---
 include/stdc-predef.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 include/stdc-predef.h

diff --git a/include/stdc-predef.h b/include/stdc-predef.h
new file mode 100644
index 0000000..baa8a54
--- /dev/null
+++ b/include/stdc-predef.h
@@ -0,0 +1,11 @@
+#ifndef _STDC_PREDEF_H
+#define _STDC_PREDEF_H
+
+/* ISO/IEC 10646:2012, equivalent to Unicode 6.1 */
+#define __STDC_ISO_10646__ 201206L
+
+#if __GCC_IEC_559 > 0
+#define __STDC_IEC_559__ 1
+#endif
+
+#endif
-- 
2.7.3



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

* Re: [PATCH v2] Add stdc-predef.h.
  2016-04-05  2:23 [PATCH v2] Add stdc-predef.h Masanori Ogino
@ 2016-06-01  8:21 ` Masanori Ogino
  2016-06-03 19:04   ` Rich Felker
  0 siblings, 1 reply; 8+ messages in thread
From: Masanori Ogino @ 2016-06-01  8:21 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

2016年4月5日(火) 11:23 Masanori Ogino <masanori.ogino@gmail.com>:

> Note that GCC does not support the "Annex G" complex arithmetic even
> though __GCC_IEC_559_COMPLEX is defined. Thus, we leave
> __STDC_IEC_559_COMPLEX__ undefined for now.
>
> Reference: http://www.openwall.com/lists/musl/2016/03/31/2
>
> Signed-off-by: Masanori Ogino <masanori.ogino@gmail.com>
> ---
>  include/stdc-predef.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>  create mode 100644 include/stdc-predef.h
>
> diff --git a/include/stdc-predef.h b/include/stdc-predef.h
> new file mode 100644
> index 0000000..baa8a54
> --- /dev/null
> +++ b/include/stdc-predef.h
> @@ -0,0 +1,11 @@
> +#ifndef _STDC_PREDEF_H
> +#define _STDC_PREDEF_H
> +
> +/* ISO/IEC 10646:2012, equivalent to Unicode 6.1 */
> +#define __STDC_ISO_10646__ 201206L
> +
> +#if __GCC_IEC_559 > 0
> +#define __STDC_IEC_559__ 1
> +#endif
> +
> +#endif
> --
> 2.7.3
>
>
ping?
-- 
Masanori Ogino

[-- Attachment #2: Type: text/html, Size: 1578 bytes --]

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

* Re: Re: [PATCH v2] Add stdc-predef.h.
  2016-06-01  8:21 ` Masanori Ogino
@ 2016-06-03 19:04   ` Rich Felker
  2016-06-04  4:19     ` Masanori Ogino
  0 siblings, 1 reply; 8+ messages in thread
From: Rich Felker @ 2016-06-03 19:04 UTC (permalink / raw)
  To: musl

On Wed, Jun 01, 2016 at 08:21:17AM +0000, Masanori Ogino wrote:
> 2016年4月5日(火) 11:23 Masanori Ogino <masanori..ogino@gmail.com>:
> 
> > Note that GCC does not support the "Annex G" complex arithmetic even
> > though __GCC_IEC_559_COMPLEX is defined. Thus, we leave
> > __STDC_IEC_559_COMPLEX__ undefined for now.
> >
> > Reference: http://www.openwall.com/lists/musl/2016/03/31/2
> >
> > Signed-off-by: Masanori Ogino <masanori.ogino@gmail.com>
> > ---
> >  include/stdc-predef.h | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >  create mode 100644 include/stdc-predef.h
> >
> > diff --git a/include/stdc-predef.h b/include/stdc-predef.h
> > new file mode 100644
> > index 0000000..baa8a54
> > --- /dev/null
> > +++ b/include/stdc-predef.h
> > @@ -0,0 +1,11 @@
> > +#ifndef _STDC_PREDEF_H
> > +#define _STDC_PREDEF_H
> > +
> > +/* ISO/IEC 10646:2012, equivalent to Unicode 6.1 */
> > +#define __STDC_ISO_10646__ 201206L
> > +
> > +#if __GCC_IEC_559 > 0
> > +#define __STDC_IEC_559__ 1
> > +#endif
> > +
> > +#endif
> > --
> > 2.7.3
> >
> >
> ping?

I've actually had my own version of this pending for a long time now,
so let's discuss it. My version was:

#ifndef _STDC_PREDEF_H
#define _STDC_PREDEF_H

#define __STDC_ISO_10646__ 201103L
#define __STDC_UTF_16__ 1
#define __STDC_UTF_32__ 1
#define __STDC_IEC_559__ 1
#define __STDC_NO_ATOMICS__ 1

#endif

Obviously my Unicode date is older -- I haven't checked which is more
correct, but after the next release we should update to latest Unicode
anyway. Other than that, I also made explicit the UTF-16/32 macros
that maybe should have been left to the compiler, and defined
__STDC_NO_ATOMICS__ which is probably a bad idea since we might or
might not support stdatomic.h depending on whether a compiler-provided
or valid third-party version is available and working.

The biggest question I think is what to do with __STDC_IEC_559__. My
intent has always been to "support Annex F" and I think we do that for
archs with hard float, but the lack of exceptions and rounding modes
might be a conformance gap for soft-float archs. Your use of
__GCC_IEC_559 gets around that, but fails to produce the desired value
for (maybe hypothetical?) non-GCC compilers that don't define the gcc
macro. It might be better to do something like:

#if !defined(__GCC_IEC_559) || __GCC_IEC_559 > 0
#define __STDC_IEC_559__ 1
#endif

What do you think? Anyone else have thoughts on the matter?

Rich


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

* Re: Re: [PATCH v2] Add stdc-predef.h.
  2016-06-03 19:04   ` Rich Felker
@ 2016-06-04  4:19     ` Masanori Ogino
  2016-06-04  5:04       ` Rich Felker
  0 siblings, 1 reply; 8+ messages in thread
From: Masanori Ogino @ 2016-06-04  4:19 UTC (permalink / raw)
  To: musl

Hello,

2016-06-04 4:04 GMT+09:00 Rich Felker <dalias@libc.org>:
> On Wed, Jun 01, 2016 at 08:21:17AM +0000, Masanori Ogino wrote:
>> 2016年4月5日(火) 11:23 Masanori Ogino <masanori..ogino@gmail.com>:
>>
>> > Note that GCC does not support the "Annex G" complex arithmetic even
>> > though __GCC_IEC_559_COMPLEX is defined. Thus, we leave
>> > __STDC_IEC_559_COMPLEX__ undefined for now.
>> >
>> > Reference: http://www.openwall.com/lists/musl/2016/03/31/2
>> >
>> > Signed-off-by: Masanori Ogino <masanori.ogino@gmail.com>
>> > ---
>> >  include/stdc-predef.h | 11 +++++++++++
>> >  1 file changed, 11 insertions(+)
>> >  create mode 100644 include/stdc-predef.h
>> >
>> > diff --git a/include/stdc-predef.h b/include/stdc-predef.h
>> > new file mode 100644
>> > index 0000000..baa8a54
>> > --- /dev/null
>> > +++ b/include/stdc-predef.h
>> > @@ -0,0 +1,11 @@
>> > +#ifndef _STDC_PREDEF_H
>> > +#define _STDC_PREDEF_H
>> > +
>> > +/* ISO/IEC 10646:2012, equivalent to Unicode 6.1 */
>> > +#define __STDC_ISO_10646__ 201206L
>> > +
>> > +#if __GCC_IEC_559 > 0
>> > +#define __STDC_IEC_559__ 1
>> > +#endif
>> > +
>> > +#endif
>> > --
>> > 2.7.3
>> >
>> >
>> ping?
>
> I've actually had my own version of this pending for a long time now,
> so let's discuss it. My version was:
>
> #ifndef _STDC_PREDEF_H
> #define _STDC_PREDEF_H
>
> #define __STDC_ISO_10646__ 201103L
> #define __STDC_UTF_16__ 1
> #define __STDC_UTF_32__ 1
> #define __STDC_IEC_559__ 1
> #define __STDC_NO_ATOMICS__ 1
>
> #endif
>
> Obviously my Unicode date is older -- I haven't checked which is more
> correct, but after the next release we should update to latest Unicode
> anyway.

Sure.

By the way, is there any automation script to update them using the
Unicode database? I couldn't find that.

> Other than that, I also made explicit the UTF-16/32 macros
> that maybe should have been left to the compiler, and defined
> __STDC_NO_ATOMICS__ which is probably a bad idea since we might or
> might not support stdatomic.h depending on whether a compiler-provided
> or valid third-party version is available and working.

Agreed.

> The biggest question I think is what to do with __STDC_IEC_559__. My
> intent has always been to "support Annex F" and I think we do that for
> archs with hard float, but the lack of exceptions and rounding modes
> might be a conformance gap for soft-float archs. Your use of
> __GCC_IEC_559 gets around that, but fails to produce the desired value
> for (maybe hypothetical?) non-GCC compilers that don't define the gcc
> macro. It might be better to do something like:
>
> #if !defined(__GCC_IEC_559) || __GCC_IEC_559 > 0
> #define __STDC_IEC_559__ 1
> #endif
>
> What do you think? Anyone else have thoughts on the matter?
>

Well, is there any compiler that does not define __GCC_IEC_559 but
uses stdc-predef.h?

> Rich



-- 
Masanori Ogino


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

* Re: Re: [PATCH v2] Add stdc-predef.h.
  2016-06-04  4:19     ` Masanori Ogino
@ 2016-06-04  5:04       ` Rich Felker
  2016-06-08 14:57         ` Masanori Ogino
  0 siblings, 1 reply; 8+ messages in thread
From: Rich Felker @ 2016-06-04  5:04 UTC (permalink / raw)
  To: musl

On Sat, Jun 04, 2016 at 01:19:47PM +0900, Masanori Ogino wrote:
> > #define __STDC_ISO_10646__ 201103L
> > #define __STDC_UTF_16__ 1
> > #define __STDC_UTF_32__ 1
> > #define __STDC_IEC_559__ 1
> > #define __STDC_NO_ATOMICS__ 1
> >
> > #endif
> >
> > Obviously my Unicode date is older -- I haven't checked which is more
> > correct, but after the next release we should update to latest Unicode
> > anyway.
> 
> Sure.
> 
> By the way, is there any automation script to update them using the
> Unicode database? I couldn't find that.

There's an unpolished set of tools that do the job, which I posted the
the mailing list several years back. I should publish them in a more
permanent and accessible place though.

Also the tools are not entirely sufficient to perform an upgrade.
Adding new case mappings requires some manual work, checking for case
mappings in Unicode that musl doesn't produce and adding the right
table tricks to get them.

> > #if !defined(__GCC_IEC_559) || __GCC_IEC_559 > 0
> > #define __STDC_IEC_559__ 1
> > #endif
> >
> > What do you think? Anyone else have thoughts on the matter?
> >
> 
> Well, is there any compiler that does not define __GCC_IEC_559 but
> uses stdc-predef.h?

Even old (pre-4.8) gcc doesn't use stdc-predef.h, but you can add
"-include stdc-predef.h" to its specs file. Presumably you can do
similar tricks with other compilers (via a wrapper script if nothing
else).

Rich


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

* Re: Re: [PATCH v2] Add stdc-predef.h.
  2016-06-04  5:04       ` Rich Felker
@ 2016-06-08 14:57         ` Masanori Ogino
  2016-07-04  0:16           ` Rich Felker
  0 siblings, 1 reply; 8+ messages in thread
From: Masanori Ogino @ 2016-06-08 14:57 UTC (permalink / raw)
  To: musl

2016-06-04 14:04 GMT+09:00 Rich Felker <dalias@libc.org>:
> On Sat, Jun 04, 2016 at 01:19:47PM +0900, Masanori Ogino wrote:
>> > #define __STDC_ISO_10646__ 201103L
>> > #define __STDC_UTF_16__ 1
>> > #define __STDC_UTF_32__ 1
>> > #define __STDC_IEC_559__ 1
>> > #define __STDC_NO_ATOMICS__ 1
>> >
>> > #endif
>> >
>> > Obviously my Unicode date is older -- I haven't checked which is more
>> > correct, but after the next release we should update to latest Unicode
>> > anyway.
>>
>> Sure.
>>
>> By the way, is there any automation script to update them using the
>> Unicode database? I couldn't find that.
>
> There's an unpolished set of tools that do the job, which I posted the
> the mailing list several years back. I should publish them in a more
> permanent and accessible place though.
>
> Also the tools are not entirely sufficient to perform an upgrade.
> Adding new case mappings requires some manual work, checking for case
> mappings in Unicode that musl doesn't produce and adding the right
> table tricks to get them.

OK.

>> > #if !defined(__GCC_IEC_559) || __GCC_IEC_559 > 0
>> > #define __STDC_IEC_559__ 1
>> > #endif
>> >
>> > What do you think? Anyone else have thoughts on the matter?
>> >
>>
>> Well, is there any compiler that does not define __GCC_IEC_559 but
>> uses stdc-predef.h?
>
> Even old (pre-4.8) gcc doesn't use stdc-predef.h, but you can add
> "-include stdc-predef.h" to its specs file. Presumably you can do
> similar tricks with other compilers (via a wrapper script if nothing
> else).

I see. I don't have any strong opinion against !defined(__GCC_IEC_559)
clause and I'm happy with it. I guess that such users are wise enough
to define the proper __GCC_IEC_559 value after reviewing the header,
though.

I'm sorry for the delay.

-- 
Masanori Ogino


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

* Re: Re: [PATCH v2] Add stdc-predef.h.
  2016-06-08 14:57         ` Masanori Ogino
@ 2016-07-04  0:16           ` Rich Felker
  2016-07-06  7:39             ` Masanori Ogino
  0 siblings, 1 reply; 8+ messages in thread
From: Rich Felker @ 2016-07-04  0:16 UTC (permalink / raw)
  To: musl

On Wed, Jun 08, 2016 at 11:57:02PM +0900, Masanori Ogino wrote:
> 2016-06-04 14:04 GMT+09:00 Rich Felker <dalias@libc.org>:
> > On Sat, Jun 04, 2016 at 01:19:47PM +0900, Masanori Ogino wrote:
> >> > #define __STDC_ISO_10646__ 201103L
> >> > #define __STDC_UTF_16__ 1
> >> > #define __STDC_UTF_32__ 1
> >> > #define __STDC_IEC_559__ 1
> >> > #define __STDC_NO_ATOMICS__ 1
> >> >
> >> > #endif
> >> >
> >> > Obviously my Unicode date is older -- I haven't checked which is more
> >> > correct, but after the next release we should update to latest Unicode
> >> > anyway.
> >>
> >> Sure.
> >>
> >> By the way, is there any automation script to update them using the
> >> Unicode database? I couldn't find that.
> >
> > There's an unpolished set of tools that do the job, which I posted the
> > the mailing list several years back. I should publish them in a more
> > permanent and accessible place though.
> >
> > Also the tools are not entirely sufficient to perform an upgrade.
> > Adding new case mappings requires some manual work, checking for case
> > mappings in Unicode that musl doesn't produce and adding the right
> > table tricks to get them.
> 
> OK.
> 
> >> > #if !defined(__GCC_IEC_559) || __GCC_IEC_559 > 0
> >> > #define __STDC_IEC_559__ 1
> >> > #endif
> >> >
> >> > What do you think? Anyone else have thoughts on the matter?
> >> >
> >>
> >> Well, is there any compiler that does not define __GCC_IEC_559 but
> >> uses stdc-predef.h?
> >
> > Even old (pre-4.8) gcc doesn't use stdc-predef.h, but you can add
> > "-include stdc-predef.h" to its specs file. Presumably you can do
> > similar tricks with other compilers (via a wrapper script if nothing
> > else).
> 
> I see. I don't have any strong opinion against !defined(__GCC_IEC_559)
> clause and I'm happy with it. I guess that such users are wise enough
> to define the proper __GCC_IEC_559 value after reviewing the header,
> though.
> 
> I'm sorry for the delay.

OK, commited patch based on this. Thanks!

Rich


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

* Re: Re: [PATCH v2] Add stdc-predef.h.
  2016-07-04  0:16           ` Rich Felker
@ 2016-07-06  7:39             ` Masanori Ogino
  0 siblings, 0 replies; 8+ messages in thread
From: Masanori Ogino @ 2016-07-06  7:39 UTC (permalink / raw)
  To: musl

Hello,

2016-07-04 9:16 GMT+09:00 Rich Felker <dalias@libc.org>:
> OK, commited patch based on this. Thanks!

Thank you!

-- 
Masanori Ogino


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

end of thread, other threads:[~2016-07-06  7:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-05  2:23 [PATCH v2] Add stdc-predef.h Masanori Ogino
2016-06-01  8:21 ` Masanori Ogino
2016-06-03 19:04   ` Rich Felker
2016-06-04  4:19     ` Masanori Ogino
2016-06-04  5:04       ` Rich Felker
2016-06-08 14:57         ` Masanori Ogino
2016-07-04  0:16           ` Rich Felker
2016-07-06  7:39             ` 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).