glibc/sysdeps/ieee754/dbl-64/s_isnan.c
Chris Metcalf e59c94fa0e math: add LDBL_CLASSIFY_COMPAT support
If a platform does not define "long-double-fcts = yes" in its
Makefiles and it does define __NO_LONG_DOUBLE_MATH in its installed
headers, it will currently create exported symbols for __finitel,
__isinfl, and __isnanl that can't be reached from userspace by
correct use of the finite(), isinf(), or isnan() macros in <math.h>.

To avoid this situation, by default for such platforms we now no
longer export these symbols, thus causing appropriate link-time
errors.  However, for platforms that previously exported these
symbols, we continue to do so as compat symbols; this is enabled
by adding LDBL_CLASSIFY_COMPAT to math_private.h for the platform.

For tile, remove the now-unnecessary exports of those functions from
libc and libm.
2015-12-03 13:00:46 -05:00

45 lines
1.1 KiB
C

/* @(#)s_isnan.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#if defined(LIBM_SCCS) && !defined(lint)
static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
#endif
/*
* isnan(x) returns 1 is x is nan, else 0;
* no branching!
*/
#include <math.h>
#include <math_private.h>
#include <shlib-compat.h>
#undef __isnan
int
__isnan (double x)
{
int32_t hx, lx;
EXTRACT_WORDS (hx, lx, x);
hx &= 0x7fffffff;
hx |= (u_int32_t) (lx | (-lx)) >> 31;
hx = 0x7ff00000 - hx;
return (int) (((u_int32_t) hx) >> 31);
}
hidden_def (__isnan)
weak_alias (__isnan, isnan)
#ifdef NO_LONG_DOUBLE
# if defined LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
# endif
weak_alias (__isnan, isnanl)
#endif