This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] fix include files to support non-GNU compilers
- From: Mikulas Patocka <mpatocka at redhat dot com>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, Richard Henderson <rth at twiddle dot net>, Andreas Schwab <schwab at suse dot de>, libc-alpha at sourceware dot org
- Date: Mon, 16 Mar 2015 12:50:53 -0400 (EDT)
- Subject: Re: [PATCH] fix include files to support non-GNU compilers
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LRH dot 2 dot 02 dot 1408311629460 dot 27738 at file01 dot intranet dot prod dot int dot rdu2 dot redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1409011646360 dot 14636 at digraph dot polyomino dot org dot uk> <alpine dot LRH dot 2 dot 02 dot 1409011849480 dot 311 at file01 dot intranet dot prod dot int dot rdu2 dot redhat dot com> <20150307210148 dot GO12857 at vapier>
> > --- glibc.orig/math/math.h
> > +++ glibc/math/math.h
> >
> > # undef __MATHDECL_1
> > -# define __MATHDECL_2(type, function,suffix, args, alias) \
> > +# ifdef __REDIRECT_NTH
> > +# define __MATHDECL_2(type, function,suffix, args, alias) \
> > extern type __REDIRECT_NTH(__MATH_PRECNAME(function,suffix), \
> > args, alias)
> > +# else
> > +# define __MATHDECL_2(type, function,suffix, args, alias) \
> > + struct __empty__declaration__
> > +# endif
> > # define __MATHDECL_1(type, function,suffix, args) \
> > __MATHDECL_2(type, function,suffix, args, __CONCAT(function,suffix))
>
> i don't think this is correct. i think you need to bracket the whole thing by
> an ifdef __REDIRECT_NTH check. Joseph would know best here though.
The problem here is that a stray semicolon at top level is invalid - it is
accepted by gcc, but it is invalid by the C standard and not accepted by
other compilers.
So if you do empty definition "#define define __MATHDECL_2(type,
function,suffix, args, alias)" and then use it this way "__MATHDECL_1
(int,__isinf,, (_Mdouble_ __value));", you get a stray semicolon and
compiler failure. You need to declare something in the __MATHDECL_2 macro
- so the patch declares an empty structure (prefixed by underscore, so it
should not clash with user programs).
An alternate solution would be to drop the semicolons from the users of
MATHDECL macro and move them to the MATHDECL macro itself, but it would
make the patch bigger.
> > --- glibc.orig/bits/wchar.h
> > +++ glibc/bits/wchar.h
> >
> > #ifdef __WCHAR_MAX__
> > # define __WCHAR_MAX __WCHAR_MAX__
> > +#elif defined __DECC
> > +# define __WCHAR_MAX 0x7fffffff
> > #elif L'\0' - 1 > 0
> > # define __WCHAR_MAX (0xffffffffu + L'\0')
>
> the issue is that L'\0' doesn't work on your compiler ? should we have some
> standards based check here instead of using __DECC ?
L'\0' is in the C89 standard - so it is a bug in the DEC C compiler that
its preprocessor doesn't accept it.
Mikulas