2017-10-09 13:58:34 +00:00
|
|
|
/* Test C99 math functions are available in C++11 without _GNU_SOURCE.
|
2024-01-01 18:12:26 +00:00
|
|
|
Copyright (C) 2017-2024 Free Software Foundation, Inc.
|
2017-10-09 13:58:34 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library 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 C Library 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
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2017-10-09 13:58:34 +00:00
|
|
|
|
|
|
|
#undef _GNU_SOURCE
|
|
|
|
#undef _DEFAULT_SOURCE
|
|
|
|
#undef _XOPEN_SOURCE
|
|
|
|
#undef _POSIX_SOURCE
|
|
|
|
#undef _POSIX_C_SOURCE
|
|
|
|
// __STRICT_ANSI__ gets defined by -std=c++11 in CFLAGS
|
|
|
|
#include <math.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
static int
|
|
|
|
do_test (void)
|
|
|
|
{
|
|
|
|
#ifdef _GNU_SOURCE
|
|
|
|
printf ("FAIL: _GNU_SOURCE is defined.\n");
|
|
|
|
return 1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
/* Verify that C11 math functions and types are defined for C++11,
|
|
|
|
without _GNU_SOURCE being defined. [BZ #21326] */
|
|
|
|
(void) FP_INFINITE;
|
|
|
|
(void) FP_NAN;
|
|
|
|
(void) FP_NORMAL;
|
|
|
|
(void) FP_SUBNORMAL;
|
|
|
|
(void) FP_ZERO;
|
|
|
|
double_t d = 1.0;
|
|
|
|
(void) d;
|
|
|
|
float_t f = 1.0f;
|
|
|
|
(void) f;
|
|
|
|
(void) acosh;
|
|
|
|
(void) acoshf;
|
|
|
|
(void) acoshl;
|
|
|
|
(void) asinh;
|
|
|
|
(void) asinhf;
|
|
|
|
(void) asinhl;
|
|
|
|
(void) atanh;
|
|
|
|
(void) atanhf;
|
|
|
|
(void) atanhl;
|
|
|
|
(void) cbrt;
|
|
|
|
(void) cbrtf;
|
|
|
|
(void) cbrtl;
|
|
|
|
(void) copysign;
|
|
|
|
(void) copysignf;
|
|
|
|
(void) copysignl;
|
|
|
|
(void) erf;
|
|
|
|
(void) erff;
|
|
|
|
(void) erfl;
|
|
|
|
(void) erfc;
|
|
|
|
(void) erfcf;
|
|
|
|
(void) erfcl;
|
|
|
|
(void) exp2;
|
|
|
|
(void) exp2f;
|
|
|
|
(void) exp2l;
|
|
|
|
(void) expm1;
|
|
|
|
(void) expm1f;
|
|
|
|
(void) expm1l;
|
|
|
|
(void) fdim;
|
|
|
|
(void) fdimf;
|
|
|
|
(void) fdiml;
|
|
|
|
(void) fma;
|
|
|
|
(void) fmaf;
|
|
|
|
(void) fmal;
|
|
|
|
(void) fmax;
|
|
|
|
(void) fmaxf;
|
|
|
|
(void) fmaxl;
|
|
|
|
(void) fmin;
|
|
|
|
(void) fminf;
|
|
|
|
(void) fminl;
|
|
|
|
(void) hypot;
|
|
|
|
(void) hypotf;
|
|
|
|
(void) hypotl;
|
|
|
|
(void) ilogb;
|
|
|
|
(void) ilogbf;
|
|
|
|
(void) ilogbl;
|
|
|
|
(void) lgamma;
|
|
|
|
(void) lgammaf;
|
|
|
|
(void) lgammal;
|
|
|
|
(void) llrint;
|
|
|
|
(void) llrintf;
|
|
|
|
(void) llrintl;
|
|
|
|
(void) llround;
|
|
|
|
(void) llroundf;
|
|
|
|
(void) llroundl;
|
|
|
|
(void) log1p;
|
|
|
|
(void) log1pf;
|
|
|
|
(void) log1pl;
|
|
|
|
(void) log2;
|
|
|
|
(void) log2f;
|
|
|
|
(void) log2l;
|
|
|
|
(void) logb;
|
|
|
|
(void) logbf;
|
|
|
|
(void) logbl;
|
|
|
|
(void) lrint;
|
|
|
|
(void) lrintf;
|
|
|
|
(void) lrintl;
|
|
|
|
(void) lround;
|
|
|
|
(void) lroundf;
|
|
|
|
(void) lroundl;
|
|
|
|
(void) nan;
|
|
|
|
(void) nanf;
|
|
|
|
(void) nanl;
|
|
|
|
(void) nearbyint;
|
|
|
|
(void) nearbyintf;
|
|
|
|
(void) nearbyintl;
|
|
|
|
(void) nextafter;
|
|
|
|
(void) nextafterf;
|
|
|
|
(void) nextafterl;
|
|
|
|
(void) nexttoward;
|
|
|
|
(void) nexttowardf;
|
|
|
|
(void) nexttowardl;
|
|
|
|
(void) remainder;
|
|
|
|
(void) remainderf;
|
|
|
|
(void) remainderl;
|
|
|
|
(void) remquo;
|
|
|
|
(void) remquof;
|
|
|
|
(void) remquol;
|
|
|
|
(void) rint;
|
|
|
|
(void) rintf;
|
|
|
|
(void) rintl;
|
|
|
|
(void) round;
|
|
|
|
(void) roundf;
|
|
|
|
(void) roundl;
|
|
|
|
(void) scalbln;
|
|
|
|
(void) scalblnf;
|
|
|
|
(void) scalblnl;
|
|
|
|
(void) scalbn;
|
|
|
|
(void) scalbnf;
|
|
|
|
(void) scalbnl;
|
|
|
|
(void) tgamma;
|
|
|
|
(void) tgammaf;
|
|
|
|
(void) tgammal;
|
|
|
|
(void) trunc;
|
|
|
|
(void) truncf;
|
|
|
|
(void) truncl;
|
|
|
|
printf ("PASS: C11 math functions present in C++11 without _GNU_SOURCE.\n");
|
|
|
|
#else
|
|
|
|
printf ("UNSUPPORTED: C++11 not enabled.\n");
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <support/test-driver.c>
|