This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Macroize function declarations in math_private.h
- From: Joseph Myers <joseph at codesourcery dot com>
- To: "Gabriel F. T. Gomes" <gftg at linux dot vnet dot ibm dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Tue, 21 Mar 2017 18:32:17 +0000
- Subject: Re: [PATCH] Macroize function declarations in math_private.h
- Authentication-results: sourceware.org; auth=none
- References: <1489777376-2786-1-git-send-email-gftg@linux.vnet.ibm.com>
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