[Gmp-commit] /var/hg/gmp-6.2: 17 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Thu May 21 10:11:11 UTC 2020


details:   /var/hg/gmp-6.2/rev/d8d907a94be8
changeset: 18038:d8d907a94be8
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:35:29 2020 +0200
description:
Provide default M_PI definition.

details:   /var/hg/gmp-6.2/rev/99858fa57bf9
changeset: 18039:99858fa57bf9
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:39:37 2020 +0200
description:
(testmain): Cast printf args to right type.

details:   /var/hg/gmp-6.2/rev/823598eb2182
changeset: 18040:823598eb2182
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:41:11 2020 +0200
description:
Add clarifying parens.

details:   /var/hg/gmp-6.2/rev/a085702be1c5
changeset: 18041:a085702be1c5
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:43:02 2020 +0200
description:
Don't use C++ comments.

details:   /var/hg/gmp-6.2/rev/969c7623ba0f
changeset: 18042:969c7623ba0f
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:46:47 2020 +0200
description:
Avoid getpagesize and use POSIX sysconf instead.

details:   /var/hg/gmp-6.2/rev/f4bc2624d161
changeset: 18043:f4bc2624d161
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:48:16 2020 +0200
description:
(tests_start): Fall back from snprintf to sprintf for C90.

details:   /var/hg/gmp-6.2/rev/ad3ca09cfa38
changeset: 18044:ad3ca09cfa38
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:51:39 2020 +0200
description:
Use local str_casecmp instead of non-standard strcasecmp.

details:   /var/hg/gmp-6.2/rev/b611aba053a9
changeset: 18045:b611aba053a9
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:52:52 2020 +0200
description:
Avoid using non-standard function fileno().

details:   /var/hg/gmp-6.2/rev/98459e997d9e
changeset: 18046:98459e997d9e
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:53:30 2020 +0200
description:
Avoid using non-standard function fileno().

details:   /var/hg/gmp-6.2/rev/7485e5578f1b
changeset: 18047:7485e5578f1b
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:57:50 2020 +0200
description:
(main): Cast printf args to right type.  (_POSIX_C_SOURCE): Define.

details:   /var/hg/gmp-6.2/rev/7dd3b6006ed1
changeset: 18048:7dd3b6006ed1
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 12:00:41 2020 +0200
description:
C90 compliance.

details:   /var/hg/gmp-6.2/rev/7803106be29d
changeset: 18049:7803106be29d
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 12:02:30 2020 +0200
description:
(speed_endtime): Cast printf args to right type.  (_POSIX_C_SOURCE): Define.

details:   /var/hg/gmp-6.2/rev/f38f82813672
changeset: 18050:f38f82813672
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 12:04:15 2020 +0200
description:
Back out 2020-01-10 change to comply to C90.

details:   /var/hg/gmp-6.2/rev/17befd429d14
changeset: 18051:17befd429d14
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 12:08:01 2020 +0200
description:
C90 compliance.

details:   /var/hg/gmp-6.2/rev/cf31c270ba2b
changeset: 18052:cf31c270ba2b
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 12:08:55 2020 +0200
description:
(_POSIX_C_SOURCE): Define.

details:   /var/hg/gmp-6.2/rev/523a26a54029
changeset: 18053:523a26a54029
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 12:10:47 2020 +0200
description:
ChangeLog

details:   /var/hg/gmp-6.2/rev/21062fa5870e
changeset: 18054:21062fa5870e
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 12:11:00 2020 +0200
description:
ChangeLog

diffstat:

 ChangeLog                          |  40 ++++++++++++++++++++++++++++++++++++++
 mini-gmp/ChangeLog                 |  10 +++++++++
 mini-gmp/tests/t-double.c          |   6 ++++-
 mini-gmp/tests/t-mpq_muldiv_2exp.c |   2 +-
 mpn/generic/get_d.c                |   2 +-
 mpn/generic/mod_1_1.c              |   2 +-
 tests/devel/try.c                  |  11 +++------
 tests/misc.c                       |   9 +++++++-
 tests/mpz/convert.c                |  19 +++++++++++++++++-
 tests/mpz/reuse.c                  |   6 ++--
 tests/spinner.c                    |   2 +-
 tune/freq.c                        |   2 +
 tune/speed.c                       |   6 ++--
 tune/speed.h                       |   6 +++-
 tune/time.c                        |  17 ++++++++++-----
 tune/tune-gcd-p.c                  |   3 +-
 tune/tuneup.c                      |  19 +++++++++++++----
 17 files changed, 128 insertions(+), 34 deletions(-)

diffs (truncated from 468 to 300 lines):

diff -r f790381afbac -r 21062fa5870e ChangeLog
--- a/ChangeLog	Tue May 19 23:05:54 2020 +0200
+++ b/ChangeLog	Thu May 21 12:11:00 2020 +0200
@@ -1,3 +1,43 @@
+2020-05-21  Torbjörn Granlund  <tg at gmplib.org>
+
+	* tune/freq.c (_POSIX_C_SOURCE): Define.
+
+	* tune/tuneup.c (print_define_with_speedup): Fall back from snprintf to
+	sprintf for C90.
+	(_POSIX_C_SOURCE): Define.
+	(max_opsize): Set by #define instead of const size_t to please C90.
+	(n_measurements): Likewise.
+	(speed_mpn_pre_set_str): Adhere to C90 declaration rules.
+
+	* tune/tune-gcd-p.c: Back out 2020-01-10 change to comply to C90.
+
+	* tune/time.c (speed_endtime): Cast printf args to right type.
+	(_POSIX_C_SOURCE): Define.
+
+	* tune/speed.h (CACHE_LINE_SIZE): Do #undef before defining.
+	(SPEED_ROUTINE_MPN_GCD_1): Provide dummy first argument for standard
+	compliance.
+	(SPEED_ROUTINE_MPN_HGCD2): Adhere to C90 declaration rules.
+
+	* tune/speed.c (main): Cast printf args to right type.
+	(_POSIX_C_SOURCE): Define.
+
+	* tests/mpz/reuse.c: Avoid using non-standard function fileno().
+	* tests/spinner.c: Likewise.
+
+	* tests/mpz/convert.c (str_casecmp): New function.
+	(main): Use it instead of non-standard strcasecmp.
+
+	* tests/misc.c (tests_start): Fall back from snprintf to sprintf for
+	C90.
+
+	* tests/devel/try.c: Avoid getpagesize and use POSIX sysconf instead.
+	(_POSIX_C_SOURCE): Define.
+
+	* mpn/generic/mod_1_1.c: Don't use C++ comments.
+
+	* mpn/generic/get_d.c: Add clarifying parens.
+
 2020-05-18  Torbjörn Granlund  <tg at gmplib.org>
 
 	* mpn/generic/toom_interpolate_12pts.c (DO_mpn_addlsh_n): Define only
diff -r f790381afbac -r 21062fa5870e mini-gmp/ChangeLog
--- a/mini-gmp/ChangeLog	Tue May 19 23:05:54 2020 +0200
+++ b/mini-gmp/ChangeLog	Thu May 21 12:11:00 2020 +0200
@@ -1,3 +1,13 @@
+2020-05-21  Torbjörn Granlund  <tg at gmplib.org>
+
+	* tests/t-mpq_muldiv_2exp.c (testmain): Cast printf args to right type.
+
+	* tests/t-double.c: Provide default M_PI definition.
+
+2020-05-19  Torbjörn Granlund  <tg at gmplib.org>
+
+	* tests/hex-random.h (enum hex_random_op): Remove final ",".
+
 2019-12-04 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mini-gmp/mini-gmp.c (mpn_invert_3by2): Remove shortcuts.
diff -r f790381afbac -r 21062fa5870e mini-gmp/tests/t-double.c
--- a/mini-gmp/tests/t-double.c	Tue May 19 23:05:54 2020 +0200
+++ b/mini-gmp/tests/t-double.c	Thu May 21 12:11:00 2020 +0200
@@ -1,6 +1,6 @@
 /*
 
-Copyright 2012, 2013, 2018 Free Software Foundation, Inc.
+Copyright 2012, 2013, 2018, 2020 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -118,6 +118,10 @@
   mpz_clear (y);
 }
 
+#ifndef M_PI
+#define M_PI 3.141592653589793238462643383279502884
+#endif
+
 static const struct
 {
   double d;
diff -r f790381afbac -r 21062fa5870e mini-gmp/tests/t-mpq_muldiv_2exp.c
--- a/mini-gmp/tests/t-mpq_muldiv_2exp.c	Tue May 19 23:05:54 2020 +0200
+++ b/mini-gmp/tests/t-mpq_muldiv_2exp.c	Thu May 21 12:11:00 2020 +0200
@@ -100,7 +100,7 @@
 	  || mpz_sizeinbase (t, 2) - 1 != e || mpz_cmp_ui (mpq_denref (aq), 1) != 0)
 	{
 	  fprintf (stderr, "mpq_div_2exp failed: %lu\n", e);
-	  fprintf (stderr, "%li %li %lu %zu\n", e2, t2, mpz_scan1 (t, 0), mpz_sizeinbase (t, 2));
+	  fprintf (stderr, "%li %li %lu %lu\n", e2, t2, mpz_scan1 (t, 0), (unsigned long) mpz_sizeinbase (t, 2));
 	  dump ("na", a);
 	  dump ("da", b);
 	  dump ("nr", mpq_numref (rq));
diff -r f790381afbac -r 21062fa5870e mpn/generic/get_d.c
--- a/mpn/generic/get_d.c	Tue May 19 23:05:54 2020 +0200
+++ b/mpn/generic/get_d.c	Thu May 21 12:11:00 2020 +0200
@@ -226,7 +226,7 @@
 	      x <<= GMP_NAIL_BITS;
 	      mhi |= x >> nbits >> 11;
 
-	      mlo = x << GMP_LIMB_BITS - nbits - 11;
+	      mlo = x << (GMP_LIMB_BITS - nbits - 11);
 	      nbits = nbits + 11 - GMP_NAIL_BITS;
 	    }
 	  else
diff -r f790381afbac -r 21062fa5870e mpn/generic/mod_1_1.c
--- a/mpn/generic/mod_1_1.c	Tue May 19 23:05:54 2020 +0200
+++ b/mpn/generic/mod_1_1.c	Thu May 21 12:11:00 2020 +0200
@@ -256,7 +256,7 @@
       cps[2] = B1modb >> cnt;
     }
   B2modb = - b * bi;
-  ASSERT (B2modb <= b);    // NB: equality iff b = B/2
+  ASSERT (B2modb <= b);    /* NB: equality iff b = B/2 */
   cps[3] = B2modb;
 }
 
diff -r f790381afbac -r 21062fa5870e tests/devel/try.c
--- a/tests/devel/try.c	Tue May 19 23:05:54 2020 +0200
+++ b/tests/devel/try.c	Thu May 21 12:11:00 2020 +0200
@@ -3,7 +3,7 @@
    THIS IS A TEST PROGRAM USED ONLY FOR DEVELOPMENT.  IT'S ALMOST CERTAIN TO
    BE SUBJECT TO INCOMPATIBLE CHANGES IN FUTURE VERSIONS OF GMP.
 
-Copyright 2000-2006, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2000-2006, 2008, 2009, 2011, 2012, 2020 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -107,6 +107,8 @@
 /* always do assertion checking */
 #define WANT_ASSERT 1
 
+#define _POSIX_C_SOURCE 199309L		/* for getopt, _SC_PAGE_SIZE */
+
 #include "config.h"
 
 #include <errno.h>
@@ -3413,11 +3415,6 @@
 void
 try_init (void)
 {
-#if HAVE_GETPAGESIZE
-  /* Prefer getpagesize() over sysconf(), since on SunOS 4 sysconf() doesn't
-     know _SC_PAGESIZE. */
-  pagesize = getpagesize ();
-#else
 #if HAVE_SYSCONF
   if ((pagesize = sysconf (_SC_PAGESIZE)) == -1)
     {
@@ -3428,7 +3425,7 @@
 #else
 Error, error, cannot get page size
 #endif
-#endif
+
 
   printf ("pagesize is 0x%lX bytes\n", pagesize);
 
diff -r f790381afbac -r 21062fa5870e tests/misc.c
--- a/tests/misc.c	Tue May 19 23:05:54 2020 +0200
+++ b/tests/misc.c	Thu May 21 12:11:00 2020 +0200
@@ -49,10 +49,17 @@
 tests_start (void)
 {
   char version[10];
-  snprintf (version, 10, "%u.%u.%u",
+#if __STDC_VERSION__ >= 199901L
+  snprintf (version, sizeof version, "%u.%u.%u",
 	    __GNU_MP_VERSION,
 	    __GNU_MP_VERSION_MINOR,
 	    __GNU_MP_VERSION_PATCHLEVEL);
+#else
+  sprintf (version, "%u.%u.%u",
+	    __GNU_MP_VERSION,
+	    __GNU_MP_VERSION_MINOR,
+	    __GNU_MP_VERSION_PATCHLEVEL);
+#endif
 
   if (strcmp (gmp_version, version) != 0)
     {
diff -r f790381afbac -r 21062fa5870e tests/mpz/convert.c
--- a/tests/mpz/convert.c	Tue May 19 23:05:54 2020 +0200
+++ b/tests/mpz/convert.c	Thu May 21 12:11:00 2020 +0200
@@ -21,12 +21,14 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h> /* for strlen */
+#include <ctype.h> /* for tolower */
 
 #include "gmp-impl.h"
 #include "tests.h"
 
 void debug_mp (mpz_t, int);
 
+static int str_casecmp (const char *, const char *);
 
 void
 string_urandomb (char *bp, size_t len, int base, gmp_randstate_ptr rands)
@@ -140,7 +142,7 @@
       for (bp = buf; bp[0] == '0' && bp[1] != '\0'; bp++)
 	;
 
-      if (strcasecmp (str, bp) != 0)
+      if (str_casecmp (str, bp) != 0)
 	{
 	  fprintf (stderr, "ERROR, str and buf different in test %d\n", i);
 	  fprintf (stderr, "str  = %s\n", str);
@@ -162,6 +164,21 @@
   exit (0);
 }
 
+/* This is similar to POSIX strcasecmp except that we don't do the comparison
+   with unsigned char.  We avoid strcasecmp for C standard conformance.  */
+static int
+str_casecmp (const char *s1, const char *s2)
+{
+  size_t i;
+  for (i = 0;; i++)
+    {
+      int c1 = s1[i];
+      int c2 = s2[i];
+      if (c1 == 0 || tolower (c1) != tolower (c2))
+	return c1 - c2;
+    }
+}
+
 void
 debug_mp (mpz_t x, int base)
 {
diff -r f790381afbac -r 21062fa5870e tests/mpz/reuse.c
--- a/tests/mpz/reuse.c	Tue May 19 23:05:54 2020 +0200
+++ b/tests/mpz/reuse.c	Thu May 21 12:11:00 2020 +0200
@@ -244,7 +244,7 @@
   for (pass = 1; pass <= reps; pass++)
     {
 #ifndef VERBOSE
-      if (isatty (fileno (stdout)))
+      if (isatty (STDOUT_FILENO))
 	{
 	  printf ("\r%d/%d passes", pass, reps);
 	  fflush (stdout);
@@ -743,7 +743,7 @@
 	}
     }
 
-  if (isatty (fileno (stdout)))
+  if (isatty (STDOUT_FILENO))
     printf ("\r%20s", "");
 
   mpz_clear (bs);
@@ -758,7 +758,7 @@
   mpz_clear (res3);
   mpz_clear (t);
 
-  if (isatty (fileno (stdout)))
+  if (isatty (STDOUT_FILENO))
     printf ("\r");
 
   tests_end ();
diff -r f790381afbac -r 21062fa5870e tests/spinner.c
--- a/tests/spinner.c	Tue May 19 23:05:54 2020 +0200
+++ b/tests/spinner.c	Thu May 21 12:11:00 2020 +0200
@@ -78,7 +78,7 @@
 void
 spinner_init (void)
 {
-  spinner_wanted = isatty (fileno (stdout));
+  spinner_wanted = isatty (STDOUT_FILENO);
   if (spinner_wanted == -1)
     abort ();
 
diff -r f790381afbac -r 21062fa5870e tune/freq.c
--- a/tune/freq.c	Tue May 19 23:05:54 2020 +0200
+++ b/tune/freq.c	Thu May 21 12:11:00 2020 +0200
@@ -60,6 +60,8 @@
 
 */
 
+#define _POSIX_C_SOURCE 2	/* for popen */
+
 #include "config.h"
 
 #if HAVE_INVENT_H
diff -r f790381afbac -r 21062fa5870e tune/speed.c
--- a/tune/speed.c	Tue May 19 23:05:54 2020 +0200
+++ b/tune/speed.c	Thu May 21 12:11:00 2020 +0200
@@ -36,9 +36,9 @@
    speed_foo() wants an "r" parameter.
 
    The routines don't have help messages or descriptions, but most have
-   suggestive names.  See the source code for full details.
+   suggestive names.  See the source code for full details. */
 
-*/



More information about the gmp-commit mailing list