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] Provide a C++ version of fpclassify that does not use __MATH_TG (bug 22146)


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


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