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

llvm-svn: 178267
This commit is contained in:
Howard Hinnant 2013-03-28 18:56:26 +00:00
parent a6788325cf
commit e00e6f23d3
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
if (N > 0xFFFFFFFB)
throw overflow_error("__next_prime overflow");
#else
(void)N;
#endif
}
@ -166,6 +168,8 @@ __check_for_overflow(size_t N)
#ifndef _LIBCPP_NO_EXCEPTIONS
if (N > 0xFFFFFFFFFFFFFFC5ull)
throw overflow_error("__next_prime overflow");
#else
(void)N;
#endif
}

View File

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

View File

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

View File

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

View File

@ -53,8 +53,18 @@ std::bad_typeid::what() const _NOEXCEPT
#ifdef __APPLE__
// 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
void __cxxabiv1::__cxa_bad_typeid() { throw std::bad_typeid(); }
void __cxxabiv1::__cxa_bad_cast() { throw std::bad_cast(); }
void __cxxabiv1::__cxa_bad_typeid()
{
#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 // _LIBCPPABI_VERSION