From e00e6f23d36a802c7a81876891e4b470513d9cae Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 28 Mar 2013 18:56:26 +0000 Subject: [PATCH] Fix a few warnings/errors for compiling with -fno-exceptions. llvm-svn: 178267 --- libcxx/src/hash.cpp | 4 ++++ libcxx/src/locale.cpp | 2 ++ libcxx/src/system_error.cpp | 3 +++ libcxx/src/thread.cpp | 2 ++ libcxx/src/typeinfo.cpp | 14 ++++++++++++-- 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/libcxx/src/hash.cpp b/libcxx/src/hash.cpp index a013500218e0..75e773a3a647 100644 --- a/libcxx/src/hash.cpp +++ b/libcxx/src/hash.cpp @@ -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 } diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp index b7a47843b3da..90bc77c92fe2 100644 --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -6003,6 +6003,8 @@ void __throw_runtime_error(const char* msg) { #ifndef _LIBCPP_NO_EXCEPTIONS throw runtime_error(msg); +#else + (void)msg; #endif } diff --git a/libcxx/src/system_error.cpp b/libcxx/src/system_error.cpp index 763d62c2a0b4..7376b770ecf8 100644 --- a/libcxx/src/system_error.cpp +++ b/libcxx/src/system_error.cpp @@ -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 } diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp index 7a06b296d44c..635500292bbc 100644 --- a/libcxx/src/thread.cpp +++ b/libcxx/src/thread.cpp @@ -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; } diff --git a/libcxx/src/typeinfo.cpp b/libcxx/src/typeinfo.cpp index 7b47d74123d6..60828944a1bc 100644 --- a/libcxx/src/typeinfo.cpp +++ b/libcxx/src/typeinfo.cpp @@ -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