[libcxx] r178267 - Fix a few warnings/errors for compiling with -fno-exceptions.

Howard Hinnant hhinnant at apple.com
Thu Mar 28 11:56:26 PDT 2013


Author: hhinnant
Date: Thu Mar 28 13:56:26 2013
New Revision: 178267

URL: http://llvm.org/viewvc/llvm-project?rev=178267&view=rev
Log:
Fix a few warnings/errors for compiling with -fno-exceptions.

Modified:
    libcxx/trunk/src/hash.cpp
    libcxx/trunk/src/locale.cpp
    libcxx/trunk/src/system_error.cpp
    libcxx/trunk/src/thread.cpp
    libcxx/trunk/src/typeinfo.cpp

Modified: libcxx/trunk/src/hash.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/hash.cpp?rev=178267&r1=178266&r2=178267&view=diff
==============================================================================
--- libcxx/trunk/src/hash.cpp (original)
+++ libcxx/trunk/src/hash.cpp Thu Mar 28 13:56:26 2013
@@ -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
 }
 

Modified: libcxx/trunk/src/locale.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=178267&r1=178266&r2=178267&view=diff
==============================================================================
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Thu Mar 28 13:56:26 2013
@@ -6003,6 +6003,8 @@ void __throw_runtime_error(const char* m
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw runtime_error(msg);
+#else
+    (void)msg;
 #endif
 }
 

Modified: libcxx/trunk/src/system_error.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/system_error.cpp?rev=178267&r1=178266&r2=178267&view=diff
==============================================================================
--- libcxx/trunk/src/system_error.cpp (original)
+++ libcxx/trunk/src/system_error.cpp Thu Mar 28 13:56:26 2013
@@ -195,6 +195,9 @@ __throw_system_error(int ev, const char*
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
     throw system_error(error_code(ev, system_category()), what_arg);
+#else
+    (void)ev;
+    (void)what_arg;
 #endif
 }
 

Modified: libcxx/trunk/src/thread.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/thread.cpp?rev=178267&r1=178266&r2=178267&view=diff
==============================================================================
--- libcxx/trunk/src/thread.cpp (original)
+++ libcxx/trunk/src/thread.cpp Thu Mar 28 13:56:26 2013
@@ -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;
 }

Modified: libcxx/trunk/src/typeinfo.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/typeinfo.cpp?rev=178267&r1=178266&r2=178267&view=diff
==============================================================================
--- libcxx/trunk/src/typeinfo.cpp (original)
+++ libcxx/trunk/src/typeinfo.cpp Thu Mar 28 13:56:26 2013
@@ -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





More information about the cfe-commits mailing list