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

mercurial at gmplib.org mercurial at gmplib.org
Sun May 24 22:59:48 UTC 2020


details:   /var/hg/gmp-6.2/rev/46f11ac46a7f
changeset: 18056:46f11ac46a7f
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Mon May 25 00:58:38 2020 +0200
description:
Use reference parameter for 'catch'.

details:   /var/hg/gmp-6.2/rev/3793678c6209
changeset: 18057:3793678c6209
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Mon May 25 00:59:42 2020 +0200
description:
Revert recent changes.

diffstat:

 tests/cxx/t-assign.cc                                       |  12 ++--
 tests/cxx/t-constr.cc                                       |  28 ++++++------
 tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc |   2 +-
 tests/cxx/t-ops2z.cc                                        |  14 +++---
 tests/cxx/t-rand.cc                                         |   2 +-
 tests/devel/try.c                                           |  11 +++-
 6 files changed, 36 insertions(+), 33 deletions(-)

diffs (291 lines):

diff -r 94b29198ab4a -r 3793678c6209 tests/cxx/t-assign.cc
--- a/tests/cxx/t-assign.cc	Mon May 25 00:56:59 2020 +0200
+++ b/tests/cxx/t-assign.cc	Mon May 25 00:59:42 2020 +0200
@@ -171,7 +171,7 @@
       mpz_class b;
       b = a;
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -182,7 +182,7 @@
       mpz_class b;
       b = a;
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -357,7 +357,7 @@
       mpq_class b;
       b = a;
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -368,7 +368,7 @@
       mpq_class b;
       b = a;
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -543,7 +543,7 @@
       mpf_class b;
       b = a;
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -554,7 +554,7 @@
       mpf_class b;
       b = a;
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
diff -r 94b29198ab4a -r 3793678c6209 tests/cxx/t-constr.cc
--- a/tests/cxx/t-constr.cc	Mon May 25 00:56:59 2020 +0200
+++ b/tests/cxx/t-constr.cc	Mon May 25 00:59:42 2020 +0200
@@ -154,7 +154,7 @@
       const char *a = "ABC";
       mpz_class b(a);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -165,7 +165,7 @@
       int base = 16;
       mpz_class b(a, base);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -175,7 +175,7 @@
       string a("abc");
       mpz_class b(a);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -186,7 +186,7 @@
       int base = 8;
       mpz_class b(a, base);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -341,7 +341,7 @@
       const char *a = "abc";
       mpq_class b(a);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -352,7 +352,7 @@
       int base = 16;
       mpq_class b (a, base);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -362,7 +362,7 @@
       string a("abc");
       mpq_class b(a);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -373,7 +373,7 @@
       int base = 8;
       mpq_class b (a, base);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -635,7 +635,7 @@
       const char *a = "abc";
       mpf_class b(a);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -646,7 +646,7 @@
       int prec = 256;
       mpf_class b(a, prec); ASSERT_ALWAYS(b == 1234567890L);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
   {
@@ -655,7 +655,7 @@
       int prec = 64, base = 8;
       mpf_class b(a, prec, base); ASSERT_ALWAYS(b == 262143L);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -665,7 +665,7 @@
       string a("abc");
       mpf_class b(a); ASSERT_ALWAYS(b == 1234567890L);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
@@ -676,7 +676,7 @@
       int prec = 128;
       mpf_class b(a, prec); ASSERT_ALWAYS(b == 1234567890L);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
   {
@@ -685,7 +685,7 @@
       int prec = 256, base = 16;
       mpf_class b(a, prec, base); ASSERT_ALWAYS(b == 65535u);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (invalid_argument) {
+    } catch (invalid_argument&) {
     }
   }
 
diff -r 94b29198ab4a -r 3793678c6209 tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc
--- a/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc	Mon May 25 00:56:59 2020 +0200
+++ b/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc	Mon May 25 00:59:42 2020 +0200
@@ -34,5 +34,5 @@
   {
     throw_expr();
   }
-  catch (invalid_argument) { }
+  catch (invalid_argument&) { }
 }
diff -r 94b29198ab4a -r 3793678c6209 tests/cxx/t-ops2z.cc
--- a/tests/cxx/t-ops2z.cc	Mon May 25 00:56:59 2020 +0200
+++ b/tests/cxx/t-ops2z.cc	Mon May 25 00:59:42 2020 +0200
@@ -89,22 +89,22 @@
   ASSERT_ALWAYS(mpz_class::factorial(3.f)==6);
   mpz_class ret;
   try { ret=factorial(-mpz_class(3)); ASSERT_ALWAYS(0); }
-  catch (std::domain_error) {}
+  catch (std::domain_error&) {}
   try { ret=mpz_class::factorial(-2); ASSERT_ALWAYS(0); }
-  catch (std::domain_error) {}
+  catch (std::domain_error&) {}
   try { ret=factorial(mpz_class(1)<<300); ASSERT_ALWAYS(0); }
-  catch (std::bad_alloc) {}
+  catch (std::bad_alloc&) {}
   ASSERT_ALWAYS(mpz_class::primorial(mpz_class(3))==6);
   ASSERT_ALWAYS(mpz_class::primorial(mpz_class(2)*2)==6);
   ASSERT_ALWAYS(mpz_class::primorial(3)==6);
   ASSERT_ALWAYS(mpz_class::primorial(3ul)==6);
   ASSERT_ALWAYS(mpz_class::primorial(3.f)==6);
   try { ret=primorial(-mpz_class(3)); ASSERT_ALWAYS(0); }
-  catch (std::domain_error) {}
+  catch (std::domain_error&) {}
   try { ret=mpz_class::primorial(-5); ASSERT_ALWAYS(0); }
-  catch (std::domain_error) {}
+  catch (std::domain_error&) {}
   try { ret=primorial(mpz_class(1)<<300); ASSERT_ALWAYS(0); }
-  catch (std::bad_alloc) {}
+  catch (std::bad_alloc&) {}
   ASSERT_ALWAYS(mpz_class::fibonacci(mpz_class(6))==8);
   ASSERT_ALWAYS(mpz_class::fibonacci(mpz_class(2)*2)==3);
   ASSERT_ALWAYS(mpz_class::fibonacci(3)==2);
@@ -113,7 +113,7 @@
   ASSERT_ALWAYS(fibonacci(-mpz_class(6))==-8);
   ASSERT_ALWAYS(mpz_class::fibonacci(-3)==2);
   try { ret=fibonacci(mpz_class(1)<<300); ASSERT_ALWAYS(0); }
-  catch (std::bad_alloc) {}
+  catch (std::bad_alloc&) {}
 }
 
 int
diff -r 94b29198ab4a -r 3793678c6209 tests/cxx/t-rand.cc
--- a/tests/cxx/t-rand.cc	Mon May 25 00:56:59 2020 +0200
+++ b/tests/cxx/t-rand.cc	Mon May 25 00:59:42 2020 +0200
@@ -49,7 +49,7 @@
       unsigned long m2exp = ULONG_MAX;
       gmp_randclass r(gmp_randinit_lc_2exp_size, m2exp);
       ASSERT_ALWAYS (0);  /* should not be reached */
-    } catch (length_error) {
+    } catch (length_error&) {
     }
   }
 
diff -r 94b29198ab4a -r 3793678c6209 tests/devel/try.c
--- a/tests/devel/try.c	Mon May 25 00:56:59 2020 +0200
+++ b/tests/devel/try.c	Mon May 25 00:59:42 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, 2020 Free Software Foundation, Inc.
+Copyright 2000-2006, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -107,8 +107,6 @@
 /* always do assertion checking */
 #define WANT_ASSERT 1
 
-#define _POSIX_C_SOURCE 199309L		/* for getopt, _SC_PAGE_SIZE */
-
 #include "config.h"
 
 #include <errno.h>
@@ -3415,6 +3413,11 @@
 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)
     {
@@ -3425,7 +3428,7 @@
 #else
 Error, error, cannot get page size
 #endif
-
+#endif
 
   printf ("pagesize is 0x%lX bytes\n", pagesize);
 



More information about the gmp-commit mailing list