mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
Move LDBL_CLASSIFY_COMPAT to its own header.
The general rule in glibc is that it's better for a macro to be always defined, and tested with #if, than for it to be tested with #ifdef, because the latter is prone to typos in the macro name as well as to the header with the macro accidentally not being included in a file testing it. (Testing with an "if" statement is even better, in those cases where it's possible to do things that way, as it then means both cases in the code get checked for syntax in glibc builds with either value of the condition.) math_private.h has several different groups of macros, meaning that architectures wanting to override some of them need to define those then include the generic version, which then defines macros if not already defined. It's hard to avoid that arrangement completely, but various cases can be improved by splitting out macros or groups of macros into separate files. This patch splits out the LDBL_CLASSIFY_COMPAT macro into a separate ldbl-classify-compat.h header. This macro is tested with #ifdef; this patch changes it to testing with #if, with a default definition to 0 in the generic header and then architecture-specific headers defining it to 1. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by the patch. * sysdeps/generic/ldbl-classify-compat.h: New file. * sysdeps/arm/ldbl-classify-compat.h: Likewise. * sysdeps/m68k/coldfire/ldbl-classify-compat.h: Likewise. * sysdeps/microblaze/ldbl-classify-compat.h: Likewise. * sysdeps/mips/ldbl-classify-compat.h: Likewise. * sysdeps/nios2/ldbl-classify-compat.h: Likewise. * sysdeps/sh/ldbl-classify-compat.h: Likewise. * sysdeps/ieee754/dbl-64/s_finite.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/s_isinf.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/s_isnan.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c: Include <ldbl-classify-compat.h>. [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/arm/math_private.h (LDBL_CLASSIFY_COMPAT): Remove macro. * sysdeps/mips/math_private.h (LDBL_CLASSIFY_COMPAT): Likewise. * sysdeps/m68k/coldfire/math_private.h: Remove file. * sysdeps/microblaze/math_private.h: Likewise. * sysdeps/nios2/math_private.h: Likewise. * sysdeps/sh/math_private.h: Likewise.
This commit is contained in:
parent
eb65a3d545
commit
6f9a3dd8b8
32
ChangeLog
32
ChangeLog
@ -1,5 +1,37 @@
|
||||
2018-02-01 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* sysdeps/generic/ldbl-classify-compat.h: New file.
|
||||
* sysdeps/arm/ldbl-classify-compat.h: Likewise.
|
||||
* sysdeps/m68k/coldfire/ldbl-classify-compat.h: Likewise.
|
||||
* sysdeps/microblaze/ldbl-classify-compat.h: Likewise.
|
||||
* sysdeps/mips/ldbl-classify-compat.h: Likewise.
|
||||
* sysdeps/nios2/ldbl-classify-compat.h: Likewise.
|
||||
* sysdeps/sh/ldbl-classify-compat.h: Likewise.
|
||||
* sysdeps/ieee754/dbl-64/s_finite.c: Include
|
||||
<ldbl-classify-compat.h>.
|
||||
[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
|
||||
* sysdeps/ieee754/dbl-64/s_isinf.c: Include
|
||||
<ldbl-classify-compat.h>.
|
||||
[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
|
||||
* sysdeps/ieee754/dbl-64/s_isnan.c: Include
|
||||
<ldbl-classify-compat.h>.
|
||||
[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
|
||||
* sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c: Include
|
||||
<ldbl-classify-compat.h>.
|
||||
[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
|
||||
* sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c: Include
|
||||
<ldbl-classify-compat.h>.
|
||||
[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
|
||||
* sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c: Include
|
||||
<ldbl-classify-compat.h>.
|
||||
[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
|
||||
* sysdeps/arm/math_private.h (LDBL_CLASSIFY_COMPAT): Remove macro.
|
||||
* sysdeps/mips/math_private.h (LDBL_CLASSIFY_COMPAT): Likewise.
|
||||
* sysdeps/m68k/coldfire/math_private.h: Remove file.
|
||||
* sysdeps/microblaze/math_private.h: Likewise.
|
||||
* sysdeps/nios2/math_private.h: Likewise.
|
||||
* sysdeps/sh/math_private.h: Likewise.
|
||||
|
||||
* sysdeps/m68k/coldfire/fpu/math_private.h: Move to ....
|
||||
* sysdeps/m68k/coldfire/math_private.h: ... here.
|
||||
* sysdeps/m68k/coldfire/nofpu/math_private.h: Remove file.
|
||||
|
@ -1,10 +1,8 @@
|
||||
#ifndef SH_MATH_PRIVATE_H
|
||||
#define SH_MATH_PRIVATE_H 1
|
||||
#ifndef ARM_LDBL_CLASSIFY_COMPAT_H
|
||||
#define ARM_LDBL_CLASSIFY_COMPAT_H 1
|
||||
|
||||
/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
|
||||
when built without long double support. */
|
||||
#define LDBL_CLASSIFY_COMPAT 1
|
||||
|
||||
#include_next <math_private.h>
|
||||
|
||||
#endif
|
@ -1,10 +1,6 @@
|
||||
#ifndef ARM_MATH_PRIVATE_H
|
||||
#define ARM_MATH_PRIVATE_H 1
|
||||
|
||||
/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
|
||||
when built without long double support. */
|
||||
#define LDBL_CLASSIFY_COMPAT 1
|
||||
|
||||
#include "fenv_private.h"
|
||||
#include_next <math_private.h>
|
||||
|
||||
|
33
sysdeps/generic/ldbl-classify-compat.h
Normal file
33
sysdeps/generic/ldbl-classify-compat.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* Specify whether there should be compat symbol aliases for some
|
||||
classification functions. Generic version.
|
||||
Copyright (C) 2015-2018 Free Software Foundation, Inc.
|
||||
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
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LDBL_CLASSIFY_COMPAT_H
|
||||
#define _LDBL_CLASSIFY_COMPAT_H 1
|
||||
|
||||
/* If defined to 1, enable __finitel, __isinfl, and __isnanl function
|
||||
aliases for binary compatibility when built without long double
|
||||
support. If defined to 0, or if long double does not have the same
|
||||
format as double, there are no such aliases. New ports should use
|
||||
the default definition of this as 0, as such
|
||||
implementation-namespace functions should only have one exported
|
||||
name per floating-point format, not one per floating-point
|
||||
type. */
|
||||
#define LDBL_CLASSIFY_COMPAT 0
|
||||
|
||||
#endif /* ldbl-classify-compat.h */
|
@ -21,6 +21,7 @@ static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $";
|
||||
|
||||
#include <math.h>
|
||||
#include <math_private.h>
|
||||
#include <ldbl-classify-compat.h>
|
||||
#include <shlib-compat.h>
|
||||
|
||||
#undef __finite
|
||||
@ -38,7 +39,7 @@ int FINITE(double x)
|
||||
hidden_def (__finite)
|
||||
weak_alias (__finite, finite)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
# ifdef LDBL_CLASSIFY_COMPAT
|
||||
# if LDBL_CLASSIFY_COMPAT
|
||||
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
|
||||
compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
|
||||
# endif
|
||||
|
@ -15,6 +15,7 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
|
||||
|
||||
#include <math.h>
|
||||
#include <math_private.h>
|
||||
#include <ldbl-classify-compat.h>
|
||||
#include <shlib-compat.h>
|
||||
|
||||
int
|
||||
@ -29,7 +30,7 @@ __isinf (double x)
|
||||
hidden_def (__isinf)
|
||||
weak_alias (__isinf, isinf)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
# if defined LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
|
||||
# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
|
||||
compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
|
||||
# endif
|
||||
weak_alias (__isinf, isinfl)
|
||||
|
@ -21,6 +21,7 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
|
||||
|
||||
#include <math.h>
|
||||
#include <math_private.h>
|
||||
#include <ldbl-classify-compat.h>
|
||||
#include <shlib-compat.h>
|
||||
|
||||
#undef __isnan
|
||||
@ -37,7 +38,7 @@ __isnan (double x)
|
||||
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)
|
||||
# if 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)
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <math_private.h>
|
||||
#include <ldbl-classify-compat.h>
|
||||
#include <shlib-compat.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@ -30,7 +31,7 @@ __finite(double x)
|
||||
hidden_def (__finite)
|
||||
weak_alias (__finite, finite)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
# ifdef LDBL_CLASSIFY_COMPAT
|
||||
# if LDBL_CLASSIFY_COMPAT
|
||||
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
|
||||
compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
|
||||
# endif
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <math_private.h>
|
||||
#include <ldbl-classify-compat.h>
|
||||
#include <shlib-compat.h>
|
||||
|
||||
int
|
||||
@ -26,7 +27,7 @@ __isinf (double x)
|
||||
hidden_def (__isinf)
|
||||
weak_alias (__isinf, isinf)
|
||||
#ifdef NO_LONG_DOUBLE
|
||||
# if defined LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
|
||||
# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
|
||||
compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
|
||||
# endif
|
||||
weak_alias (__isinf, isinfl)
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <math_private.h>
|
||||
#include <ldbl-classify-compat.h>
|
||||
#include <shlib-compat.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@ -32,7 +33,7 @@ int __isnan(double x)
|
||||
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)
|
||||
# if 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)
|
||||
|
@ -1,10 +1,8 @@
|
||||
#ifndef NIO2_MATH_PRIVATE_H
|
||||
#define NIO2_MATH_PRIVATE_H 1
|
||||
#ifndef COLDFIRE_LDBL_CLASSIFY_COMPAT_H
|
||||
#define COLDFIRE_LDBL_CLASSIFY_COMPAT_H 1
|
||||
|
||||
/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
|
||||
when built without long double support. */
|
||||
#define LDBL_CLASSIFY_COMPAT 1
|
||||
|
||||
#include_next <math_private.h>
|
||||
|
||||
#endif
|
@ -1,10 +1,8 @@
|
||||
#ifndef COLDFIRE_MATH_PRIVATE_H
|
||||
#define COLDFIRE_MATH_PRIVATE_H 1
|
||||
#ifndef MICROBLAZE_LDBL_CLASSIFY_COMPAT_H
|
||||
#define MICROBLAZE_LDBL_CLASSIFY_COMPAT_H 1
|
||||
|
||||
/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
|
||||
when built without long double support. */
|
||||
#define LDBL_CLASSIFY_COMPAT 1
|
||||
|
||||
#include_next <math_private.h>
|
||||
|
||||
#endif
|
@ -1,10 +1,8 @@
|
||||
#ifndef MICROBLAZE_MATH_PRIVATE_H
|
||||
#define MICROBLAZE_MATH_PRIVATE_H 1
|
||||
#ifndef MIPS_LDBL_CLASSIFY_COMPAT_H
|
||||
#define MIPS_LDBL_CLASSIFY_COMPAT_H 1
|
||||
|
||||
/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
|
||||
when built without long double support. */
|
||||
#define LDBL_CLASSIFY_COMPAT 1
|
||||
|
||||
#include_next <math_private.h>
|
||||
|
||||
#endif
|
@ -240,10 +240,6 @@ libc_feholdsetround_mips_ctx (struct rm_ctx *ctx, int round)
|
||||
|
||||
#endif
|
||||
|
||||
/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
|
||||
when built without long double support. */
|
||||
#define LDBL_CLASSIFY_COMPAT 1
|
||||
|
||||
#include_next <math_private.h>
|
||||
|
||||
#endif
|
||||
|
8
sysdeps/nios2/ldbl-classify-compat.h
Normal file
8
sysdeps/nios2/ldbl-classify-compat.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef NIOS2_LDBL_CLASSIFY_COMPAT_H
|
||||
#define NIOS2_LDBL_CLASSIFY_COMPAT_H 1
|
||||
|
||||
/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
|
||||
when built without long double support. */
|
||||
#define LDBL_CLASSIFY_COMPAT 1
|
||||
|
||||
#endif
|
8
sysdeps/sh/ldbl-classify-compat.h
Normal file
8
sysdeps/sh/ldbl-classify-compat.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef SH_LDBL_CLASSIFY_COMPAT_H
|
||||
#define SH_LDBL_CLASSIFY_COMPAT_H 1
|
||||
|
||||
/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
|
||||
when built without long double support. */
|
||||
#define LDBL_CLASSIFY_COMPAT 1
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user