From patchwork Thu Feb 1 21:01:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 868447 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-89907-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="XaDaGVxt"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zXXc60XGMz9ryr for ; Fri, 2 Feb 2018 08:01:57 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=v/iyAXymjAzN5MCJTwF9vdda6K2KP yRuwzRgPXjFnPl82/wwnR1AtXSSrnx5Ikf5Qh8Br5+4eofvPNkYbRYca4vyyc7VR Pzuk2W67yrr/H8WuCwgAmXvN1nqeSQhEdVRqvdn7fDxbgKZsNLv+mz/4aivOk8X5 AWfzh55j+kxc5E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=2/d6bXwIe3ThSs0V+gJla6S750Q=; b=XaD aGVxtRiemWo8OX6jE/362ciS8b1GOq9X1H/8zpcliohOfvB9oESoJOmWOO3VAEO5 L77basCcsFKXvsYFAsYTZ54Z54DCoHXuzoXuC4dqhg7s0AFtBJ09T84M7UA/pW9i vdl+3T8n76rBvGzpAvKwW2XJaBS+RSrfhZlxzfKE= Received: (qmail 22292 invoked by alias); 1 Feb 2018 21:01:52 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 21849 invoked by uid 89); 1 Feb 2018 21:01:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Date: Thu, 1 Feb 2018 21:01:42 +0000 From: Joseph Myers To: Subject: Move LDBL_CLASSIFY_COMPAT to its own header [committed] Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) 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. Committed. 2018-02-01 Joseph Myers * 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]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/s_isinf.c: Include . [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/s_isnan.c: Include . [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c: Include . [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c: Include . [LDBL_CLASSIFY_COMPAT]: Test value, not whether defined. * sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c: Include . [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. diff --git a/sysdeps/arm/ldbl-classify-compat.h b/sysdeps/arm/ldbl-classify-compat.h new file mode 100644 index 0000000..f3f1060 --- /dev/null +++ b/sysdeps/arm/ldbl-classify-compat.h @@ -0,0 +1,8 @@ +#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 + +#endif diff --git a/sysdeps/arm/math_private.h b/sysdeps/arm/math_private.h index d39e9ee..c175b15 100644 --- a/sysdeps/arm/math_private.h +++ b/sysdeps/arm/math_private.h @@ -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 diff --git a/sysdeps/generic/ldbl-classify-compat.h b/sysdeps/generic/ldbl-classify-compat.h new file mode 100644 index 0000000..d77ca18 --- /dev/null +++ b/sysdeps/generic/ldbl-classify-compat.h @@ -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 + . */ + +#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 */ diff --git a/sysdeps/ieee754/dbl-64/s_finite.c b/sysdeps/ieee754/dbl-64/s_finite.c index eed80c6..da1519b 100644 --- a/sysdeps/ieee754/dbl-64/s_finite.c +++ b/sysdeps/ieee754/dbl-64/s_finite.c @@ -21,6 +21,7 @@ static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $"; #include #include +#include #include #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 diff --git a/sysdeps/ieee754/dbl-64/s_isinf.c b/sysdeps/ieee754/dbl-64/s_isinf.c index c0ad545..93eb65c 100644 --- a/sysdeps/ieee754/dbl-64/s_isinf.c +++ b/sysdeps/ieee754/dbl-64/s_isinf.c @@ -15,6 +15,7 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $"; #include #include +#include #include 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) diff --git a/sysdeps/ieee754/dbl-64/s_isnan.c b/sysdeps/ieee754/dbl-64/s_isnan.c index 642ec3a..82723ee 100644 --- a/sysdeps/ieee754/dbl-64/s_isnan.c +++ b/sysdeps/ieee754/dbl-64/s_isnan.c @@ -21,6 +21,7 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $"; #include #include +#include #include #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) diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c index ef51608..4067692 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -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 diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c index 951fb73..2b427a8 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c @@ -11,6 +11,7 @@ #include #include +#include #include 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) diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c index bcff9e3..cd805d1 100644 --- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c +++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -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) diff --git a/sysdeps/m68k/coldfire/ldbl-classify-compat.h b/sysdeps/m68k/coldfire/ldbl-classify-compat.h new file mode 100644 index 0000000..c1ec4d4 --- /dev/null +++ b/sysdeps/m68k/coldfire/ldbl-classify-compat.h @@ -0,0 +1,8 @@ +#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 + +#endif diff --git a/sysdeps/m68k/coldfire/math_private.h b/sysdeps/m68k/coldfire/math_private.h deleted file mode 100644 index d306a50..0000000 --- a/sysdeps/m68k/coldfire/math_private.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef COLDFIRE_MATH_PRIVATE_H -#define COLDFIRE_MATH_PRIVATE_H 1 - -/* Enable __finitel, __isinfl, and __isnanl for binary compatibility - when built without long double support. */ -#define LDBL_CLASSIFY_COMPAT 1 - -#include_next - -#endif diff --git a/sysdeps/microblaze/ldbl-classify-compat.h b/sysdeps/microblaze/ldbl-classify-compat.h new file mode 100644 index 0000000..38c5c99 --- /dev/null +++ b/sysdeps/microblaze/ldbl-classify-compat.h @@ -0,0 +1,8 @@ +#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 + +#endif diff --git a/sysdeps/microblaze/math_private.h b/sysdeps/microblaze/math_private.h deleted file mode 100644 index 64dc181..0000000 --- a/sysdeps/microblaze/math_private.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef MICROBLAZE_MATH_PRIVATE_H -#define MICROBLAZE_MATH_PRIVATE_H 1 - -/* Enable __finitel, __isinfl, and __isnanl for binary compatibility - when built without long double support. */ -#define LDBL_CLASSIFY_COMPAT 1 - -#include_next - -#endif diff --git a/sysdeps/mips/ldbl-classify-compat.h b/sysdeps/mips/ldbl-classify-compat.h new file mode 100644 index 0000000..547ac7b --- /dev/null +++ b/sysdeps/mips/ldbl-classify-compat.h @@ -0,0 +1,8 @@ +#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 + +#endif diff --git a/sysdeps/mips/math_private.h b/sysdeps/mips/math_private.h index a3c2513..01ae8b1 100644 --- a/sysdeps/mips/math_private.h +++ b/sysdeps/mips/math_private.h @@ -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 #endif diff --git a/sysdeps/nios2/ldbl-classify-compat.h b/sysdeps/nios2/ldbl-classify-compat.h new file mode 100644 index 0000000..a9614de --- /dev/null +++ b/sysdeps/nios2/ldbl-classify-compat.h @@ -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 diff --git a/sysdeps/nios2/math_private.h b/sysdeps/nios2/math_private.h deleted file mode 100644 index bc7f9c8..0000000 --- a/sysdeps/nios2/math_private.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef NIO2_MATH_PRIVATE_H -#define NIO2_MATH_PRIVATE_H 1 - -/* Enable __finitel, __isinfl, and __isnanl for binary compatibility - when built without long double support. */ -#define LDBL_CLASSIFY_COMPAT 1 - -#include_next - -#endif diff --git a/sysdeps/sh/ldbl-classify-compat.h b/sysdeps/sh/ldbl-classify-compat.h new file mode 100644 index 0000000..d3b978c --- /dev/null +++ b/sysdeps/sh/ldbl-classify-compat.h @@ -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 diff --git a/sysdeps/sh/math_private.h b/sysdeps/sh/math_private.h deleted file mode 100644 index d13f2d4..0000000 --- a/sysdeps/sh/math_private.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef SH_MATH_PRIVATE_H -#define SH_MATH_PRIVATE_H 1 - -/* Enable __finitel, __isinfl, and __isnanl for binary compatibility - when built without long double support. */ -#define LDBL_CLASSIFY_COMPAT 1 - -#include_next - -#endif