[Gmp-commit] /var/hg/gmp: c89 workaround for t-limbs.

mercurial at gmplib.org mercurial at gmplib.org
Tue Feb 26 19:37:14 CET 2013


details:   /var/hg/gmp/rev/8d53023ba093
changeset: 15486:8d53023ba093
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Tue Feb 26 19:37:11 2013 +0100
description:
c89 workaround for t-limbs.

diffstat:

 ChangeLog           |   5 +++++
 tests/mpz/t-limbs.c |  11 +++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diffs (47 lines):

diff -r ad6a16e4df98 -r 8d53023ba093 ChangeLog
--- a/ChangeLog	Mon Feb 25 17:21:49 2013 +0100
+++ b/ChangeLog	Tue Feb 26 19:37:11 2013 +0100
@@ -1,3 +1,8 @@
+2013-02-26  Niels Möller  <nisse at lysator.liu.se>
+
+	* tests/mpz/t-limbs.c (check_roinit): Test MPZ_ROINIT_N only if
+	compiler supports c99.
+
 2013-02-25  Niels Möller  <nisse at lysator.liu.se>
 
 	* mini-gmp/tests/t-double.c (testmain): Declare double variables
diff -r ad6a16e4df98 -r 8d53023ba093 tests/mpz/t-limbs.c
--- a/tests/mpz/t-limbs.c	Mon Feb 25 17:21:49 2013 +0100
+++ b/tests/mpz/t-limbs.c	Tue Feb 26 19:37:11 2013 +0100
@@ -186,24 +186,27 @@
       mpz_add (ref, a, b);
       {
 	mpz_t a1, b1;
+#if __STDC_VERSION__ >= 199001
 	const mpz_t a2 = MPZ_ROINIT_N ( (mp_ptr) ap, an);
 	const mpz_t b2 = MPZ_ROINIT_N ( (mp_ptr) bp, bn);
 
-	mpz_add (r, mpz_roinit_n (a1, ap, an), mpz_roinit_n (b1, bp, bn));
+	mpz_set_ui (r, 0);
+	mpz_add (r, a2, b2);
 	if (mpz_cmp (r, ref) != 0)
 	  {
-	    printf ("mpz_roinit_n failed\n");
+	    printf ("MPZ_ROINIT_N failed\n");
 	    gmp_printf ("a = %Zx\n", a);
 	    gmp_printf ("b = %Zx\n", b);
 	    gmp_printf ("r = %Zx (bad)\n", r);
 	    gmp_printf ("ref = %Zx\n", ref);
 	    abort ();
 	  }
+#endif
 	mpz_set_ui (r, 0);
-	mpz_add (r, a2, b2);
+	mpz_add (r, mpz_roinit_n (a1, ap, an), mpz_roinit_n (b1, bp, bn));
 	if (mpz_cmp (r, ref) != 0)
 	  {
-	    printf ("MPZ_ROINIT_N failed\n");
+	    printf ("mpz_roinit_n failed\n");
 	    gmp_printf ("a = %Zx\n", a);
 	    gmp_printf ("b = %Zx\n", b);
 	    gmp_printf ("r = %Zx (bad)\n", r);


More information about the gmp-commit mailing list