aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/qexc.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-07-15 06:01:52 +0200
committerJay Berkenbilt <ejb@ql.org>2009-07-15 06:01:52 +0200
commit86f2d3449c651674b92b1249186375ad821f9017 (patch)
tree2e5af880c7aba03fa9a2d65041da575d5281ddd1 /libtests/qexc.cc
parenta1c0aaf03adf0344b34dd591f9103479f249e965 (diff)
downloadqpdf-86f2d3449c651674b92b1249186375ad821f9017.tar.zst
windows fixes; okay for modern compilers
git-svn-id: svn+q:///qpdf/trunk@685 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'libtests/qexc.cc')
-rw-r--r--libtests/qexc.cc31
1 files changed, 9 insertions, 22 deletions
diff --git a/libtests/qexc.cc b/libtests/qexc.cc
index 87e56820..6a89f68d 100644
--- a/libtests/qexc.cc
+++ b/libtests/qexc.cc
@@ -4,20 +4,6 @@
#include <errno.h>
#include <stdlib.h>
-void do_terminate()
-{
- try
- {
- throw;
- }
- catch (std::exception& e)
- {
- std::cerr << "uncaught exception: " << e.what() << std::endl;
- exit(3);
- }
- exit(4);
-}
-
void f(int n)
{
switch (n)
@@ -33,19 +19,11 @@ void f(int n)
case 2:
throw QEXC::System("doing something", EINVAL);
break;
-
- case 3:
- {
- int a = -1;
- new char[a];
- }
- break;
}
}
int main(int argc, char* argv[])
{
- std::set_terminate(do_terminate);
if (argc != 2)
{
std::cerr << "usage: qexc n" << std::endl;
@@ -62,5 +40,14 @@ int main(int argc, char* argv[])
std::cerr << "what: " << e.what() << std::endl;
exit(2);
}
+ catch (std::exception& e)
+ {
+ std::cerr << "uncaught exception: " << e.what() << std::endl;
+ exit(3);
+ }
+ catch (...)
+ {
+ exit(4);
+ }
return 0;
}