aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2007-06-26 11:01:15 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2007-06-26 11:01:15 +0000
commit949d9ae181520a37c81fb8e4e4ff2d9241d09812 (patch)
treec08f612197e36b298606bc1f8799f4950b34b0ad /libstdc++-v3/testsuite
parent12c7b51e3e3e27a31c7b0aabf93610024967339a (diff)
downloadgcc-949d9ae181520a37c81fb8e4e4ff2d9241d09812.zip
gcc-949d9ae181520a37c81fb8e4e4ff2d9241d09812.tar.gz
gcc-949d9ae181520a37c81fb8e4e4ff2d9241d09812.tar.bz2
throw_allocator.h: Fixes for -fno-exceptions.
2007-06-26 Benjamin Kosnik <bkoz@redhat.com> * include/ext/throw_allocator.h: Fixes for -fno-exceptions. * testsuite/util/testsuite_shared.cc: Same. * testsuite/util/io/illegal_input_error.hpp: Same. * testsuite/util/io/verified_cmd_line_input.cc: Same. * libsupc++/typeinfo (type_info): Correct comment formatting, clarify member access and public interface. * libsupc++/exception: Less compressed comments. * libsupc++/new: Same. From-SVN: r126016
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/util/io/illegal_input_error.hpp19
-rw-r--r--libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc47
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_shared.cc7
3 files changed, 34 insertions, 39 deletions
diff --git a/libstdc++-v3/testsuite/util/io/illegal_input_error.hpp b/libstdc++-v3/testsuite/util/io/illegal_input_error.hpp
index 3e786d4..63675f9 100644
--- a/libstdc++-v3/testsuite/util/io/illegal_input_error.hpp
+++ b/libstdc++-v3/testsuite/util/io/illegal_input_error.hpp
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -47,17 +47,26 @@
#ifndef PB_DS_ILLEGAL_INPUT_EX_HPP
#define PB_DS_ILLEGAL_INPUT_EX_HPP
+#include <exception>
+
namespace pb_ds
{
-
namespace test
{
-
- class illegal_input_error
+ class illegal_input_error : public std::exception
{ };
+ // Substitute for concurrence_error object in the case of -fno-exceptions.
+ inline void
+ __throw_illegal_input_error()
+ {
+#if __EXCEPTIONS
+ throw illegal_input_error();
+#else
+ __builtin_abort();
+#endif
+ }
} // namespace test
-
} // namespace pb_ds
#endif // #ifndef PB_DS_ILLEGAL_INPUT_EX_HPP
diff --git a/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc b/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc
index 7b004a5..c24cd6f 100644
--- a/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc
+++ b/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc
@@ -1,6 +1,6 @@
// -*- C++ -*-
-// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -48,84 +48,69 @@
#include <limits.h>
#include <utility>
#include <stdlib.h>
+#include <bits/functexcept.h>
namespace pb_ds
{
-
namespace test
{
-
void
verify_argc(size_t given, size_t required)
{
if (given != required)
- throw illegal_input_error();
+ __throw_illegal_input_error();
}
void
verify_prob(double prob)
{
if (prob < 0 || prob > 1)
- throw illegal_input_error();
+ __throw_illegal_input_error();
}
std::string
get_cmd_line_str(int argc, char* a_p_argv[], int argn)
{
if (argc <= argn)
- throw illegal_input_error();
-
+ __throw_illegal_input_error();
const std::string ret(a_p_argv[argn]);
-
- return (ret);
+ return ret;
}
double
get_cmd_line_prob(int argc, char* a_p_argv[], int argn)
{
if (argc <= argn)
- throw illegal_input_error();
-
+ __throw_illegal_input_error();
const double ret = ::atof(a_p_argv[argn]);
-
verify_prob(ret);
-
- return (ret);
+ return ret;
}
size_t
get_cmd_line_size(int argc, char* a_p_argv[], int argn)
{
if (argc <= argn)
- throw illegal_input_error();
-
+ __throw_illegal_input_error();
const size_t ret = static_cast<size_t>(::atoi(a_p_argv[argn]));
-
- return (ret);
+ return ret;
}
bool
get_cmd_line_bool(int argc, char* a_p_argv[], int argn)
{
if (argc <= argn)
- throw illegal_input_error();
+ __throw_illegal_input_error();
const std::string opt(a_p_argv[argn]);
-
if (opt.size() != 1)
- throw illegal_input_error();
-
+ __throw_illegal_input_error();
if (opt[0] == 't')
- return (true);
-
+ return true;
if (opt[0] == 'f')
- return (false);
-
- throw illegal_input_error();
-
- return (false);
+ return false;
+ __throw_illegal_input_error();
+ return false;
}
-
} // namespace test
-
} // namespace pb_ds
diff --git a/libstdc++-v3/testsuite/util/testsuite_shared.cc b/libstdc++-v3/testsuite/util/testsuite_shared.cc
index d651442..cf09c2d 100644
--- a/libstdc++-v3/testsuite/util/testsuite_shared.cc
+++ b/libstdc++-v3/testsuite/util/testsuite_shared.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -21,6 +21,7 @@
#include <iostream>
#include <sstream>
#include <ext/mt_allocator.h>
+#include <bits/functexcept.h>
// libstdc++/22309
extern "C" void
@@ -43,7 +44,7 @@ try_throw_exception()
{
try
{
- throw std::bad_exception();
+ std::__throw_bad_exception();
}
catch (const std::exception& e)
{ }
@@ -68,5 +69,5 @@ try_function_random_fail()
}
// Randomly throw. See if other threads cleanup.
- throw std::bad_exception();
+ std::__throw_bad_exception();
}