public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Gabriel F.T.Gomes <gftg@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/gabriel/powerpc-ieee128-printscan] Refactor *cvt functions implementation (5/5)
Date: Tue, 03 Dec 2019 17:03:00 -0000	[thread overview]
Message-ID: <20191203170344.82813.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e470a3f2e608ddfe4ce3ca1ce2cf8d3896750be3

commit e470a3f2e608ddfe4ce3ca1ce2cf8d3896750be3
Author: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
Date:   Tue Nov 26 14:48:49 2019 -0300

    Refactor *cvt functions implementation (5/5)
    
    Changes since v2:
    
      - Moved the removal of unused macros to a previous patch
    
    Changes since v1:
    
      - Adapted after patch v1 19/31 (remove hidden_* uses) was dropped.
      - Fixed unintended removal of cvt* symbols on alpha and s390x
        (now tested with build-many-glibcs.py).
    
    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.
    
    The commit message is on patch 1-4/5.

Diff:
---
 misc/efgcvt-template.c   | 17 ++++++-----------
 misc/efgcvt.c            | 28 +++++++++++++++++++---------
 misc/efgcvt_r-template.c | 12 ++++++------
 misc/efgcvt_r.c          | 22 +++++++++++++---------
 misc/qefgcvt.c           | 28 ++++++++++++++++++----------
 misc/qefgcvt_r.c         | 22 ++++++++++++----------
 6 files changed, 74 insertions(+), 55 deletions(-)

diff --git a/misc/efgcvt-template.c b/misc/efgcvt-template.c
index 5eea9f6..7fabdf2 100644
--- a/misc/efgcvt-template.c
+++ b/misc/efgcvt-template.c
@@ -37,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);
@@ -51,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 deb975b..ddf3069 100644
--- a/misc/efgcvt.c
+++ b/misc/efgcvt.c
@@ -16,17 +16,27 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#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 <efgcvt-dbl-macros.h>
+#include <efgcvt-template.c>
+
 #if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-# define cvt_symbol(symbol) \
-  cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
-	      APPEND (q, symbol), GLIBC_2_0); \
-  strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+# define cvt_symbol(local, symbol) \
+  cvt_symbol_1 (libc, local, APPEND (q, symbol), GLIBC_2_0); \
+  strong_alias (local, symbol)
 # define cvt_symbol_1(lib, local, symbol, version) \
   compat_symbol (lib, local, symbol, version)
 #else
-# define cvt_symbol(symbol) \
-  strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+# define cvt_symbol(local, symbol) \
+  strong_alias (local, symbol)
 #endif
-cvt_symbol(fcvt);
-cvt_symbol(ecvt);
-cvt_symbol(gcvt);
+cvt_symbol (__fcvt, fcvt);
+cvt_symbol (__ecvt, ecvt);
+cvt_symbol (__gcvt, gcvt);
diff --git a/misc/efgcvt_r-template.c b/misc/efgcvt_r-template.c
index 04457cd..9777501 100644
--- a/misc/efgcvt_r-template.c
+++ b/misc/efgcvt_r-template.c
@@ -30,8 +30,8 @@
 #define APPEND2(a, b) a##b
 
 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;
@@ -125,8 +125,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;
 
@@ -185,8 +185,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 a9ea569..5dabcad 100644
--- a/misc/efgcvt_r.c
+++ b/misc/efgcvt_r.c
@@ -16,20 +16,24 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#define ECVT_R ecvt_r
+#define FCVT_R fcvt_r
+#define __ECVT_R __ecvt_r
+#define __FCVT_R __fcvt_r
+#include <efgcvt-dbl-macros.h>
+#include <efgcvt_r-template.c>
+
 #if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-# define cvt_symbol(symbol) \
-  cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
-	      APPEND (q, symbol), GLIBC_2_0); \
-  weak_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+# define cvt_symbol(local, symbol) \
+  cvt_symbol_1 (libc, local, APPEND (q, symbol), GLIBC_2_0); \
+  weak_alias (local, symbol)
 # define cvt_symbol_1(lib, local, symbol, version) \
   libc_hidden_def (local) \
   compat_symbol (lib, local, symbol, version)
 #else
-# define cvt_symbol(symbol) \
-  cvt_symbol_1 (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
-#  define cvt_symbol_1(local, symbol) \
+# define cvt_symbol(local, symbol) \
   libc_hidden_def (local) \
   weak_alias (local, symbol)
 #endif
-cvt_symbol(fcvt_r);
-cvt_symbol(ecvt_r);
+cvt_symbol (__fcvt_r, fcvt_r);
+cvt_symbol (__ecvt_r, ecvt_r);
diff --git a/misc/qefgcvt.c b/misc/qefgcvt.c
index ed75a4f..903bf93 100644
--- a/misc/qefgcvt.c
+++ b/misc/qefgcvt.c
@@ -16,16 +16,24 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#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 <efgcvt-ldbl-macros.h>
+#include <efgcvt-template.c>
+
 #if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-# define cvt_symbol(symbol) \
-  cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
-	      APPEND (FUNC_PREFIX, symbol), GLIBC_2_4)
-# define cvt_symbol_1(lib, local, symbol, version) \
-    versioned_symbol (lib, local, symbol, version)
+# define cvt_symbol(local, symbol) \
+  versioned_symbol (libc, local, symbol, GLIBC_2_4)
 #else
-# define cvt_symbol(symbol) \
-  strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+# define cvt_symbol(local, symbol) \
+  strong_alias (local, symbol)
 #endif
-cvt_symbol(fcvt);
-cvt_symbol(ecvt);
-cvt_symbol(gcvt);
+cvt_symbol (__qfcvt, qfcvt);
+cvt_symbol (__qecvt, qecvt);
+cvt_symbol (__qgcvt, qgcvt);
diff --git a/misc/qefgcvt_r.c b/misc/qefgcvt_r.c
index b8eb837..b790bf7 100644
--- a/misc/qefgcvt_r.c
+++ b/misc/qefgcvt_r.c
@@ -17,19 +17,21 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#define ECVT_R qecvt_r
+#define FCVT_R qfcvt_r
+#define __ECVT_R __qecvt_r
+#define __FCVT_R __qfcvt_r
+#include <efgcvt-ldbl-macros.h>
+#include <efgcvt_r-template.c>
+
 #if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-# define cvt_symbol(symbol) \
-  cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
-	      APPEND (FUNC_PREFIX, symbol), GLIBC_2_4)
-# define cvt_symbol_1(lib, local, symbol, version) \
+# define cvt_symbol(local, symbol) \
   libc_hidden_def (local) \
-  versioned_symbol (lib, local, symbol, version)
+  versioned_symbol (libc, local, symbol, GLIBC_2_4)
 #else
-# define cvt_symbol(symbol) \
-  cvt_symbol_1 (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
-#  define cvt_symbol_1(local, symbol) \
+# define cvt_symbol(local, symbol) \
   libc_hidden_def (local) \
   weak_alias (local, symbol)
 #endif
-cvt_symbol(fcvt_r);
-cvt_symbol(ecvt_r);
+cvt_symbol (__qfcvt_r, qfcvt_r);
+cvt_symbol (__qecvt_r, qecvt_r);


             reply	other threads:[~2019-12-03 17:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 17:03 Gabriel F.T.Gomes [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-10-25 15:34 Gabriel F.T.Gomes
2019-10-15 19:03 Gabriel F.T.Gomes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191203170344.82813.qmail@sourceware.org \
    --to=gftg@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).