This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Provide a C++ version of fpclassify that does not use __MATH_TG (bug 22146)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: "Gabriel F. T. Gomes" <gabriel at inconstante dot eti dot br>
- Cc: <libc-alpha at sourceware dot org>
- Date: Wed, 20 Sep 2017 16:10:05 +0000
- Subject: Re: [PATCH] Provide a C++ version of fpclassify that does not use __MATH_TG (bug 22146)
- Authentication-results: sourceware.org; auth=none
- References: <20170920150931.8008-1-gabriel@inconstante.eti.br>
On Wed, 20 Sep 2017, Gabriel F. T. Gomes wrote:
> When optimization for size is on (-Os), fpclassify does not use the
> type-generic __builtin_fpclassify builtin, instead it uses __MATH_TG.
> However, __MATH_TG uses __builtin_types_compatible_p, which is not
> available in C++ mode.
>
> This patch adds a C++ version of fpclassify that does not rely on
> __MATH_TG nor on the aforementioned builtins. It uses C++ overloading
> capabilities to distinguish between the floating-point types.
I don't think this is correct. It's the job of libstdc++ to provide the
C++ version of fpclassify (std::fpclassify is in C++11 and later); putting
it in glibc's math.h risks interfering with the libstdc++ version. The
issue here is, as with isinf, *only* one at the time libstdc++ is
configured (with --enable-target-optspace, I presume), not for subsequent
use of libstdc++. So you only need to enable the __builtin_fpclassify for
__cplusplus (a one-line change) to let the configure test work when
libstdc++ is built with -Os.
--
Joseph S. Myers
joseph@codesourcery.com