[PATCH 05/20] Use <gmp-rename.h> for defining alias as well
Richard Henderson
rth at twiddle.net
Mon Mar 4 19:41:35 CET 2013
There aren't many of them, but we'll be better off in the end.
---
gen-rename.c | 2 ++
gmp-h.in | 17 ++++++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/gen-rename.c b/gen-rename.c
index 0ff4ea5..a4fd854 100644
--- a/gen-rename.c
+++ b/gen-rename.c
@@ -26,5 +26,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#define __GMP_WITHIN_CONFIGURE
#define __GMP_PUBLIC_FULL(TYPE, API_NAME, ARGS, NT, ATTRS, ABI_NAME) \
__GMP_XYZZY API_NAME ABI_NAME
+#define __GMP_PUBLIC_ALIAS_FULL(NEW_NAME, OLD_NAME, ABI_NAME) \
+ __GMP_XYZZY NEW_NAME ABI_NAME
#include "gmp.h"
diff --git a/gmp-h.in b/gmp-h.in
index 33a5d63..157b3d8 100644
--- a/gmp-h.in
+++ b/gmp-h.in
@@ -249,10 +249,12 @@ typedef __mpq_struct *mpq_ptr;
__GMP_PUBLIC_NT - for "no-throw" functions
__GMP_PUBLIC_NT_A - for "no-throw" functions with attributes
__GMP_PUBLIC_DATA - for declaring data variables
+ __GMP_PUBLIC_ALIAS - for re-declaring symbols with another name
*/
#if !defined(__GMP_WITHIN_CONFIGURE) || !defined(__GMP_PUBLIC_FULL)
#define __GMP_PUBLIC_FULL(TYPE, API_NAME, ARGS, NT, ATTRS, ABI_NAME) \
__GMP_DECLSPEC TYPE API_NAME ARGS NT ATTRS
+#define __GMP_PUBLIC_ALIAS_FULL(NEW_NAME, OLD_NAME, ABI_NAME)
#endif
#define __GMP_GLU1(X, Y) X ## Y
@@ -273,6 +275,10 @@ typedef __mpq_struct *mpq_ptr;
__GMP_PUBLIC_FULL(extern TYPE, API_NAME, , , , \
__GMP_GLUE(__GMP_ABI_PREFIX, API_NAME))
+#define __GMP_PUBLIC_ALIAS(NEW_NAME, OLD_NAME) \
+ __GMP_PUBLIC_ALIAS_FULL(NEW_NAME, OLD_NAME, \
+ __GMP_GLUE(__GMP_ABI_PREFIX, OLD_NAME))
+
/* When using GCC, we'll adjust the API symbol to point to the ABI symbol
automatically. Otherwise, we'll have generated and installed a set of
defines that will perform the remapping at the preprocessor level. */
@@ -637,9 +643,9 @@ __GMP_PUBLIC (int, gmp_vsscanf, (const char *, const char *, va_list));
#undef __GMP_ABI_PREFIX
#define __GMP_ABI_PREFIX __g
-#define mpz_realloc __gmpz_realloc
__GMP_PUBLIC_FULL (void *, _mpz_realloc, (mpz_ptr, mp_size_t),
/* no nothrow */, /* no attrs */, __gmpz_realloc);
+__GMP_PUBLIC_ALIAS_FULL (mpz_realloc, _mpz_realloc, __gmpz_realloc)
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs)
__GMP_PUBLIC (void, mpz_abs, (mpz_ptr, mpz_srcptr));
@@ -860,7 +866,7 @@ __GMP_PUBLIC (void, mpz_ior, (mpz_ptr, mpz_srcptr, mpz_srcptr));
__GMP_PUBLIC_A (int, mpz_jacobi, (mpz_srcptr, mpz_srcptr),
__GMP_ATTRIBUTE_PURE);
-#define mpz_kronecker mpz_jacobi /* alias */
+__GMP_PUBLIC_ALIAS (mpz_kronecker, mpz_jacobi)
__GMP_PUBLIC_A (int, mpz_kronecker_si, (mpz_srcptr, long),
__GMP_ATTRIBUTE_PURE);
@@ -878,7 +884,7 @@ __GMP_PUBLIC (void, mpz_lcm, (mpz_ptr, mpz_srcptr, mpz_srcptr));
__GMP_PUBLIC (void, mpz_lcm_ui, (mpz_ptr, mpz_srcptr, unsigned long));
-#define mpz_legendre mpz_jacobi /* alias */
+__GMP_PUBLIC_ALIAS (mpz_legendre, mpz_jacobi)
__GMP_PUBLIC (void, mpz_lucnum_ui, (mpz_ptr, unsigned long int));
@@ -888,7 +894,8 @@ __GMP_PUBLIC_A (int, mpz_millerrabin, (mpz_srcptr, int), __GMP_ATTRIBUTE_PURE);
__GMP_PUBLIC (void, mpz_mod, (mpz_ptr, mpz_srcptr, mpz_srcptr));
-#define mpz_mod_ui mpz_fdiv_r_ui /* same as fdiv_r because divisor unsigned */
+/* same as fdiv_r because divisor unsigned */
+__GMP_PUBLIC_ALIAS (mpz_mod_ui, mpz_fdiv_r_ui)
__GMP_PUBLIC (void, mpz_mul, (mpz_ptr, mpz_srcptr, mpz_srcptr));
@@ -1031,8 +1038,8 @@ __GMP_PUBLIC (void, mpz_urandomb, (mpz_ptr, gmp_randstate_t, mp_bitcnt_t));
__GMP_PUBLIC (void, mpz_urandomm, (mpz_ptr, gmp_randstate_t, mpz_srcptr));
-#define mpz_eor __gmpz_xor
__GMP_PUBLIC (void, mpz_xor, (mpz_ptr, mpz_srcptr, mpz_srcptr));
+__GMP_PUBLIC_ALIAS (mpz_eor, mpz_xor)
__GMP_PUBLIC (mp_srcptr, mpz_limbs_read, (mpz_srcptr));
--
1.8.1.2
More information about the gmp-devel
mailing list