summaryrefslogtreecommitdiff
path: root/lib/math.in.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-02-07 06:57:44 +0100
committerJörg Frings-Fürst <debian@jff.email>2022-02-07 06:57:44 +0100
commit6ffaa52cf732a84c0f8259dbc9b8183960ec5c33 (patch)
treed3136c22e3e805cfc0efe78412cce905a17e0c8d /lib/math.in.h
parent591cbf5878b7d4105b275585b9db1324c9dfce56 (diff)
parentaf151c593704a40e10efb28d1e3dd59a23a661f3 (diff)
Merge branch 'release/debian/1.0-1'debian/1.0-1
Diffstat (limited to 'lib/math.in.h')
-rw-r--r--lib/math.in.h467
1 files changed, 369 insertions, 98 deletions
diff --git a/lib/math.in.h b/lib/math.in.h
index 8c2f564..ccc3584 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1,27 +1,18 @@
/* A GNU-like <math.h>.
- Copyright (C) 2002-2003, 2007-2018 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2007-2022 Free Software Foundation, Inc.
- This program is free software: you can redistribute it and/or
- modify it under the terms of either:
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- or
-
- * the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- or both in parallel, as here.
- This program is distributed in the hope that it will be useful,
+ This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_MATH_H
@@ -31,8 +22,23 @@
#endif
@PRAGMA_COLUMNS@
+#if defined _GL_INCLUDING_MATH_H
+/* Special invocation convention:
+ - On FreeBSD 12.2 we have a sequence of nested includes
+ <math.h> -> <stdlib.h> -> <sys/wait.h> -> <sys/types.h> -> <sys/select.h>
+ -> <signal.h> -> <pthread.h> -> <stdlib.h> -> <math.h>
+ In this situation, the functions are not yet declared, therefore we cannot
+ provide the C++ aliases. */
+
+#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
+
+#else
+/* Normal invocation convention. */
+
/* The include_next requires a split double-inclusion guard. */
+#define _GL_INCLUDING_MATH_H
#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
+#undef _GL_INCLUDING_MATH_H
#ifndef _@GUARD_PREFIX@_MATH_H
#define _@GUARD_PREFIX@_MATH_H
@@ -50,6 +56,16 @@ _GL_INLINE_HEADER_BEGIN
# define _GL_MATH_INLINE _GL_INLINE
#endif
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+ The attribute __const__ was added in gcc 2.95. */
+#ifndef _GL_ATTRIBUTE_CONST
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined __clang__
+# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
+# else
+# define _GL_ATTRIBUTE_CONST /* empty */
+# endif
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
@@ -76,20 +92,20 @@ _gl_cxx_ ## func ## l (long double l) \
{ \
return func (l); \
}
-# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func) \
+# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func,rpl_func,rettype) \
_GL_BEGIN_NAMESPACE \
-inline int \
-func (float f) \
+inline rettype \
+rpl_func (float f) \
{ \
return _gl_cxx_ ## func ## f (f); \
} \
-inline int \
-func (double d) \
+inline rettype \
+rpl_func (double d) \
{ \
return _gl_cxx_ ## func ## d (d); \
} \
-inline int \
-func (long double l) \
+inline rettype \
+rpl_func (long double l) \
{ \
return _gl_cxx_ ## func ## l (l); \
} \
@@ -101,27 +117,27 @@ _GL_END_NAMESPACE
classification macros with an argument of real-floating (that is,
one of float, double, or long double). */
#define _GL_WARN_REAL_FLOATING_DECL(func) \
-_GL_MATH_INLINE int \
-rpl_ ## func ## f (float f) \
-{ \
- return func (f); \
-} \
-_GL_MATH_INLINE int \
-rpl_ ## func ## d (double d) \
-{ \
- return func (d); \
-} \
-_GL_MATH_INLINE int \
-rpl_ ## func ## l (long double l) \
-{ \
- return func (l); \
-} \
-_GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - " \
- "use gnulib module " #func " for portability"); \
-_GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - " \
- "use gnulib module " #func " for portability"); \
-_GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - " \
- "use gnulib module " #func " for portability")
+_GL_MATH_INLINE int \
+_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - " \
+ "use gnulib module " #func " for portability") \
+rpl_ ## func ## f (float f) \
+{ \
+ return func (f); \
+} \
+_GL_MATH_INLINE int \
+_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - " \
+ "use gnulib module " #func " for portability") \
+rpl_ ## func ## d (double d) \
+{ \
+ return func (d); \
+} \
+_GL_MATH_INLINE int \
+_GL_WARN_ON_USE_ATTRIBUTE (#func " is unportable - " \
+ "use gnulib module " #func " for portability") \
+rpl_ ## func ## l (long double l) \
+{ \
+ return func (l); \
+}
#define _GL_WARN_REAL_FLOATING_IMPL(func, value) \
(sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value) \
: sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value) \
@@ -264,7 +280,9 @@ _GL_WARN_ON_USE (acosf, "acosf is unportable - "
_GL_FUNCDECL_SYS (acosl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (acosl, long double, (long double x));
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (acosl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef acosl
# if HAVE_RAW_DECL_ACOSL
@@ -304,7 +322,9 @@ _GL_WARN_ON_USE (asinf, "asinf is unportable - "
_GL_FUNCDECL_SYS (asinl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (asinl, long double, (long double x));
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (asinl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef asinl
# if HAVE_RAW_DECL_ASINL
@@ -344,7 +364,9 @@ _GL_WARN_ON_USE (atanf, "atanf is unportable - "
_GL_FUNCDECL_SYS (atanl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (atanl, long double, (long double x));
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (atanl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef atanl
# if HAVE_RAW_DECL_ATANL
@@ -407,7 +429,9 @@ _GL_WARN_ON_USE (cbrtf, "cbrtf is unportable - "
_GL_FUNCDECL_SYS (cbrt, double, (double x));
# endif
_GL_CXXALIAS_SYS (cbrt, double, (double x));
-_GL_CXXALIASWARN (cbrt);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (cbrt, double, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef cbrt
# if HAVE_RAW_DECL_CBRT
@@ -475,7 +499,9 @@ _GL_CXXALIAS_RPL (ceil, double, (double x));
# else
_GL_CXXALIAS_SYS (ceil, double, (double x));
# endif
-_GL_CXXALIASWARN (ceil);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (ceil, double, (double x));
+# endif
#endif
#if @GNULIB_CEILL@
@@ -493,7 +519,9 @@ _GL_FUNCDECL_SYS (ceill, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (ceill, long double, (long double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (ceill);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef ceill
# if HAVE_RAW_DECL_CEILL
@@ -505,6 +533,7 @@ _GL_WARN_ON_USE (ceill, "ceill is unportable - "
#if @GNULIB_COPYSIGNF@
# if !@HAVE_DECL_COPYSIGNF@
+# undef copysignf
_GL_FUNCDECL_SYS (copysignf, float, (float x, float y));
# endif
_GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
@@ -522,7 +551,9 @@ _GL_WARN_ON_USE (copysignf, "copysignf is unportable - "
_GL_FUNCDECL_SYS (copysign, double, (double x, double y));
# endif
_GL_CXXALIAS_SYS (copysign, double, (double x, double y));
-_GL_CXXALIASWARN (copysign);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (copysign, double, (double x, double y));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef copysign
# if HAVE_RAW_DECL_COPYSIGN
@@ -576,7 +607,9 @@ _GL_WARN_ON_USE (cosf, "cosf is unportable - "
_GL_FUNCDECL_SYS (cosl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (cosl, long double, (long double x));
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (cosl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef cosl
# if HAVE_RAW_DECL_COSL
@@ -636,12 +669,23 @@ _GL_WARN_ON_USE (expf, "expf is unportable - "
#endif
#if @GNULIB_EXPL@
-# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
-# undef expl
+# if @REPLACE_EXPL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef expl
+# define expl rpl_expl
+# endif
+_GL_FUNCDECL_RPL (expl, long double, (long double x));
+_GL_CXXALIAS_RPL (expl, long double, (long double x));
+# else
+# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
+# undef expl
_GL_FUNCDECL_SYS (expl, long double, (long double x));
-# endif
+# endif
_GL_CXXALIAS_SYS (expl, long double, (long double x));
+# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (expl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef expl
# if HAVE_RAW_DECL_EXPL
@@ -679,7 +723,9 @@ _GL_FUNCDECL_SYS (exp2, double, (double x));
# endif
_GL_CXXALIAS_SYS (exp2, double, (double x));
# endif
-_GL_CXXALIASWARN (exp2);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (exp2, double, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef exp2
# if HAVE_RAW_DECL_EXP2
@@ -750,7 +796,9 @@ _GL_FUNCDECL_SYS (expm1, double, (double x));
# endif
_GL_CXXALIAS_SYS (expm1, double, (double x));
# endif
-_GL_CXXALIASWARN (expm1);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (expm1, double, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef expm1
# if HAVE_RAW_DECL_EXPM1
@@ -760,11 +808,22 @@ _GL_WARN_ON_USE (expm1, "expm1 is unportable - "
#endif
#if @GNULIB_EXPM1L@
-# if !@HAVE_DECL_EXPM1L@
-# undef expm1l
+# if @REPLACE_EXPM1L@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef expm1l
+# define expm1l rpl_expm1l
+# endif
+_GL_FUNCDECL_RPL (expm1l, long double, (long double x));
+_GL_CXXALIAS_RPL (expm1l, long double, (long double x));
+# else
+# if !@HAVE_DECL_EXPM1L@
+# undef expm1l
+# if !(defined __cplusplus && defined _AIX)
_GL_FUNCDECL_SYS (expm1l, long double, (long double x));
-# endif
+# endif
+# endif
_GL_CXXALIAS_SYS (expm1l, long double, (long double x));
+# endif
_GL_CXXALIASWARN (expm1l);
#elif defined GNULIB_POSIXCHECK
# undef expm1l
@@ -781,7 +840,9 @@ _GL_WARN_ON_USE (expm1l, "expm1l is unportable - "
_GL_FUNCDECL_SYS (fabsf, float, (float x));
# endif
_GL_CXXALIAS_SYS (fabsf, float, (float x));
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fabsf);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fabsf
# if HAVE_RAW_DECL_FABSF
@@ -805,7 +866,9 @@ _GL_FUNCDECL_SYS (fabsl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (fabsl, long double, (long double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fabsl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fabsl
# if HAVE_RAW_DECL_FABSL
@@ -850,7 +913,9 @@ _GL_CXXALIAS_RPL (floor, double, (double x));
# else
_GL_CXXALIAS_SYS (floor, double, (double x));
# endif
-_GL_CXXALIASWARN (floor);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (floor, double, (double x));
+# endif
#endif
#if @GNULIB_FLOORL@
@@ -868,7 +933,9 @@ _GL_FUNCDECL_SYS (floorl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (floorl, long double, (long double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (floorl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef floorl
# if HAVE_RAW_DECL_FLOORL
@@ -888,6 +955,7 @@ _GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z));
_GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z));
# else
# if !@HAVE_FMAF@
+# undef fmaf
_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z));
# endif
_GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z));
@@ -911,11 +979,14 @@ _GL_FUNCDECL_RPL (fma, double, (double x, double y, double z));
_GL_CXXALIAS_RPL (fma, double, (double x, double y, double z));
# else
# if !@HAVE_FMA@
+# undef fma
_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z));
# endif
_GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
# endif
-_GL_CXXALIASWARN (fma);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (fma, double, (double x, double y, double z));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fma
# if HAVE_RAW_DECL_FMA
@@ -937,8 +1008,10 @@ _GL_CXXALIAS_RPL (fmal, long double,
# else
# if !@HAVE_FMAL@
# undef fmal
+# if !(defined __cplusplus && defined _AIX)
_GL_FUNCDECL_SYS (fmal, long double,
(long double x, long double y, long double z));
+# endif
# endif
_GL_CXXALIAS_SYS (fmal, long double,
(long double x, long double y, long double z));
@@ -988,7 +1061,9 @@ _GL_CXXALIAS_RPL (fmod, double, (double x, double y));
# else
_GL_CXXALIAS_SYS (fmod, double, (double x, double y));
# endif
-_GL_CXXALIASWARN (fmod);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (fmod, double, (double x, double y));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fmod
# if HAVE_RAW_DECL_FMOD
@@ -1012,7 +1087,9 @@ _GL_FUNCDECL_SYS (fmodl, long double, (long double x, long double y));
# endif
_GL_CXXALIAS_SYS (fmodl, long double, (long double x, long double y));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (fmodl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef fmodl
# if HAVE_RAW_DECL_FMODL
@@ -1044,7 +1121,9 @@ _GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (frexpf);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef frexpf
# if HAVE_RAW_DECL_FREXPF
@@ -1071,7 +1150,9 @@ _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
# else
_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN1 (frexp, double, (double x, int *expptr));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef frexp
/* Assume frexp is always declared. */
@@ -1104,7 +1185,9 @@ _GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr));
# endif
#endif
#if @GNULIB_FREXPL@ && !(@REPLACE_FREXPL@ && !@HAVE_DECL_FREXPL@)
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (frexpl);
+# endif
#endif
#if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
# undef frexpl
@@ -1130,7 +1213,9 @@ _GL_FUNCDECL_SYS (hypotf, float, (float x, float y));
# endif
_GL_CXXALIAS_SYS (hypotf, float, (float x, float y));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (hypotf);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef hypotf
# if HAVE_RAW_DECL_HYPOTF
@@ -1151,7 +1236,9 @@ _GL_CXXALIAS_RPL (hypot, double, (double x, double y));
# else
_GL_CXXALIAS_SYS (hypot, double, (double x, double y));
# endif
-_GL_CXXALIASWARN (hypot);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (hypot, double, (double x, double y));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef hypot
# if HAVE_RAW_DECL_HYPOT
@@ -1175,7 +1262,9 @@ _GL_FUNCDECL_SYS (hypotl, long double, (long double x, long double y));
# endif
_GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (hypotl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef hypotl
# if HAVE_RAW_DECL_HYPOTL
@@ -1222,7 +1311,9 @@ _GL_FUNCDECL_SYS (ilogb, int, (double x));
# endif
_GL_CXXALIAS_SYS (ilogb, int, (double x));
# endif
-_GL_CXXALIASWARN (ilogb);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (ilogb, int, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef ilogb
# if HAVE_RAW_DECL_ILOGB
@@ -1241,6 +1332,7 @@ _GL_FUNCDECL_RPL (ilogbl, int, (long double x));
_GL_CXXALIAS_RPL (ilogbl, int, (long double x));
# else
# if !@HAVE_ILOGBL@
+# undef ilogbl
_GL_FUNCDECL_SYS (ilogbl, int, (long double x));
# endif
_GL_CXXALIAS_SYS (ilogbl, int, (long double x));
@@ -1255,6 +1347,55 @@ _GL_WARN_ON_USE (ilogbl, "ilogbl is unportable - "
#endif
+#if @GNULIB_MDA_J0@
+/* On native Windows, map 'j0' to '_j0', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::j0 always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef j0
+# define j0 _j0
+# endif
+_GL_CXXALIAS_MDA (j0, double, (double x));
+# else
+_GL_CXXALIAS_SYS (j0, double, (double x));
+# endif
+_GL_CXXALIASWARN (j0);
+#endif
+
+#if @GNULIB_MDA_J1@
+/* On native Windows, map 'j1' to '_j1', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::j1 always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef j1
+# define j1 _j1
+# endif
+_GL_CXXALIAS_MDA (j1, double, (double x));
+# else
+_GL_CXXALIAS_SYS (j1, double, (double x));
+# endif
+_GL_CXXALIASWARN (j1);
+#endif
+
+#if @GNULIB_MDA_JN@
+/* On native Windows, map 'jn' to '_jn', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::jn always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef jn
+# define jn _jn
+# endif
+_GL_CXXALIAS_MDA (jn, double, (int n, double x));
+# else
+_GL_CXXALIAS_SYS (jn, double, (int n, double x));
+# endif
+_GL_CXXALIASWARN (jn);
+#endif
+
+
/* Return x * 2^exp. */
#if @GNULIB_LDEXPF@
# if !@HAVE_LDEXPF@
@@ -1262,7 +1403,9 @@ _GL_WARN_ON_USE (ilogbl, "ilogbl is unportable - "
_GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp));
# endif
_GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp));
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (ldexpf);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef ldexpf
# if HAVE_RAW_DECL_LDEXPF
@@ -1288,7 +1431,9 @@ _GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp));
# endif
#endif
#if @GNULIB_LDEXPL@
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (ldexpl);
+# endif
#endif
#if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK
# undef ldexpl
@@ -1334,7 +1479,9 @@ _GL_CXXALIAS_RPL (log, double, (double x));
# else
_GL_CXXALIAS_SYS (log, double, (double x));
# endif
-_GL_CXXALIASWARN (log);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (log, double, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef log
# if HAVE_RAW_DECL_LOG
@@ -1358,7 +1505,9 @@ _GL_FUNCDECL_SYS (logl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (logl, long double, (long double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (logl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef logl
# if HAVE_RAW_DECL_LOGL
@@ -1403,7 +1552,9 @@ _GL_CXXALIAS_RPL (log10, double, (double x));
# else
_GL_CXXALIAS_SYS (log10, double, (double x));
# endif
-_GL_CXXALIASWARN (log10);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (log10, double, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef log10
# if HAVE_RAW_DECL_LOG10
@@ -1427,7 +1578,9 @@ _GL_FUNCDECL_SYS (log10l, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (log10l, long double, (long double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (log10l);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef log10l
# if HAVE_RAW_DECL_LOG10L
@@ -1474,7 +1627,9 @@ _GL_FUNCDECL_SYS (log1p, double, (double x));
# endif
_GL_CXXALIAS_SYS (log1p, double, (double x));
# endif
-_GL_CXXALIASWARN (log1p);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (log1p, double, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef log1p
# if HAVE_RAW_DECL_LOG1P
@@ -1546,7 +1701,9 @@ _GL_FUNCDECL_SYS (log2, double, (double x));
# endif
_GL_CXXALIAS_SYS (log2, double, (double x));
# endif
-_GL_CXXALIASWARN (log2);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (log2, double, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef log2
# if HAVE_RAW_DECL_LOG2
@@ -1616,7 +1773,9 @@ _GL_FUNCDECL_SYS (logb, double, (double x));
# endif
_GL_CXXALIAS_SYS (logb, double, (double x));
# endif
-_GL_CXXALIASWARN (logb);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (logb, double, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef logb
# if HAVE_RAW_DECL_LOGB
@@ -1684,7 +1843,9 @@ _GL_CXXALIAS_RPL (modf, double, (double x, double *iptr));
# else
_GL_CXXALIAS_SYS (modf, double, (double x, double *iptr));
# endif
-_GL_CXXALIASWARN (modf);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (modf, double, (double x, double *iptr));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef modf
# if HAVE_RAW_DECL_MODF
@@ -1710,7 +1871,9 @@ _GL_FUNCDECL_SYS (modfl, long double, (long double x, long double *iptr)
# endif
_GL_CXXALIAS_SYS (modfl, long double, (long double x, long double *iptr));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (modfl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef modfl
# if HAVE_RAW_DECL_MODFL
@@ -1773,7 +1936,9 @@ _GL_FUNCDECL_SYS (remainder, double, (double x, double y));
# endif
_GL_CXXALIAS_SYS (remainder, double, (double x, double y));
# endif
-_GL_CXXALIASWARN (remainder);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (remainder, double, (double x, double y));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef remainder
# if HAVE_RAW_DECL_REMAINDER
@@ -1793,7 +1958,9 @@ _GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y));
# else
# if !@HAVE_DECL_REMAINDERL@
# undef remainderl
+# if !(defined __cplusplus && defined _AIX)
_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y));
+# endif
# endif
_GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y));
# endif
@@ -1826,7 +1993,9 @@ _GL_WARN_ON_USE (rintf, "rintf is unportable - "
_GL_FUNCDECL_SYS (rint, double, (double x));
# endif
_GL_CXXALIAS_SYS (rint, double, (double x));
-_GL_CXXALIASWARN (rint);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (rint, double, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef rint
# if HAVE_RAW_DECL_RINT
@@ -1836,10 +2005,19 @@ _GL_WARN_ON_USE (rint, "rint is unportable - "
#endif
#if @GNULIB_RINTL@
-# if !@HAVE_RINTL@
+# if @REPLACE_RINTL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef rintl
+# define rintl rpl_rintl
+# endif
+_GL_FUNCDECL_RPL (rintl, long double, (long double x));
+_GL_CXXALIAS_RPL (rintl, long double, (long double x));
+# else
+# if !@HAVE_RINTL@
_GL_FUNCDECL_SYS (rintl, long double, (long double x));
-# endif
+# endif
_GL_CXXALIAS_SYS (rintl, long double, (long double x));
+# endif
_GL_CXXALIASWARN (rintl);
#elif defined GNULIB_POSIXCHECK
# undef rintl
@@ -1887,7 +2065,9 @@ _GL_FUNCDECL_SYS (round, double, (double x));
# endif
_GL_CXXALIAS_SYS (round, double, (double x));
# endif
-_GL_CXXALIASWARN (round);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (round, double, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef round
# if HAVE_RAW_DECL_ROUND
@@ -1907,7 +2087,9 @@ _GL_CXXALIAS_RPL (roundl, long double, (long double x));
# else
# if !@HAVE_DECL_ROUNDL@
# undef roundl
+# if !(defined __cplusplus && defined _AIX)
_GL_FUNCDECL_SYS (roundl, long double, (long double x));
+# endif
# endif
_GL_CXXALIAS_SYS (roundl, long double, (long double x));
# endif
@@ -1931,7 +2113,7 @@ _GL_FUNCDECL_RPL (sinf, float, (float x));
_GL_CXXALIAS_RPL (sinf, float, (float x));
# else
# if !@HAVE_SINF@
- # undef sinf
+# undef sinf
_GL_FUNCDECL_SYS (sinf, float, (float x));
# endif
_GL_CXXALIAS_SYS (sinf, float, (float x));
@@ -1951,7 +2133,9 @@ _GL_WARN_ON_USE (sinf, "sinf is unportable - "
_GL_FUNCDECL_SYS (sinl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (sinl, long double, (long double x));
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (sinl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef sinl
# if HAVE_RAW_DECL_SINL
@@ -2025,7 +2209,9 @@ _GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (sqrtl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef sqrtl
# if HAVE_RAW_DECL_SQRTL
@@ -2065,7 +2251,9 @@ _GL_WARN_ON_USE (tanf, "tanf is unportable - "
_GL_FUNCDECL_SYS (tanl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (tanl, long double, (long double x));
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (tanl);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef tanl
# if HAVE_RAW_DECL_TANL
@@ -2137,7 +2325,9 @@ _GL_FUNCDECL_SYS (trunc, double, (double x));
# endif
_GL_CXXALIAS_SYS (trunc, double, (double x));
# endif
-_GL_CXXALIASWARN (trunc);
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN1 (trunc, double, (double x));
+# endif
#elif defined GNULIB_POSIXCHECK
# undef trunc
# if HAVE_RAW_DECL_TRUNC
@@ -2170,6 +2360,55 @@ _GL_WARN_ON_USE (truncl, "truncl is unportable - "
#endif
+#if @GNULIB_MDA_Y0@
+/* On native Windows, map 'y0' to '_y0', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::y0 always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef y0
+# define y0 _y0
+# endif
+_GL_CXXALIAS_MDA (y0, double, (double x));
+# else
+_GL_CXXALIAS_SYS (y0, double, (double x));
+# endif
+_GL_CXXALIASWARN (y0);
+#endif
+
+#if @GNULIB_MDA_Y1@
+/* On native Windows, map 'y1' to '_y1', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::y1 always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef y1
+# define y1 _y1
+# endif
+_GL_CXXALIAS_MDA (y1, double, (double x));
+# else
+_GL_CXXALIAS_SYS (y1, double, (double x));
+# endif
+_GL_CXXALIASWARN (y1);
+#endif
+
+#if @GNULIB_MDA_YN@
+/* On native Windows, map 'yn' to '_yn', so that -loldnames is not
+ required. In C++ with GNULIB_NAMESPACE, avoid differences between
+ platforms by defining GNULIB_NAMESPACE::yn always. */
+# if defined _WIN32 && !defined __CYGWIN__
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef yn
+# define yn _yn
+# endif
+_GL_CXXALIAS_MDA (yn, double, (int n, double x));
+# else
+_GL_CXXALIAS_SYS (yn, double, (int n, double x));
+# endif
+_GL_CXXALIASWARN (yn);
+#endif
+
+
/* Definitions of function-like macros come here, after the function
declarations. */
@@ -2189,7 +2428,14 @@ _GL_EXTERN_C int gl_isfinitel (long double x);
# if defined isfinite || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
# undef isfinite
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite)
+# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__)))
+ /* This platform's <cmath> possibly defines isfinite through a set of inline
+ functions. */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, rpl_isfinite, bool)
+# define isfinite rpl_isfinite
+# else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite, isfinite, bool)
+# endif
# endif
# endif
#elif defined GNULIB_POSIXCHECK
@@ -2216,7 +2462,14 @@ _GL_EXTERN_C int gl_isinfl (long double x);
# if defined isinf || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
# undef isinf
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf)
+# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
+ /* This platform's <cmath> possibly defines isinf through a set of inline
+ functions. */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, rpl_isinf, bool)
+# define isinf rpl_isinf
+# else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf, isinf, bool)
+# endif
# endif
# endif
#elif defined GNULIB_POSIXCHECK
@@ -2233,10 +2486,11 @@ _GL_WARN_REAL_FLOATING_DECL (isinf);
# if @HAVE_ISNANF@
/* The original <math.h> included above provides a declaration of isnan macro
or (older) isnanf function. */
-# if __GNUC__ >= 4
- /* GCC 4.0 and newer provides three built-ins for isnan. */
+# if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+ /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.
+ GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't. */
# undef isnanf
-# define isnanf(x) __builtin_isnanf ((float)(x))
+# define isnanf(x) __builtin_isnan ((float)(x))
# elif defined isnan
# undef isnanf
# define isnanf(x) isnan ((float)(x))
@@ -2256,8 +2510,8 @@ _GL_EXTERN_C int isnanf (float x);
# if @HAVE_ISNAND@
/* The original <math.h> included above provides a declaration of isnan
macro. */
-# if __GNUC__ >= 4
- /* GCC 4.0 and newer provides three built-ins for isnan. */
+# if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+ /* GCC >= 4.0 and clang provide a type-generic built-in for isnan. */
# undef isnand
# define isnand(x) __builtin_isnan ((double)(x))
# else
@@ -2277,10 +2531,11 @@ _GL_EXTERN_C int isnand (double x);
# if @HAVE_ISNANL@
/* The original <math.h> included above provides a declaration of isnan
macro or (older) isnanl function. */
-# if __GNUC__ >= 4
- /* GCC 4.0 and newer provides three built-ins for isnan. */
+# if (__GNUC__ >= 4) || (__clang_major__ >= 4)
+ /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.
+ GCC >= 4.0 also provides __builtin_isnanl, but clang doesn't. */
# undef isnanl
-# define isnanl(x) __builtin_isnanl ((long double)(x))
+# define isnanl(x) __builtin_isnan ((long double)(x))
# elif defined isnan
# undef isnanl
# define isnanl(x) isnan ((long double)(x))
@@ -2300,20 +2555,20 @@ _GL_EXTERN_C int isnanl (long double x) _GL_ATTRIBUTE_CONST;
isnanf.h (e.g.) here, because those may end up being macros
that recursively expand back to isnan. So use the gnulib
replacements for them directly. */
-# if @HAVE_ISNANF@ && __GNUC__ >= 4
-# define gl_isnan_f(x) __builtin_isnanf ((float)(x))
+# if @HAVE_ISNANF@ && (__GNUC__ >= 4) || (__clang_major__ >= 4)
+# define gl_isnan_f(x) __builtin_isnan ((float)(x))
# else
_GL_EXTERN_C int rpl_isnanf (float x);
# define gl_isnan_f(x) rpl_isnanf (x)
# endif
-# if @HAVE_ISNAND@ && __GNUC__ >= 4
+# if @HAVE_ISNAND@ && (__GNUC__ >= 4) || (__clang_major__ >= 4)
# define gl_isnan_d(x) __builtin_isnan ((double)(x))
# else
_GL_EXTERN_C int rpl_isnand (double x);
# define gl_isnan_d(x) rpl_isnand (x)
# endif
-# if @HAVE_ISNANL@ && __GNUC__ >= 4
-# define gl_isnan_l(x) __builtin_isnanl ((long double)(x))
+# if @HAVE_ISNANL@ && (__GNUC__ >= 4) || (__clang_major__ >= 4)
+# define gl_isnan_l(x) __builtin_isnan ((long double)(x))
# else
_GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
# define gl_isnan_l(x) rpl_isnanl (x)
@@ -2323,18 +2578,25 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
(sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
gl_isnan_f (x))
-# elif __GNUC__ >= 4
+# elif (__GNUC__ >= 4) || (__clang_major__ >= 4)
# undef isnan
# define isnan(x) \
- (sizeof (x) == sizeof (long double) ? __builtin_isnanl ((long double)(x)) : \
+ (sizeof (x) == sizeof (long double) ? __builtin_isnan ((long double)(x)) : \
sizeof (x) == sizeof (double) ? __builtin_isnan ((double)(x)) : \
- __builtin_isnanf ((float)(x)))
+ __builtin_isnan ((float)(x)))
# endif
# ifdef __cplusplus
# if defined isnan || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
# undef isnan
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan)
+# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ < 12) || (defined __FreeBSD__ && __clang_major__ < 7) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
+ /* This platform's <cmath> possibly defines isnan through a set of inline
+ functions. */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
+# define isnan rpl_isnan
+# else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool)
+# endif
# endif
# else
/* Ensure isnan is a macro. */
@@ -2352,21 +2614,21 @@ _GL_WARN_REAL_FLOATING_DECL (isnan);
#if @GNULIB_SIGNBIT@
-# if (@REPLACE_SIGNBIT_USING_GCC@ \
+# if (@REPLACE_SIGNBIT_USING_BUILTINS@ \
&& (!defined __cplusplus || __cplusplus < 201103))
# undef signbit
- /* GCC 4.0 and newer provides three built-ins for signbit. */
+ /* GCC >= 4.0 and clang provide three built-ins for signbit. */
# define signbit(x) \
(sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
__builtin_signbitf (x))
# endif
-# if @REPLACE_SIGNBIT@
+# if @REPLACE_SIGNBIT@ && !GNULIB_defined_signbit
# undef signbit
_GL_EXTERN_C int gl_signbitf (float arg);
_GL_EXTERN_C int gl_signbitd (double arg);
_GL_EXTERN_C int gl_signbitl (long double arg);
-# if __GNUC__ >= 2 && !defined __STRICT_ANSI__
+# if (__GNUC__ >= 2 || defined __clang__) && !defined __STRICT_ANSI__
# define _GL_NUM_UINT_WORDS(type) \
((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
# if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf
@@ -2404,12 +2666,20 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
(sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
gl_signbitf (x))
+# define GNULIB_defined_signbit 1
# endif
# ifdef __cplusplus
# if defined signbit || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
# undef signbit
-_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit)
+# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __OpenBSD__ || defined _AIX || (defined _WIN32 && !defined __CYGWIN__)))
+ /* This platform's <cmath> possibly defines signbit through a set of inline
+ functions. */
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, rpl_signbit, bool)
+# define signbit rpl_signbit
+# else
+_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit, signbit, bool)
+# endif
# endif
# endif
#elif defined GNULIB_POSIXCHECK
@@ -2423,4 +2693,5 @@ _GL_WARN_REAL_FLOATING_DECL (signbit);
_GL_INLINE_HEADER_END
#endif /* _@GUARD_PREFIX@_MATH_H */
+#endif /* _GL_INCLUDING_MATH_H */
#endif /* _@GUARD_PREFIX@_MATH_H */