From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 39726 invoked by alias); 15 Oct 2019 19:03:55 -0000 Mailing-List: contact glibc-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: , Sender: glibc-cvs-owner@sourceware.org List-Subscribe: Received: (qmail 39632 invoked by uid 10126); 15 Oct 2019 19:03:55 -0000 Date: Tue, 15 Oct 2019 19:03:00 -0000 Message-ID: <20191015190355.39630.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Gabriel F.T.Gomes To: glibc-cvs@sourceware.org Subject: [glibc/gabriel/powerpc-ieee128-printscan] Refactor *cvt functions implementation (5/5) X-Act-Checkin: glibc X-Git-Author: Gabriel F. T. Gomes X-Git-Refname: refs/heads/gabriel/powerpc-ieee128-printscan X-Git-Oldrev: ebd7273305ceee35771c4fe0c7498f31f712cc7a X-Git-Newrev: 46e069a9d85c85f896674c93e3d9a3a6d5934699 X-SW-Source: 2019-q4/txt/msg00062.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=46e069a9d85c85f896674c93e3d9a3a6d5934699 commit 46e069a9d85c85f896674c93e3d9a3a6d5934699 Author: Gabriel F. T. Gomes Date: Tue Oct 15 15:05:53 2019 -0300 Refactor *cvt functions implementation (5/5) This patch is to be squashed with the other n/5 refactoring patches. This patch replaces the use of the APPEND macro with one new macro being defined for each of the cvt* functions. This makes it easier to define functions names for IEEE long double on powerpc64le, e.g. __ecvtieee128. Diff: --- misc/efgcvt-template.c | 19 ++++++------------- misc/efgcvt.c | 11 ++++++++++- misc/efgcvt_r-template.c | 23 ++++++----------------- misc/efgcvt_r.c | 7 ++++++- misc/qefgcvt.c | 11 ++++++++++- misc/qefgcvt_r.c | 7 ++++++- 6 files changed, 44 insertions(+), 34 deletions(-) diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c index aeb4e1e..7fabdf2 100644 --- a/misc/efgcvt-template.c +++ b/misc/efgcvt-template.c @@ -25,8 +25,6 @@ #define APPEND(a, b) APPEND2 (a, b) #define APPEND2(a, b) a##b -#define __APPEND(a, b) __APPEND2 (a, b) -#define __APPEND2(a, b) __##a##b #define FCVT_BUFFER APPEND (FUNC_PREFIX, fcvt_buffer) @@ -39,13 +37,11 @@ static char ECVT_BUFFER[MAXDIG]; libc_freeres_ptr (static char *FCVT_BUFPTR); char * -__APPEND (FUNC_PREFIX, fcvt) (FLOAT_TYPE value, int ndigit, int *decpt, - int *sign) +__FCVT (FLOAT_TYPE value, int ndigit, int *decpt, int *sign) { if (FCVT_BUFPTR == NULL) { - if (__APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, - FCVT_BUFFER, MAXDIG) != -1) + if (__FCVT_R (value, ndigit, decpt, sign, FCVT_BUFFER, MAXDIG) != -1) return FCVT_BUFFER; FCVT_BUFPTR = (char *) malloc (FCVT_MAXDIG); @@ -53,25 +49,22 @@ __APPEND (FUNC_PREFIX, fcvt) (FLOAT_TYPE value, int ndigit, int *decpt, return FCVT_BUFFER; } - (void) __APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, - FCVT_BUFPTR, FCVT_MAXDIG); + (void) __FCVT_R (value, ndigit, decpt, sign, FCVT_BUFPTR, FCVT_MAXDIG); return FCVT_BUFPTR; } char * -__APPEND (FUNC_PREFIX, ecvt) (FLOAT_TYPE value, int ndigit, int *decpt, - int *sign) +__ECVT (FLOAT_TYPE value, int ndigit, int *decpt, int *sign) { - (void) __APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, - ECVT_BUFFER, MAXDIG); + (void) __ECVT_R (value, ndigit, decpt, sign, ECVT_BUFFER, MAXDIG); return ECVT_BUFFER; } char * -__APPEND (FUNC_PREFIX, gcvt) (FLOAT_TYPE value, int ndigit, char *buf) +__GCVT (FLOAT_TYPE value, int ndigit, char *buf) { sprintf (buf, "%.*" FLOAT_FMT_FLAG "g", MIN (ndigit, NDIGIT_MAX), value); return buf; diff --git a/misc/efgcvt.c b/misc/efgcvt.c index 8e6bdbf..f49fdc2 100644 --- a/misc/efgcvt.c +++ b/misc/efgcvt.c @@ -16,7 +16,16 @@ License along with the GNU C Library; if not, see . */ -#include "efgcvt.c" +#define ECVT ecvt +#define FCVT fcvt +#define GCVT gcvt +#define __ECVT __ecvt +#define __FCVT __fcvt +#define __GCVT __gcvt +#define __ECVT_R __ecvt_r +#define __FCVT_R __fcvt_r +#include +#include #if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) # define cvt_symbol(local, symbol) \ diff --git a/misc/efgcvt_r-template.c b/misc/efgcvt_r-template.c index f215dbd..065ecd1 100644 --- a/misc/efgcvt_r-template.c +++ b/misc/efgcvt_r-template.c @@ -26,20 +26,9 @@ #include -#define APPEND(a, b) APPEND2 (a, b) -#define APPEND2(a, b) a##b -#define __APPEND(a, b) __APPEND2 (a, b) -#define __APPEND2(a, b) __##a##b - -#define FLOOR APPEND(floor, FLOAT_NAME_EXT) -#define FABS APPEND(fabs, FLOAT_NAME_EXT) -#define LOG10 APPEND(log10, FLOAT_NAME_EXT) -#define EXP APPEND(exp, FLOAT_NAME_EXT) - - int -__APPEND (FUNC_PREFIX, fcvt_r) (FLOAT_TYPE value, int ndigit, int *decpt, - int *sign, char *buf, size_t len) +__FCVT_R (FLOAT_TYPE value, int ndigit, int *decpt, int *sign, + char *buf, size_t len) { ssize_t n; ssize_t i; @@ -133,8 +122,8 @@ __APPEND (FUNC_PREFIX, fcvt_r) (FLOAT_TYPE value, int ndigit, int *decpt, } int -__APPEND (FUNC_PREFIX, ecvt_r) (FLOAT_TYPE value, int ndigit, int *decpt, - int *sign, char *buf, size_t len) +__ECVT_R (FLOAT_TYPE value, int ndigit, int *decpt, int *sign, + char *buf, size_t len) { int exponent = 0; @@ -193,8 +182,8 @@ __APPEND (FUNC_PREFIX, ecvt_r) (FLOAT_TYPE value, int ndigit, int *decpt, *sign = isfinite (value) ? signbit (value) != 0 : 0; } else - if (__APPEND (FUNC_PREFIX, fcvt_r) (value, MIN (ndigit, NDIGIT_MAX) - 1, - decpt, sign, buf, len)) + if (__FCVT_R (value, MIN (ndigit, NDIGIT_MAX) - 1, + decpt, sign, buf, len)) return -1; *decpt += exponent; diff --git a/misc/efgcvt_r.c b/misc/efgcvt_r.c index f906681..50075bb 100644 --- a/misc/efgcvt_r.c +++ b/misc/efgcvt_r.c @@ -16,7 +16,12 @@ License along with the GNU C Library; if not, see . */ -#include "efgcvt_r.c" +#define ECVT_R ecvt_r +#define FCVT_R fcvt_r +#define __ECVT_R __ecvt_r +#define __FCVT_R __fcvt_r +#include +#include #if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) # define cvt_symbol(local, symbol) \ diff --git a/misc/qefgcvt.c b/misc/qefgcvt.c index cddad1c..0ace26a 100644 --- a/misc/qefgcvt.c +++ b/misc/qefgcvt.c @@ -16,7 +16,16 @@ License along with the GNU C Library; if not, see . */ -#include "efgcvt.c" +#define ECVT qecvt +#define FCVT qfcvt +#define GCVT qgcvt +#define __ECVT __qecvt +#define __FCVT __qfcvt +#define __GCVT __qgcvt +#define __ECVT_R __qecvt_r +#define __FCVT_R __qfcvt_r +#include +#include #if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) # define cvt_symbol(local, symbol) \ diff --git a/misc/qefgcvt_r.c b/misc/qefgcvt_r.c index 7293f1e..5d8deed 100644 --- a/misc/qefgcvt_r.c +++ b/misc/qefgcvt_r.c @@ -17,7 +17,12 @@ License along with the GNU C Library; if not, see . */ -#include "efgcvt_r.c" +#define ECVT_R qecvt_r +#define FCVT_R qfcvt_r +#define __ECVT_R __qecvt_r +#define __FCVT_R __qfcvt_r +#include +#include #if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) # define cvt_symbol(local, symbol) \