Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160603190453.GP10893@brightrain.aerifal.cx>
Date: Fri, 3 Jun 2016 15:04:53 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Re: [PATCH v2] Add stdc-predef.h.

On Wed, Jun 01, 2016 at 08:21:17AM +0000, Masanori Ogino wrote:
> 2016年4月5日(火) 11:23 Masanori Ogino <masanori..ogino@...il.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@...il.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

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.