[Gmp-commit] /var/hg/gmp-5.1: 4 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Wed May 15 01:07:57 CEST 2013
details: /var/hg/gmp-5.1/rev/d864c82a8f7c
changeset: 15407:d864c82a8f7c
user: Marc Glisse <marc.glisse at inria.fr>
date: Wed May 15 00:43:41 2013 +0200
description:
New testcase to clearly identify C++ compilers that have a broken exception support. [backport]
details: /var/hg/gmp-5.1/rev/49f10bf08481
changeset: 15408:49f10bf08481
user: Marc Glisse <marc.glisse at inria.fr>
date: Wed May 15 00:49:58 2013 +0200
description:
Include <math.h> instead of <cmath> followed by using namespace std. Don't include unused <iostream>.
details: /var/hg/gmp-5.1/rev/64735ab96ceb
changeset: 15409:64735ab96ceb
user: Marc Glisse <marc.glisse at inria.fr>
date: Wed May 15 00:55:07 2013 +0200
description:
Include <stdarg.h> instead of <cstdarg>, there is little point since we do "using namespace std;" afterwards. An alternative would have been to move this using namespace before the inclusion of <gmp.h>. [backport]
details: /var/hg/gmp-5.1/rev/3b886a0ae8ca
changeset: 15410:3b886a0ae8ca
user: Marc Glisse <marc.glisse at inria.fr>
date: Wed May 15 01:01:44 2013 +0200
description:
Link C++ tests with -lm, so we can compare the result of mpf functions with libm functions. [backport]
diffstat:
ChangeLog | 14 ++++
cxx/osdoprnti.cc | 4 +-
tests/cxx/Makefile.am | 12 +++-
tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc | 38 +++++++++++++
tests/cxx/t-ops2.cc | 7 +-
5 files changed, 66 insertions(+), 9 deletions(-)
diffs (155 lines):
diff -r 152a505d71e1 -r 3b886a0ae8ca ChangeLog
--- a/ChangeLog Fri May 10 00:16:31 2013 +0200
+++ b/ChangeLog Wed May 15 01:01:44 2013 +0200
@@ -11,6 +11,11 @@
* configure.ac (arm*-*-*): Set up path also for plainest CPU variants.
+2012-03-17 Marc Glisse <marc.glisse at inria.fr>
+
+ * tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc: New file.
+ * tests/cxx/Makefile.am: Add new file. Reorder the tests.
+
2013-03-11 Torbjorn Granlund <tege at gmplib.org>
* tests/mpz/t-powm_ui.c: Test larger arguments.
@@ -34,6 +39,15 @@
* mini-gmp/tests/t-reuse.c: Fix typo causing the same negation condition
to be applied to all operands. (See 2013-02-03, Torbjorn)
+2013-02-17 Marc Glisse <marc.glisse at inria.fr>
+
+ * cxx/osdoprnti.cc: Use <stdarg.h> and <string.h> rather than <cstdarg>
+ and <cstring> (revert 2002-12-21).
+
+ * tests/cxx/Makefile.am: Link with libm.
+ * tests/cxx/t-ops2.cc: Comment about more tests. Use <math.h> rather
+ than <cmath> and using namespace. Don't include <iostream>.
+
2013-02-16 Marc Glisse <marc.glisse at inria.fr>
* gmpxx.h: Include <algorithm>.
diff -r 152a505d71e1 -r 3b886a0ae8ca cxx/osdoprnti.cc
--- a/cxx/osdoprnti.cc Fri May 10 00:16:31 2013 +0200
+++ b/cxx/osdoprnti.cc Wed May 15 01:01:44 2013 +0200
@@ -22,8 +22,8 @@
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include <iostream>
-#include <cstdarg> /* for va_list and hence doprnt_funs_t */
-#include <cstring> /* for strlen */
+#include <stdarg.h> /* for va_list and hence doprnt_funs_t */
+#include <string.h> /* for strlen */
#include "gmp.h"
#include "gmp-impl.h"
diff -r 152a505d71e1 -r 3b886a0ae8ca tests/cxx/Makefile.am
--- a/tests/cxx/Makefile.am Fri May 10 00:16:31 2013 +0200
+++ b/tests/cxx/Makefile.am Wed May 15 01:01:44 2013 +0200
@@ -22,18 +22,22 @@
# 3.2 on itanium2-hp-hpux11.22. Without this option, the libgmp.sl.6
# required by libgmpxx.sl (ie. in its NEEDED records) is not found by the
# linker. FIXME: Presumably libtool should do something about this itself.
+# -lm is needed for t-ops2 which compares the results of trunc and mpf_trunc.
#
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = -L$(top_builddir)/.libs \
$(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmpxx.la \
- $(top_builddir)/libgmp.la
+ $(top_builddir)/libgmp.la \
+ -lm
if WANT_CXX
-check_PROGRAMS = t-assign t-binary t-cast t-constr t-cxx11 \
+check_PROGRAMS = t-binary t-cast t-cxx11 \
t-headers t-iostream t-istream t-locale t-misc t-mix \
t-ops t-ops2 t-ops3 t-ostream t-prec \
- t-rand t-ternary t-unary
+ t-ternary t-unary \
+ t-do-exceptions-work-at-all-with-this-compiler \
+ t-assign t-constr t-rand
TESTS = $(check_PROGRAMS)
endif
@@ -56,6 +60,8 @@
t_rand_SOURCES = t-rand.cc
t_ternary_SOURCES = t-ternary.cc
t_unary_SOURCES = t-unary.cc
+t_do_exceptions_work_at_all_with_this_compiler_SOURCES = \
+ t-do-exceptions-work-at-all-with-this-compiler.cc
$(top_builddir)/tests/libtests.la:
cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
diff -r 152a505d71e1 -r 3b886a0ae8ca tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc Wed May 15 01:01:44 2013 +0200
@@ -0,0 +1,38 @@
+/* Test if the compiler has working try / throw / catch.
+
+Copyright 2013 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library test suite.
+
+The GNU MP Library test suite is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 3 of the License,
+or (at your option) any later version.
+
+The GNU MP Library test suite is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+the GNU MP Library test suite. If not, see http://www.gnu.org/licenses/. */
+
+#include <stdexcept>
+
+inline void
+throw_expr ()
+{
+ throw std::invalid_argument ("Test");
+}
+
+using namespace std;
+
+int
+main ()
+{
+ try
+ {
+ throw_expr();
+ }
+ catch (invalid_argument) { }
+}
diff -r 152a505d71e1 -r 3b886a0ae8ca tests/cxx/t-ops2.cc
--- a/tests/cxx/t-ops2.cc Fri May 10 00:16:31 2013 +0200
+++ b/tests/cxx/t-ops2.cc Wed May 15 01:01:44 2013 +0200
@@ -19,16 +19,13 @@
#include "config.h"
-#include <iostream>
-#include <cmath>
+#include <math.h>
#include "gmp.h"
#include "gmpxx.h"
#include "gmp-impl.h"
#include "tests.h"
-using namespace std;
-
#define CHECK1(Type,a,fun) \
ASSERT_ALWAYS(fun((Type)(a))==fun(a))
@@ -184,6 +181,8 @@
ASSERT_ALWAYS(sqrt(mpf_class(7))>2.64);
ASSERT_ALWAYS(sqrt(mpf_class(7))<2.65);
ASSERT_ALWAYS(sqrt(mpf_class(0))==0);
+ // TODO: add some consistency checks, as described in
+ // http://gmplib.org/list-archives/gmp-bugs/2013-February/002940.html
CHECK1(mpf_class,1.9,trunc);
CHECK1(mpf_class,1.9,floor);
CHECK1(mpf_class,1.9,ceil);
More information about the gmp-commit
mailing list