2016-05-06 21:00:39 +00:00
|
|
|
/* Common utilities for testing strtod and its derivatives.
|
|
|
|
This file is part of the GNU C Library.
|
2019-01-01 00:11:28 +00:00
|
|
|
Copyright (C) 2016-2019 Free Software Foundation, Inc.
|
2016-05-06 21:00:39 +00:00
|
|
|
|
|
|
|
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/>. */
|
2016-05-06 21:00:39 +00:00
|
|
|
|
|
|
|
#ifndef _TST_STRTOD_H
|
|
|
|
#define _TST_STRTOD_H
|
|
|
|
|
|
|
|
#define FSTRLENMAX 128
|
|
|
|
|
2016-07-25 18:10:00 +00:00
|
|
|
#include <bits/floatn.h>
|
|
|
|
|
2017-11-07 18:08:44 +00:00
|
|
|
#define F16 __f16 ()
|
|
|
|
#define F32 __f32 ()
|
|
|
|
#define F64 __f64 ()
|
2016-07-25 18:10:00 +00:00
|
|
|
#define F128 __f128 ()
|
2017-11-07 18:08:44 +00:00
|
|
|
#define F32X __f32x ()
|
|
|
|
#define F64X __f64x ()
|
|
|
|
#define F128X __f128x ()
|
|
|
|
|
|
|
|
/* Test strfromfN and strtofN on all platforms that provide them,
|
|
|
|
whether or not the type _FloatN is ABI-distinct from other types;
|
|
|
|
likewise _FloatNx functions. */
|
|
|
|
#if __HAVE_FLOAT16
|
|
|
|
# define IF_FLOAT16(x) x
|
|
|
|
#else
|
|
|
|
# define IF_FLOAT16(x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if __HAVE_FLOAT32
|
|
|
|
# define IF_FLOAT32(x) x
|
|
|
|
#else
|
|
|
|
# define IF_FLOAT32(x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if __HAVE_FLOAT64
|
|
|
|
# define IF_FLOAT64(x) x
|
|
|
|
#else
|
|
|
|
# define IF_FLOAT64(x)
|
|
|
|
#endif
|
2016-07-25 18:10:00 +00:00
|
|
|
|
|
|
|
#if __HAVE_FLOAT128
|
|
|
|
# define IF_FLOAT128(x) x
|
|
|
|
#else
|
|
|
|
# define IF_FLOAT128(x)
|
|
|
|
#endif
|
|
|
|
|
2017-11-07 18:08:44 +00:00
|
|
|
#if __HAVE_FLOAT32X
|
|
|
|
# define IF_FLOAT32X(x) x
|
|
|
|
#else
|
|
|
|
# define IF_FLOAT32X(x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if __HAVE_FLOAT64X
|
|
|
|
# define IF_FLOAT64X(x) x
|
|
|
|
#else
|
|
|
|
# define IF_FLOAT64X(x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if __HAVE_FLOAT128X
|
|
|
|
# define IF_FLOAT128X(x) x
|
|
|
|
#else
|
|
|
|
# define IF_FLOAT128X(x)
|
|
|
|
#endif
|
|
|
|
|
2017-06-21 12:20:39 +00:00
|
|
|
/* Provide an extra parameter expansion for mfunc. */
|
|
|
|
#define MMFUNC(mmfunc, ...) mmfunc (__VA_ARGS__)
|
|
|
|
|
2016-05-06 21:00:39 +00:00
|
|
|
/* Splat n variants of the same test for the various strtod functions. */
|
2016-07-25 18:10:00 +00:00
|
|
|
#define GEN_TEST_STRTOD_FOREACH(mfunc, ...) \
|
|
|
|
mfunc ( f, float, strfromf, f, f, ##__VA_ARGS__) \
|
|
|
|
mfunc ( d, double, strfromd, , , ##__VA_ARGS__) \
|
|
|
|
mfunc ( ld, long double, strfroml, L, l, ##__VA_ARGS__) \
|
2017-11-07 18:08:44 +00:00
|
|
|
IF_FLOAT16 (MMFUNC \
|
|
|
|
(mfunc, f16, _Float16, strfromf16, F16, f16, ##__VA_ARGS__)) \
|
|
|
|
IF_FLOAT32 (MMFUNC \
|
|
|
|
(mfunc, f32, _Float32, strfromf32, F32, f32, ##__VA_ARGS__)) \
|
|
|
|
IF_FLOAT64 (MMFUNC \
|
|
|
|
(mfunc, f64, _Float64, strfromf64, F64, f64, ##__VA_ARGS__)) \
|
2017-06-21 12:20:39 +00:00
|
|
|
IF_FLOAT128 (MMFUNC \
|
2017-11-07 18:08:44 +00:00
|
|
|
(mfunc, f128, _Float128, strfromf128, F128, f128, ##__VA_ARGS__)) \
|
|
|
|
IF_FLOAT32X (MMFUNC \
|
|
|
|
(mfunc, f32x, _Float32x, strfromf32x, F32X, f32x, ##__VA_ARGS__)) \
|
|
|
|
IF_FLOAT64X (MMFUNC \
|
|
|
|
(mfunc, f64x, _Float64x, strfromf64x, F64X, f64x, ##__VA_ARGS__)) \
|
|
|
|
IF_FLOAT128X (MMFUNC \
|
|
|
|
(mfunc, f128x, _Float128x, strfromf128x, F128X, f128x, ##__VA_ARGS__))
|
2016-05-06 21:00:39 +00:00
|
|
|
/* The arguments to the generated macros are:
|
|
|
|
FSUF - Function suffix
|
|
|
|
FTYPE - float type
|
|
|
|
FTOSTR - float to string func
|
|
|
|
LSUF - Literal suffix
|
|
|
|
CSUF - C standardish suffix for many of the math functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-11-07 18:08:44 +00:00
|
|
|
#define STRTOD_TEST_FOREACH(mfunc, ...) \
|
|
|
|
({ \
|
|
|
|
int result = 0; \
|
|
|
|
result |= mfunc ## f (__VA_ARGS__); \
|
|
|
|
result |= mfunc ## d (__VA_ARGS__); \
|
|
|
|
result |= mfunc ## ld (__VA_ARGS__); \
|
|
|
|
IF_FLOAT16 (result |= mfunc ## f16 (__VA_ARGS__)); \
|
|
|
|
IF_FLOAT32 (result |= mfunc ## f32 (__VA_ARGS__)); \
|
|
|
|
IF_FLOAT64 (result |= mfunc ## f64 (__VA_ARGS__)); \
|
|
|
|
IF_FLOAT128 (result |= mfunc ## f128 (__VA_ARGS__)); \
|
|
|
|
IF_FLOAT32X (result |= mfunc ## f32x (__VA_ARGS__)); \
|
|
|
|
IF_FLOAT64X (result |= mfunc ## f64x (__VA_ARGS__)); \
|
|
|
|
IF_FLOAT128X (result |= mfunc ## f128x (__VA_ARGS__)); \
|
|
|
|
result; \
|
2016-05-06 21:00:39 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|