diff options
author | Joseph Myers <joseph@codesourcery.com> | 2021-09-29 18:20:32 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2021-09-29 18:20:32 +0000 |
commit | 9bd9978639c2f75dbea5c25226264b1ac11fdf05 (patch) | |
tree | 9caaa3482305a7b25f2b0798ac898e111f4d1eb0 /math | |
parent | 79850e1025aabeccd3586c32ca259aa854607582 (diff) | |
download | glibc-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')
-rw-r--r-- | math/bits/mathcalls.h | 2 | ||||
-rw-r--r-- | math/tgmath.h | 12 |
2 files changed, 12 insertions, 2 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)); diff --git a/math/tgmath.h b/math/tgmath.h index 3d7b0998df..e8042833dd 100644 --- a/math/tgmath.h +++ b/math/tgmath.h @@ -892,12 +892,20 @@ /* Return positive difference between X and Y. */ #define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim) +#if __GLIBC_USE (ISOC2X) && !defined __USE_GNU /* Return maximum numeric value from X and Y. */ -#define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax) +# define fmax(Val1, Val2) __TGMATH_BINARY_REAL_STD_ONLY (Val1, Val2, fmax) /* Return minimum numeric value from X and Y. */ -#define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin) +# define fmin(Val1, Val2) __TGMATH_BINARY_REAL_STD_ONLY (Val1, Val2, fmin) +#else +/* Return maximum numeric value from X and Y. */ +# define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax) +/* Return minimum numeric value from X and Y. */ +# define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin) +#endif + /* Multiply-add function computed as a ternary operation. */ #define fma(Val1, Val2, Val3) \ |