This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix include files to support non-GNU compilers


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]