BIND 10 trac542, updated. cba6db1c8d894a7f30ae820a49aea3d0ff8c18be [trac542] Remove typeid from exception caught message
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed May 11 15:16:11 UTC 2011
The branch, trac542 has been updated
via cba6db1c8d894a7f30ae820a49aea3d0ff8c18be (commit)
from d4a2c864bf1952f1bcccead59159462519c58e10 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit cba6db1c8d894a7f30ae820a49aea3d0ff8c18be
Author: Stephen Morris <stephen at isc.org>
Date: Wed May 11 16:13:47 2011 +0100
[trac542] Remove typeid from exception caught message
On some compilers, use of typeid() requires that RTTI is explicitly
specified on the compiler command line. For an isc::Exception message,
the file and line number will identify the exception. For a message
output caused by std::exception, the what() should identify the exception.
-----------------------------------------------------------------------
Summary of changes:
src/lib/util/io/tests/Makefile.am | 1 +
src/lib/util/unittests/Makefile.am | 4 ++--
src/lib/util/unittests/run_all.cc | 18 +++++++++---------
3 files changed, 12 insertions(+), 11 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/util/io/tests/Makefile.am b/src/lib/util/io/tests/Makefile.am
index 56d50cf..4cd7095 100644
--- a/src/lib/util/io/tests/Makefile.am
+++ b/src/lib/util/io/tests/Makefile.am
@@ -20,6 +20,7 @@ run_unittests_LDADD = $(GTEST_LDADD)
run_unittests_LDADD += $(top_builddir)/src/lib/util/io/libutil_io.la
run_unittests_LDADD += \
$(top_builddir)/src/lib/util/unittests/libutil_unittests.la
+run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
endif
noinst_PROGRAMS = $(TESTS)
diff --git a/src/lib/util/unittests/Makefile.am b/src/lib/util/unittests/Makefile.am
index 2ddeef1..631d90f 100644
--- a/src/lib/util/unittests/Makefile.am
+++ b/src/lib/util/unittests/Makefile.am
@@ -8,7 +8,7 @@ libutil_unittests_la_SOURCES += run_all.h run_all.cc
libutil_unittests_la_SOURCES += testdata.h testdata.cc
libutil_unittests_la_SOURCES += textdata.h
-libutil_unittests_ls_LDADD = $(top_builddir)/src/lib/util/io/libutil_io.la
-libutil_unittests_ls_LDADD += $(top_builddir)/src/lib/util/libutil.la
+libutil_unittests_la_LIBADD = $(top_builddir)/src/lib/util/libutil.la
+libutil_unittests_la_LIBADD = $(top_builddir)/src/lib/exceptions/libexceptions.la
CLEANFILES = *.gcno *.gcda
diff --git a/src/lib/util/unittests/run_all.cc b/src/lib/util/unittests/run_all.cc
index 1545487..f96b274 100644
--- a/src/lib/util/unittests/run_all.cc
+++ b/src/lib/util/unittests/run_all.cc
@@ -33,17 +33,17 @@ run_all() {
try {
ret = RUN_ALL_TESTS();
} catch (const isc::Exception& ex) {
- std::cerr << "*** isc::exception of class '" << typeid(ex).name()
- << "' was thrown:\n"
- << " file: " << ex.getFile() << "\n"
- << " line: " << ex.getLine() << "\n"
- << " what: " << ex.what() << std::endl;
+ // Could output more information with typeid(), but there is no
+ // guarantee that all compilers will support it without an explicit
+ // flag on the command line.
+ std::cerr << "*** Exception derived from isc::exception thrown:\n"
+ << " file: " << ex.getFile() << "\n"
+ << " line: " << ex.getLine() << "\n"
+ << " what: " << ex.what() << std::endl;
throw;
} catch (const std::exception& ex) {
- std::cerr << "*** std::exception of class '"
- << typeid(ex).name()
- << "' was thrown:\n"
- << " what: " << ex.what() << std::endl;
+ std::cerr << "*** Exception derived from std::exception thrown:\n"
+ << " what: " << ex.what() << std::endl;
throw;
}
} else {
More information about the bind10-changes
mailing list