[Gmp-commit] /var/hg/gmp: mini-gmp/tests/: Avoid a handful of warnings.

mercurial at gmplib.org mercurial at gmplib.org
Fri Jan 25 08:41:53 CET 2013


details:   /var/hg/gmp/rev/eaa270e55c3e
changeset: 15352:eaa270e55c3e
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Jan 25 08:40:26 2013 +0100
description:
mini-gmp/tests/: Avoid a handful of warnings.

diffstat:

 ChangeLog                 |   6 ++++++
 mini-gmp/tests/t-comb.c   |   1 -
 mini-gmp/tests/t-div.c    |   6 +++---
 mini-gmp/tests/t-double.c |   4 ++--
 mini-gmp/tests/t-import.c |  12 ++++++------
 mini-gmp/tests/t-str.c    |  10 +++++-----
 6 files changed, 22 insertions(+), 17 deletions(-)

diffs (146 lines):

diff -r 829243243448 -r eaa270e55c3e ChangeLog
--- a/ChangeLog	Wed Jan 23 22:29:35 2013 +0100
+++ b/ChangeLog	Fri Jan 25 08:40:26 2013 +0100
@@ -3,6 +3,12 @@
 	* mini-gmp/mini-gmp.c (mpz_cmpabs_d, mpz_cmp_d): Simplify.
 	(mpz_set_str): Behaviour more adherent to the real GMP. 
 
+	* mini-gmp/tests/t-str.c: Cast size_t to unsigned long, for printf.
+	* mini-gmp/tests/t-import.c: Likewise.
+	* mini-gmp/tests/t-comb.c: Remove an unused var.
+	* mini-gmp/tests/t-div.c: Remove unused args passed to fprintf.
+	* mini-gmp/tests/t-double.c: Use float immediates with float vars.
+
 2013-01-22  Torbjorn Granlund  <tege at gmplib.org>
 
 	* Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump version info.
diff -r 829243243448 -r eaa270e55c3e mini-gmp/tests/t-comb.c
--- a/mini-gmp/tests/t-comb.c	Wed Jan 23 22:29:35 2013 +0100
+++ b/mini-gmp/tests/t-comb.c	Fri Jan 25 08:40:26 2013 +0100
@@ -54,7 +54,6 @@
 {
   mpz_t          want;
   unsigned long  n, k;
-  int            tests;
 
   mpz_init (want);
 
diff -r 829243243448 -r eaa270e55c3e mini-gmp/tests/t-div.c
--- a/mini-gmp/tests/t-div.c	Wed Jan 23 22:29:35 2013 +0100
+++ b/mini-gmp/tests/t-div.c	Fri Jan 25 08:40:26 2013 +0100
@@ -144,7 +144,7 @@
 	      mpz_mod (r, a, b);
 	      if (mpz_cmp (r, rr))
 		{
-		  fprintf (stderr, "mpz_mod failed:\n", name[j]);
+		  fprintf (stderr, "mpz_mod failed:\n");
 		  dump ("a", a);
 		  dump ("b", b);
 		  dump ("r   ", r);
@@ -158,7 +158,7 @@
 	      mpz_mod (r, a, b);
 	      if (mpz_cmp (r, rr))
 		{
-		  fprintf (stderr, "mpz_mod failed:\n", name[j]);
+		  fprintf (stderr, "mpz_mod failed:\n");
 		  dump ("a", a);
 		  dump ("b", b);
 		  dump ("r   ", r);
@@ -242,7 +242,7 @@
 		  mpz_mod_ui (r, a, mpz_get_ui (b));
 		  if (mpz_cmp (r, rr))
 		    {
-		      fprintf (stderr, "mpz_mod failed:\n", name[j]);
+		      fprintf (stderr, "mpz_mod failed:\n");
 		      dump ("a", a);
 		      dump ("b", b);
 		      dump ("r   ", r);
diff -r 829243243448 -r eaa270e55c3e mini-gmp/tests/t-double.c
--- a/mini-gmp/tests/t-double.c	Wed Jan 23 22:29:35 2013 +0100
+++ b/mini-gmp/tests/t-double.c	Fri Jan 25 08:40:26 2013 +0100
@@ -108,7 +108,7 @@
 	  fprintf (stderr, "mpz_cmp_d (x, d) failed:\n");
 	  goto dumperror;
 	}
-      f = d + 1;
+      f = d + 1.0;
       if (f > d && ! (mpz_cmp_d (x, f) < 0))
 	{
 	  fprintf (stderr, "mpz_cmp_d (x, f) failed:\n");
@@ -135,7 +135,7 @@
 	  fprintf (stderr, "mpz_cmp_d (x, d) failed:\n");
 	  goto dumperror;
 	}
-      f = d - 1;
+      f = d - 1.0;
       if (f < d && ! (mpz_cmp_d (x, f) > 0))
 	{
 	  fprintf (stderr, "mpz_cmp_d (x, f) failed:\n");
diff -r 829243243448 -r eaa270e55c3e mini-gmp/tests/t-import.c
--- a/mini-gmp/tests/t-import.c	Wed Jan 23 22:29:35 2013 +0100
+++ b/mini-gmp/tests/t-import.c	Fri Jan 25 08:40:26 2013 +0100
@@ -73,8 +73,8 @@
 	    if (mpz_cmp (a, res))
 	      {
 		fprintf (stderr, "mpz_import failed:\n"
-			 "in_count %d, out_count %d, endian = %d, order = %d\n",
-			 in_count, out_count, endian, order);
+			 "in_count %lu, out_count %lu, endian = %d, order = %d\n",
+			 (unsigned long) in_count, (unsigned long) out_count, endian, order);
 		dump ("a", a);
 		dump ("res", res);
 		abort ();
@@ -89,15 +89,15 @@
 		|| output[1+in_count*size] != 17)
 	      {
 		fprintf (stderr, "mpz_export failed:\n"
-			 "in_count %d, out_count %d, endian = %d, order = %d\n",
-			 in_count, out_count, endian, order);
+			 "in_count %lu, out_count %lu, endian = %d, order = %d\n",
+			 (unsigned long) in_count, (unsigned long) out_count, endian, order);
 		dump_bytes ("input", input, in_count * size);
 		dump_bytes ("output", output+1, out_count * size);
 		if (output[0] != 17)
 		  fprintf (stderr, "Overwrite at -1, value %02x\n", output[0]);
 		if (output[1+in_count*size] != 17)
-		  fprintf (stderr, "Overwrite at %d, value %02x\n",
-			   in_count*size, output[1+in_count*size]);
+		  fprintf (stderr, "Overwrite at %lu, value %02x\n",
+			   (unsigned long) (in_count*size), output[1+in_count*size]);
 
 		abort ();
 	      }
diff -r 829243243448 -r eaa270e55c3e mini-gmp/tests/t-str.c
--- a/mini-gmp/tests/t-str.c	Wed Jan 23 22:29:35 2013 +0100
+++ b/mini-gmp/tests/t-str.c	Fri Jan 25 08:40:26 2013 +0100
@@ -213,8 +213,8 @@
 	      if (tn != rn)
 		{
 		  fprintf (stderr,
-			   "fread failed, expected %u bytes, got only %u.\n",
-			   rn, tn);
+			   "fread failed, expected %lu bytes, got only %lu.\n",
+			   (unsigned long) rn, (unsigned long) tn);
 		  abort ();
 		}
 
@@ -258,8 +258,8 @@
 	      if (bn != arn)
 		{
 		  fprintf (stderr, "mpn_get_str failed:\n");
-		  fprintf (stderr, "returned length: %d (bad)\n", bn);
-		  fprintf (stderr, "expected: %d\n", arn);
+		  fprintf (stderr, "returned length: %lu (bad)\n", (unsigned long) bn);
+		  fprintf (stderr, "expected: %lu\n", (unsigned long) arn);
 		  fprintf (stderr, "  base = %d\n", base);
 		  fprintf (stderr, "r = %s\n", ap);
 		  fprintf (stderr, "  base = 16\n");
@@ -287,7 +287,7 @@
 		  if (bp[i] != value)
 		    {
 		      fprintf (stderr, "mpn_get_str failed:\n");
-		      fprintf (stderr, "digit %d: %d (bad)\n", i, bp[i]);
+		      fprintf (stderr, "digit %lu: %d (bad)\n", (unsigned long) i, bp[i]);
 		      fprintf (stderr, "expected: %d\n", value);
 		      fprintf (stderr, "  base = %d\n", base);
 		      fprintf (stderr, "r = %s\n", ap);


More information about the gmp-commit mailing list