glibc/sysdeps
Joseph Myers a60eca2e55 Simplify HUGE_VAL definitions.
There are various bits/huge_val*.h headers to define HUGE_VAL and
related macros.  All of them use __builtin_huge_val etc. for GCC 3.3
and later.  Then there are various fallbacks, such as using a large
hex float constant for GCC 2.96 and later, or using unions (with or
without compound literals) to construct the bytes of an infinity, with
this last being the reason for having architecture-specific files.
Supporting TS 18661-3 _FloatN / _FloatNx types that have the same
format as other supported types will mean adding more such macros;
needing to add more headers for them doesn't seem very desirable.

The fallbacks based on bytes of the representation of an infinity do
not meet the standard requirements for a constant expression.  At
least one of them is also wrong: sysdeps/sh/bits/huge_val.h is
producing a mixed-endian representation which does not match what GCC
does.

This patch eliminates all those headers, defining the macros directly
in math.h.  For GCC 3.3 and later, the built-in functions are used as
now.  For other compilers, a large constant 1e10000 (with appropriate
suffix) is used.  This is like the fallback for GCC 2.96 and later,
but without using hex floats (which have no apparent advantage here).
It is unambiguously valid standard C for all floating-point formats
with infinities, which covers all formats supported by glibc or likely
to be supported by glibc in future (C90 DR#025 said that if a
floating-point format represents infinities, all real values lie
within the range of representable values, so the constraints for
constant expressions are not violated), but may generate compiler
warnings and wouldn't handle the TS 18661-1 FENV_ROUND pragma
correctly.  If someone is actually using a compiler with glibc that
does not claim to be GCC 3.3 or later, but which has a better way to
define the HUGE_VAL macros, we can always add compiler conditionals in
with alternative definitions.

I intend to make similar changes for INF and NAN.  The SNAN macros
already just use __builtin_nans etc. with no fallback for compilers
not claiming to be GCC 3.3 or later.

Tested for x86_64.

	* math/math.h: Do not include bits/huge_val.h, bits/huge_valf.h,
	bits/huge_vall.h or bits/huge_val_flt128.h.
	(HUGE_VAL): Define directly here.
	[__USE_ISOC99] (HUGE_VALF): Likewise.
	[__USE_ISOC99] (HUGE_VALL): Likewise.
	[__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
	(HUGE_VAL_F128): Likewise.
	* math/Makefile (headers): Remove bits/huge_val.h,
	bits/huge_valf.h, bits/huge_vall.h and bits/huge_val_flt128.h.
	* bits/huge_val.h: Remove.
	* bits/huge_val_flt128.h: Likewise.
	* bits/huge_valf.h: Likewise.
	* bits/huge_vall.h: Likewise.
	* sysdeps/ia64/bits/huge_vall.h: Likewise.
	* sysdeps/ieee754/bits/huge_val.h: Likewise.
	* sysdeps/ieee754/bits/huge_valf.h: Likewise.
	* sysdeps/m68k/m680x0/bits/huge_vall.h: Likewise.
	* sysdeps/sh/bits/huge_val.h: Likewise.
	* sysdeps/sparc/bits/huge_vall.h: Likewise.
	* sysdeps/x86/bits/huge_vall.h: Likewise.
2017-08-31 15:50:50 +00:00
..
aarch64 elf: Remove internal_function attribute 2017-08-31 16:59:37 +02:00
alpha Remove sysdeps/alpha/bb_init_func.S 2017-08-20 06:51:15 -07:00
arm elf: Remove internal_function attribute 2017-08-31 16:59:37 +02:00
generic elf: Remove internal_function attribute 2017-08-31 16:59:37 +02:00
gnu Regenerate sysdeps/gnu/errlist.c. 2017-06-04 15:27:14 -04:00
hppa Remove extra semicolons in struct pthread_mutex (bug 21804) 2017-07-24 12:22:05 +02:00
i386 elf: Remove internal_function attribute 2017-08-31 16:59:37 +02:00
ia64 Simplify HUGE_VAL definitions. 2017-08-31 15:50:50 +00:00
ieee754 Simplify HUGE_VAL definitions. 2017-08-31 15:50:50 +00:00
init_array Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
m68k Simplify HUGE_VAL definitions. 2017-08-31 15:50:50 +00:00
mach elf: Remove internal_function attribute 2017-08-31 16:59:37 +02:00
microblaze Update Microblaze libm-test-ulps 2017-07-28 09:19:40 -03:00
mips Fix mcontext_t sigcontext namespace (bug 21457). 2017-08-30 22:02:04 +00:00
nios2 elf: Remove internal_function attribute 2017-08-31 16:59:37 +02:00
nptl Remove extra semicolons in struct pthread_mutex (bug 21804) 2017-07-24 12:22:05 +02:00
posix dirent: Remove internal_function attribute 2017-08-31 16:02:40 +02:00
powerpc Provide a C++ version of iszero that does not use __MATH_TG (bug 21930) 2017-08-28 15:22:37 -03:00
pthread aio: Remove internal_function function attribute 2017-08-31 15:59:06 +02:00
s390 S390: Add new s390 platform z14. 2017-08-15 14:00:07 +02:00
sh Simplify HUGE_VAL definitions. 2017-08-31 15:50:50 +00:00
sparc Simplify HUGE_VAL definitions. 2017-08-31 15:50:50 +00:00
tile elf: Remove internal_function attribute 2017-08-31 16:59:37 +02:00
unix elf: Remove internal_function attribute 2017-08-31 16:59:37 +02:00
wordsize-32 Build divdi3 only for architecture that required it 2017-04-06 15:14:34 -03:00
wordsize-64 Add missing header files throughout the testsuite. 2017-02-16 17:33:18 -05:00
x86 Simplify HUGE_VAL definitions. 2017-08-31 15:50:50 +00:00
x86_64 elf: Remove internal_function attribute 2017-08-31 16:59:37 +02:00