[PATCH 02/20] Introduce and use __GMP_PUBLIC.

Richard Henderson rth at twiddle.net
Mon Mar 4 19:41:32 CET 2013


No functional change yet, just rearranging how the declarations are
represented in the source.
---
 gmp-h.in | 825 ++++++++++++++++++++++++++++++++++++---------------------------
 1 file changed, 476 insertions(+), 349 deletions(-)

diff --git a/gmp-h.in b/gmp-h.in
index 4e95480..6a19652 100644
--- a/gmp-h.in
+++ b/gmp-h.in
@@ -128,6 +128,28 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define __GMP_DECLSPEC
 #endif
 
+/* __GMP_PUBLIC defines the GMP API and ABI.  It comes in several variants
+   to make the usage less arduous:
+     __GMP_PUBLIC	- for normal functions
+     __GMP_PUBLIC_A	- for functions with attributes
+     __GMP_PUBLIC_NT	- for "no-throw" functions
+     __GMP_PUBLIC_NT_A	- for "no-throw" functions with attributes
+     __GMP_PUBLIC_DATA	- for declaring data variables
+*/
+#define __GMP_PUBLIC_FULL(TYPE, API_NAME, ARGS, NT, ATTRS) \
+  __GMP_DECLSPEC TYPE API_NAME ARGS NT ATTRS
+
+#define __GMP_PUBLIC_NT_A(TYPE, API_NAME, ARGS, ATTRS) \
+  __GMP_PUBLIC_FULL(TYPE, API_NAME, ARGS, __GMP_NOTHROW, ATTRS)
+#define __GMP_PUBLIC_A(TYPE, API_NAME, ARGS, ATTRS) \
+  __GMP_PUBLIC_FULL(TYPE, API_NAME, ARGS, , ATTRS)
+#define __GMP_PUBLIC_NT(TYPE, API_NAME, ARGS) \
+  __GMP_PUBLIC_FULL(TYPE, API_NAME, ARGS, __GMP_NOTHROW, )
+#define __GMP_PUBLIC(TYPE, API_NAME, ARGS) \
+  __GMP_PUBLIC_FULL(TYPE, API_NAME, ARGS, , )
+   
+#define __GMP_PUBLIC_DATA(TYPE, API_NAME) \
+  __GMP_DECLSPEC extern TYPE API_NAME
 
 #ifdef __GMP_SHORT_LIMB
 typedef unsigned int		mp_limb_t;
@@ -478,114 +500,121 @@ using std::FILE;
 #endif
 
 #define mp_set_memory_functions __gmp_set_memory_functions
-__GMP_DECLSPEC void mp_set_memory_functions (void *(*) (size_t),
-				      void *(*) (void *, size_t, size_t),
-				      void (*) (void *, size_t)) __GMP_NOTHROW;
+__GMP_PUBLIC_NT (void, mp_set_memory_functions,
+		 (void *(*) (size_t),
+		  void *(*) (void *, size_t, size_t),
+		  void (*) (void *, size_t)));
 
 #define mp_get_memory_functions __gmp_get_memory_functions
-__GMP_DECLSPEC void mp_get_memory_functions (void *(**) (size_t),
-				      void *(**) (void *, size_t, size_t),
-				      void (**) (void *, size_t)) __GMP_NOTHROW;
+__GMP_PUBLIC_NT (void, mp_get_memory_functions,
+		 (void *(**) (size_t),
+		  void *(**) (void *, size_t, size_t),
+		  void (**) (void *, size_t)));
 
 #define mp_bits_per_limb __gmp_bits_per_limb
-__GMP_DECLSPEC extern const int mp_bits_per_limb;
+__GMP_PUBLIC_DATA (const int, mp_bits_per_limb);
 
 #define gmp_errno __gmp_errno
-__GMP_DECLSPEC extern int gmp_errno;
+__GMP_PUBLIC_DATA (int, gmp_errno);
 
 #define gmp_version __gmp_version
-__GMP_DECLSPEC extern const char * const gmp_version;
+__GMP_PUBLIC_DATA (const char * const, gmp_version);
 
 
 /**************** Random number routines.  ****************/
 
 /* obsolete */
 #define gmp_randinit __gmp_randinit
-__GMP_DECLSPEC void gmp_randinit (gmp_randstate_t, gmp_randalg_t, ...);
+__GMP_PUBLIC (void, gmp_randinit, (gmp_randstate_t, gmp_randalg_t, ...));
 
 #define gmp_randinit_default __gmp_randinit_default
-__GMP_DECLSPEC void gmp_randinit_default (gmp_randstate_t);
+__GMP_PUBLIC (void, gmp_randinit_default, (gmp_randstate_t));
 
 #define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp
-__GMP_DECLSPEC void gmp_randinit_lc_2exp (gmp_randstate_t, mpz_srcptr, unsigned long int, mp_bitcnt_t);
+__GMP_PUBLIC (void, gmp_randinit_lc_2exp,
+	      (gmp_randstate_t, mpz_srcptr, unsigned long int, mp_bitcnt_t));
 
 #define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size
-__GMP_DECLSPEC int gmp_randinit_lc_2exp_size (gmp_randstate_t, mp_bitcnt_t);
+__GMP_PUBLIC (int, gmp_randinit_lc_2exp_size, (gmp_randstate_t, mp_bitcnt_t));
 
 #define gmp_randinit_mt __gmp_randinit_mt
-__GMP_DECLSPEC void gmp_randinit_mt (gmp_randstate_t);
+__GMP_PUBLIC (void, gmp_randinit_mt, (gmp_randstate_t));
 
 #define gmp_randinit_set __gmp_randinit_set
-__GMP_DECLSPEC void gmp_randinit_set (gmp_randstate_t, const __gmp_randstate_struct *);
+__GMP_PUBLIC (void, gmp_randinit_set,
+	      (gmp_randstate_t, const __gmp_randstate_struct *));
 
 #define gmp_randseed __gmp_randseed
-__GMP_DECLSPEC void gmp_randseed (gmp_randstate_t, mpz_srcptr);
+__GMP_PUBLIC (void, gmp_randseed, (gmp_randstate_t, mpz_srcptr));
 
 #define gmp_randseed_ui __gmp_randseed_ui
-__GMP_DECLSPEC void gmp_randseed_ui (gmp_randstate_t, unsigned long int);
+__GMP_PUBLIC (void, gmp_randseed_ui, (gmp_randstate_t, unsigned long int));
 
 #define gmp_randclear __gmp_randclear
-__GMP_DECLSPEC void gmp_randclear (gmp_randstate_t);
+__GMP_PUBLIC (void, gmp_randclear, (gmp_randstate_t));
 
 #define gmp_urandomb_ui __gmp_urandomb_ui
-__GMP_DECLSPEC unsigned long gmp_urandomb_ui (gmp_randstate_t, unsigned long);
+__GMP_PUBLIC (unsigned long, gmp_urandomb_ui,
+	      (gmp_randstate_t, unsigned long));
 
 #define gmp_urandomm_ui __gmp_urandomm_ui
-__GMP_DECLSPEC unsigned long gmp_urandomm_ui (gmp_randstate_t, unsigned long);
+__GMP_PUBLIC (unsigned long, gmp_urandomm_ui,
+	      (gmp_randstate_t, unsigned long));
 
 
 /**************** Formatted output routines.  ****************/
 
 #define gmp_asprintf __gmp_asprintf
-__GMP_DECLSPEC int gmp_asprintf (char **, const char *, ...);
+__GMP_PUBLIC (int, gmp_asprintf, (char **, const char *, ...));
 
 #define gmp_fprintf __gmp_fprintf
 #ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC int gmp_fprintf (FILE *, const char *, ...);
+__GMP_PUBLIC (int, gmp_fprintf, (FILE *, const char *, ...));
 #endif
 
 #define gmp_obstack_printf __gmp_obstack_printf
 #if defined (_GMP_H_HAVE_OBSTACK)
-__GMP_DECLSPEC int gmp_obstack_printf (struct obstack *, const char *, ...);
+__GMP_PUBLIC (int, gmp_obstack_printf, (struct obstack *, const char *, ...));
 #endif
 
 #define gmp_obstack_vprintf __gmp_obstack_vprintf
 #if defined (_GMP_H_HAVE_OBSTACK) && defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_obstack_vprintf (struct obstack *, const char *, va_list);
+__GMP_PUBLIC (int, gmp_obstack_vprintf,
+	      (struct obstack *, const char *, va_list));
 #endif
 
 #define gmp_printf __gmp_printf
-__GMP_DECLSPEC int gmp_printf (const char *, ...);
+__GMP_PUBLIC (int, gmp_printf, (const char *, ...));
 
 #define gmp_snprintf __gmp_snprintf
-__GMP_DECLSPEC int gmp_snprintf (char *, size_t, const char *, ...);
+__GMP_PUBLIC (int, gmp_snprintf, (char *, size_t, const char *, ...));
 
 #define gmp_sprintf __gmp_sprintf
-__GMP_DECLSPEC int gmp_sprintf (char *, const char *, ...);
+__GMP_PUBLIC (int, gmp_sprintf, (char *, const char *, ...));
 
 #define gmp_vasprintf __gmp_vasprintf
 #if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vasprintf (char **, const char *, va_list);
+__GMP_PUBLIC (int, gmp_vasprintf, (char **, const char *, va_list));
 #endif
 
 #define gmp_vfprintf __gmp_vfprintf
 #if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vfprintf (FILE *, const char *, va_list);
+__GMP_PUBLIC (int, gmp_vfprintf, (FILE *, const char *, va_list));
 #endif
 
 #define gmp_vprintf __gmp_vprintf
 #if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vprintf (const char *, va_list);
+__GMP_PUBLIC (int, gmp_vprintf, (const char *, va_list));
 #endif
 
 #define gmp_vsnprintf __gmp_vsnprintf
 #if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vsnprintf (char *, size_t, const char *, va_list);
+__GMP_PUBLIC (int, gmp_vsnprintf, (char *, size_t, const char *, va_list));
 #endif
 
 #define gmp_vsprintf __gmp_vsprintf
 #if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vsprintf (char *, const char *, va_list);
+__GMP_PUBLIC (int, gmp_vsprintf, (char *, const char *, va_list));
 #endif
 
 
@@ -593,28 +622,28 @@ __GMP_DECLSPEC int gmp_vsprintf (char *, const char *, va_list);
 
 #define gmp_fscanf __gmp_fscanf
 #ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC int gmp_fscanf (FILE *, const char *, ...);
+__GMP_PUBLIC (int, gmp_fscanf, (FILE *, const char *, ...));
 #endif
 
 #define gmp_scanf __gmp_scanf
-__GMP_DECLSPEC int gmp_scanf (const char *, ...);
+__GMP_PUBLIC (int, gmp_scanf, (const char *, ...));
 
 #define gmp_sscanf __gmp_sscanf
-__GMP_DECLSPEC int gmp_sscanf (const char *, const char *, ...);
+__GMP_PUBLIC (int, gmp_sscanf, (const char *, const char *, ...));
 
 #define gmp_vfscanf __gmp_vfscanf
 #if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vfscanf (FILE *, const char *, va_list);
+__GMP_PUBLIC (int, gmp_vfscanf, (FILE *, const char *, va_list));
 #endif
 
 #define gmp_vscanf __gmp_vscanf
 #if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vscanf (const char *, va_list);
+__GMP_PUBLIC (int, gmp_vscanf, (const char *, va_list));
 #endif
 
 #define gmp_vsscanf __gmp_vsscanf
 #if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vsscanf (const char *, const char *, va_list);
+__GMP_PUBLIC (int, gmp_vsscanf, (const char *, const char *, va_list));
 #endif
 
 
@@ -622,515 +651,567 @@ __GMP_DECLSPEC int gmp_vsscanf (const char *, const char *, va_list);
 
 #define _mpz_realloc __gmpz_realloc
 #define mpz_realloc __gmpz_realloc
-__GMP_DECLSPEC void *_mpz_realloc (mpz_ptr, mp_size_t);
+__GMP_PUBLIC (void *, _mpz_realloc, (mpz_ptr, mp_size_t));
 
 #define mpz_abs __gmpz_abs
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs)
-__GMP_DECLSPEC void mpz_abs (mpz_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_abs, (mpz_ptr, mpz_srcptr));
 #endif
 
 #define mpz_add __gmpz_add
-__GMP_DECLSPEC void mpz_add (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_add, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_add_ui __gmpz_add_ui
-__GMP_DECLSPEC void mpz_add_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_add_ui, (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_addmul __gmpz_addmul
-__GMP_DECLSPEC void mpz_addmul (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_addmul, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_addmul_ui __gmpz_addmul_ui
-__GMP_DECLSPEC void mpz_addmul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_addmul_ui, (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_and __gmpz_and
-__GMP_DECLSPEC void mpz_and (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_and, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_array_init __gmpz_array_init
-__GMP_DECLSPEC void mpz_array_init (mpz_ptr, mp_size_t, mp_size_t);
+__GMP_PUBLIC (void, mpz_array_init, (mpz_ptr, mp_size_t, mp_size_t));
 
 #define mpz_bin_ui __gmpz_bin_ui
-__GMP_DECLSPEC void mpz_bin_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_bin_ui, (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_bin_uiui __gmpz_bin_uiui
-__GMP_DECLSPEC void mpz_bin_uiui (mpz_ptr, unsigned long int, unsigned long int);
+__GMP_PUBLIC (void, mpz_bin_uiui,
+	      (mpz_ptr, unsigned long int, unsigned long int));
 
 #define mpz_cdiv_q __gmpz_cdiv_q
-__GMP_DECLSPEC void mpz_cdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_cdiv_q, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp
-__GMP_DECLSPEC void mpz_cdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_cdiv_q_2exp, (mpz_ptr, mpz_srcptr, mp_bitcnt_t));
 
 #define mpz_cdiv_q_ui __gmpz_cdiv_q_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (unsigned long int, mpz_cdiv_q_ui,
+	      (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_cdiv_qr __gmpz_cdiv_qr
-__GMP_DECLSPEC void mpz_cdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_cdiv_qr, (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (unsigned long int, mpz_cdiv_qr_ui,
+	      (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_cdiv_r __gmpz_cdiv_r
-__GMP_DECLSPEC void mpz_cdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_cdiv_r, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp
-__GMP_DECLSPEC void mpz_cdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_cdiv_r_2exp, (mpz_ptr, mpz_srcptr, mp_bitcnt_t));
 
 #define mpz_cdiv_r_ui __gmpz_cdiv_r_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (unsigned long int, mpz_cdiv_r_ui,
+	      (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_cdiv_ui __gmpz_cdiv_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (unsigned long int, mpz_cdiv_ui,
+		(mpz_srcptr, unsigned long int), __GMP_ATTRIBUTE_PURE);
 
 #define mpz_clear __gmpz_clear
-__GMP_DECLSPEC void mpz_clear (mpz_ptr);
+__GMP_PUBLIC (void, mpz_clear, (mpz_ptr));
 
 #define mpz_clears __gmpz_clears
-__GMP_DECLSPEC void mpz_clears (mpz_ptr, ...);
+__GMP_PUBLIC (void, mpz_clears, (mpz_ptr, ...));
 
 #define mpz_clrbit __gmpz_clrbit
-__GMP_DECLSPEC void mpz_clrbit (mpz_ptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_clrbit, (mpz_ptr, mp_bitcnt_t));
 
 #define mpz_cmp __gmpz_cmp
-__GMP_DECLSPEC int mpz_cmp (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_cmp, (mpz_srcptr, mpz_srcptr),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_cmp_d __gmpz_cmp_d
-__GMP_DECLSPEC int mpz_cmp_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_cmp_d, (mpz_srcptr, double), __GMP_ATTRIBUTE_PURE);
 
 #define _mpz_cmp_si __gmpz_cmp_si
-__GMP_DECLSPEC int _mpz_cmp_si (mpz_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, _mpz_cmp_si, (mpz_srcptr, signed long int),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define _mpz_cmp_ui __gmpz_cmp_ui
-__GMP_DECLSPEC int _mpz_cmp_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, _mpz_cmp_ui, (mpz_srcptr, unsigned long int),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_cmpabs __gmpz_cmpabs
-__GMP_DECLSPEC int mpz_cmpabs (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_cmpabs, (mpz_srcptr, mpz_srcptr),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_cmpabs_d __gmpz_cmpabs_d
-__GMP_DECLSPEC int mpz_cmpabs_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_cmpabs_d, (mpz_srcptr, double), __GMP_ATTRIBUTE_PURE);
 
 #define mpz_cmpabs_ui __gmpz_cmpabs_ui
-__GMP_DECLSPEC int mpz_cmpabs_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_cmpabs_ui, (mpz_srcptr, unsigned long int),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_com __gmpz_com
-__GMP_DECLSPEC void mpz_com (mpz_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_com, (mpz_ptr, mpz_srcptr));
 
 #define mpz_combit __gmpz_combit
-__GMP_DECLSPEC void mpz_combit (mpz_ptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_combit, (mpz_ptr, mp_bitcnt_t));
 
 #define mpz_congruent_p __gmpz_congruent_p
-__GMP_DECLSPEC int mpz_congruent_p (mpz_srcptr, mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_congruent_p, (mpz_srcptr, mpz_srcptr, mpz_srcptr),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_congruent_2exp_p __gmpz_congruent_2exp_p
-__GMP_DECLSPEC int mpz_congruent_2exp_p (mpz_srcptr, mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_congruent_2exp_p,
+		   (mpz_srcptr, mpz_srcptr, mp_bitcnt_t),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_congruent_ui_p __gmpz_congruent_ui_p
-__GMP_DECLSPEC int mpz_congruent_ui_p (mpz_srcptr, unsigned long, unsigned long) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_congruent_ui_p,
+	        (mpz_srcptr, unsigned long, unsigned long),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_divexact __gmpz_divexact
-__GMP_DECLSPEC void mpz_divexact (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_divexact, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_divexact_ui __gmpz_divexact_ui
-__GMP_DECLSPEC void mpz_divexact_ui (mpz_ptr, mpz_srcptr, unsigned long);
+__GMP_PUBLIC (void, mpz_divexact_ui, (mpz_ptr, mpz_srcptr, unsigned long));
 
 #define mpz_divisible_p __gmpz_divisible_p
-__GMP_DECLSPEC int mpz_divisible_p (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_divisible_p, (mpz_srcptr, mpz_srcptr),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_divisible_ui_p __gmpz_divisible_ui_p
-__GMP_DECLSPEC int mpz_divisible_ui_p (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_divisible_ui_p, (mpz_srcptr, unsigned long),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_divisible_2exp_p __gmpz_divisible_2exp_p
-__GMP_DECLSPEC int mpz_divisible_2exp_p (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_divisible_2exp_p, (mpz_srcptr, mp_bitcnt_t),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_dump __gmpz_dump
-__GMP_DECLSPEC void mpz_dump (mpz_srcptr);
+__GMP_PUBLIC (void, mpz_dump, (mpz_srcptr));
 
 #define mpz_export __gmpz_export
-__GMP_DECLSPEC void *mpz_export (void *, size_t *, int, size_t, int, size_t, mpz_srcptr);
+__GMP_PUBLIC (void *, mpz_export,
+	      (void *, size_t *, int, size_t, int, size_t, mpz_srcptr));
 
 #define mpz_fac_ui __gmpz_fac_ui
-__GMP_DECLSPEC void mpz_fac_ui (mpz_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_fac_ui, (mpz_ptr, unsigned long int));
 
 #define mpz_2fac_ui __gmpz_2fac_ui
-__GMP_DECLSPEC void mpz_2fac_ui (mpz_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_2fac_ui, (mpz_ptr, unsigned long int));
 
 #define mpz_mfac_uiui __gmpz_mfac_uiui
-__GMP_DECLSPEC void mpz_mfac_uiui (mpz_ptr, unsigned long int, unsigned long int);
+__GMP_PUBLIC (void, mpz_mfac_uiui,
+	      (mpz_ptr, unsigned long int, unsigned long int));
 
 #define mpz_primorial_ui __gmpz_primorial_ui
-__GMP_DECLSPEC void mpz_primorial_ui (mpz_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_primorial_ui, (mpz_ptr, unsigned long int));
 
 #define mpz_fdiv_q __gmpz_fdiv_q
-__GMP_DECLSPEC void mpz_fdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_fdiv_q, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_fdiv_q_2exp __gmpz_fdiv_q_2exp
-__GMP_DECLSPEC void mpz_fdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_fdiv_q_2exp, (mpz_ptr, mpz_srcptr, mp_bitcnt_t));
 
 #define mpz_fdiv_q_ui __gmpz_fdiv_q_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (unsigned long int, mpz_fdiv_q_ui,
+	      (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_fdiv_qr __gmpz_fdiv_qr
-__GMP_DECLSPEC void mpz_fdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_fdiv_qr, (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_fdiv_qr_ui __gmpz_fdiv_qr_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (unsigned long int, mpz_fdiv_qr_ui,
+	      (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_fdiv_r __gmpz_fdiv_r
-__GMP_DECLSPEC void mpz_fdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_fdiv_r, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_fdiv_r_2exp __gmpz_fdiv_r_2exp
-__GMP_DECLSPEC void mpz_fdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_fdiv_r_2exp, (mpz_ptr, mpz_srcptr, mp_bitcnt_t));
 
 #define mpz_fdiv_r_ui __gmpz_fdiv_r_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (unsigned long int, mpz_fdiv_r_ui,
+	      (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_fdiv_ui __gmpz_fdiv_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (unsigned long int, mpz_fdiv_ui,
+		(mpz_srcptr, unsigned long int),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_fib_ui __gmpz_fib_ui
-__GMP_DECLSPEC void mpz_fib_ui (mpz_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_fib_ui, (mpz_ptr, unsigned long int));
 
 #define mpz_fib2_ui __gmpz_fib2_ui
-__GMP_DECLSPEC void mpz_fib2_ui (mpz_ptr, mpz_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_fib2_ui, (mpz_ptr, mpz_ptr, unsigned long int));
 
 #define mpz_fits_sint_p __gmpz_fits_sint_p
-__GMP_DECLSPEC int mpz_fits_sint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_fits_sint_p, (mpz_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpz_fits_slong_p __gmpz_fits_slong_p
-__GMP_DECLSPEC int mpz_fits_slong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_fits_slong_p, (mpz_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpz_fits_sshort_p __gmpz_fits_sshort_p
-__GMP_DECLSPEC int mpz_fits_sshort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_fits_sshort_p, (mpz_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpz_fits_uint_p __gmpz_fits_uint_p
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_uint_p)
-__GMP_DECLSPEC int mpz_fits_uint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_fits_uint_p, (mpz_srcptr), __GMP_ATTRIBUTE_PURE);
 #endif
 
 #define mpz_fits_ulong_p __gmpz_fits_ulong_p
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ulong_p)
-__GMP_DECLSPEC int mpz_fits_ulong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_fits_ulong_p, (mpz_srcptr), __GMP_ATTRIBUTE_PURE);
 #endif
 
 #define mpz_fits_ushort_p __gmpz_fits_ushort_p
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ushort_p)
-__GMP_DECLSPEC int mpz_fits_ushort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_fits_ushort_p, (mpz_srcptr), __GMP_ATTRIBUTE_PURE);
 #endif
 
 #define mpz_gcd __gmpz_gcd
-__GMP_DECLSPEC void mpz_gcd (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_gcd, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_gcd_ui __gmpz_gcd_ui
-__GMP_DECLSPEC unsigned long int mpz_gcd_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (unsigned long int, mpz_gcd_ui,
+	      (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_gcdext __gmpz_gcdext
-__GMP_DECLSPEC void mpz_gcdext (mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_gcdext,
+	      (mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_get_d __gmpz_get_d
-__GMP_DECLSPEC double mpz_get_d (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (double, mpz_get_d, (mpz_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpz_get_d_2exp __gmpz_get_d_2exp
-__GMP_DECLSPEC double mpz_get_d_2exp (signed long int *, mpz_srcptr);
+__GMP_PUBLIC (double, mpz_get_d_2exp, (signed long int *, mpz_srcptr));
 
 #define mpz_get_si __gmpz_get_si
-__GMP_DECLSPEC /* signed */ long int mpz_get_si (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (signed long int, mpz_get_si, (mpz_srcptr),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_get_str __gmpz_get_str
-__GMP_DECLSPEC char *mpz_get_str (char *, int, mpz_srcptr);
+__GMP_PUBLIC (char *, mpz_get_str, (char *, int, mpz_srcptr));
 
 #define mpz_get_ui __gmpz_get_ui
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_get_ui)
-__GMP_DECLSPEC unsigned long int mpz_get_ui (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (unsigned long int, mpz_get_ui, (mpz_srcptr),
+		   __GMP_ATTRIBUTE_PURE);
 #endif
 
 #define mpz_getlimbn __gmpz_getlimbn
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_getlimbn)
-__GMP_DECLSPEC mp_limb_t mpz_getlimbn (mpz_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (mp_limb_t, mpz_getlimbn, (mpz_srcptr, mp_size_t),
+		   __GMP_ATTRIBUTE_PURE);
 #endif
 
 #define mpz_hamdist __gmpz_hamdist
-__GMP_DECLSPEC mp_bitcnt_t mpz_hamdist (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (mp_bitcnt_t, mpz_hamdist, (mpz_srcptr, mpz_srcptr),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_import __gmpz_import
-__GMP_DECLSPEC void mpz_import (mpz_ptr, size_t, int, size_t, int, size_t, const void *);
+__GMP_PUBLIC (void, mpz_import,
+	      (mpz_ptr, size_t, int, size_t, int, size_t, const void *));
 
 #define mpz_init __gmpz_init
-__GMP_DECLSPEC void mpz_init (mpz_ptr);
+__GMP_PUBLIC (void, mpz_init, (mpz_ptr));
 
 #define mpz_init2 __gmpz_init2
-__GMP_DECLSPEC void mpz_init2 (mpz_ptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_init2, (mpz_ptr, mp_bitcnt_t));
 
 #define mpz_inits __gmpz_inits
-__GMP_DECLSPEC void mpz_inits (mpz_ptr, ...);
+__GMP_PUBLIC (void, mpz_inits, (mpz_ptr, ...));
 
 #define mpz_init_set __gmpz_init_set
-__GMP_DECLSPEC void mpz_init_set (mpz_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_init_set, (mpz_ptr, mpz_srcptr));
 
 #define mpz_init_set_d __gmpz_init_set_d
-__GMP_DECLSPEC void mpz_init_set_d (mpz_ptr, double);
+__GMP_PUBLIC (void, mpz_init_set_d, (mpz_ptr, double));
 
 #define mpz_init_set_si __gmpz_init_set_si
-__GMP_DECLSPEC void mpz_init_set_si (mpz_ptr, signed long int);
+__GMP_PUBLIC (void, mpz_init_set_si, (mpz_ptr, signed long int));
 
 #define mpz_init_set_str __gmpz_init_set_str
-__GMP_DECLSPEC int mpz_init_set_str (mpz_ptr, const char *, int);
+__GMP_PUBLIC (int, mpz_init_set_str, (mpz_ptr, const char *, int));
 
 #define mpz_init_set_ui __gmpz_init_set_ui
-__GMP_DECLSPEC void mpz_init_set_ui (mpz_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_init_set_ui, (mpz_ptr, unsigned long int));
 
 #define mpz_inp_raw __gmpz_inp_raw
 #ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_inp_raw (mpz_ptr, FILE *);
+__GMP_PUBLIC (size_t, mpz_inp_raw, (mpz_ptr, FILE *));
 #endif
 
 #define mpz_inp_str __gmpz_inp_str
 #ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_inp_str (mpz_ptr, FILE *, int);
+__GMP_PUBLIC (size_t, mpz_inp_str, (mpz_ptr, FILE *, int));
 #endif
 
 #define mpz_invert __gmpz_invert
-__GMP_DECLSPEC int mpz_invert (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (int, mpz_invert, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_ior __gmpz_ior
-__GMP_DECLSPEC void mpz_ior (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_ior, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_jacobi __gmpz_jacobi
-__GMP_DECLSPEC int mpz_jacobi (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_jacobi, (mpz_srcptr, mpz_srcptr),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_kronecker mpz_jacobi  /* alias */
 
 #define mpz_kronecker_si __gmpz_kronecker_si
-__GMP_DECLSPEC int mpz_kronecker_si (mpz_srcptr, long) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_kronecker_si, (mpz_srcptr, long),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_kronecker_ui __gmpz_kronecker_ui
-__GMP_DECLSPEC int mpz_kronecker_ui (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_kronecker_ui, (mpz_srcptr, unsigned long),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_si_kronecker __gmpz_si_kronecker
-__GMP_DECLSPEC int mpz_si_kronecker (long, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_si_kronecker, (long, mpz_srcptr),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_ui_kronecker __gmpz_ui_kronecker
-__GMP_DECLSPEC int mpz_ui_kronecker (unsigned long, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_ui_kronecker, (unsigned long, mpz_srcptr),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_lcm __gmpz_lcm
-__GMP_DECLSPEC void mpz_lcm (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_lcm, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_lcm_ui __gmpz_lcm_ui
-__GMP_DECLSPEC void mpz_lcm_ui (mpz_ptr, mpz_srcptr, unsigned long);
+__GMP_PUBLIC (void, mpz_lcm_ui, (mpz_ptr, mpz_srcptr, unsigned long));
 
 #define mpz_legendre mpz_jacobi  /* alias */
 
 #define mpz_lucnum_ui __gmpz_lucnum_ui
-__GMP_DECLSPEC void mpz_lucnum_ui (mpz_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_lucnum_ui, (mpz_ptr, unsigned long int));
 
 #define mpz_lucnum2_ui __gmpz_lucnum2_ui
-__GMP_DECLSPEC void mpz_lucnum2_ui (mpz_ptr, mpz_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_lucnum2_ui, (mpz_ptr, mpz_ptr, unsigned long int));
 
 #define mpz_millerrabin __gmpz_millerrabin
-__GMP_DECLSPEC int mpz_millerrabin (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_millerrabin, (mpz_srcptr, int), __GMP_ATTRIBUTE_PURE);
 
 #define mpz_mod __gmpz_mod
-__GMP_DECLSPEC void mpz_mod (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__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 */
 
 #define mpz_mul __gmpz_mul
-__GMP_DECLSPEC void mpz_mul (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_mul, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_mul_2exp __gmpz_mul_2exp
-__GMP_DECLSPEC void mpz_mul_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_mul_2exp, (mpz_ptr, mpz_srcptr, mp_bitcnt_t));
 
 #define mpz_mul_si __gmpz_mul_si
-__GMP_DECLSPEC void mpz_mul_si (mpz_ptr, mpz_srcptr, long int);
+__GMP_PUBLIC (void, mpz_mul_si, (mpz_ptr, mpz_srcptr, long int));
 
 #define mpz_mul_ui __gmpz_mul_ui
-__GMP_DECLSPEC void mpz_mul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_mul_ui, (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_neg __gmpz_neg
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_neg)
-__GMP_DECLSPEC void mpz_neg (mpz_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_neg, (mpz_ptr, mpz_srcptr));
 #endif
 
 #define mpz_nextprime __gmpz_nextprime
-__GMP_DECLSPEC void mpz_nextprime (mpz_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_nextprime, (mpz_ptr, mpz_srcptr));
 
 #define mpz_out_raw __gmpz_out_raw
 #ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_out_raw (FILE *, mpz_srcptr);
+__GMP_PUBLIC (size_t, mpz_out_raw, (FILE *, mpz_srcptr));
 #endif
 
 #define mpz_out_str __gmpz_out_str
 #ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_out_str (FILE *, int, mpz_srcptr);
+__GMP_PUBLIC (size_t, mpz_out_str, (FILE *, int, mpz_srcptr));
 #endif
 
 #define mpz_perfect_power_p __gmpz_perfect_power_p
-__GMP_DECLSPEC int mpz_perfect_power_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_perfect_power_p, (mpz_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpz_perfect_square_p __gmpz_perfect_square_p
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_perfect_square_p)
-__GMP_DECLSPEC int mpz_perfect_square_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_perfect_square_p, (mpz_srcptr), __GMP_ATTRIBUTE_PURE);
 #endif
 
 #define mpz_popcount __gmpz_popcount
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_popcount)
-__GMP_DECLSPEC mp_bitcnt_t mpz_popcount (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (mp_bitcnt_t, mpz_popcount, (mpz_srcptr),
+		   __GMP_ATTRIBUTE_PURE);
 #endif
 
 #define mpz_pow_ui __gmpz_pow_ui
-__GMP_DECLSPEC void mpz_pow_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_pow_ui, (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_powm __gmpz_powm
-__GMP_DECLSPEC void mpz_powm (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_powm, (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_powm_sec __gmpz_powm_sec
-__GMP_DECLSPEC void mpz_powm_sec (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_powm_sec,
+	      (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_powm_ui __gmpz_powm_ui
-__GMP_DECLSPEC void mpz_powm_ui (mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_powm_ui,
+	      (mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr));
 
 #define mpz_probab_prime_p __gmpz_probab_prime_p
-__GMP_DECLSPEC int mpz_probab_prime_p (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpz_probab_prime_p, (mpz_srcptr, int),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_random __gmpz_random
-__GMP_DECLSPEC void mpz_random (mpz_ptr, mp_size_t);
+__GMP_PUBLIC (void, mpz_random, (mpz_ptr, mp_size_t));
 
 #define mpz_random2 __gmpz_random2
-__GMP_DECLSPEC void mpz_random2 (mpz_ptr, mp_size_t);
+__GMP_PUBLIC (void, mpz_random2, (mpz_ptr, mp_size_t));
 
 #define mpz_realloc2 __gmpz_realloc2
-__GMP_DECLSPEC void mpz_realloc2 (mpz_ptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_realloc2, (mpz_ptr, mp_bitcnt_t));
 
 #define mpz_remove __gmpz_remove
-__GMP_DECLSPEC mp_bitcnt_t mpz_remove (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (mp_bitcnt_t, mpz_remove, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_root __gmpz_root
-__GMP_DECLSPEC int mpz_root (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (int, mpz_root, (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_rootrem __gmpz_rootrem
-__GMP_DECLSPEC void mpz_rootrem (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_rootrem,
+	      (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_rrandomb __gmpz_rrandomb
-__GMP_DECLSPEC void mpz_rrandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_rrandomb, (mpz_ptr, gmp_randstate_t, mp_bitcnt_t));
 
 #define mpz_scan0 __gmpz_scan0
-__GMP_DECLSPEC mp_bitcnt_t mpz_scan0 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (mp_bitcnt_t, mpz_scan0, (mpz_srcptr, mp_bitcnt_t),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_scan1 __gmpz_scan1
-__GMP_DECLSPEC mp_bitcnt_t mpz_scan1 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (mp_bitcnt_t, mpz_scan1, (mpz_srcptr, mp_bitcnt_t),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_set __gmpz_set
-__GMP_DECLSPEC void mpz_set (mpz_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_set, (mpz_ptr, mpz_srcptr));
 
 #define mpz_set_d __gmpz_set_d
-__GMP_DECLSPEC void mpz_set_d (mpz_ptr, double);
+__GMP_PUBLIC (void, mpz_set_d, (mpz_ptr, double));
 
 #define mpz_set_f __gmpz_set_f
-__GMP_DECLSPEC void mpz_set_f (mpz_ptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpz_set_f, (mpz_ptr, mpf_srcptr));
 
 #define mpz_set_q __gmpz_set_q
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_set_q)
-__GMP_DECLSPEC void mpz_set_q (mpz_ptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpz_set_q, (mpz_ptr, mpq_srcptr));
 #endif
 
 #define mpz_set_si __gmpz_set_si
-__GMP_DECLSPEC void mpz_set_si (mpz_ptr, signed long int);
+__GMP_PUBLIC (void, mpz_set_si, (mpz_ptr, signed long int));
 
 #define mpz_set_str __gmpz_set_str
-__GMP_DECLSPEC int mpz_set_str (mpz_ptr, const char *, int);
+__GMP_PUBLIC (int, mpz_set_str, (mpz_ptr, const char *, int));
 
 #define mpz_set_ui __gmpz_set_ui
-__GMP_DECLSPEC void mpz_set_ui (mpz_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_set_ui, (mpz_ptr, unsigned long int));
 
 #define mpz_setbit __gmpz_setbit
-__GMP_DECLSPEC void mpz_setbit (mpz_ptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_setbit, (mpz_ptr, mp_bitcnt_t));
 
 #define mpz_size __gmpz_size
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_size)
-__GMP_DECLSPEC size_t mpz_size (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (size_t, mpz_size, (mpz_srcptr), __GMP_ATTRIBUTE_PURE);
 #endif
 
 #define mpz_sizeinbase __gmpz_sizeinbase
-__GMP_DECLSPEC size_t mpz_sizeinbase (mpz_srcptr, int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (size_t, mpz_sizeinbase, (mpz_srcptr, int),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_sqrt __gmpz_sqrt
-__GMP_DECLSPEC void mpz_sqrt (mpz_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_sqrt, (mpz_ptr, mpz_srcptr));
 
 #define mpz_sqrtrem __gmpz_sqrtrem
-__GMP_DECLSPEC void mpz_sqrtrem (mpz_ptr, mpz_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_sqrtrem, (mpz_ptr, mpz_ptr, mpz_srcptr));
 
 #define mpz_sub __gmpz_sub
-__GMP_DECLSPEC void mpz_sub (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_sub, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_sub_ui __gmpz_sub_ui
-__GMP_DECLSPEC void mpz_sub_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_sub_ui, (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_ui_sub __gmpz_ui_sub
-__GMP_DECLSPEC void mpz_ui_sub (mpz_ptr, unsigned long int, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_ui_sub, (mpz_ptr, unsigned long int, mpz_srcptr));
 
 #define mpz_submul __gmpz_submul
-__GMP_DECLSPEC void mpz_submul (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_submul, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_submul_ui __gmpz_submul_ui
-__GMP_DECLSPEC void mpz_submul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpz_submul_ui, (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_swap __gmpz_swap
-__GMP_DECLSPEC void mpz_swap (mpz_ptr, mpz_ptr) __GMP_NOTHROW;
+__GMP_PUBLIC_NT (void, mpz_swap, (mpz_ptr, mpz_ptr));
 
 #define mpz_tdiv_ui __gmpz_tdiv_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (unsigned long int, mpz_tdiv_ui,
+		(mpz_srcptr, unsigned long int),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpz_tdiv_q __gmpz_tdiv_q
-__GMP_DECLSPEC void mpz_tdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_tdiv_q, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_tdiv_q_2exp __gmpz_tdiv_q_2exp
-__GMP_DECLSPEC void mpz_tdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_tdiv_q_2exp, (mpz_ptr, mpz_srcptr, mp_bitcnt_t));
 
 #define mpz_tdiv_q_ui __gmpz_tdiv_q_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (unsigned long int, mpz_tdiv_q_ui,
+	      (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_tdiv_qr __gmpz_tdiv_qr
-__GMP_DECLSPEC void mpz_tdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_tdiv_qr, (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_tdiv_qr_ui __gmpz_tdiv_qr_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (unsigned long int, mpz_tdiv_qr_ui,
+	      (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_tdiv_r __gmpz_tdiv_r
-__GMP_DECLSPEC void mpz_tdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_tdiv_r, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_tdiv_r_2exp __gmpz_tdiv_r_2exp
-__GMP_DECLSPEC void mpz_tdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_tdiv_r_2exp, (mpz_ptr, mpz_srcptr, mp_bitcnt_t));
 
 #define mpz_tdiv_r_ui __gmpz_tdiv_r_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_PUBLIC (unsigned long int, mpz_tdiv_r_ui,
+	      (mpz_ptr, mpz_srcptr, unsigned long int));
 
 #define mpz_tstbit __gmpz_tstbit
-__GMP_DECLSPEC int mpz_tstbit (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpz_tstbit, (mpz_srcptr, mp_bitcnt_t),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpz_ui_pow_ui __gmpz_ui_pow_ui
-__GMP_DECLSPEC void mpz_ui_pow_ui (mpz_ptr, unsigned long int, unsigned long int);
+__GMP_PUBLIC (void, mpz_ui_pow_ui,
+	      (mpz_ptr, unsigned long int, unsigned long int));
 
 #define mpz_urandomb __gmpz_urandomb
-__GMP_DECLSPEC void mpz_urandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpz_urandomb, (mpz_ptr, gmp_randstate_t, mp_bitcnt_t));
 
 #define mpz_urandomm __gmpz_urandomm
-__GMP_DECLSPEC void mpz_urandomm (mpz_ptr, gmp_randstate_t, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_urandomm, (mpz_ptr, gmp_randstate_t, mpz_srcptr));
 
 #define mpz_xor __gmpz_xor
 #define mpz_eor __gmpz_xor
-__GMP_DECLSPEC void mpz_xor (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpz_xor, (mpz_ptr, mpz_srcptr, mpz_srcptr));
 
 #define mpz_limbs_read __gmpz_limbs_read
-__GMP_DECLSPEC mp_srcptr mpz_limbs_read (mpz_srcptr);
+__GMP_PUBLIC (mp_srcptr, mpz_limbs_read, (mpz_srcptr));
 
 #define mpz_limbs_write __gmpz_limbs_write
-__GMP_DECLSPEC mp_ptr mpz_limbs_write (mpz_ptr, mp_size_t);
+__GMP_PUBLIC (mp_ptr, mpz_limbs_write, (mpz_ptr, mp_size_t));
 
 #define mpz_limbs_modify __gmpz_limbs_modify
-__GMP_DECLSPEC mp_ptr mpz_limbs_modify (mpz_ptr, mp_size_t);
+__GMP_PUBLIC (mp_ptr, mpz_limbs_modify, (mpz_ptr, mp_size_t));
 
 #define mpz_limbs_finish __gmpz_limbs_finish
-__GMP_DECLSPEC void mpz_limbs_finish (mpz_ptr, mp_size_t);
+__GMP_PUBLIC (void, mpz_limbs_finish, (mpz_ptr, mp_size_t));
 
 #define mpz_roinit_n __gmpz_roinit_n
-__GMP_DECLSPEC mpz_srcptr mpz_roinit_n (mpz_ptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (mpz_srcptr, mpz_roinit_n, (mpz_ptr, mp_srcptr, mp_size_t));
 
 #define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
 
@@ -1138,320 +1219,333 @@ __GMP_DECLSPEC mpz_srcptr mpz_roinit_n (mpz_ptr, mp_srcptr, mp_size_t);
 
 #define mpq_abs __gmpq_abs
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_abs)
-__GMP_DECLSPEC void mpq_abs (mpq_ptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpq_abs, (mpq_ptr, mpq_srcptr));
 #endif
 
 #define mpq_add __gmpq_add
-__GMP_DECLSPEC void mpq_add (mpq_ptr, mpq_srcptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpq_add, (mpq_ptr, mpq_srcptr, mpq_srcptr));
 
 #define mpq_canonicalize __gmpq_canonicalize
-__GMP_DECLSPEC void mpq_canonicalize (mpq_ptr);
+__GMP_PUBLIC (void, mpq_canonicalize, (mpq_ptr));
 
 #define mpq_clear __gmpq_clear
-__GMP_DECLSPEC void mpq_clear (mpq_ptr);
+__GMP_PUBLIC (void, mpq_clear, (mpq_ptr));
 
 #define mpq_clears __gmpq_clears
-__GMP_DECLSPEC void mpq_clears (mpq_ptr, ...);
+__GMP_PUBLIC (void, mpq_clears, (mpq_ptr, ...));
 
 #define mpq_cmp __gmpq_cmp
-__GMP_DECLSPEC int mpq_cmp (mpq_srcptr, mpq_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpq_cmp, (mpq_srcptr, mpq_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define _mpq_cmp_si __gmpq_cmp_si
-__GMP_DECLSPEC int _mpq_cmp_si (mpq_srcptr, long, unsigned long) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, _mpq_cmp_si, (mpq_srcptr, long, unsigned long),
+		__GMP_ATTRIBUTE_PURE);
 
 #define _mpq_cmp_ui __gmpq_cmp_ui
-__GMP_DECLSPEC int _mpq_cmp_ui (mpq_srcptr, unsigned long int, unsigned long int) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, _mpq_cmp_ui,
+		(mpq_srcptr, unsigned long int, unsigned long int),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpq_div __gmpq_div
-__GMP_DECLSPEC void mpq_div (mpq_ptr, mpq_srcptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpq_div, (mpq_ptr, mpq_srcptr, mpq_srcptr));
 
 #define mpq_div_2exp __gmpq_div_2exp
-__GMP_DECLSPEC void mpq_div_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpq_div_2exp, (mpq_ptr, mpq_srcptr, mp_bitcnt_t));
 
 #define mpq_equal __gmpq_equal
-__GMP_DECLSPEC int mpq_equal (mpq_srcptr, mpq_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpq_equal, (mpq_srcptr, mpq_srcptr),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpq_get_num __gmpq_get_num
-__GMP_DECLSPEC void mpq_get_num (mpz_ptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpq_get_num, (mpz_ptr, mpq_srcptr));
 
 #define mpq_get_den __gmpq_get_den
-__GMP_DECLSPEC void mpq_get_den (mpz_ptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpq_get_den, (mpz_ptr, mpq_srcptr));
 
 #define mpq_get_d __gmpq_get_d
-__GMP_DECLSPEC double mpq_get_d (mpq_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (double, mpq_get_d, (mpq_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpq_get_str __gmpq_get_str
-__GMP_DECLSPEC char *mpq_get_str (char *, int, mpq_srcptr);
+__GMP_PUBLIC (char *, mpq_get_str, (char *, int, mpq_srcptr));
 
 #define mpq_init __gmpq_init
-__GMP_DECLSPEC void mpq_init (mpq_ptr);
+__GMP_PUBLIC (void, mpq_init, (mpq_ptr));
 
 #define mpq_inits __gmpq_inits
-__GMP_DECLSPEC void mpq_inits (mpq_ptr, ...);
+__GMP_PUBLIC (void, mpq_inits, (mpq_ptr, ...));
 
 #define mpq_inp_str __gmpq_inp_str
 #ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpq_inp_str (mpq_ptr, FILE *, int);
+__GMP_PUBLIC (size_t, mpq_inp_str, (mpq_ptr, FILE *, int));
 #endif
 
 #define mpq_inv __gmpq_inv
-__GMP_DECLSPEC void mpq_inv (mpq_ptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpq_inv, (mpq_ptr, mpq_srcptr));
 
 #define mpq_mul __gmpq_mul
-__GMP_DECLSPEC void mpq_mul (mpq_ptr, mpq_srcptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpq_mul, (mpq_ptr, mpq_srcptr, mpq_srcptr));
 
 #define mpq_mul_2exp __gmpq_mul_2exp
-__GMP_DECLSPEC void mpq_mul_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpq_mul_2exp, (mpq_ptr, mpq_srcptr, mp_bitcnt_t));
 
 #define mpq_neg __gmpq_neg
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_neg)
-__GMP_DECLSPEC void mpq_neg (mpq_ptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpq_neg, (mpq_ptr, mpq_srcptr));
 #endif
 
 #define mpq_out_str __gmpq_out_str
 #ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpq_out_str (FILE *, int, mpq_srcptr);
+__GMP_PUBLIC (size_t, mpq_out_str, (FILE *, int, mpq_srcptr));
 #endif
 
 #define mpq_set __gmpq_set
-__GMP_DECLSPEC void mpq_set (mpq_ptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpq_set, (mpq_ptr, mpq_srcptr));
 
 #define mpq_set_d __gmpq_set_d
-__GMP_DECLSPEC void mpq_set_d (mpq_ptr, double);
+__GMP_PUBLIC (void, mpq_set_d, (mpq_ptr, double));
 
 #define mpq_set_den __gmpq_set_den
-__GMP_DECLSPEC void mpq_set_den (mpq_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpq_set_den, (mpq_ptr, mpz_srcptr));
 
 #define mpq_set_f __gmpq_set_f
-__GMP_DECLSPEC void mpq_set_f (mpq_ptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpq_set_f, (mpq_ptr, mpf_srcptr));
 
 #define mpq_set_num __gmpq_set_num
-__GMP_DECLSPEC void mpq_set_num (mpq_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpq_set_num, (mpq_ptr, mpz_srcptr));
 
 #define mpq_set_si __gmpq_set_si
-__GMP_DECLSPEC void mpq_set_si (mpq_ptr, signed long int, unsigned long int);
+__GMP_PUBLIC (void, mpq_set_si, (mpq_ptr, signed long int, unsigned long int));
 
 #define mpq_set_str __gmpq_set_str
-__GMP_DECLSPEC int mpq_set_str (mpq_ptr, const char *, int);
+__GMP_PUBLIC (int, mpq_set_str, (mpq_ptr, const char *, int));
 
 #define mpq_set_ui __gmpq_set_ui
-__GMP_DECLSPEC void mpq_set_ui (mpq_ptr, unsigned long int, unsigned long int);
+__GMP_PUBLIC (void, mpq_set_ui,
+	      (mpq_ptr, unsigned long int, unsigned long int));
 
 #define mpq_set_z __gmpq_set_z
-__GMP_DECLSPEC void mpq_set_z (mpq_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpq_set_z, (mpq_ptr, mpz_srcptr));
 
 #define mpq_sub __gmpq_sub
-__GMP_DECLSPEC void mpq_sub (mpq_ptr, mpq_srcptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpq_sub, (mpq_ptr, mpq_srcptr, mpq_srcptr));
 
 #define mpq_swap __gmpq_swap
-__GMP_DECLSPEC void mpq_swap (mpq_ptr, mpq_ptr) __GMP_NOTHROW;
+__GMP_PUBLIC_NT (void, mpq_swap, (mpq_ptr, mpq_ptr));
 
 
 /**************** Float (i.e. F) routines.  ****************/
 
 #define mpf_abs __gmpf_abs
-__GMP_DECLSPEC void mpf_abs (mpf_ptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_abs, (mpf_ptr, mpf_srcptr));
 
 #define mpf_add __gmpf_add
-__GMP_DECLSPEC void mpf_add (mpf_ptr, mpf_srcptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_add, (mpf_ptr, mpf_srcptr, mpf_srcptr));
 
 #define mpf_add_ui __gmpf_add_ui
-__GMP_DECLSPEC void mpf_add_ui (mpf_ptr, mpf_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpf_add_ui, (mpf_ptr, mpf_srcptr, unsigned long int));
 #define mpf_ceil __gmpf_ceil
-__GMP_DECLSPEC void mpf_ceil (mpf_ptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_ceil, (mpf_ptr, mpf_srcptr));
 
 #define mpf_clear __gmpf_clear
-__GMP_DECLSPEC void mpf_clear (mpf_ptr);
+__GMP_PUBLIC (void, mpf_clear, (mpf_ptr));
 
 #define mpf_clears __gmpf_clears
-__GMP_DECLSPEC void mpf_clears (mpf_ptr, ...);
+__GMP_PUBLIC (void, mpf_clears, (mpf_ptr, ...));
 
 #define mpf_cmp __gmpf_cmp
-__GMP_DECLSPEC int mpf_cmp (mpf_srcptr, mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpf_cmp, (mpf_srcptr, mpf_srcptr),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpf_cmp_d __gmpf_cmp_d
-__GMP_DECLSPEC int mpf_cmp_d (mpf_srcptr, double) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpf_cmp_d, (mpf_srcptr, double), __GMP_ATTRIBUTE_PURE);
 
 #define mpf_cmp_si __gmpf_cmp_si
-__GMP_DECLSPEC int mpf_cmp_si (mpf_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpf_cmp_si, (mpf_srcptr, signed long int),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpf_cmp_ui __gmpf_cmp_ui
-__GMP_DECLSPEC int mpf_cmp_ui (mpf_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpf_cmp_ui, (mpf_srcptr, unsigned long int),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpf_div __gmpf_div
-__GMP_DECLSPEC void mpf_div (mpf_ptr, mpf_srcptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_div, (mpf_ptr, mpf_srcptr, mpf_srcptr));
 
 #define mpf_div_2exp __gmpf_div_2exp
-__GMP_DECLSPEC void mpf_div_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpf_div_2exp, (mpf_ptr, mpf_srcptr, mp_bitcnt_t));
 
 #define mpf_div_ui __gmpf_div_ui
-__GMP_DECLSPEC void mpf_div_ui (mpf_ptr, mpf_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpf_div_ui, (mpf_ptr, mpf_srcptr, unsigned long int));
 
 #define mpf_dump __gmpf_dump
-__GMP_DECLSPEC void mpf_dump (mpf_srcptr);
+__GMP_PUBLIC (void, mpf_dump, (mpf_srcptr));
 
 #define mpf_eq __gmpf_eq
-__GMP_DECLSPEC int mpf_eq (mpf_srcptr, mpf_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpf_eq, (mpf_srcptr, mpf_srcptr, mp_bitcnt_t),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpf_fits_sint_p __gmpf_fits_sint_p
-__GMP_DECLSPEC int mpf_fits_sint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpf_fits_sint_p, (mpf_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpf_fits_slong_p __gmpf_fits_slong_p
-__GMP_DECLSPEC int mpf_fits_slong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpf_fits_slong_p, (mpf_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpf_fits_sshort_p __gmpf_fits_sshort_p
-__GMP_DECLSPEC int mpf_fits_sshort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpf_fits_sshort_p, (mpf_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpf_fits_uint_p __gmpf_fits_uint_p
-__GMP_DECLSPEC int mpf_fits_uint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpf_fits_uint_p, (mpf_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpf_fits_ulong_p __gmpf_fits_ulong_p
-__GMP_DECLSPEC int mpf_fits_ulong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpf_fits_ulong_p, (mpf_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpf_fits_ushort_p __gmpf_fits_ushort_p
-__GMP_DECLSPEC int mpf_fits_ushort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpf_fits_ushort_p, (mpf_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpf_floor __gmpf_floor
-__GMP_DECLSPEC void mpf_floor (mpf_ptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_floor, (mpf_ptr, mpf_srcptr));
 
 #define mpf_get_d __gmpf_get_d
-__GMP_DECLSPEC double mpf_get_d (mpf_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (double, mpf_get_d, (mpf_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpf_get_d_2exp __gmpf_get_d_2exp
-__GMP_DECLSPEC double mpf_get_d_2exp (signed long int *, mpf_srcptr);
+__GMP_PUBLIC (double, mpf_get_d_2exp, (signed long int *, mpf_srcptr));
 
 #define mpf_get_default_prec __gmpf_get_default_prec
-__GMP_DECLSPEC mp_bitcnt_t mpf_get_default_prec (void) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (mp_bitcnt_t, mpf_get_default_prec, (void),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpf_get_prec __gmpf_get_prec
-__GMP_DECLSPEC mp_bitcnt_t mpf_get_prec (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (mp_bitcnt_t, mpf_get_prec, (mpf_srcptr),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpf_get_si __gmpf_get_si
-__GMP_DECLSPEC long mpf_get_si (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (long, mpf_get_si, (mpf_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpf_get_str __gmpf_get_str
-__GMP_DECLSPEC char *mpf_get_str (char *, mp_exp_t *, int, size_t, mpf_srcptr);
+__GMP_PUBLIC (char *, mpf_get_str,
+	      (char *, mp_exp_t *, int, size_t, mpf_srcptr));
 
 #define mpf_get_ui __gmpf_get_ui
-__GMP_DECLSPEC unsigned long mpf_get_ui (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (unsigned long, mpf_get_ui, (mpf_srcptr),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpf_init __gmpf_init
-__GMP_DECLSPEC void mpf_init (mpf_ptr);
+__GMP_PUBLIC (void, mpf_init, (mpf_ptr));
 
 #define mpf_init2 __gmpf_init2
-__GMP_DECLSPEC void mpf_init2 (mpf_ptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpf_init2, (mpf_ptr, mp_bitcnt_t));
 
 #define mpf_inits __gmpf_inits
-__GMP_DECLSPEC void mpf_inits (mpf_ptr, ...);
+__GMP_PUBLIC (void, mpf_inits, (mpf_ptr, ...));
 
 #define mpf_init_set __gmpf_init_set
-__GMP_DECLSPEC void mpf_init_set (mpf_ptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_init_set, (mpf_ptr, mpf_srcptr));
 
 #define mpf_init_set_d __gmpf_init_set_d
-__GMP_DECLSPEC void mpf_init_set_d (mpf_ptr, double);
+__GMP_PUBLIC (void, mpf_init_set_d, (mpf_ptr, double));
 
 #define mpf_init_set_si __gmpf_init_set_si
-__GMP_DECLSPEC void mpf_init_set_si (mpf_ptr, signed long int);
+__GMP_PUBLIC (void, mpf_init_set_si, (mpf_ptr, signed long int));
 
 #define mpf_init_set_str __gmpf_init_set_str
-__GMP_DECLSPEC int mpf_init_set_str (mpf_ptr, const char *, int);
+__GMP_PUBLIC (int, mpf_init_set_str, (mpf_ptr, const char *, int));
 
 #define mpf_init_set_ui __gmpf_init_set_ui
-__GMP_DECLSPEC void mpf_init_set_ui (mpf_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpf_init_set_ui, (mpf_ptr, unsigned long int));
 
 #define mpf_inp_str __gmpf_inp_str
 #ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpf_inp_str (mpf_ptr, FILE *, int);
+__GMP_PUBLIC (size_t, mpf_inp_str, (mpf_ptr, FILE *, int));
 #endif
 
 #define mpf_integer_p __gmpf_integer_p
-__GMP_DECLSPEC int mpf_integer_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpf_integer_p, (mpf_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpf_mul __gmpf_mul
-__GMP_DECLSPEC void mpf_mul (mpf_ptr, mpf_srcptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_mul, (mpf_ptr, mpf_srcptr, mpf_srcptr));
 
 #define mpf_mul_2exp __gmpf_mul_2exp
-__GMP_DECLSPEC void mpf_mul_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpf_mul_2exp, (mpf_ptr, mpf_srcptr, mp_bitcnt_t));
 
 #define mpf_mul_ui __gmpf_mul_ui
-__GMP_DECLSPEC void mpf_mul_ui (mpf_ptr, mpf_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpf_mul_ui, (mpf_ptr, mpf_srcptr, unsigned long int));
 
 #define mpf_neg __gmpf_neg
-__GMP_DECLSPEC void mpf_neg (mpf_ptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_neg, (mpf_ptr, mpf_srcptr));
 
 #define mpf_out_str __gmpf_out_str
 #ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpf_out_str (FILE *, int, size_t, mpf_srcptr);
+__GMP_PUBLIC (size_t, mpf_out_str, (FILE *, int, size_t, mpf_srcptr));
 #endif
 
 #define mpf_pow_ui __gmpf_pow_ui
-__GMP_DECLSPEC void mpf_pow_ui (mpf_ptr, mpf_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpf_pow_ui, (mpf_ptr, mpf_srcptr, unsigned long int));
 
 #define mpf_random2 __gmpf_random2
-__GMP_DECLSPEC void mpf_random2 (mpf_ptr, mp_size_t, mp_exp_t);
+__GMP_PUBLIC (void, mpf_random2, (mpf_ptr, mp_size_t, mp_exp_t));
 
 #define mpf_reldiff __gmpf_reldiff
-__GMP_DECLSPEC void mpf_reldiff (mpf_ptr, mpf_srcptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_reldiff, (mpf_ptr, mpf_srcptr, mpf_srcptr));
 
 #define mpf_set __gmpf_set
-__GMP_DECLSPEC void mpf_set (mpf_ptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_set, (mpf_ptr, mpf_srcptr));
 
 #define mpf_set_d __gmpf_set_d
-__GMP_DECLSPEC void mpf_set_d (mpf_ptr, double);
+__GMP_PUBLIC (void, mpf_set_d, (mpf_ptr, double));
 
 #define mpf_set_default_prec __gmpf_set_default_prec
-__GMP_DECLSPEC void mpf_set_default_prec (mp_bitcnt_t) __GMP_NOTHROW;
+__GMP_PUBLIC_NT (void, mpf_set_default_prec, (mp_bitcnt_t));
 
 #define mpf_set_prec __gmpf_set_prec
-__GMP_DECLSPEC void mpf_set_prec (mpf_ptr, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpf_set_prec, (mpf_ptr, mp_bitcnt_t));
 
 #define mpf_set_prec_raw __gmpf_set_prec_raw
-__GMP_DECLSPEC void mpf_set_prec_raw (mpf_ptr, mp_bitcnt_t) __GMP_NOTHROW;
+__GMP_PUBLIC_NT (void, mpf_set_prec_raw, (mpf_ptr, mp_bitcnt_t));
 
 #define mpf_set_q __gmpf_set_q
-__GMP_DECLSPEC void mpf_set_q (mpf_ptr, mpq_srcptr);
+__GMP_PUBLIC (void, mpf_set_q, (mpf_ptr, mpq_srcptr));
 
 #define mpf_set_si __gmpf_set_si
-__GMP_DECLSPEC void mpf_set_si (mpf_ptr, signed long int);
+__GMP_PUBLIC (void, mpf_set_si, (mpf_ptr, signed long int));
 
 #define mpf_set_str __gmpf_set_str
-__GMP_DECLSPEC int mpf_set_str (mpf_ptr, const char *, int);
+__GMP_PUBLIC (int, mpf_set_str, (mpf_ptr, const char *, int));
 
 #define mpf_set_ui __gmpf_set_ui
-__GMP_DECLSPEC void mpf_set_ui (mpf_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpf_set_ui, (mpf_ptr, unsigned long int));
 
 #define mpf_set_z __gmpf_set_z
-__GMP_DECLSPEC void mpf_set_z (mpf_ptr, mpz_srcptr);
+__GMP_PUBLIC (void, mpf_set_z, (mpf_ptr, mpz_srcptr));
 
 #define mpf_size __gmpf_size
-__GMP_DECLSPEC size_t mpf_size (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (size_t, mpf_size, (mpf_srcptr), __GMP_ATTRIBUTE_PURE);
 
 #define mpf_sqrt __gmpf_sqrt
-__GMP_DECLSPEC void mpf_sqrt (mpf_ptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_sqrt, (mpf_ptr, mpf_srcptr));
 
 #define mpf_sqrt_ui __gmpf_sqrt_ui
-__GMP_DECLSPEC void mpf_sqrt_ui (mpf_ptr, unsigned long int);
+__GMP_PUBLIC (void, mpf_sqrt_ui, (mpf_ptr, unsigned long int));
 
 #define mpf_sub __gmpf_sub
-__GMP_DECLSPEC void mpf_sub (mpf_ptr, mpf_srcptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_sub, (mpf_ptr, mpf_srcptr, mpf_srcptr));
 
 #define mpf_sub_ui __gmpf_sub_ui
-__GMP_DECLSPEC void mpf_sub_ui (mpf_ptr, mpf_srcptr, unsigned long int);
+__GMP_PUBLIC (void, mpf_sub_ui, (mpf_ptr, mpf_srcptr, unsigned long int));
 
 #define mpf_swap __gmpf_swap
-__GMP_DECLSPEC void mpf_swap (mpf_ptr, mpf_ptr) __GMP_NOTHROW;
+__GMP_PUBLIC_NT (void, mpf_swap, (mpf_ptr, mpf_ptr));
 
 #define mpf_trunc __gmpf_trunc
-__GMP_DECLSPEC void mpf_trunc (mpf_ptr, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_trunc, (mpf_ptr, mpf_srcptr));
 
 #define mpf_ui_div __gmpf_ui_div
-__GMP_DECLSPEC void mpf_ui_div (mpf_ptr, unsigned long int, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_ui_div, (mpf_ptr, unsigned long int, mpf_srcptr));
 
 #define mpf_ui_sub __gmpf_ui_sub
-__GMP_DECLSPEC void mpf_ui_sub (mpf_ptr, unsigned long int, mpf_srcptr);
+__GMP_PUBLIC (void, mpf_ui_sub, (mpf_ptr, unsigned long int, mpf_srcptr));
 
 #define mpf_urandomb __gmpf_urandomb
-__GMP_DECLSPEC void mpf_urandomb (mpf_t, gmp_randstate_t, mp_bitcnt_t);
+__GMP_PUBLIC (void, mpf_urandomb, (mpf_t, gmp_randstate_t, mp_bitcnt_t));
 
 
 /************ Low level positive-integer (i.e. N) routines.  ************/
@@ -1460,171 +1554,204 @@ __GMP_DECLSPEC void mpf_urandomb (mpf_t, gmp_randstate_t, mp_bitcnt_t);
 
 #define mpn_add __MPN(add)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add)
-__GMP_DECLSPEC mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (mp_limb_t, mpn_add,
+	      (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
 #endif
 
 #define mpn_add_1 __MPN(add_1)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add_1)
-__GMP_DECLSPEC mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
+__GMP_PUBLIC_NT (mp_limb_t, mpn_add_1,
+		 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
 #endif
 
 #define mpn_add_n __MPN(add_n)
-__GMP_DECLSPEC mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (mp_limb_t, mpn_add_n, (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 
 #define mpn_addmul_1 __MPN(addmul_1)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_PUBLIC (mp_limb_t, mpn_addmul_1,
+	      (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
 
 #define mpn_cmp __MPN(cmp)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_cmp)
-__GMP_DECLSPEC int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (int, mpn_cmp, (mp_srcptr, mp_srcptr, mp_size_t),
+		   __GMP_ATTRIBUTE_PURE);
 #endif
 
 #define mpn_divexact_by3(dst,src,size) \
   mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0))
 
 #define mpn_divexact_by3c __MPN(divexact_by3c)
-__GMP_DECLSPEC mp_limb_t mpn_divexact_by3c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_PUBLIC (mp_limb_t, mpn_divexact_by3c,
+	      (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
 
 #define mpn_divmod_1(qp,np,nsize,dlimb) \
   mpn_divrem_1 (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dlimb)
 
 #define mpn_divrem __MPN(divrem)
-__GMP_DECLSPEC mp_limb_t mpn_divrem (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (mp_limb_t, mpn_divrem,
+	      (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
 
 #define mpn_divrem_1 __MPN(divrem_1)
-__GMP_DECLSPEC mp_limb_t mpn_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_PUBLIC (mp_limb_t, mpn_divrem_1,
+	      (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
 
 #define mpn_divrem_2 __MPN(divrem_2)
-__GMP_DECLSPEC mp_limb_t mpn_divrem_2 (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr);
+__GMP_PUBLIC (mp_limb_t, mpn_divrem_2,
+	      (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr));
 
 #define mpn_div_qr_2 __MPN(div_qr_2)
-__GMP_DECLSPEC mp_limb_t mpn_div_qr_2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+__GMP_PUBLIC (mp_limb_t, mpn_div_qr_2,
+	      (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
 
 #define mpn_gcd __MPN(gcd)
-__GMP_DECLSPEC mp_size_t mpn_gcd (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
+__GMP_PUBLIC (mp_size_t, mpn_gcd,
+	      (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
 
 #define mpn_gcd_1 __MPN(gcd_1)
-__GMP_DECLSPEC mp_limb_t mpn_gcd_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (mp_limb_t, mpn_gcd_1, (mp_srcptr, mp_size_t, mp_limb_t),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpn_gcdext_1 __MPN(gcdext_1)
-__GMP_DECLSPEC mp_limb_t mpn_gcdext_1 (mp_limb_signed_t *, mp_limb_signed_t *, mp_limb_t, mp_limb_t);
+__GMP_PUBLIC (mp_limb_t, mpn_gcdext_1,
+	      (mp_limb_signed_t *, mp_limb_signed_t *, mp_limb_t, mp_limb_t));
 
 #define mpn_gcdext __MPN(gcdext)
-__GMP_DECLSPEC mp_size_t mpn_gcdext (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
+__GMP_PUBLIC (mp_size_t, mpn_gcdext,
+	      (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t,
+	       mp_ptr, mp_size_t));
 
 #define mpn_get_str __MPN(get_str)
-__GMP_DECLSPEC size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
+__GMP_PUBLIC (size_t, mpn_get_str, (unsigned char *, int, mp_ptr, mp_size_t));
 
 #define mpn_hamdist __MPN(hamdist)
-__GMP_DECLSPEC mp_bitcnt_t mpn_hamdist (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (mp_bitcnt_t, mpn_hamdist, (mp_srcptr, mp_srcptr, mp_size_t),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpn_lshift __MPN(lshift)
-__GMP_DECLSPEC mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+__GMP_PUBLIC (mp_limb_t, mpn_lshift,
+	      (mp_ptr, mp_srcptr, mp_size_t, unsigned int));
 
 #define mpn_mod_1 __MPN(mod_1)
-__GMP_DECLSPEC mp_limb_t mpn_mod_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (mp_limb_t, mpn_mod_1, (mp_srcptr, mp_size_t, mp_limb_t),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpn_mul __MPN(mul)
-__GMP_DECLSPEC mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (mp_limb_t, mpn_mul,
+	      (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
 
 #define mpn_mul_1 __MPN(mul_1)
-__GMP_DECLSPEC mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_PUBLIC (mp_limb_t, mpn_mul_1, (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
 
 #define mpn_mul_n __MPN(mul_n)
-__GMP_DECLSPEC void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_mul_n, (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 
 #define mpn_sqr __MPN(sqr)
-__GMP_DECLSPEC void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_sqr, (mp_ptr, mp_srcptr, mp_size_t));
 
 #define mpn_neg __MPN(neg)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_neg)
-__GMP_DECLSPEC mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (mp_limb_t, mpn_neg, (mp_ptr, mp_srcptr, mp_size_t));
 #endif
 
 #define mpn_com __MPN(com)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_com)
-__GMP_DECLSPEC void mpn_com (mp_ptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_com, (mp_ptr, mp_srcptr, mp_size_t));
 #endif
 
 #define mpn_perfect_square_p __MPN(perfect_square_p)
-__GMP_DECLSPEC int mpn_perfect_square_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpn_perfect_square_p, (mp_srcptr, mp_size_t),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpn_perfect_power_p __MPN(perfect_power_p)
-__GMP_DECLSPEC int mpn_perfect_power_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (int, mpn_perfect_power_p, (mp_srcptr, mp_size_t),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpn_popcount __MPN(popcount)
-__GMP_DECLSPEC mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_NT_A (mp_bitcnt_t, mpn_popcount, (mp_srcptr, mp_size_t),
+		   __GMP_ATTRIBUTE_PURE);
 
 #define mpn_pow_1 __MPN(pow_1)
-__GMP_DECLSPEC mp_size_t mpn_pow_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
+__GMP_PUBLIC (mp_size_t, mpn_pow_1,
+	      (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr));
 
 /* undocumented now, but retained here for upward compatibility */
 #define mpn_preinv_mod_1 __MPN(preinv_mod_1)
-__GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1 (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (mp_limb_t, mpn_preinv_mod_1,
+	        (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpn_random __MPN(random)
-__GMP_DECLSPEC void mpn_random (mp_ptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_random, (mp_ptr, mp_size_t));
 
 #define mpn_random2 __MPN(random2)
-__GMP_DECLSPEC void mpn_random2 (mp_ptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_random2, (mp_ptr, mp_size_t));
 
 #define mpn_rshift __MPN(rshift)
-__GMP_DECLSPEC mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+__GMP_PUBLIC (mp_limb_t, mpn_rshift,
+	      (mp_ptr, mp_srcptr, mp_size_t, unsigned int));
 
 #define mpn_scan0 __MPN(scan0)
-__GMP_DECLSPEC mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (mp_bitcnt_t, mpn_scan0, (mp_srcptr, mp_bitcnt_t),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpn_scan1 __MPN(scan1)
-__GMP_DECLSPEC mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
+__GMP_PUBLIC_A (mp_bitcnt_t, mpn_scan1, (mp_srcptr, mp_bitcnt_t),
+		__GMP_ATTRIBUTE_PURE);
 
 #define mpn_set_str __MPN(set_str)
-__GMP_DECLSPEC mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
+__GMP_PUBLIC (mp_size_t, mpn_set_str,
+	      (mp_ptr, const unsigned char *, size_t, int));
 
 #define mpn_sqrtrem __MPN(sqrtrem)
-__GMP_DECLSPEC mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (mp_size_t, mpn_sqrtrem, (mp_ptr, mp_ptr, mp_srcptr, mp_size_t));
 
 #define mpn_sub __MPN(sub)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub)
-__GMP_DECLSPEC mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (mp_limb_t, mpn_sub,
+	      (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
 #endif
 
 #define mpn_sub_1 __MPN(sub_1)
 #if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub_1)
-__GMP_DECLSPEC mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
+__GMP_PUBLIC_NT (mp_limb_t, mpn_sub_1,
+		 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
 #endif
 
 #define mpn_sub_n __MPN(sub_n)
-__GMP_DECLSPEC mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (mp_limb_t, mpn_sub_n, (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 
 #define mpn_submul_1 __MPN(submul_1)
-__GMP_DECLSPEC mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_PUBLIC (mp_limb_t, mpn_submul_1,
+	      (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
 
 #define mpn_tdiv_qr __MPN(tdiv_qr)
-__GMP_DECLSPEC void mpn_tdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_tdiv_qr,
+	      (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t,
+	       mp_srcptr, mp_size_t));
 
 #define mpn_and_n __MPN(and_n)
-__GMP_DECLSPEC void mpn_and_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_and_n, (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 #define mpn_andn_n __MPN(andn_n)
-__GMP_DECLSPEC void mpn_andn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_andn_n, (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 #define mpn_nand_n __MPN(nand_n)
-__GMP_DECLSPEC void mpn_nand_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_nand_n, (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 #define mpn_ior_n __MPN(ior_n)
-__GMP_DECLSPEC void mpn_ior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_ior_n, (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 #define mpn_iorn_n __MPN(iorn_n)
-__GMP_DECLSPEC void mpn_iorn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_iorn_n, (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 #define mpn_nior_n __MPN(nior_n)
-__GMP_DECLSPEC void mpn_nior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_nior_n, (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 #define mpn_xor_n __MPN(xor_n)
-__GMP_DECLSPEC void mpn_xor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_xor_n, (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 #define mpn_xnor_n __MPN(xnor_n)
-__GMP_DECLSPEC void mpn_xnor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_xnor_n, (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
 
 #define mpn_copyi __MPN(copyi)
-__GMP_DECLSPEC void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_copyi, (mp_ptr, mp_srcptr, mp_size_t));
 #define mpn_copyd __MPN(copyd)
-__GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_copyd, (mp_ptr, mp_srcptr, mp_size_t));
 #define mpn_zero __MPN(zero)
-__GMP_DECLSPEC void mpn_zero (mp_ptr, mp_size_t);
+__GMP_PUBLIC (void, mpn_zero, (mp_ptr, mp_size_t));
 
 /**************** mpz inlines ****************/
 
-- 
1.8.1.2



More information about the gmp-devel mailing list