From patchwork Tue Dec 5 18:32:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 844878 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-87845-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="kZudaZmo"; 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 3yrr336dk1z9t3r for ; Wed, 6 Dec 2017 05:33:03 +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=pBIO0Iz1iU9YEkHOgRXaTGLS5IigV 4iaHN30Wdwr/LT0psFJaolAy19FbDUXO9y3BR6pdy10LWcHwmR7R5On92X/HAxYi eXtGS3ImkI/8seRiA64NZfpE6Y9v0RlKwbt6IauZLKXDZ9nPT8qYE/DerUzLcGT6 vbSOYONeqh4JL0= 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=khT//ZsdNyaJEU3PWD3FMfl8MCw=; b=kZu daZmosPcdy+gKchoA5PquO99NkjKewMh4xj+1IH3e8bDHKoB7OCJ0X5u5r2m5X6f 6mx+VvC9mOTUhW83LN3gTz/GIjLlOGDied3SQsyiOmDl51HnCFFh0UaDSLGd498E vKM0Q9KGnlmEDH3xmeKFINLxsEqN99gdML6cfooQ= Received: (qmail 59127 invoked by alias); 5 Dec 2017 18:32:57 -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 59117 invoked by uid 89); 5 Dec 2017 18:32:56 -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: Tue, 5 Dec 2017 18:32:48 +0000 From: Joseph Myers To: Subject: Support defining strtof64, strtof32x, wcstof64, wcstof32x aliases [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-03.mgc.mentorg.com (139.181.222.3) This patch adds support for defining strtof64, strtof32x, wcstof64, wcstof32x and the corresponding _l functions as aliases of the corresponding double functions when _Float64 and _Float32x support is enabled. Tested for x86_64; also tested with build-many-glibcs.py in conjunction with other _Float64 / _Float32x changes. Committed. 2017-12-05 Joseph Myers * stdlib/strtod.c: Include . (BUILD_DOUBLE): New macro. [BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64] (strtof64): Define and later undefine as macro. Define as weak alias if [!USE_WIDE_CHAR]. [BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64] (wcstof64): Define and later undefine as macro. Define as weak alias if [USE_WIDE_CHAR]. [BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X] (strtof32x): Define and later undefine as macro. Define as weak alias if [!USE_WIDE_CHAR]. [BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X] (wcstof32x): Define and later undefine as macro. Define as weak alias if [USE_WIDE_CHAR]. * stdlib/strtod_l.c: Include . (BUILD_DOUBLE): New macro. [BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64] (strtof64_l): Define and later undefine as macro. Define as weak alias if [!USE_WIDE_CHAR]. [BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64] (wcstof64_l): Define and later undefine as macro. Define as weak alias if [USE_WIDE_CHAR]. [BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X] (strtof32x_l): Define and later undefine as macro. Define as weak alias if [!USE_WIDE_CHAR]. [BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X] (wcstof32x_l): Define and later undefine as macro. Define as weak alias if [USE_WIDE_CHAR]. diff --git a/stdlib/strtod.c b/stdlib/strtod.c index 2ac1b2e..546ab9e3 100644 --- a/stdlib/strtod.c +++ b/stdlib/strtod.c @@ -17,6 +17,25 @@ License along with the GNU C Library; if not, see . */ +#include + +#ifdef FLOAT +# define BUILD_DOUBLE 0 +#else +# define BUILD_DOUBLE 1 +#endif + +#if BUILD_DOUBLE +# if __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64 +# define strtof64 __hide_strtof64 +# define wcstof64 __hide_wcstof64 +# endif +# if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X +# define strtof32x __hide_strtof32x +# define wcstof32x __hide_wcstof32x +# endif +#endif + #include #include #include @@ -78,3 +97,24 @@ compat_symbol (libc, __strtod_internal, __strtold_internal, GLIBC_2_0); # endif # endif #endif + +#if BUILD_DOUBLE +# if __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64 +# undef strtof64 +# undef wcstof64 +# ifdef USE_WIDE_CHAR +weak_alias (wcstod, wcstof64) +# else +weak_alias (strtod, strtof64) +# endif +# endif +# if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X +# undef strtof32x +# undef wcstof32x +# ifdef USE_WIDE_CHAR +weak_alias (wcstod, wcstof32x) +# else +weak_alias (strtod, strtof32x) +# endif +# endif +#endif diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index 9fc9e4c..3008721 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -17,6 +17,25 @@ License along with the GNU C Library; if not, see . */ +#include + +#ifdef FLOAT +# define BUILD_DOUBLE 0 +#else +# define BUILD_DOUBLE 1 +#endif + +#if BUILD_DOUBLE +# if __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64 +# define strtof64_l __hide_strtof64_l +# define wcstof64_l __hide_wcstof64_l +# endif +# if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X +# define strtof32x_l __hide_strtof32x_l +# define wcstof32x_l __hide_wcstof32x_l +# endif +#endif + #include extern double ____strtod_l_internal (const char *, char **, int, locale_t); @@ -1784,3 +1803,24 @@ compat_symbol (libc, strtod_l, strtold_l, GLIBC_2_3); # endif # endif #endif + +#if BUILD_DOUBLE +# if __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64 +# undef strtof64_l +# undef wcstof64_l +# ifdef USE_WIDE_CHAR +weak_alias (wcstod_l, wcstof64_l) +# else +weak_alias (strtod_l, strtof64_l) +# endif +# endif +# if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X +# undef strtof32x_l +# undef wcstof32x_l +# ifdef USE_WIDE_CHAR +weak_alias (wcstod_l, wcstof32x_l) +# else +weak_alias (strtod_l, strtof32x_l) +# endif +# endif +#endif