about summary refs log tree commit diff
path: root/math/bits
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2021-09-29 18:20:32 +0000
committerJoseph Myers <joseph@codesourcery.com>2021-09-29 18:20:32 +0000
commit9bd9978639c2f75dbea5c25226264b1ac11fdf05 (patch)
tree9caaa3482305a7b25f2b0798ac898e111f4d1eb0 /math/bits
parent79850e1025aabeccd3586c32ca259aa854607582 (diff)
downloadglibc-9bd9978639c2f75dbea5c25226264b1ac11fdf05.tar.gz
glibc-9bd9978639c2f75dbea5c25226264b1ac11fdf05.tar.xz
glibc-9bd9978639c2f75dbea5c25226264b1ac11fdf05.zip
Do not declare fmax, fmin _FloatN, _FloatNx versions for C2X
At the last WG14 meeting,
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2711.htm> was
accepted, which places more emphasis on the new fmaximum / fminimum
functions and less on the old fmax / fmin functions.  Some of the
changes are to examples, notes or otherwise don't require
implementation changes.  However, the changes include removing the
_FloatN / _FloatNx versions of the fmax and fmin functions that came
from TS 18661-3.

Thus, those function versions should only be declared under similar
conditions to the _FloatN / _FloatNx versions of fmaxmag and fminmag:
for _GNU_SOURCE and pre-C2X use of __STDC_WANT_IEC_60559_TYPES_EXT__,
but not for C2X without _GNU_SOURCE.

In turn this requires a tgmath.h change so that the corresponding
tgmath.h macros, for C2X with __STDC_WANT_IEC_60559_TYPES_EXT__ but
without _GNU_SOURCE, don't try to use function variants that aren't
declared.  (That issue doesn't arise for the tgmath.h macros for
fmaxmag and fminmag, because those aren't defined at all in those
circumstances unless __STDC_WANT_IEC_60559_BFP_EXT__ (from TS 18661-1
and not specified at all by C2X) is also defined, and in that case the
_FloatN / _FloatNx versions of fmaxmag and fminmag get declared - this
is only ever an issue when it's possible for some functions
corresponding to a type-generic-macro to be declared, and for _FloatN
/ _FloatNx functions in general to be declared, but without the
_FloatN / _FloatNx functions corresponding to that particular macro
being declared.)

Tested for x86_64.
Diffstat (limited to 'math/bits')
-rw-r--r--math/bits/mathcalls.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index ee0c6d7219..da4cf4e10c 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -328,11 +328,13 @@ __MATHDECL (long long int,llround,, (_Mdouble_ __x));
 /* Return positive difference between X and Y.  */
 __MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
 
+# if !__MATH_DECLARING_FLOATN || defined __USE_GNU || !__GLIBC_USE (ISOC2X)
 /* Return maximum numeric value from X and Y.  */
 __MATHCALLX (fmax,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
 
 /* Return minimum numeric value from X and Y.  */
 __MATHCALLX (fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
+# endif
 
 /* Multiply-add function computed as a ternary operation.  */
 __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));