From 5be04ec2ceb1df77afbca4fcbf9e92a712612d6f Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:27:12 +0100 Subject: Sync with the latest Gnulib code (d4ec02b3cc) --- gl/math.in.h | 404 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 386 insertions(+), 18 deletions(-) (limited to 'gl/math.in.h') diff --git a/gl/math.in.h b/gl/math.in.h index f3d58afc..96d0da44 100644 --- a/gl/math.in.h +++ b/gl/math.in.h @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 2002-2003, 2007-2023 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2007-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -15,6 +15,11 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +/* On Android, in C++ mode, when /usr/include/c++/v1/math.h is being included + and /usr/include/math.h has not yet been included, skip this file, since it + would lead to many syntax errors. */ +#if !(defined __ANDROID__ && defined _LIBCPP_MATH_H && !defined INFINITY) + #ifndef _@GUARD_PREFIX@_MATH_H #if __GNUC__ >= 3 @@ -43,14 +48,17 @@ #ifndef _@GUARD_PREFIX@_MATH_H #define _@GUARD_PREFIX@_MATH_H +/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, _GL_ATTRIBUTE_CONST, + GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* On OpenVMS, NAN, INFINITY, and HUGEVAL macros are defined in . */ #if defined __VMS && ! defined NAN # include #endif -#ifndef _GL_INLINE_HEADER_BEGIN - #error "Please include config.h first." -#endif _GL_INLINE_HEADER_BEGIN #ifndef _GL_MATH_INLINE # define _GL_MATH_INLINE _GL_INLINE @@ -1426,6 +1434,29 @@ _GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - " # endif #endif +/* Return x * 2^exp. */ +#if @GNULIB_LDEXP@ +# if @REPLACE_LDEXP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ldexp +# define ldexp rpl_ldexp +# endif +_GL_FUNCDECL_RPL (ldexp, double, (double x, int exp)); +_GL_CXXALIAS_RPL (ldexp, double, (double x, int exp)); +# else +/* Assume ldexp is always declared. */ +_GL_CXXALIAS_SYS (ldexp, double, (double x, int exp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN1 (ldexp, double, (double x, int exp)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef ldexp +/* Assume ldexp is always declared. */ +_GL_WARN_ON_USE (ldexp, "ldexp is unportable - " + "use gnulib module ldexp for portability"); +#endif + /* Return x * 2^exp. */ #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -1691,7 +1722,9 @@ _GL_FUNCDECL_SYS (log2f, float, (float x)); # endif _GL_CXXALIAS_SYS (log2f, float, (float x)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (log2f); +# endif #elif defined GNULIB_POSIXCHECK # undef log2f # if HAVE_RAW_DECL_LOG2F @@ -2512,16 +2545,22 @@ _GL_WARN_REAL_FLOATING_DECL (isinf); #if @GNULIB_ISNANF@ /* Test for NaN for 'float' numbers. */ # if @HAVE_ISNANF@ +# if defined __sun || defined __sgi +/* Solaris and IRIX have isnanf() and declare it in . We cannot + define isnanf as a macro, because that would conflict with . */ +_GL_EXTERN_C int isnanf (float x); +# else /* The original included above provides a declaration of isnan macro or (older) isnanf function. */ -# if (__GNUC__ >= 4) || (__clang_major__ >= 4) +# 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_isnan ((float)(x)) -# elif defined isnan -# undef isnanf -# define isnanf(x) isnan ((float)(x)) +# undef isnanf +# define isnanf(x) __builtin_isnan ((float)(x)) +# elif defined isnan +# undef isnanf +# define isnanf(x) isnan ((float)(x)) +# endif # endif # else /* Test whether X is a NaN. */ @@ -2536,15 +2575,21 @@ _GL_EXTERN_C int isnanf (float x); This function is a gnulib extension, unlike isnan() which applied only to 'double' numbers earlier but now is a type-generic macro. */ # if @HAVE_ISNAND@ +# if defined __sun || defined __sgi +/* Solaris and IRIX have isnand() and declare it in . We cannot + define isnand as a macro, because that would conflict with . */ +_GL_EXTERN_C int isnand (double x); +# else /* The original included above provides a declaration of isnan macro. */ -# if (__GNUC__ >= 4) || (__clang_major__ >= 4) +# 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 -# undef isnand -# define isnand(x) isnan ((double)(x)) +# undef isnand +# define isnand(x) __builtin_isnan ((double)(x)) +# else +# undef isnand +# define isnand(x) isnan ((double)(x)) +# endif # endif # else /* Test whether X is a NaN. */ @@ -2617,12 +2662,17 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST; # if defined isnan || defined GNULIB_NAMESPACE _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan) # undef isnan -# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ < 12) || (defined __FreeBSD__ && (__clang_major__ < 7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__))) +# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ != 12) || (defined __FreeBSD__ && (__clang_major__ < 7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__))) /* This platform's possibly defines isnan through a set of inline functions. */ _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool) # define isnan rpl_isnan # define GNULIB_NAMESPACE_LACKS_ISNAN 1 +# elif __clang_major__ >= 14 + /* Neither of the two possible _GL_MATH_CXX_REAL_FLOATING_DECL_2 invocations + works. Inline functions are already present in /usr/include/c++/v1/math.h, + which comes from LLVM. */ +# define GNULIB_NAMESPACE_LACKS_ISNAN 1 # else _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, isnan, bool) # endif @@ -2657,12 +2707,13 @@ _GL_WARN_REAL_FLOATING_DECL (isnan); _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 __clang__) && !defined __STRICT_ANSI__ +# if __GNUC__ >= 2 || defined __clang__ # 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 # define gl_signbitf_OPTIMIZED_MACRO # define gl_signbitf(arg) \ + __extension__ \ ({ union { float _value; \ unsigned int _word[_GL_NUM_UINT_WORDS (float)]; \ } _m; \ @@ -2673,6 +2724,7 @@ _GL_EXTERN_C int gl_signbitl (long double arg); # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd # define gl_signbitd_OPTIMIZED_MACRO # define gl_signbitd(arg) \ + __extension__ \ ({ union { double _value; \ unsigned int _word[_GL_NUM_UINT_WORDS (double)]; \ } _m; \ @@ -2683,6 +2735,7 @@ _GL_EXTERN_C int gl_signbitl (long double arg); # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl # define gl_signbitl_OPTIMIZED_MACRO # define gl_signbitl(arg) \ + __extension__ \ ({ union { long double _value; \ unsigned int _word[_GL_NUM_UINT_WORDS (long double)]; \ } _m; \ @@ -2720,8 +2773,323 @@ _GL_WARN_REAL_FLOATING_DECL (signbit); # endif #endif + +#if @GNULIB_GETPAYLOADF@ +# if @REPLACE_GETPAYLOADF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getpayloadf +# define getpayloadf rpl_getpayloadf +# endif +_GL_FUNCDECL_RPL (getpayloadf, float, (const float *)); +_GL_CXXALIAS_RPL (getpayloadf, float, (const float *)); +# else +# if !@HAVE_GETPAYLOADF@ +_GL_FUNCDECL_SYS (getpayloadf, float, (const float *)); +# endif +_GL_CXXALIAS_SYS (getpayloadf, float, (const float *)); +# endif +_GL_CXXALIASWARN (getpayloadf); +#elif defined GNULIB_POSIXCHECK +# undef getpayloadf +# if HAVE_RAW_DECL_GETPAYLOADF +_GL_WARN_ON_USE (getpayloadf, "getpayloadf is unportable - " + "use gnulib module getpayloadf for portability"); +# endif +#endif + +#if @GNULIB_GETPAYLOAD@ +# if @REPLACE_GETPAYLOAD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getpayload +# define getpayload rpl_getpayload +# endif +_GL_FUNCDECL_RPL (getpayload, double, (const double *)); +_GL_CXXALIAS_RPL (getpayload, double, (const double *)); +# else +# if !@HAVE_GETPAYLOAD@ +_GL_FUNCDECL_SYS (getpayload, double, (const double *)); +# endif +_GL_CXXALIAS_SYS (getpayload, double, (const double *)); +# endif +_GL_CXXALIASWARN (getpayload); +#elif defined GNULIB_POSIXCHECK +# undef getpayload +# if HAVE_RAW_DECL_GETPAYLOAD +_GL_WARN_ON_USE (getpayload, "getpayload is unportable - " + "use gnulib module getpayload for portability"); +# endif +#endif + +#if @GNULIB_GETPAYLOADL@ +# if @REPLACE_GETPAYLOADL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getpayloadl +# define getpayloadl rpl_getpayloadl +# endif +_GL_FUNCDECL_RPL (getpayloadl, long double, (const long double *)); +_GL_CXXALIAS_RPL (getpayloadl, long double, (const long double *)); +# else +# if !@HAVE_GETPAYLOADL@ +_GL_FUNCDECL_SYS (getpayloadl, long double, (const long double *)); +# endif +_GL_CXXALIAS_SYS (getpayloadl, long double, (const long double *)); +# endif +_GL_CXXALIASWARN (getpayloadl); +#elif defined GNULIB_POSIXCHECK +# undef getpayloadl +# if HAVE_RAW_DECL_GETPAYLOADL +_GL_WARN_ON_USE (getpayloadl, "getpayloadl is unportable - " + "use gnulib module getpayloadl for portability"); +# endif +#endif + + +#if @GNULIB_SETPAYLOADF@ +# if !@HAVE_SETPAYLOADF@ +_GL_FUNCDECL_SYS (setpayloadf, int, (float *, float)); +# endif +_GL_CXXALIAS_SYS (setpayloadf, int, (float *, float)); +_GL_CXXALIASWARN (setpayloadf); +#elif defined GNULIB_POSIXCHECK +# undef setpayloadf +# if HAVE_RAW_DECL_SETPAYLOADF +_GL_WARN_ON_USE (setpayloadf, "setpayloadf is unportable - " + "use gnulib module setpayloadf for portability"); +# endif +#endif + +#if @GNULIB_SETPAYLOAD@ +# if !@HAVE_SETPAYLOAD@ +_GL_FUNCDECL_SYS (setpayload, int, (double *, double)); +# endif +_GL_CXXALIAS_SYS (setpayload, int, (double *, double)); +_GL_CXXALIASWARN (setpayload); +#elif defined GNULIB_POSIXCHECK +# undef setpayload +# if HAVE_RAW_DECL_SETPAYLOAD +_GL_WARN_ON_USE (setpayload, "setpayload is unportable - " + "use gnulib module setpayload for portability"); +# endif +#endif + +#if @GNULIB_SETPAYLOADL@ +# if !@HAVE_SETPAYLOADL@ +_GL_FUNCDECL_SYS (setpayloadl, int, (long double *, long double)); +# endif +_GL_CXXALIAS_SYS (setpayloadl, int, (long double *, long double)); +_GL_CXXALIASWARN (setpayloadl); +#elif defined GNULIB_POSIXCHECK +# undef setpayloadl +# if HAVE_RAW_DECL_SETPAYLOADL +_GL_WARN_ON_USE (setpayloadl, "setpayloadl is unportable - " + "use gnulib module setpayloadl for portability"); +# endif +#endif + + +#if @GNULIB_SETPAYLOADSIGF@ +# if !@HAVE_SETPAYLOADSIGF@ +_GL_FUNCDECL_SYS (setpayloadsigf, int, (float *, float)); +# endif +_GL_CXXALIAS_SYS (setpayloadsigf, int, (float *, float)); +_GL_CXXALIASWARN (setpayloadsigf); +#elif defined GNULIB_POSIXCHECK +# undef setpayloadsigf +# if HAVE_RAW_DECL_SETPAYLOADSIGF +_GL_WARN_ON_USE (setpayloadsigf, "setpayloadsigf is unportable - " + "use gnulib module setpayloadsigf for portability"); +# endif +#endif + +#if @GNULIB_SETPAYLOADSIG@ +# if !@HAVE_SETPAYLOADSIG@ +_GL_FUNCDECL_SYS (setpayloadsig, int, (double *, double)); +# endif +_GL_CXXALIAS_SYS (setpayloadsig, int, (double *, double)); +_GL_CXXALIASWARN (setpayloadsig); +#elif defined GNULIB_POSIXCHECK +# undef setpayloadsig +# if HAVE_RAW_DECL_SETPAYLOADSIG +_GL_WARN_ON_USE (setpayloadsig, "setpayloadsig is unportable - " + "use gnulib module setpayloadsig for portability"); +# endif +#endif + +#if @GNULIB_SETPAYLOADSIGL@ +# if !@HAVE_SETPAYLOADSIGL@ +_GL_FUNCDECL_SYS (setpayloadsigl, int, (long double *, long double)); +# endif +_GL_CXXALIAS_SYS (setpayloadsigl, int, (long double *, long double)); +_GL_CXXALIASWARN (setpayloadsigl); +#elif defined GNULIB_POSIXCHECK +# undef setpayloadsigl +# if HAVE_RAW_DECL_SETPAYLOADSIGL +_GL_WARN_ON_USE (setpayloadsigl, "setpayloadsigl is unportable - " + "use gnulib module setpayloadsigl for portability"); +# endif +#endif + + +#if @GNULIB_TOTALORDERF@ +# if @REPLACE_TOTALORDERF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef totalorderf +# define totalorderf rpl_totalorderf +# endif +_GL_FUNCDECL_RPL (totalorderf, int, (float const *, float const *)); +_GL_CXXALIAS_RPL (totalorderf, int, (float const *, float const *)); +# else +# if !@HAVE_TOTALORDERF@ +_GL_FUNCDECL_SYS (totalorderf, int, (float const *, float const *)); +# endif +_GL_CXXALIAS_SYS (totalorderf, int, (float const *, float const *)); +# endif +_GL_CXXALIASWARN (totalorderf); +#elif defined GNULIB_POSIXCHECK +# undef totalorderf +# if HAVE_RAW_DECL_TOTALORDERF +_GL_WARN_ON_USE (totalorderf, "totalorderf is unportable - " + "use gnulib module totalorderf for portability"); +# endif +#endif + +#if @GNULIB_TOTALORDER@ +# if @REPLACE_TOTALORDER@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef totalorder +# define totalorder rpl_totalorder +# endif +_GL_FUNCDECL_RPL (totalorder, int, (double const *, double const *)); +_GL_CXXALIAS_RPL (totalorder, int, (double const *, double const *)); +# else +# if !@HAVE_TOTALORDER@ +_GL_FUNCDECL_SYS (totalorder, int, (double const *, double const *)); +# endif +_GL_CXXALIAS_SYS (totalorder, int, (double const *, double const *)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN1 (totalorder, int, (double const *, double const *)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef totalorder +# if HAVE_RAW_DECL_TOTALORDER +_GL_WARN_ON_USE (totalorder, "totalorder is unportable - " + "use gnulib module totalorder for portability"); +# endif +#endif + +#if @GNULIB_TOTALORDERL@ +# if @REPLACE_TOTALORDERL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef totalorderl +# define totalorderl rpl_totalorderl +# endif +_GL_FUNCDECL_RPL (totalorderl, int, + (long double const *, long double const *)); +_GL_CXXALIAS_RPL (totalorderl, int, + (long double const *, long double const *)); +# else +# if !@HAVE_TOTALORDERL@ +_GL_FUNCDECL_SYS (totalorderl, int, + (long double const *, long double const *)); +# endif +_GL_CXXALIAS_SYS (totalorderl, int, + (long double const *, long double const *)); +# endif +_GL_CXXALIASWARN (totalorderl); +#elif defined GNULIB_POSIXCHECK +# undef totalorderl +# if HAVE_RAW_DECL_TOTALORDERL +_GL_WARN_ON_USE (totalorderl, "totalorderl is unportable - " + "use gnulib module totalorderl for portability"); +# endif +#endif + + +#if @GNULIB_TOTALORDERMAGF@ +# if @REPLACE_TOTALORDERMAGF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef totalordermagf +# define totalordermagf rpl_totalordermagf +# endif +_GL_FUNCDECL_RPL (totalordermagf, int, (float const *, float const *)); +_GL_CXXALIAS_RPL (totalordermagf, int, (float const *, float const *)); +# else +# if !@HAVE_TOTALORDERMAGF@ +_GL_FUNCDECL_SYS (totalordermagf, int, (float const *, float const *)); +# endif +_GL_CXXALIAS_SYS (totalordermagf, int, (float const *, float const *)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN1 (totalordermagf, int, (float const *, float const *)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef totalordermagf +# if HAVE_RAW_DECL_TOTALORDERMAGF +_GL_WARN_ON_USE (totalordermagf, "totalordermagf is unportable - " + "use gnulib module totalordermagf for portability"); +# endif +#endif + +#if @GNULIB_TOTALORDERMAG@ +# if @REPLACE_TOTALORDERMAG@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef totalordermag +# define totalordermag rpl_totalordermag +# endif +_GL_FUNCDECL_RPL (totalordermag, int, (double const *, double const *)); +_GL_CXXALIAS_RPL (totalordermag, int, (double const *, double const *)); +# else +# if !@HAVE_TOTALORDERMAG@ +_GL_FUNCDECL_SYS (totalordermag, int, (double const *, double const *)); +# endif +_GL_CXXALIAS_SYS (totalordermag, int, (double const *, double const *)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN1 (totalordermag, int, (double const *, double const *)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef totalordermag +# if HAVE_RAW_DECL_TOTALORDERMAG +_GL_WARN_ON_USE (totalordermag, "totalordermag is unportable - " + "use gnulib module totalordermag for portability"); +# endif +#endif + +#if @GNULIB_TOTALORDERMAGL@ +# if @REPLACE_TOTALORDERMAGL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef totalordermagl +# define totalordermagl rpl_totalordermagl +# endif +_GL_FUNCDECL_RPL (totalordermagl, int, + (long double const *, long double const *)); +_GL_CXXALIAS_RPL (totalordermagl, int, + (long double const *, long double const *)); +# else +# if !@HAVE_TOTALORDERMAGL@ +_GL_FUNCDECL_SYS (totalordermagl, int, + (long double const *, long double const *)); +# endif +_GL_CXXALIAS_SYS (totalordermagl, int, + (long double const *, long double const *)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN1 (totalordermagl, int, + (long double const *, long double const *)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef totalordermagl +# if HAVE_RAW_DECL_TOTALORDERMAGL +_GL_WARN_ON_USE (totalordermagl, "totalordermagl is unportable - " + "use gnulib module totalordermagl for portability"); +# endif +#endif + + _GL_INLINE_HEADER_END #endif /* _@GUARD_PREFIX@_MATH_H */ #endif /* _GL_INCLUDING_MATH_H */ #endif /* _@GUARD_PREFIX@_MATH_H */ +#endif -- cgit v1.2.3-74-g34f1