[PATCH] Provide a C++ version of fpclassify that does not use __MATH_TG (bug 22146)
Joseph Myers
joseph@codesourcery.com
Wed Sep 20 16:10:00 GMT 2017
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
More information about the Libc-alpha
mailing list