[Gmp-commit] /home/hgfiles/gmp: Make it possible to compile GMP with g++.

mercurial at gmplib.org mercurial at gmplib.org
Wed Nov 10 16:28:05 CET 2010


details:   /home/hgfiles/gmp/rev/4c7883ebf326
changeset: 13679:4c7883ebf326
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Nov 10 16:28:01 2010 +0100
description:
Make it possible to compile GMP with g++.

diffstat:

 ChangeLog                |  69 ++++++++++++++++++++++++++++++++++++++++++++++++
 gmp-impl.h               |   2 +
 mp_get_fns.c             |   2 +-
 mp_set_fns.c             |   2 +-
 mpbsd/min.c              |   1 -
 mpbsd/xtom.c             |   1 -
 mpf/cmp.c                |   2 +-
 mpf/cmp_si.c             |   2 +-
 mpf/cmp_ui.c             |   2 +-
 mpf/fits_s.h             |   2 +-
 mpf/fits_u.h             |   2 +-
 mpf/get_dfl_prec.c       |   2 +-
 mpf/get_prc.c            |   2 +-
 mpf/get_si.c             |   2 +-
 mpf/get_ui.c             |   2 +-
 mpf/int_p.c              |   2 +-
 mpf/set_dfl_prec.c       |   2 +-
 mpf/set_prc_raw.c        |   2 +-
 mpf/set_str.c            |   1 -
 mpf/size.c               |   2 +-
 mpf/swap.c               |   2 +-
 mpn/generic/toom43_mul.c |  12 ++++----
 mpn/generic/toom44_mul.c |   8 ++--
 mpn/generic/toom4_sqr.c  |   2 +-
 mpn/generic/toom52_mul.c |  16 +++++-----
 mpn/generic/toom53_mul.c |  12 ++++----
 mpn/generic/toom62_mul.c |  16 +++++-----
 mpq/equal.c              |   2 +-
 mpq/swap.c               |   2 +-
 mpz/clrbit.c             |   6 +--
 mpz/cmp.c                |   2 +-
 mpz/cmp_si.c             |   2 +-
 mpz/cmp_ui.c             |   2 +-
 mpz/cmpabs.c             |   2 +-
 mpz/cmpabs_ui.c          |   2 +-
 mpz/cong_2exp.c          |   2 +-
 mpz/divis_2exp.c         |   2 +-
 mpz/fits_s.h             |   2 +-
 mpz/get_si.c             |   2 +-
 mpz/hamdist.c            |   2 +-
 mpz/inp_str.c            |   1 -
 mpz/powm.c               |  24 ++++++++--------
 mpz/scan0.c              |   2 +-
 mpz/scan1.c              |   2 +-
 mpz/set_str.c            |   1 -
 mpz/setbit.c             |   6 +--
 mpz/sizeinbase.c         |   2 +-
 mpz/swap.c               |   2 +-
 mpz/tstbit.c             |   2 +-
 randlc2x.c               |   6 ++--
 tal-reent.c              |   2 +-
 tests/memory.c           |   1 +
 tests/misc.c             |   2 +-
 tests/misc/t-printf.c    |   2 +-
 tests/misc/t-scanf.c     |   2 +-
 tests/mpz/convert.c      |   2 +-
 tests/refmpn.c           |   4 +-
 tests/tests.h            |   2 +-
 58 files changed, 165 insertions(+), 102 deletions(-)

diffs (truncated from 1048 to 300 lines):

diff -r bf3be2ae2a3a -r 4c7883ebf326 ChangeLog
--- a/ChangeLog	Tue Nov 09 21:22:51 2010 +0100
+++ b/ChangeLog	Wed Nov 10 16:28:01 2010 +0100
@@ -1,3 +1,72 @@
+2010-11-10  Torbjorn Granlund  <tege at gmplib.org>
+
+	Make it possible to compile GMP with g++:
+
+	* gmp-impl.h: Declare __gmp_digit_value_tab here.
+	* mpbsd/min.c: ...not here.
+	* mpbsd/xtom.c: ...nor here.
+	* mpf/set_str.c: ...nor here.
+	* mpz/inp_str.c: ...nor here.
+	* mpz/set_str.c: ...nor here.
+
+	* mpn/generic/toom43_mul.c: Add casts for logical operations on enums.
+	* mpn/generic/toom44_mul.c: Likewise.
+	* mpn/generic/toom4_sqr.c: Likewise.
+	* mpn/generic/toom52_mul.c: Likewise.
+	* mpn/generic/toom53_mul.c: Likewise.
+	* mpn/generic/toom62_mul.c: Likewise.
+
+	* mpz/clrbit.c: Clean up typing using MPZ_REALLOC.
+	* mpz/setbit.c: Likewise.
+
+	* mpz/powm.c: Avoid variable name 'new'.
+
+	* randlc2x.c: Add explicit casts for type conversions.
+	* tests/misc/t-printf.c: Likewise.
+	* tests/misc/t-scanf.c: Likewise.
+	* tests/misc.c: Likewise.
+	* tests/mpz/convert.c: Likewise.
+	* tests/refmpn.c: Likewise.
+
+	* tests/tests.h: Unconditionally use <sstream> for now.
+
+	* tests/memory.c: Include "tests.h.
+
+	* mp_get_fns.c: Add a __GMP_NOTHROW for coherency with prototype.
+	* mp_set_fns.c: Likewise.
+	* mpf/cmp.c: Likewise.
+	* mpf/cmp_si.c: Likewise.
+	* mpf/cmp_ui.c: Likewise.
+	* mpf/fits_s.h: Likewise.
+	* mpf/fits_u.h: Likewise.
+	* mpf/get_dfl_prec.c: Likewise.
+	* mpf/get_prc.c: Likewise.
+	* mpf/get_si.c: Likewise.
+	* mpf/get_ui.c: Likewise.
+	* mpf/int_p.c: Likewise.
+	* mpf/set_dfl_prec.c: Likewise.
+	* mpf/set_prc_raw.c: Likewise.
+	* mpf/size.c: Likewise.
+	* mpf/swap.c: Likewise.
+	* mpq/equal.c: Likewise.
+	* mpq/swap.c: Likewise.
+	* mpz/cmp.c: Likewise.
+	* mpz/cmp_si.c: Likewise.
+	* mpz/cmp_ui.c: Likewise.
+	* mpz/cmpabs.c: Likewise.
+	* mpz/cmpabs_ui.c: Likewise.
+	* mpz/cong_2exp.c: Likewise.
+	* mpz/divis_2exp.c: Likewise.
+	* mpz/fits_s.h: Likewise.
+	* mpz/get_si.c: Likewise.
+	* mpz/hamdist.c: Likewise.
+	* mpz/scan0.c: Likewise.
+	* mpz/scan1.c: Likewise.
+	* mpz/sizeinbase.c: Likewise.
+	* mpz/swap.c: Likewise.
+	* mpz/tstbit.c: Likewise.
+	* tal-reent.c: Likewise.
+
 2010-11-09  Torbjorn Granlund  <tege at gmplib.org>
 
 	* configure.in: Get rid of K&R support.
diff -r bf3be2ae2a3a -r 4c7883ebf326 gmp-impl.h
--- a/gmp-impl.h	Tue Nov 09 21:22:51 2010 +0100
+++ b/gmp-impl.h	Wed Nov 10 16:28:01 2010 +0100
@@ -3518,6 +3518,8 @@
 #endif
 
 
+__GMP_DECLSPEC extern const unsigned char __gmp_digit_value_tab[];
+
 __GMP_DECLSPEC extern int __gmp_junk;
 __GMP_DECLSPEC extern const int __gmp_0;
 __GMP_DECLSPEC void __gmp_exception __GMP_PROTO ((int)) ATTRIBUTE_NORETURN;
diff -r bf3be2ae2a3a -r 4c7883ebf326 mp_get_fns.c
--- a/mp_get_fns.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mp_get_fns.c	Wed Nov 10 16:28:01 2010 +0100
@@ -24,7 +24,7 @@
 void
 mp_get_memory_functions (void *(**alloc_func) (size_t),
 			 void *(**realloc_func) (void *, size_t, size_t),
-			 void (**free_func) (void *, size_t))
+			 void (**free_func) (void *, size_t)) __GMP_NOTHROW
 {
   if (alloc_func != NULL)
     *alloc_func = __gmp_allocate_func;
diff -r bf3be2ae2a3a -r 4c7883ebf326 mp_set_fns.c
--- a/mp_set_fns.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mp_set_fns.c	Wed Nov 10 16:28:01 2010 +0100
@@ -24,7 +24,7 @@
 void
 mp_set_memory_functions (void *(*alloc_func) (size_t),
 			 void *(*realloc_func) (void *, size_t, size_t),
-			 void (*free_func) (void *, size_t))
+			 void (*free_func) (void *, size_t)) __GMP_NOTHROW
 {
   if (alloc_func == 0)
     alloc_func = __gmp_default_allocate;
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpbsd/min.c
--- a/mpbsd/min.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpbsd/min.c	Wed Nov 10 16:28:01 2010 +0100
@@ -24,7 +24,6 @@
 #include "gmp.h"
 #include "gmp-impl.h"
 
-extern const unsigned char __gmp_digit_value_tab[];
 #define digit_value_tab __gmp_digit_value_tab
 
 void
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpbsd/xtom.c
--- a/mpbsd/xtom.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpbsd/xtom.c	Wed Nov 10 16:28:01 2010 +0100
@@ -25,7 +25,6 @@
 #include "gmp.h"
 #include "gmp-impl.h"
 
-extern const unsigned char __gmp_digit_value_tab[];
 #define digit_value __gmp_digit_value_tab
 
 MINT *
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/cmp.c
--- a/mpf/cmp.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/cmp.c	Wed Nov 10 16:28:01 2010 +0100
@@ -21,7 +21,7 @@
 #include "gmp-impl.h"
 
 int
-mpf_cmp (mpf_srcptr u, mpf_srcptr v)
+mpf_cmp (mpf_srcptr u, mpf_srcptr v) __GMP_NOTHROW
 {
   mp_srcptr up, vp;
   mp_size_t usize, vsize;
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/cmp_si.c
--- a/mpf/cmp_si.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/cmp_si.c	Wed Nov 10 16:28:01 2010 +0100
@@ -22,7 +22,7 @@
 #include "gmp-impl.h"
 
 int
-mpf_cmp_si (mpf_srcptr u, long int vval)
+mpf_cmp_si (mpf_srcptr u, long int vval) __GMP_NOTHROW
 {
   mp_srcptr up;
   mp_size_t usize;
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/cmp_ui.c
--- a/mpf/cmp_ui.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/cmp_ui.c	Wed Nov 10 16:28:01 2010 +0100
@@ -21,7 +21,7 @@
 #include "gmp-impl.h"
 
 int
-mpf_cmp_ui (mpf_srcptr u, unsigned long int vval)
+mpf_cmp_ui (mpf_srcptr u, unsigned long int vval) __GMP_NOTHROW
 {
   mp_srcptr up;
   mp_size_t usize;
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/fits_s.h
--- a/mpf/fits_s.h	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/fits_s.h	Wed Nov 10 16:28:01 2010 +0100
@@ -24,7 +24,7 @@
 /* Notice this is equivalent to mpz_set_f + mpz_fits_s*_p.  */
 
 int
-FUNCTION (mpf_srcptr f)
+FUNCTION (mpf_srcptr f) __GMP_NOTHROW
 {
   mp_size_t  fs, fn;
   mp_srcptr  fp;
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/fits_u.h
--- a/mpf/fits_u.h	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/fits_u.h	Wed Nov 10 16:28:01 2010 +0100
@@ -24,7 +24,7 @@
 /* Notice this is equivalent to mpz_set_f + mpz_fits_u*_p.  */
 
 int
-FUNCTION (mpf_srcptr f)
+FUNCTION (mpf_srcptr f) __GMP_NOTHROW
 {
   mp_size_t  fn;
   mp_srcptr  fp;
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/get_dfl_prec.c
--- a/mpf/get_dfl_prec.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/get_dfl_prec.c	Wed Nov 10 16:28:01 2010 +0100
@@ -22,7 +22,7 @@
 
 
 mp_bitcnt_t
-mpf_get_default_prec (void)
+mpf_get_default_prec (void) __GMP_NOTHROW
 {
   return __GMPF_PREC_TO_BITS (__gmp_default_fp_limb_precision);
 }
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/get_prc.c
--- a/mpf/get_prc.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/get_prc.c	Wed Nov 10 16:28:01 2010 +0100
@@ -21,7 +21,7 @@
 #include "gmp-impl.h"
 
 mp_bitcnt_t
-mpf_get_prec (mpf_srcptr x)
+mpf_get_prec (mpf_srcptr x) __GMP_NOTHROW
 {
   return __GMPF_PREC_TO_BITS (x->_mp_prec);
 }
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/get_si.c
--- a/mpf/get_si.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/get_si.c	Wed Nov 10 16:28:01 2010 +0100
@@ -40,7 +40,7 @@
    -0x80000000 instead of the desired 0.  */
 
 long
-mpf_get_si (mpf_srcptr f)
+mpf_get_si (mpf_srcptr f) __GMP_NOTHROW
 {
   mp_exp_t exp;
   mp_size_t size, abs_size;
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/get_ui.c
--- a/mpf/get_ui.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/get_ui.c	Wed Nov 10 16:28:01 2010 +0100
@@ -61,7 +61,7 @@
    tested first we ensure MP_EXP_T_MIN doesn't reach exp>1.  */
 
 unsigned long
-mpf_get_ui (mpf_srcptr f)
+mpf_get_ui (mpf_srcptr f) __GMP_NOTHROW
 {
   mp_size_t size;
   mp_exp_t exp;
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/int_p.c
--- a/mpf/int_p.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/int_p.c	Wed Nov 10 16:28:01 2010 +0100
@@ -23,7 +23,7 @@
 
 
 int
-mpf_integer_p (mpf_srcptr f)
+mpf_integer_p (mpf_srcptr f) __GMP_NOTHROW
 {
   mp_srcptr ptr;
   mp_exp_t exp;
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/set_dfl_prec.c
--- a/mpf/set_dfl_prec.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/set_dfl_prec.c	Wed Nov 10 16:28:01 2010 +0100
@@ -23,7 +23,7 @@
 mp_size_t __gmp_default_fp_limb_precision = __GMPF_BITS_TO_PREC (53);
 
 void
-mpf_set_default_prec (mp_bitcnt_t prec_in_bits)
+mpf_set_default_prec (mp_bitcnt_t prec_in_bits) __GMP_NOTHROW
 {
   __gmp_default_fp_limb_precision = __GMPF_BITS_TO_PREC (prec_in_bits);
 }
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/set_prc_raw.c
--- a/mpf/set_prc_raw.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/set_prc_raw.c	Wed Nov 10 16:28:01 2010 +0100
@@ -23,7 +23,7 @@
 #include "gmp-impl.h"
 
 void
-mpf_set_prec_raw (mpf_ptr x, mp_bitcnt_t prec_in_bits)
+mpf_set_prec_raw (mpf_ptr x, mp_bitcnt_t prec_in_bits) __GMP_NOTHROW
 {
   x->_mp_prec = __GMPF_BITS_TO_PREC (prec_in_bits);
 }
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/set_str.c
--- a/mpf/set_str.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/set_str.c	Wed Nov 10 16:28:01 2010 +0100
@@ -47,7 +47,6 @@
 #include "gmp-impl.h"
 #include "longlong.h"
 
-extern const unsigned char __gmp_digit_value_tab[];
 #define digit_value_tab __gmp_digit_value_tab
 
 /* Compute base^exp and return the most significant prec limbs in rp[].
diff -r bf3be2ae2a3a -r 4c7883ebf326 mpf/size.c
--- a/mpf/size.c	Tue Nov 09 21:22:51 2010 +0100
+++ b/mpf/size.c	Wed Nov 10 16:28:01 2010 +0100
@@ -22,7 +22,7 @@
 #include "gmp-impl.h"
 
 size_t
-mpf_size (mpf_srcptr f)
+mpf_size (mpf_srcptr f) __GMP_NOTHROW
 {
   return __GMP_ABS (f->_mp_size);


More information about the gmp-commit mailing list