Fix a few warnings/errors for compiling with -fno-exceptions.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178267 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2013-03-28 18:56:26 +00:00
parent 742fecbd2a
commit db4d478ff4
5 changed files with 23 additions and 2 deletions

View File

@ -155,6 +155,8 @@ __check_for_overflow(size_t N)
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
if (N > 0xFFFFFFFB) if (N > 0xFFFFFFFB)
throw overflow_error("__next_prime overflow"); throw overflow_error("__next_prime overflow");
#else
(void)N;
#endif #endif
} }
@ -166,6 +168,8 @@ __check_for_overflow(size_t N)
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
if (N > 0xFFFFFFFFFFFFFFC5ull) if (N > 0xFFFFFFFFFFFFFFC5ull)
throw overflow_error("__next_prime overflow"); throw overflow_error("__next_prime overflow");
#else
(void)N;
#endif #endif
} }

View File

@ -6003,6 +6003,8 @@ void __throw_runtime_error(const char* msg)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
throw runtime_error(msg); throw runtime_error(msg);
#else
(void)msg;
#endif #endif
} }

View File

@ -195,6 +195,9 @@ __throw_system_error(int ev, const char* what_arg)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
throw system_error(error_code(ev, system_category()), what_arg); throw system_error(error_code(ev, system_category()), what_arg);
#else
(void)ev;
(void)what_arg;
#endif #endif
} }

View File

@ -36,6 +36,8 @@ thread::join()
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
if (ec) if (ec)
throw system_error(error_code(ec, system_category()), "thread::join failed"); throw system_error(error_code(ec, system_category()), "thread::join failed");
#else
(void)ec;
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
__t_ = 0; __t_ = 0;
} }

View File

@ -53,8 +53,18 @@ std::bad_typeid::what() const _NOEXCEPT
#ifdef __APPLE__ #ifdef __APPLE__
// On Darwin, the cxa_bad_* functions cannot be in the lower level library // On Darwin, the cxa_bad_* functions cannot be in the lower level library
// because bad_cast and bad_typeid are defined in his higher level library // because bad_cast and bad_typeid are defined in his higher level library
void __cxxabiv1::__cxa_bad_typeid() { throw std::bad_typeid(); } void __cxxabiv1::__cxa_bad_typeid()
void __cxxabiv1::__cxa_bad_cast() { throw std::bad_cast(); } {
#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_typeid();
#endif
}
void __cxxabiv1::__cxa_bad_cast()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw std::bad_cast();
#endif
}
#endif #endif
#endif // _LIBCPPABI_VERSION #endif // _LIBCPPABI_VERSION