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] Macroize function declarations in math_private.h


On Fri, 17 Mar 2017, Gabriel F. T. Gomes wrote:

> 2017-03-17  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
> 
> 	* sysdeps/generic/math_private.h: Move the declaration of many
> 	functions to sysdeps/generic/math_private_common.h.
> 	* sysdeps/generic/math_private_common.h: New file with the
> 	declarations of the functions removed from math_private.h
> 	macroized by floating-point type.

I don't think math_private_common.h is a good name.  Calling something 
"common" raises the question of what it's common between - not between 
different architectures, for example, as that's implied by 
sysdeps/generic.  Something like "calls" might be better than "common".

There are also various complications in here that look like they are 
replicating peculiarities of the existing header, when it might be better 
to clean up those peculiarities first so it's easier for the new 
arrangements to preserve semantics.  Thus:

> +#define _Mint_ int32_t

It would seem better to make float, double, long double code consistent 
about whether this type is int or int32_t, so such a macro is no longer 
needed.

> +#if defined __MATH_DECLARING_LONG_DOUBLE && !defined NO_LONG_DOUBLE
> +/* Prototypes required to compile the ldbl-96 support without warnings.  */
> +extern int __MSUF (__finite) (_Mdouble_);
> +extern int __MSUF (__ilogb) (_Mdouble_);
> +extern int __MSUF (__isinf) (_Mdouble_);
> +extern int __MSUF (__isnan) (_Mdouble_);
> +extern _Mdouble_ __MSUF (__atan) (_Mdouble_);
> +extern _Mdouble_ __MSUF (__expm1) (_Mdouble_);
> +extern _Mdouble_ __MSUF (__floor) (_Mdouble_);
> +extern _Mdouble_ __MSUF (__frexp) (_Mdouble_, int *);
> +extern _Mdouble_ __MSUF (__ldexp) (_Mdouble_, int);
> +extern _Mdouble_ __MSUF (__log1p) (_Mdouble_);
> +extern _Mdouble_ __MSUF (__nan) (const char *);
> +extern _Mdouble_ __MSUF (__rint) (_Mdouble_);
> +extern _Mdouble_ __MSUF (__scalbn) (_Mdouble_, int);
> +extern _Mdouble_ __MSUF (__sqrt) (_Mdouble_ x);
> +extern _Mdouble_ __MSUF (fabs) (_Mdouble_ x);
> +extern void __MSUF (__sincos) (_Mdouble_, _Mdouble_ *, _Mdouble_ *);
> +extern _Mdouble_ __MSUF (__logb) (_Mdouble_ x);
> +extern _Mdouble_ __MSUF (__significand) (_Mdouble_ x);
> +#endif

None of thse should be needed.  math.h defines __MATHDECL and __MATHDECLX 
so that they declare both func and __func together for each function.  
It's questionable whether math.h *should* declare the __ versions in the 
absence of _LIBC, but I'd expect those declarations could be removed from 
math_private.h without causing any build issues, because of the public 
header declaring the functions for long double just as for other types.

-- 
Joseph S. Myers
joseph@codesourcery.com


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