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

llvm-svn: 178267
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: e00e6f23d36a802c7a81876891e4b470513d9cae
diff --git a/src/hash.cpp b/src/hash.cpp
index a013500..75e773a 100644
--- a/src/hash.cpp
+++ b/src/hash.cpp
@@ -155,6 +155,8 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
     if (N > 0xFFFFFFFB)
         throw overflow_error("__next_prime overflow");
+#else
+    (void)N;
 #endif
 }
 
@@ -166,6 +168,8 @@
 #ifndef _LIBCPP_NO_EXCEPTIONS
     if (N > 0xFFFFFFFFFFFFFFC5ull)
         throw overflow_error("__next_prime overflow");
+#else
+    (void)N;
 #endif
 }
 
diff --git a/src/locale.cpp b/src/locale.cpp
index b7a4784..90bc77c 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -6003,6 +6003,8 @@
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw runtime_error(msg);
+#else
+    (void)msg;
 #endif
 }
 
diff --git a/src/system_error.cpp b/src/system_error.cpp
index 763d62c..7376b77 100644
--- a/src/system_error.cpp
+++ b/src/system_error.cpp
@@ -195,6 +195,9 @@
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw system_error(error_code(ev, system_category()), what_arg);
+#else
+    (void)ev;
+    (void)what_arg;
 #endif
 }
 
diff --git a/src/thread.cpp b/src/thread.cpp
index 7a06b29..6355002 100644
--- a/src/thread.cpp
+++ b/src/thread.cpp
@@ -36,6 +36,8 @@
 #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/src/typeinfo.cpp b/src/typeinfo.cpp
index 7b47d74..6082894 100644
--- a/src/typeinfo.cpp
+++ b/src/typeinfo.cpp
@@ -53,8 +53,18 @@
 #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