[Gmp-commit] /var/hg/gmp: New testcase to clearly identify C++ compilers that...

mercurial at gmplib.org mercurial at gmplib.org
Sun Mar 17 14:08:20 CET 2013


details:   /var/hg/gmp/rev/68bcab037661
changeset: 15584:68bcab037661
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Sun Mar 17 14:08:15 2013 +0100
description:
New testcase to clearly identify C++ compilers that have a broken exception support.

diffstat:

 ChangeLog                                                   |   5 +
 tests/cxx/Makefile.am                                       |   8 ++-
 tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc |  38 +++++++++++++
 3 files changed, 49 insertions(+), 2 deletions(-)

diffs (81 lines):

diff -r 6dbd2044d1ce -r 68bcab037661 ChangeLog
--- a/ChangeLog	Thu Mar 14 22:45:42 2013 +0100
+++ b/ChangeLog	Sun Mar 17 14:08:15 2013 +0100
@@ -1,3 +1,8 @@
+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-14  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/ia64/cnd_aors_n.asm: New file.
diff -r 6dbd2044d1ce -r 68bcab037661 tests/cxx/Makefile.am
--- a/tests/cxx/Makefile.am	Thu Mar 14 22:45:42 2013 +0100
+++ b/tests/cxx/Makefile.am	Sun Mar 17 14:08:15 2013 +0100
@@ -32,10 +32,12 @@
   -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
 
@@ -58,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 6dbd2044d1ce -r 68bcab037661 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	Sun Mar 17 14:08:15 2013 +0100
@@ -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) { }
+}


More information about the gmp-commit mailing list