[cfe-commits] [libcxx] r110828 - in /libcxx/trunk: include/__config include/__functional_03 include/__locale include/__tree include/exception include/functional include/locale include/map include/memory include/regex lib/buildit src/exception.cpp src/ios.cpp src/locale.cpp src/memory.cpp src/mutex.cpp src/new.cpp src/string.cpp src/system_error.cpp src/thread.cpp

Howard Hinnant hhinnant at apple.com
Wed Aug 11 10:04:32 PDT 2010


Author: hhinnant
Date: Wed Aug 11 12:04:31 2010
New Revision: 110828

URL: http://llvm.org/viewvc/llvm-project?rev=110828&view=rev
Log:
now works with -fno-exceptions and -fno-rtti

Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/__functional_03
    libcxx/trunk/include/__locale
    libcxx/trunk/include/__tree
    libcxx/trunk/include/exception
    libcxx/trunk/include/functional
    libcxx/trunk/include/locale
    libcxx/trunk/include/map
    libcxx/trunk/include/memory
    libcxx/trunk/include/regex
    libcxx/trunk/lib/buildit
    libcxx/trunk/src/exception.cpp
    libcxx/trunk/src/ios.cpp
    libcxx/trunk/src/locale.cpp
    libcxx/trunk/src/memory.cpp
    libcxx/trunk/src/mutex.cpp
    libcxx/trunk/src/new.cpp
    libcxx/trunk/src/string.cpp
    libcxx/trunk/src/system_error.cpp
    libcxx/trunk/src/thread.cpp

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Wed Aug 11 12:04:31 2010
@@ -90,6 +90,10 @@
 #define _LIBCPP_NO_EXCEPTIONS
 #endif
 
+#if !(__has_feature(cxx_rtti))
+#define _LIBCPP_NO_RTTI
+#endif
+
 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
 #define _LIBCPP_HAS_NO_STRONG_USING
 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -139,6 +143,10 @@
 #define _LIBCPP_NO_EXCEPTIONS
 #endif
 
+#ifndef __GXX_RTTI
+#define _LIBCPP_NO_RTTI
+#endif
+
 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
 
 #ifndef __GXX_EXPERIMENTAL_CXX0X__

Modified: libcxx/trunk/include/__functional_03
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__functional_03?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/include/__functional_03 (original)
+++ libcxx/trunk/include/__functional_03 Wed Aug 11 12:04:31 2010
@@ -243,8 +243,10 @@
     virtual void destroy() = 0;
     virtual void destroy_deallocate() = 0;
     virtual _R operator()() = 0;
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* target(const type_info&) const = 0;
     virtual const std::type_info& target_type() const = 0;
+#endif
 };
 
 template<class _R, class _A0>
@@ -260,8 +262,10 @@
     virtual void destroy() = 0;
     virtual void destroy_deallocate() = 0;
     virtual _R operator()(_A0) = 0;
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* target(const type_info&) const = 0;
     virtual const std::type_info& target_type() const = 0;
+#endif
 };
 
 template<class _R, class _A0, class _A1>
@@ -277,8 +281,10 @@
     virtual void destroy() = 0;
     virtual void destroy_deallocate() = 0;
     virtual _R operator()(_A0, _A1) = 0;
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* target(const type_info&) const = 0;
     virtual const std::type_info& target_type() const = 0;
+#endif
 };
 
 template<class _R, class _A0, class _A1, class _A2>
@@ -294,8 +300,10 @@
     virtual void destroy() = 0;
     virtual void destroy_deallocate() = 0;
     virtual _R operator()(_A0, _A1, _A2) = 0;
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* target(const type_info&) const = 0;
     virtual const std::type_info& target_type() const = 0;
+#endif
 };
 
 template<class _FD, class _Alloc, class _FB> class __func;
@@ -313,8 +321,10 @@
     virtual void destroy();
     virtual void destroy_deallocate();
     virtual _R operator()();
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* target(const type_info&) const;
     virtual const std::type_info& target_type() const;
+#endif
 };
 
 template<class _F, class _Alloc, class _R>
@@ -360,6 +370,8 @@
     return __invoke<_R>(__f_.first());
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 template<class _F, class _Alloc, class _R>
 const void*
 __func<_F, _Alloc, _R()>::target(const type_info& __ti) const
@@ -376,6 +388,8 @@
     return typeid(_F);
 }
 
+#endif
+
 template<class _F, class _Alloc, class _R, class _A0>
 class __func<_F, _Alloc, _R(_A0)>
     : public  __base<_R(_A0)>
@@ -389,8 +403,10 @@
     virtual void destroy();
     virtual void destroy_deallocate();
     virtual _R operator()(_A0);
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* target(const type_info&) const;
     virtual const std::type_info& target_type() const;
+#endif
 };
 
 template<class _F, class _Alloc, class _R, class _A0>
@@ -436,6 +452,8 @@
     return __invoke(__f_.first(), __a0);
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 template<class _F, class _Alloc, class _R, class _A0>
 const void*
 __func<_F, _Alloc, _R(_A0)>::target(const type_info& __ti) const
@@ -452,6 +470,8 @@
     return typeid(_F);
 }
 
+#endif
+
 template<class _F, class _Alloc, class _R, class _A0, class _A1>
 class __func<_F, _Alloc, _R(_A0, _A1)>
     : public  __base<_R(_A0, _A1)>
@@ -465,8 +485,10 @@
     virtual void destroy();
     virtual void destroy_deallocate();
     virtual _R operator()(_A0, _A1);
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* target(const type_info&) const;
     virtual const std::type_info& target_type() const;
+#endif
 };
 
 template<class _F, class _Alloc, class _R, class _A0, class _A1>
@@ -512,6 +534,8 @@
     return __invoke(__f_.first(), __a0, __a1);
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 template<class _F, class _Alloc, class _R, class _A0, class _A1>
 const void*
 __func<_F, _Alloc, _R(_A0, _A1)>::target(const type_info& __ti) const
@@ -528,6 +552,8 @@
     return typeid(_F);
 }
 
+#endif
+
 template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
 class __func<_F, _Alloc, _R(_A0, _A1, _A2)>
     : public  __base<_R(_A0, _A1, _A2)>
@@ -541,8 +567,10 @@
     virtual void destroy();
     virtual void destroy_deallocate();
     virtual _R operator()(_A0, _A1, _A2);
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* target(const type_info&) const;
     virtual const std::type_info& target_type() const;
+#endif
 };
 
 template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
@@ -588,6 +616,8 @@
     return __invoke(__f_.first(), __a0, __a1, __a2);
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
 const void*
 __func<_F, _Alloc, _R(_A0, _A1, _A2)>::target(const type_info& __ti) const
@@ -604,6 +634,8 @@
     return typeid(_F);
 }
 
+#endif
+
 }  // __function
 
 template<class _R>
@@ -669,10 +701,12 @@
     // 20.7.16.2.4, function invocation:
     _R operator()() const;
 
+#ifndef _LIBCPP_NO_RTTI
     // 20.7.16.2.5, function target access:
     const std::type_info& target_type() const;
     template <typename _T> _T* target();
     template <typename _T> const _T* target() const;
+#endif
 };
 
 template<class _R>
@@ -797,11 +831,15 @@
 _R
 function<_R()>::operator()() const
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__f_ == 0)
         throw bad_function_call();
+#endif
     return (*__f_)();
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 template<class _R>
 const std::type_info&
 function<_R()>::target_type() const
@@ -831,6 +869,8 @@
     return (const _T*)__f_->target(typeid(_T));
 }
 
+#endif
+
 template<class _R, class _A0>
 class function<_R(_A0)>
     : public unary_function<_A0, _R>
@@ -905,10 +945,12 @@
     // 20.7.16.2.4, function invocation:
     _R operator()(_A0) const;
 
+#ifndef _LIBCPP_NO_RTTI
     // 20.7.16.2.5, function target access:
     const std::type_info& target_type() const;
     template <typename _T> _T* target();
     template <typename _T> const _T* target() const;
+#endif
 };
 
 template<class _R, class _A0>
@@ -1033,11 +1075,15 @@
 _R
 function<_R(_A0)>::operator()(_A0 __a0) const
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__f_ == 0)
         throw bad_function_call();
+#endif
     return (*__f_)(__a0);
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 template<class _R, class _A0>
 const std::type_info&
 function<_R(_A0)>::target_type() const
@@ -1067,6 +1113,8 @@
     return (const _T*)__f_->target(typeid(_T));
 }
 
+#endif
+
 template<class _R, class _A0, class _A1>
 class function<_R(_A0, _A1)>
     : public binary_function<_A0, _A1, _R>
@@ -1141,10 +1189,12 @@
     // 20.7.16.2.4, function invocation:
     _R operator()(_A0, _A1) const;
 
+#ifndef _LIBCPP_NO_RTTI
     // 20.7.16.2.5, function target access:
     const std::type_info& target_type() const;
     template <typename _T> _T* target();
     template <typename _T> const _T* target() const;
+#endif
 };
 
 template<class _R, class _A0, class _A1>
@@ -1269,11 +1319,15 @@
 _R
 function<_R(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__f_ == 0)
         throw bad_function_call();
+#endif
     return (*__f_)(__a0, __a1);
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 template<class _R, class _A0, class _A1>
 const std::type_info&
 function<_R(_A0, _A1)>::target_type() const
@@ -1303,6 +1357,8 @@
     return (const _T*)__f_->target(typeid(_T));
 }
 
+#endif
+
 template<class _R, class _A0, class _A1, class _A2>
 class function<_R(_A0, _A1, _A2)>
 {
@@ -1376,10 +1432,12 @@
     // 20.7.16.2.4, function invocation:
     _R operator()(_A0, _A1, _A2) const;
 
+#ifndef _LIBCPP_NO_RTTI
     // 20.7.16.2.5, function target access:
     const std::type_info& target_type() const;
     template <typename _T> _T* target();
     template <typename _T> const _T* target() const;
+#endif
 };
 
 template<class _R, class _A0, class _A1, class _A2>
@@ -1504,11 +1562,15 @@
 _R
 function<_R(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__f_ == 0)
         throw bad_function_call();
+#endif
     return (*__f_)(__a0, __a1, __a2);
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 template<class _R, class _A0, class _A1, class _A2>
 const std::type_info&
 function<_R(_A0, _A1, _A2)>::target_type() const
@@ -1538,6 +1600,8 @@
     return (const _T*)__f_->target(typeid(_T));
 }
 
+#endif
+
 template <class _F> 
 inline _LIBCPP_INLINE_VISIBILITY
 bool

Modified: libcxx/trunk/include/__locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/include/__locale (original)
+++ libcxx/trunk/include/__locale Wed Aug 11 12:04:31 2010
@@ -134,8 +134,10 @@
 locale
 locale::combine(const locale& __other) const
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (!_STD::has_facet<_Facet>(__other))
         throw runtime_error("locale::combine: locale missing facet");
+#endif
     return locale(*this, &const_cast<_Facet&>(_STD::use_facet<_Facet>(__other)));
 }
 

Modified: libcxx/trunk/include/__tree
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tree?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/include/__tree (original)
+++ libcxx/trunk/include/__tree Wed Aug 11 12:04:31 2010
@@ -1102,8 +1102,10 @@
     if (size() != 0)
     {
         __node_pointer __cache = __detach();
+#ifndef _LIBCPP_NO_EXCEPTIONS
         try
         {
+#endif
             for (; __cache != nullptr && __first != __last; ++__first)
             {
                 __cache->__value_ = *__first;
@@ -1111,6 +1113,7 @@
                 __node_insert_unique(__cache);
                 __cache = __next;
             }
+#ifndef _LIBCPP_NO_EXCEPTIONS
         }
         catch (...)
         {
@@ -1119,6 +1122,7 @@
             destroy(__cache);
             throw;
         }
+#endif
         if (__cache != nullptr)
         {
             while (__cache->__parent_ != nullptr)
@@ -1138,8 +1142,10 @@
     if (size() != 0)
     {
         __node_pointer __cache = __detach();
+#ifndef _LIBCPP_NO_EXCEPTIONS
         try
         {
+#endif
             for (; __cache != nullptr && __first != __last; ++__first)
             {
                 __cache->__value_ = *__first;
@@ -1147,6 +1153,7 @@
                 __node_insert_multi(__cache);
                 __cache = __next;
             }
+#ifndef _LIBCPP_NO_EXCEPTIONS
         }
         catch (...)
         {
@@ -1155,6 +1162,7 @@
             destroy(__cache);
             throw;
         }
+#endif
         if (__cache != nullptr)
         {
             while (__cache->__parent_ != nullptr)
@@ -1253,8 +1261,10 @@
         if (size() != 0)
         {
             __node_pointer __cache = __detach();
+#ifndef _LIBCPP_NO_EXCEPTIONS
             try
             {
+#endif
                 while (__cache != nullptr && __t.size() != 0)
                 {
                     __cache->__value_ = _STD::move(__t.remove(__t.begin())->__value_);
@@ -1262,6 +1272,7 @@
                     __node_insert_multi(__cache);
                     __cache = __next;
                 }
+#ifndef _LIBCPP_NO_EXCEPTIONS
             }
             catch (...)
             {
@@ -1270,6 +1281,7 @@
                 destroy(__cache);
                 throw;
             }
+#endif
             if (__cache != nullptr)
             {
                 while (__cache->__parent_ != nullptr)

Modified: libcxx/trunk/include/exception
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/exception?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/include/exception (original)
+++ libcxx/trunk/include/exception Wed Aug 11 12:04:31 2010
@@ -141,6 +141,7 @@
 exception_ptr
 make_exception_ptr(_E __e)
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     try
     {
         throw __e;
@@ -149,6 +150,7 @@
     {
         return current_exception();
     }
+#endif
 }
 
 // nested_exception
@@ -188,7 +190,9 @@
                                     >::type* = 0)
 #endif
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     throw __nested<typename remove_reference<_Tp>::type>(_STD::forward<_Tp>(__t));
+#endif
 }
 
 template <class _Tp>
@@ -204,7 +208,9 @@
                                     >::type* = 0)
 #endif
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     throw _STD::forward<_Tp>(__t);
+#endif
 }
 
 template <class _E>

Modified: libcxx/trunk/include/functional
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/functional?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/include/functional (original)
+++ libcxx/trunk/include/functional Wed Aug 11 12:04:31 2010
@@ -1000,8 +1000,10 @@
     virtual void destroy() = 0;
     virtual void destroy_deallocate() = 0;
     virtual _R operator()(_ArgTypes&& ...) = 0;
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* target(const type_info&) const = 0;
     virtual const std::type_info& target_type() const = 0;
+#endif
 };
 
 template<class _FD, class _Alloc, class _FB> class __func;
@@ -1019,8 +1021,10 @@
     virtual void destroy();
     virtual void destroy_deallocate();
     virtual _R operator()(_ArgTypes&& ... __arg);
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* target(const type_info&) const;
     virtual const std::type_info& target_type() const;
+#endif
 };
 
 template<class _F, class _Alloc, class _R, class ..._ArgTypes>
@@ -1066,6 +1070,8 @@
     return __invoke(__f_.first(), _STD::forward<_ArgTypes>(__arg)...);
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 template<class _F, class _Alloc, class _R, class ..._ArgTypes>
 const void*
 __func<_F, _Alloc, _R(_ArgTypes...)>::target(const type_info& __ti) const
@@ -1082,6 +1088,8 @@
     return typeid(_F);
 }
 
+#endif
+
 }  // __function
 
 template<class _R, class ..._ArgTypes>
@@ -1163,10 +1171,12 @@
     // 20.7.16.2.4, function invocation:
     _R operator()(_ArgTypes...) const;
 
+#ifndef _LIBCPP_NO_RTTI
     // 20.7.16.2.5, function target access:
     const std::type_info& target_type() const;
     template <typename _T> _T* target();
     template <typename _T> const _T* target() const;
+#endif
 };
 
 template<class _R, class ..._ArgTypes>
@@ -1331,11 +1341,15 @@
 _R
 function<_R(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__f_ == 0)
         throw bad_function_call();
+#endif
     return (*__f_)(_STD::forward<_ArgTypes>(__arg)...);
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 template<class _R, class ..._ArgTypes>
 const std::type_info&
 function<_R(_ArgTypes...)>::target_type() const
@@ -1365,6 +1379,8 @@
     return (const _T*)__f_->target(typeid(_T));
 }
 
+#endif
+
 template <class _R, class... _ArgTypes> 
 inline _LIBCPP_INLINE_VISIBILITY
 bool

Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Wed Aug 11 12:04:31 2010
@@ -3690,8 +3690,10 @@
         if (__r == codecvt_base::ok)
             return __ws;
     }
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__wide_err_string_.empty())
         throw range_error("wstring_convert: from_bytes error");
+#endif
     return __wide_err_string_;
 }
 
@@ -3776,8 +3778,10 @@
                 return __bs;
         }
     }
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__byte_err_string_.empty())
         throw range_error("wstring_convert: to_bytes error");
+#endif
     return __byte_err_string_;
 }
 

Modified: libcxx/trunk/include/map
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/include/map (original)
+++ libcxx/trunk/include/map Wed Aug 11 12:04:31 2010
@@ -1136,8 +1136,10 @@
 {
     __node_base_pointer __parent;
     __node_base_pointer& __child = __find_equal_key(__parent, __k);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__child == nullptr)
         throw out_of_range("map::at:  key not found");
+#endif
     return static_cast<__node_pointer>(__child)->__value_.second;
 }
 
@@ -1147,8 +1149,10 @@
 {
     __node_base_const_pointer __parent;
     __node_base_const_pointer __child = __find_equal_key(__parent, __k);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__child == nullptr)
         throw out_of_range("map::at:  key not found");
+#endif
     return static_cast<__node_const_pointer>(__child)->__value_.second;
 }
 

Modified: libcxx/trunk/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Wed Aug 11 12:04:31 2010
@@ -2642,7 +2642,9 @@
     long use_count() const {return __shared_count::use_count();}
     __shared_weak_count* lock();
 
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* __get_deleter(const type_info&) const;
+#endif
 private:
     virtual void __on_zero_shared_weak() = 0;
 };
@@ -2656,13 +2658,17 @@
     __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
         :  __data_(__compressed_pair<_Tp, _Dp>(__p, _STD::move(__d)), _STD::move(__a)) {}
 
+#ifndef _LIBCPP_NO_RTTI
     virtual const void* __get_deleter(const type_info&) const;
+#endif
 
 private:
     virtual void __on_zero_shared();
     virtual void __on_zero_shared_weak();
 };
 
+#ifndef _LIBCPP_NO_RTTI
+
 template <class _Tp, class _Dp, class _Alloc>
 const void*
 __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const
@@ -2670,6 +2676,8 @@
     return __t == typeid(_Dp) ? &__data_.first().second() : 0;
 }
 
+#endif
+
 template <class _Tp, class _Dp, class _Alloc>
 void
 __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared()
@@ -2834,9 +2842,11 @@
     template <class _U> bool owner_before(weak_ptr<_U> const& __p) const
         {return __cntrl_ < __p.__cntrl_;}
 
+#ifndef _LIBCPP_NO_RTTI
     template <class _Dp>
         _Dp* __get_deleter() const
             {return (_Dp*)(__cntrl_ ? __cntrl_->__get_deleter(typeid(_Dp)) : 0);}
+#endif
 
 #ifndef _LIBCPP_HAS_NO_VARIADICS
 
@@ -3591,6 +3601,8 @@
     return shared_ptr<_Tp>(__r, const_cast<_Tp*>(__r.get()));
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 template<class _Dp, class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 _Dp*
@@ -3599,6 +3611,8 @@
     return __p.template __get_deleter<_Dp>();
 }
 
+#endif
+
 template<class _Tp>
 class weak_ptr
 {

Modified: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Wed Aug 11 12:04:31 2010
@@ -2263,8 +2263,10 @@
             }
             else
             {
+#ifndef _LIBCPP_NO_EXCEPTIONS
                 if (__b.size() != 1 || __e.size() != 1)
                     throw regex_error(regex_constants::error_collate);
+#endif
                 if (__icase_)
                 {
                     __b[0] = __traits_.translate_nocase(__b[0]);
@@ -2894,8 +2896,10 @@
     case egrep:
         __first = __parse_egrep(__first, __last);
         break;
+#ifndef _LIBCPP_NO_EXCEPTIONS
     default:
         throw regex_error(regex_constants::__re_err_grammar);
+#endif
     }
     return __first;
 }
@@ -2926,8 +2930,10 @@
                 }
             }
         }
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (__first != __last)
             throw regex_error(regex_constants::__re_err_empty);
+#endif
     }
     return __first;
 }
@@ -2940,15 +2946,19 @@
 {
     __owns_one_state<_CharT>* __sa = __end_;
     _ForwardIterator __temp = __parse_ERE_branch(__first, __last);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__temp == __first)
         throw regex_error(regex_constants::__re_err_empty);
+#endif
     __first = __temp;
     while (__first != __last && *__first == '|')
     {
         __owns_one_state<_CharT>* __sb = __end_;
         __temp = __parse_ERE_branch(++__first, __last);
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (__temp == __first)
             throw regex_error(regex_constants::__re_err_empty);
+#endif
         __push_alternation(__sa, __sb);
         __first = __temp;
     }
@@ -2962,8 +2972,10 @@
                                                  _ForwardIterator __last)
 {
     _ForwardIterator __temp = __parse_ERE_expression(__first, __last);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__temp == __first)
         throw regex_error(regex_constants::__re_err_empty);
+#endif
     do
     {
         __first = __temp;
@@ -2998,8 +3010,10 @@
             unsigned __temp_count = __marked_count_;
             ++__open_count_;
             __temp = __parse_extended_reg_exp(++__temp, __last);
+#ifndef _LIBCPP_NO_EXCEPTIONS
             if (__temp == __last || *__temp != ')')
                 throw regex_error(regex_constants::error_paren);
+#endif
             __push_end_marked_subexpression(__temp_count);
             --__open_count_;
             ++__temp;
@@ -3064,8 +3078,10 @@
             unsigned __temp_count = __marked_count_;
             __first = __parse_RE_expression(__temp, __last);
             __temp = __parse_Back_close_paren(__first, __last);
+#ifndef _LIBCPP_NO_EXCEPTIONS
             if (__temp == __first)
                 throw regex_error(regex_constants::error_paren);
+#endif
             __push_end_marked_subexpression(__temp_count);
             __first = __temp;
         }
@@ -3374,16 +3390,22 @@
                 int __min = 0;
                 __first = __temp;
                 __temp = __parse_DUP_COUNT(__first, __last, __min);
+#ifndef _LIBCPP_NO_EXCEPTIONS
                 if (__temp == __first)
                     throw regex_error(regex_constants::error_badbrace);
+#endif
                 __first = __temp;
+#ifndef _LIBCPP_NO_EXCEPTIONS
                 if (__first == __last)
                     throw regex_error(regex_constants::error_brace);
+#endif
                 if (*__first != ',')
                 {
                     __temp = __parse_Back_close_brace(__first, __last);
+#ifndef _LIBCPP_NO_EXCEPTIONS
                     if (__temp == __first)
                         throw regex_error(regex_constants::error_brace);
+#endif
                     __push_loop(__min, __min, __s, __mexp_begin, __mexp_end,
                                     true);
                     __first = __temp;
@@ -3394,14 +3416,18 @@
                     int __max = -1;
                     __first = __parse_DUP_COUNT(__first, __last, __max);
                     __temp = __parse_Back_close_brace(__first, __last);
+#ifndef _LIBCPP_NO_EXCEPTIONS
                     if (__temp == __first)
                         throw regex_error(regex_constants::error_brace);
+#endif
                     if (__max == -1)
                         __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
                     else
                     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
                         if (__max < __min)
                             throw regex_error(regex_constants::error_badbrace);
+#endif
                         __push_loop(__min, __max, __s, __mexp_begin, __mexp_end,
                                     true);
                     }
@@ -3461,11 +3487,15 @@
             {
                 int __min;
                 _ForwardIterator __temp = __parse_DUP_COUNT(++__first, __last, __min);
+#ifndef _LIBCPP_NO_EXCEPTIONS
                 if (__temp == __first)
                     throw regex_error(regex_constants::error_badbrace);
+#endif
                 __first = __temp;
+#ifndef _LIBCPP_NO_EXCEPTIONS
                 if (__first == __last)
                     throw regex_error(regex_constants::error_brace);
+#endif
                 switch (*__first)
                 {
                 case '}':
@@ -3479,8 +3509,11 @@
                         __push_loop(__min, __min, __s, __mexp_begin, __mexp_end);
                     break;
                 case ',':
-                    if (++__first == __last)
+                    ++__first;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+                    if (__first == __last)
                         throw regex_error(regex_constants::error_badbrace);
+#endif
                     if (*__first == '}')
                     {
                         ++__first;
@@ -3496,14 +3529,20 @@
                     {
                         int __max = -1;
                         __temp = __parse_DUP_COUNT(__first, __last, __max);
+#ifndef _LIBCPP_NO_EXCEPTIONS
                         if (__temp == __first)
                             throw regex_error(regex_constants::error_brace);
+#endif
                         __first = __temp;
+#ifndef _LIBCPP_NO_EXCEPTIONS
                         if (__first == __last || *__first != '}')
                             throw regex_error(regex_constants::error_brace);
+#endif
                         ++__first;
+#ifndef _LIBCPP_NO_EXCEPTIONS
                         if (__max < __min)
                             throw regex_error(regex_constants::error_badbrace);
+#endif
                         if (__grammar == ECMAScript && __first != __last && *__first == '?')
                         {
                             ++__first;
@@ -3513,8 +3552,10 @@
                             __push_loop(__min, __max, __s, __mexp_begin, __mexp_end);
                     }
                     break;
+#ifndef _LIBCPP_NO_EXCEPTIONS
                 default:
                     throw regex_error(regex_constants::error_badbrace);
+#endif
                 }
             }
             break;
@@ -3531,8 +3572,11 @@
 {
     if (__first != __last && *__first == '[')
     {
-        if (++__first == __last)
+        ++__first;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        if (__first == __last)
             throw regex_error(regex_constants::error_brack);
+#endif
         bool __negate = false;
         if (*__first == '^')
         {
@@ -3541,23 +3585,29 @@
         }
         __bracket_expression<_CharT, _Traits>* __ml = __start_matching_list(__negate);
         // __ml owned by *this
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (__first == __last)
             throw regex_error(regex_constants::error_brack);
+#endif
         if ((__flags_ & 0x1F0) != ECMAScript && *__first == ']')
         {
             __ml->__add_char(']');
             ++__first;
         }
         __first = __parse_follow_list(__first, __last, __ml);
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (__first == __last)
             throw regex_error(regex_constants::error_brack);
+#endif
         if (*__first == '-')
         {
             __ml->__add_char('-');
             ++__first;
         }
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (__first == __last || *__first != ']')
             throw regex_error(regex_constants::error_brack);
+#endif
         ++__first;
     }
     return __first;
@@ -3677,8 +3727,10 @@
                           basic_string<_CharT>& __str,
                           __bracket_expression<_CharT, _Traits>* __ml)
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__first == __last)
         throw regex_error(regex_constants::error_escape);
+#endif
     switch (*__first)
     {
     case 0:
@@ -3719,8 +3771,10 @@
                           _ForwardIterator __last,
                           basic_string<_CharT>* __str)
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__first == __last)
         throw regex_error(regex_constants::error_escape);
+#endif
     switch (*__first)
     {
     case '\\':
@@ -3788,8 +3842,10 @@
         else
             __push_char(_CharT(__val));
     }
+#ifndef _LIBCPP_NO_EXCEPTIONS
     else
         throw regex_error(regex_constants::error_escape);
+#endif
     return __first;
 }
 
@@ -3805,14 +3861,18 @@
     value_type _Equal_close[2] = {'=', ']'};
     _ForwardIterator __temp = _STD::search(__first, __last, _Equal_close,
                                                             _Equal_close+2);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__temp == __last)
         throw regex_error(regex_constants::error_brack);
+#endif
     // [__first, __temp) contains all text in [= ... =]
     typedef typename _Traits::string_type string_type;
     string_type __collate_name =
         __traits_.lookup_collatename(__first, __temp);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__collate_name.empty())
         throw regex_error(regex_constants::error_collate);
+#endif
     string_type __equiv_name =
         __traits_.transform_primary(__collate_name.begin(),
                                     __collate_name.end());
@@ -3828,8 +3888,10 @@
         case 2:
             __ml->__add_digraph(__collate_name[0], __collate_name[1]);
             break;
+#ifndef _LIBCPP_NO_EXCEPTIONS
         default:
             throw regex_error(regex_constants::error_collate);
+#endif
         }
     }
     __first = next(__temp, 2);
@@ -3848,14 +3910,18 @@
     value_type _Colon_close[2] = {':', ']'};
     _ForwardIterator __temp = _STD::search(__first, __last, _Colon_close,
                                                             _Colon_close+2);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__temp == __last)
         throw regex_error(regex_constants::error_brack);
+#endif
     // [__first, __temp) contains all text in [: ... :]
     typedef typename _Traits::char_class_type char_class_type;
     char_class_type __class_type =
         __traits_.lookup_classname(__first, __temp, __flags_ & icase);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__class_type == 0)
         throw regex_error(regex_constants::error_brack);
+#endif
     __ml->__add_class(__class_type);
     __first = next(__temp, 2);
     return __first;
@@ -3873,8 +3939,10 @@
     value_type _Dot_close[2] = {'.', ']'};
     _ForwardIterator __temp = _STD::search(__first, __last, _Dot_close,
                                                             _Dot_close+2);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__temp == __last)
         throw regex_error(regex_constants::error_brack);
+#endif
     // [__first, __temp) contains all text in [. ... .]
     typedef typename _Traits::string_type string_type;
     __col_sym = __traits_.lookup_collatename(__first, __temp);
@@ -3883,8 +3951,10 @@
     case 1:
     case 2:
         break;
+#ifndef _LIBCPP_NO_EXCEPTIONS
     default:
         throw regex_error(regex_constants::error_collate);
+#endif
     }
     __first = next(__temp, 2);
     return __first;
@@ -4022,8 +4092,10 @@
                                 __temp = __exp.__parse(++__temp, __last);
                                 __exp.__push_l_anchor();
                                 __push_lookahead(_STD::move(__exp), false);
+#ifndef _LIBCPP_NO_EXCEPTIONS
                                 if (__temp == __last || *__temp != ')')
                                     throw regex_error(regex_constants::error_paren);
+#endif
                                 __first = ++__temp;
                             }
                             break;
@@ -4034,8 +4106,10 @@
                                 __temp = __exp.__parse(++__temp, __last);
                                 __exp.__push_l_anchor();
                                 __push_lookahead(_STD::move(__exp), true);
+#ifndef _LIBCPP_NO_EXCEPTIONS
                                 if (__temp == __last || *__temp != ')')
                                     throw regex_error(regex_constants::error_paren);
+#endif
                                 __first = ++__temp;
                             }
                             break;
@@ -4071,15 +4145,20 @@
             break;
         case '(':
             {
-                if (++__first == __last)
+                ++__first;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+                if (__first == __last)
                     throw regex_error(regex_constants::error_paren);
+#endif
                 _ForwardIterator __temp = _STD::next(__first);
                 if (__temp != __last && *__first == '?' && *__temp == ':')
                 {
                     ++__open_count_;
                     __first = __parse_ecma_exp(++__temp, __last);
+#ifndef _LIBCPP_NO_EXCEPTIONS
                     if (__first == __last || *__first != ')')
                         throw regex_error(regex_constants::error_paren);
+#endif
                     --__open_count_;
                     ++__first;
                 }
@@ -4089,8 +4168,10 @@
                     unsigned __temp_count = __marked_count_;
                     ++__open_count_;
                     __first = __parse_ecma_exp(__first, __last);
+#ifndef _LIBCPP_NO_EXCEPTIONS
                     if (__first == __last || *__first != ')')
                         throw regex_error(regex_constants::error_paren);
+#endif
                     __push_end_marked_subexpression(__temp_count);
                     --__open_count_;
                     ++__first;
@@ -4151,8 +4232,10 @@
             unsigned __v = *__first - '0';
             for (++__first; '0' <= *__first && *__first <= '9'; ++__first)
                 __v = 10 * __v + *__first - '0';
+#ifndef _LIBCPP_NO_EXCEPTIONS
             if (__v > mark_count())
                 throw regex_error(regex_constants::error_backref);
+#endif
             __push_back_ref(__v);
         }
     }
@@ -4270,31 +4353,51 @@
             }
             break;
         case 'u':
-            if (++__first == __last)
+            ++__first;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            if (__first == __last)
                 throw regex_error(regex_constants::error_escape);
+#endif
             __hd = __traits_.value(*__first, 16);
+#ifndef _LIBCPP_NO_EXCEPTIONS
             if (__hd == -1)
                 throw regex_error(regex_constants::error_escape);
+#endif
             __sum = 16 * __sum + __hd;
-            if (++__first == __last)
+            ++__first;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            if (__first == __last)
                 throw regex_error(regex_constants::error_escape);
+#endif
             __hd = __traits_.value(*__first, 16);
+#ifndef _LIBCPP_NO_EXCEPTIONS
             if (__hd == -1)
                 throw regex_error(regex_constants::error_escape);
+#endif
             __sum = 16 * __sum + __hd;
             // drop through
         case 'x':
-            if (++__first == __last)
+            ++__first;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            if (__first == __last)
                 throw regex_error(regex_constants::error_escape);
+#endif
             __hd = __traits_.value(*__first, 16);
+#ifndef _LIBCPP_NO_EXCEPTIONS
             if (__hd == -1)
                 throw regex_error(regex_constants::error_escape);
+#endif
             __sum = 16 * __sum + __hd;
-            if (++__first == __last)
+            ++__first;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            if (__first == __last)
                 throw regex_error(regex_constants::error_escape);
+#endif
             __hd = __traits_.value(*__first, 16);
+#ifndef _LIBCPP_NO_EXCEPTIONS
             if (__hd == -1)
                 throw regex_error(regex_constants::error_escape);
+#endif
             __sum = 16 * __sum + __hd;
             if (__str)
                 *__str = _CharT(__sum);
@@ -4311,8 +4414,10 @@
                     __push_char(*__first);
                 ++__first;
             }
+#ifndef _LIBCPP_NO_EXCEPTIONS
             else if (__str)
                 throw regex_error(regex_constants::error_escape);
+#endif
             break;
         }
     }
@@ -5206,8 +5311,11 @@
                 __states.pop_back();
                 break;
             default:
+#ifndef _LIBCPP_NO_EXCEPTIONS
                 throw regex_error(regex_constants::__re_err_unknown);
+#endif
                 break;
+
             }
         } while (!__states.empty());
     }
@@ -5274,7 +5382,9 @@
                 __states.pop_back();
                 break;
             default:
+#ifndef _LIBCPP_NO_EXCEPTIONS
                 throw regex_error(regex_constants::__re_err_unknown);
+#endif
                 break;
             }
         } while (!__states.empty());
@@ -5354,7 +5464,9 @@
                 __states.pop_back();
                 break;
             default:
+#ifndef _LIBCPP_NO_EXCEPTIONS
                 throw regex_error(regex_constants::__re_err_unknown);
+#endif
                 break;
             }
         } while (!__states.empty());

Modified: libcxx/trunk/lib/buildit
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/buildit?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/lib/buildit (original)
+++ libcxx/trunk/lib/buildit Wed Aug 11 12:04:31 2010
@@ -21,7 +21,7 @@
   *-apple-*)
     if [ -z $RC_BUILDIT ]
     then
-      RC_CFLAGS="-arch i386 -arch x86_64"
+      RC_CFLAGS="-arch i386 -arch x86_64 -fno-exceptions -fno-rtti"
     fi
     SOEXT=dylib
     LDSHARED_FLAGS="-o libc++.1.dylib \

Modified: libcxx/trunk/src/exception.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/exception.cpp?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/src/exception.cpp (original)
+++ libcxx/trunk/src/exception.cpp Wed Aug 11 12:04:31 2010
@@ -54,15 +54,21 @@
 void
 std::terminate()
 {
-    try {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+    try
+    {
+#endif
         (*__terminate_handler)();
         // handler should not return
         ::abort ();
+#ifndef _LIBCPP_NO_EXCEPTIONS
     } 
-    catch (...) {
+    catch (...)
+    {
         // handler should not throw exception
         ::abort ();
     }
+#endif
 }
 
 

Modified: libcxx/trunk/src/ios.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/ios.cpp?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/src/ios.cpp (original)
+++ libcxx/trunk/src/ios.cpp Wed Aug 11 12:04:31 2010
@@ -260,8 +260,10 @@
         __rdstate_ = state;
     else
         __rdstate_ = state | badbit;
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (((state | (__rdbuf_ ? goodbit : badbit)) & __exceptions_) != 0)
         throw failure("ios_base::clear");
+#endif
 }
 
 // init
@@ -300,23 +302,31 @@
     if (__event_cap_ < rhs.__event_size_)
     {
         new_callbacks.reset((event_callback*)malloc(sizeof(event_callback) * rhs.__event_size_));
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (!new_callbacks)
             throw bad_alloc();
+#endif
         new_ints.reset((int*)malloc(sizeof(int) * rhs.__event_size_));
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (!new_ints)
             throw bad_alloc();
+#endif
     }
     if (__iarray_cap_ < rhs.__iarray_size_)
     {
         new_longs.reset((long*)malloc(sizeof(long) * rhs.__iarray_size_));
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (!new_longs)
             throw bad_alloc();
+#endif
     }
     if (__parray_cap_ < rhs.__parray_size_)
     {
         new_pointers.reset((void**)malloc(sizeof(void*) * rhs.__parray_size_));
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (!new_pointers)
             throw bad_alloc();
+#endif
     }
     // Got everything we need.  Copy everything but __rdstate_, __rdbuf_ and __exceptions_
     __fmtflags_ = rhs.__fmtflags_;
@@ -417,16 +427,20 @@
 ios_base::__set_badbit_and_consider_rethrow()
 {
     __rdstate_ |= badbit;
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__exceptions_ & badbit)
         throw;
+#endif
 }
 
 void
 ios_base::__set_failbit_and_consider_rethrow()
 {
     __rdstate_ |= failbit;
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__exceptions_ & failbit)
         throw;
+#endif
 }
 
 bool

Modified: libcxx/trunk/src/locale.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Wed Aug 11 12:04:31 2010
@@ -132,8 +132,10 @@
       name_(name),
       facets_(N)
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     try
     {
+#endif
         facets_ = locale::classic().__locale_->facets_;
         for (unsigned i = 0; i < facets_.size(); ++i)
             if (facets_[i])
@@ -158,6 +160,7 @@
         install(new time_put_byname<wchar_t>(name_));
         install(new messages_byname<char>(name_));
         install(new messages_byname<wchar_t>(name_));
+#ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
     {
@@ -166,6 +169,7 @@
                 facets_[i]->__release_shared();
         throw;
     }
+#endif
 }
 
 locale::__imp::__imp(const __imp& other)
@@ -186,8 +190,10 @@
     for (unsigned i = 0; i < facets_.size(); ++i)
         if (facets_[i])
             facets_[i]->__add_shared();
+#ifndef _LIBCPP_NO_EXCEPTIONS
     try
     {
+#endif
         if (c & locale::collate)
         {
             install(new collate_byname<char>(name));
@@ -226,6 +232,7 @@
             install(new messages_byname<char>(name));
             install(new messages_byname<wchar_t>(name));
         }
+#ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
     {
@@ -234,6 +241,7 @@
                 facets_[i]->__release_shared();
         throw;
     }
+#endif
 }
 
 template<class F>
@@ -253,8 +261,10 @@
     for (unsigned i = 0; i < facets_.size(); ++i)
         if (facets_[i])
             facets_[i]->__add_shared();
+#ifndef _LIBCPP_NO_EXCEPTIONS
     try
     {
+#endif
         if (c & locale::collate)
         {
             install_from<_STD::collate<char> >(one);
@@ -301,6 +311,7 @@
             install_from<_STD::messages<char> >(one);
             install_from<_STD::messages<wchar_t> >(one);
         }
+#ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
     {
@@ -309,6 +320,7 @@
                 facets_[i]->__release_shared();
         throw;
     }
+#endif
 }
 
 locale::__imp::__imp(const __imp& other, facet* f, long id)
@@ -346,8 +358,10 @@
 const locale::facet*
 locale::__imp::use_facet(long id) const
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (!has_facet(id))
         throw bad_cast();
+#endif
     return facets_[id];
 }
 
@@ -414,8 +428,12 @@
 }
 
 locale::locale(const char* name)
+#ifndef _LIBCPP_NO_EXCEPTIONS
     : __locale_(name ? new __imp(name)
                      : throw runtime_error("locale constructed with null"))
+#else
+    : __locale_(new __imp(name))
+#endif
 {
     __locale_->__add_shared();
 }
@@ -427,8 +445,12 @@
 }
 
 locale::locale(const locale& other, const char* name, category c)
+#ifndef _LIBCPP_NO_EXCEPTIONS
     : __locale_(name ? new __imp(*other.__locale_, name, c)
                      : throw runtime_error("locale constructed with null"))
+#else
+    : __locale_(new __imp(*other.__locale_, name, c))
+#endif
 {
     __locale_->__add_shared();
 }
@@ -545,18 +567,22 @@
     : collate<char>(refs),
       __l(newlocale(LC_ALL_MASK, n, 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__l == 0)
         throw runtime_error("collate_byname<char>::collate_byname"
                             " failed to construct for " + string(n));
+#endif
 }
 
 collate_byname<char>::collate_byname(const string& name, size_t refs)
     : collate<char>(refs),
       __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__l == 0)
         throw runtime_error("collate_byname<char>::collate_byname"
                             " failed to construct for " + name);
+#endif
 }
 
 collate_byname<char>::~collate_byname()
@@ -593,18 +619,22 @@
     : collate<wchar_t>(refs),
       __l(newlocale(LC_ALL_MASK, n, 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__l == 0)
         throw runtime_error("collate_byname<wchar_t>::collate_byname(size_t refs)"
                             " failed to construct for " + string(n));
+#endif
 }
 
 collate_byname<wchar_t>::collate_byname(const string& name, size_t refs)
     : collate<wchar_t>(refs),
       __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__l == 0)
         throw runtime_error("collate_byname<wchar_t>::collate_byname(size_t refs)"
                             " failed to construct for " + name);
+#endif
 }
 
 collate_byname<wchar_t>::~collate_byname()
@@ -828,18 +858,22 @@
     : ctype<char>(0, false, refs),
       __l(newlocale(LC_ALL_MASK, name, 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__l == 0)
         throw runtime_error("ctype_byname<char>::ctype_byname"
                             " failed to construct for " + string(name));
+#endif
 }
 
 ctype_byname<char>::ctype_byname(const string& name, size_t refs)
     : ctype<char>(0, false, refs),
       __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__l == 0)
         throw runtime_error("ctype_byname<char>::ctype_byname"
                             " failed to construct for " + name);
+#endif
 }
 
 ctype_byname<char>::~ctype_byname()
@@ -881,18 +915,22 @@
     : ctype<wchar_t>(refs),
       __l(newlocale(LC_ALL_MASK, name, 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__l == 0)
         throw runtime_error("ctype_byname<wchar_t>::ctype_byname"
                             " failed to construct for " + string(name));
+#endif
 }
 
 ctype_byname<wchar_t>::ctype_byname(const string& name, size_t refs)
     : ctype<wchar_t>(refs),
       __l(newlocale(LC_ALL_MASK, name.c_str(), 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__l == 0)
         throw runtime_error("ctype_byname<wchar_t>::ctype_byname"
                             " failed to construct for " + name);
+#endif
 }
 
 ctype_byname<wchar_t>::~ctype_byname()
@@ -1092,9 +1130,11 @@
     : locale::facet(refs),
       __l(newlocale(LC_ALL_MASK, nm, 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__l == 0)
         throw runtime_error("codecvt_byname<wchar_t, char, mbstate_t>::codecvt_byname"
                             " failed to construct for " + string(nm));
+#endif
 }
 
 codecvt<wchar_t, char, mbstate_t>::~codecvt()
@@ -3832,9 +3872,11 @@
     if (strcmp(nm, "C") != 0)
     {
         unique_ptr<_xlocale, int(*)(locale_t)>  loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (loc == 0)
             throw runtime_error("numpunct_byname<char>::numpunct_byname"
                                 " failed to construct for " + string(nm));
+#endif
         lconv* lc = localeconv_l(loc.get());
         if (*lc->decimal_point)
             __decimal_point_ = *lc->decimal_point;
@@ -3869,9 +3911,11 @@
     if (strcmp(nm, "C") != 0)
     {
         unique_ptr<_xlocale, int(*)(locale_t)>  loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (loc == 0)
             throw runtime_error("numpunct_byname<char>::numpunct_byname"
                                 " failed to construct for " + string(nm));
+#endif
         lconv* lc = localeconv_l(loc.get());
         if (*lc->decimal_point)
             __decimal_point_ = *lc->decimal_point;
@@ -4274,17 +4318,21 @@
 __time_get::__time_get(const char* nm)
     : __loc_(newlocale(LC_ALL_MASK, nm, 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__loc_ == 0)
         throw runtime_error("time_get_byname"
                             " failed to construct for " + string(nm));
+#endif
 }
 
 __time_get::__time_get(const string& nm)
     : __loc_(newlocale(LC_ALL_MASK, nm.c_str(), 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__loc_ == 0)
         throw runtime_error("time_get_byname"
                             " failed to construct for " + nm);
+#endif
 }
 
 __time_get::~__time_get()
@@ -4921,17 +4969,21 @@
 __time_put::__time_put(const char* nm)
     : __loc_(newlocale(LC_ALL_MASK, nm, 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__loc_ == 0)
         throw runtime_error("time_put_byname"
                             " failed to construct for " + string(nm));
+#endif
 }
 
 __time_put::__time_put(const string& nm)
     : __loc_(newlocale(LC_ALL_MASK, nm.c_str(), 0))
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (__loc_ == 0)
         throw runtime_error("time_put_byname"
                             " failed to construct for " + nm);
+#endif
 }
 
 __time_put::~__time_put()
@@ -5210,9 +5262,11 @@
 {
     typedef moneypunct<char, false> base;
     unique_ptr<_xlocale, int(*)(locale_t)>  loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (loc == 0)
         throw runtime_error("moneypunct_byname"
                             " failed to construct for " + string(nm));
+#endif
     lconv* lc = localeconv_l(loc.get());
     if (*lc->mon_decimal_point)
         __decimal_point_ = *lc->mon_decimal_point;
@@ -5246,9 +5300,11 @@
 {
     typedef moneypunct<char, true> base;
     unique_ptr<_xlocale, int(*)(locale_t)>  loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (loc == 0)
         throw runtime_error("moneypunct_byname"
                             " failed to construct for " + string(nm));
+#endif
     lconv* lc = localeconv_l(loc.get());
     if (*lc->mon_decimal_point)
         __decimal_point_ = *lc->mon_decimal_point;
@@ -5282,9 +5338,11 @@
 {
     typedef moneypunct<wchar_t, false> base;
     unique_ptr<_xlocale, int(*)(locale_t)>  loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (loc == 0)
         throw runtime_error("moneypunct_byname"
                             " failed to construct for " + string(nm));
+#endif
     lconv* lc = localeconv_l(loc.get());
     if (*lc->mon_decimal_point)
         __decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
@@ -5341,9 +5399,11 @@
 {
     typedef moneypunct<wchar_t, true> base;
     unique_ptr<_xlocale, int(*)(locale_t)>  loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (loc == 0)
         throw runtime_error("moneypunct_byname"
                             " failed to construct for " + string(nm));
+#endif
     lconv* lc = localeconv_l(loc.get());
     if (*lc->mon_decimal_point)
         __decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
@@ -5398,7 +5458,9 @@
 
 void __throw_runtime_error(const char* msg)
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     throw runtime_error(msg);
+#endif
 }
 
 template class collate<char>;

Modified: libcxx/trunk/src/memory.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/memory.cpp?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/src/memory.cpp (original)
+++ libcxx/trunk/src/memory.cpp Wed Aug 11 12:04:31 2010
@@ -107,12 +107,16 @@
     return 0;
 }
 
+#ifndef _LIBCPP_NO_RTTI
+
 const void*
 __shared_weak_count::__get_deleter(const type_info&) const
 {
     return 0;
 }
 
+#endif
+
 void
 declare_reachable(void*)
 {

Modified: libcxx/trunk/src/mutex.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/mutex.cpp?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/src/mutex.cpp (original)
+++ libcxx/trunk/src/mutex.cpp Wed Aug 11 12:04:31 2010
@@ -220,8 +220,10 @@
         pthread_cond_wait(&cv, &mut);
     if (flag == 0)
     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
         try
         {
+#endif
             flag = 1;
             pthread_mutex_unlock(&mut);
             func(arg);
@@ -229,6 +231,7 @@
             flag = ~0ul;
             pthread_mutex_unlock(&mut);
             pthread_cond_broadcast(&cv);
+#ifndef _LIBCPP_NO_EXCEPTIONS
         }
         catch (...)
         {
@@ -238,6 +241,7 @@
             pthread_cond_broadcast(&cv);
             throw;
         }
+#endif
     }
     else
         pthread_mutex_unlock(&mut);

Modified: libcxx/trunk/src/new.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/new.cpp?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/src/new.cpp (original)
+++ libcxx/trunk/src/new.cpp Wed Aug 11 12:04:31 2010
@@ -42,7 +42,11 @@
         if (__new_handler)
             __new_handler();
         else
+#ifndef _LIBCPP_NO_EXCEPTIONS
             throw std::bad_alloc();
+#else
+            break;
+#endif
     }
     return p;
 }
@@ -52,13 +56,17 @@
 operator new(size_t size, const std::nothrow_t&) throw()
 {
     void* p = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
     try
     {
+#endif
         p = ::operator new(size);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
     {
     }
+#endif
     return p;
 }
 
@@ -74,13 +82,17 @@
 operator new[](size_t size, const std::nothrow_t& nothrow) throw()
 {
     void* p = 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
     try
     {
+#endif
         p = ::operator new[](size);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
     {
     }
+#endif
     return p;
 }
 
@@ -162,7 +174,9 @@
 void
 __throw_bad_alloc()
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     throw bad_alloc();
+#endif
 }
 
 }  // std

Modified: libcxx/trunk/src/string.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/string.cpp?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/src/string.cpp (original)
+++ libcxx/trunk/src/string.cpp Wed Aug 11 12:04:31 2010
@@ -79,9 +79,11 @@
         ptr = const_cast<char*>(p);
     if (ptr == p)
     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (r == 0)
             throw invalid_argument("stoi: no conversion");
         throw out_of_range("stoi: out of range");
+#endif
     }
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
@@ -98,9 +100,11 @@
         ptr = const_cast<wchar_t*>(p);
     if (ptr == p)
     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (r == 0)
             throw invalid_argument("stoi: no conversion");
         throw out_of_range("stoi: out of range");
+#endif
     }
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
@@ -115,9 +119,11 @@
     long r = strtol(p, &ptr, base);
     if (ptr == p)
     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (r == 0)
             throw invalid_argument("stol: no conversion");
         throw out_of_range("stol: out of range");
+#endif
     }
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
@@ -132,9 +138,11 @@
     long r = wcstol(p, &ptr, base);
     if (ptr == p)
     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (r == 0)
             throw invalid_argument("stol: no conversion");
         throw out_of_range("stol: out of range");
+#endif
     }
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
@@ -149,9 +157,11 @@
     unsigned long r = strtoul(p, &ptr, base);
     if (ptr == p)
     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (r == 0)
             throw invalid_argument("stoul: no conversion");
         throw out_of_range("stoul: out of range");
+#endif
     }
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
@@ -166,9 +176,11 @@
     unsigned long r = wcstoul(p, &ptr, base);
     if (ptr == p)
     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (r == 0)
             throw invalid_argument("stoul: no conversion");
         throw out_of_range("stoul: out of range");
+#endif
     }
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
@@ -183,9 +195,11 @@
     long long r = strtoll(p, &ptr, base);
     if (ptr == p)
     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (r == 0)
             throw invalid_argument("stoll: no conversion");
         throw out_of_range("stoll: out of range");
+#endif
     }
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
@@ -200,9 +214,11 @@
     long long r = wcstoll(p, &ptr, base);
     if (ptr == p)
     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (r == 0)
             throw invalid_argument("stoll: no conversion");
         throw out_of_range("stoll: out of range");
+#endif
     }
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
@@ -217,9 +233,11 @@
     unsigned long long r = strtoull(p, &ptr, base);
     if (ptr == p)
     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (r == 0)
             throw invalid_argument("stoull: no conversion");
         throw out_of_range("stoull: out of range");
+#endif
     }
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
@@ -234,9 +252,11 @@
     unsigned long long r = wcstoull(p, &ptr, base);
     if (ptr == p)
     {
+#ifndef _LIBCPP_NO_EXCEPTIONS
         if (r == 0)
             throw invalid_argument("stoull: no conversion");
         throw out_of_range("stoull: out of range");
+#endif
     }
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
@@ -252,10 +272,12 @@
     errno = 0;
     double r = strtod(p, &ptr);
     swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (errno_save == ERANGE)
         throw out_of_range("stof: out of range");
     if (ptr == p)
         throw invalid_argument("stof: no conversion");
+#endif
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
     return static_cast<float>(r);
@@ -270,10 +292,12 @@
     errno = 0;
     double r = wcstod(p, &ptr);
     swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (errno_save == ERANGE)
         throw out_of_range("stof: out of range");
     if (ptr == p)
         throw invalid_argument("stof: no conversion");
+#endif
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
     return static_cast<float>(r);
@@ -288,10 +312,12 @@
     errno = 0;
     double r = strtod(p, &ptr);
     swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (errno_save == ERANGE)
         throw out_of_range("stod: out of range");
     if (ptr == p)
         throw invalid_argument("stod: no conversion");
+#endif
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
     return r;
@@ -306,10 +332,12 @@
     errno = 0;
     double r = wcstod(p, &ptr);
     swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (errno_save == ERANGE)
         throw out_of_range("stod: out of range");
     if (ptr == p)
         throw invalid_argument("stod: no conversion");
+#endif
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
     return r;
@@ -324,10 +352,12 @@
     errno = 0;
     long double r = strtold(p, &ptr);
     swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (errno_save == ERANGE)
         throw out_of_range("stold: out of range");
     if (ptr == p)
         throw invalid_argument("stold: no conversion");
+#endif
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
     return r;
@@ -342,10 +372,12 @@
     errno = 0;
     long double r = wcstold(p, &ptr);
     swap(errno, errno_save);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (errno_save == ERANGE)
         throw out_of_range("stold: out of range");
     if (ptr == p)
         throw invalid_argument("stold: no conversion");
+#endif
     if (idx)
         *idx = static_cast<size_t>(ptr - p);
     return r;

Modified: libcxx/trunk/src/system_error.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/system_error.cpp?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/src/system_error.cpp (original)
+++ libcxx/trunk/src/system_error.cpp Wed Aug 11 12:04:31 2010
@@ -193,7 +193,9 @@
 void
 __throw_system_error(int ev, const char* what_arg)
 {
+#ifndef _LIBCPP_NO_EXCEPTIONS
     throw system_error(error_code(ev, system_category()), what_arg);
+#endif
 }
 
 _LIBCPP_END_NAMESPACE_STD

Modified: libcxx/trunk/src/thread.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/thread.cpp?rev=110828&r1=110827&r2=110828&view=diff
==============================================================================
--- libcxx/trunk/src/thread.cpp (original)
+++ libcxx/trunk/src/thread.cpp Wed Aug 11 12:04:31 2010
@@ -24,8 +24,10 @@
 thread::join()
 {
     int ec = pthread_join(__t_, 0);
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (ec)
         throw system_error(error_code(ec, system_category()), "thread::join failed");
+#endif
     __t_ = 0;
 }
 
@@ -39,8 +41,10 @@
         if (ec == 0)
             __t_ = 0;
     }
+#ifndef _LIBCPP_NO_EXCEPTIONS
     if (ec)
         throw system_error(error_code(ec, system_category()), "thread::detach failed");
+#endif
 }
 
 unsigned





More information about the cfe-commits mailing list