Fixing whitespace problems

llvm-svn: 111751
This commit is contained in:
Howard Hinnant 2010-08-22 00:03:27 +00:00
parent b3371f6f49
commit 940e211c87
16 changed files with 131 additions and 158 deletions

View File

@ -27,5 +27,4 @@ __ph<10> _10;
} // placeholders
_LIBCPP_END_NAMESPACE_STD

View File

@ -15,7 +15,7 @@
#include <cerrno> // errno
#include <system_error> // __throw_system_error
#include <time.h> // clock_gettime, CLOCK_MONOTONIC
#endif /* __APPLE__ */
#endif // __APPLE__
_LIBCPP_BEGIN_NAMESPACE_STD
@ -103,7 +103,7 @@ monotonic_clock::now()
return time_point(duration(fp()));
}
#else /* !APPLE */
#else // __APPLE__
// FIXME: We assume that clock_gettime(CLOCK_MONOTONIC) works on
// non-apple systems. Instead, we should check _POSIX_TIMERS and
// _POSIX_MONOTONIC_CLOCK and fall back to something else if those
@ -121,7 +121,7 @@ monotonic_clock::now()
__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
}
#endif /* APPLE */
#endif // __APPLE__
}

View File

@ -18,14 +18,12 @@
// current unexpected handler are in the ABI library.
#define __terminate_handler __cxxabiapple::__cxa_terminate_handler
#define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
#else
#else // __APPLE__
static std::terminate_handler __terminate_handler;
static std::unexpected_handler __unexpected_handler;
#endif
#endif // __APPLE__
std::unexpected_handler
std::unexpected_handler
std::set_unexpected(std::unexpected_handler func) throw()
{
std::terminate_handler old = __unexpected_handler;
@ -41,8 +39,7 @@ std::unexpected()
std::terminate();
}
std::terminate_handler
std::terminate_handler
std::set_terminate(std::terminate_handler func) throw()
{
std::terminate_handler old = __terminate_handler;
@ -50,53 +47,49 @@ std::set_terminate(std::terminate_handler func) throw()
return old;
}
void
std::terminate()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
(*__terminate_handler)();
// handler should not return
::abort ();
#ifndef _LIBCPP_NO_EXCEPTIONS
}
}
catch (...)
{
// handler should not throw exception
::abort ();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
bool std::uncaught_exception() throw()
{
#if __APPLE__
// on Darwin, there is a helper function so __cxa_get_globals is private
return __cxxabiapple::__cxa_uncaught_exception();
#else
#else // __APPLE__
#warning uncaught_exception not yet implemented
::abort();
// Not provided by Ubuntu gcc-4.2.4's cxxabi.h.
// __cxa_eh_globals * globals = __cxa_get_globals();
// return (globals->uncaughtExceptions != 0);
#endif
#endif // __APPLE__
}
namespace std
namespace std
{
exception::~exception() throw()
{
exception::~exception() throw()
{
}
bad_exception::~bad_exception() throw()
{
bad_exception::~bad_exception() throw()
{
}
const char* exception::what() const throw()
@ -109,8 +102,6 @@ const char* bad_exception::what() const throw()
return "std::bad_exception";
}
exception_ptr::~exception_ptr()
{
#if __APPLE__
@ -118,7 +109,7 @@ exception_ptr::~exception_ptr()
#else
#warning exception_ptr not yet implemented
::abort();
#endif
#endif // __APPLE__
}
exception_ptr::exception_ptr(const exception_ptr& other)
@ -129,7 +120,7 @@ exception_ptr::exception_ptr(const exception_ptr& other)
#else
#warning exception_ptr not yet implemented
::abort();
#endif
#endif // __APPLE__
}
exception_ptr& exception_ptr::operator=(const exception_ptr& other)
@ -142,10 +133,10 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other)
__ptr_ = other.__ptr_;
}
return *this;
#else
#else // __APPLE__
#warning exception_ptr not yet implemented
::abort();
#endif
#endif // __APPLE__
}
nested_exception::nested_exception()
@ -167,30 +158,29 @@ nested_exception::rethrow_nested /*[[noreturn]]*/ () const
} // std
std::exception_ptr std::current_exception()
{
#if __APPLE__
// be nicer if there was a constructor that took a ptr, then
// be nicer if there was a constructor that took a ptr, then
// this whole function would be just:
// return exception_ptr(__cxa_current_primary_exception());
std::exception_ptr ptr;
ptr.__ptr_ = __cxxabiapple::__cxa_current_primary_exception();
return ptr;
#else
#else // __APPLE__
#warning exception_ptr not yet implemented
::abort();
#endif
#endif // __APPLE__
}
void std::rethrow_exception(exception_ptr p)
{
#if __APPLE__
__cxxabiapple::__cxa_rethrow_primary_exception(p.__ptr_);
__cxxabiapple::__cxa_rethrow_primary_exception(p.__ptr_);
// if p.__ptr_ is NULL, above returns so we terminate
terminate();
#else
terminate();
#else // __APPLE__
#warning exception_ptr not yet implemented
::abort();
#endif
#endif // __APPLE__
}

View File

@ -126,14 +126,14 @@ const unsigned indices[] =
// Returns: If n == 0, returns 0. Else returns the lowest prime number that
// is greater than or equal to n.
//
//
// The algorithm creates a list of small primes, plus an open-ended list of
// potential primes. All prime numbers are potential prime numbers. However
// some potential prime numbers are not prime. In an ideal world, all potential
// prime numbers would be prime. Candiate prime numbers are chosen as the next
// highest potential prime. Then this number is tested for prime by dividing it
// by all potential prime numbers less than the sqrt of the candidate.
//
//
// This implementation defines potential primes as those numbers not divisible
// by 2, 3, 5, and 7. Other (common) implementations define potential primes
// as those not divisible by 2. A few other implementations define potential

View File

@ -263,7 +263,7 @@ ios_base::clear(iostate state)
#ifndef _LIBCPP_NO_EXCEPTIONS
if (((state | (__rdbuf_ ? goodbit : badbit)) & __exceptions_) != 0)
throw failure("ios_base::clear");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
// init
@ -305,12 +305,12 @@ ios_base::copyfmt(const ios_base& rhs)
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!new_callbacks)
throw bad_alloc();
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
new_ints.reset((int*)malloc(sizeof(int) * rhs.__event_size_));
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!new_ints)
throw bad_alloc();
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (__iarray_cap_ < rhs.__iarray_size_)
{
@ -318,7 +318,7 @@ ios_base::copyfmt(const ios_base& rhs)
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!new_longs)
throw bad_alloc();
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (__parray_cap_ < rhs.__parray_size_)
{
@ -326,7 +326,7 @@ ios_base::copyfmt(const ios_base& rhs)
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!new_pointers)
throw bad_alloc();
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
// Got everything we need. Copy everything but __rdstate_, __rdbuf_ and __exceptions_
__fmtflags_ = rhs.__fmtflags_;
@ -430,7 +430,7 @@ ios_base::__set_badbit_and_consider_rethrow()
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__exceptions_ & badbit)
throw;
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
void
@ -440,7 +440,7 @@ ios_base::__set_failbit_and_consider_rethrow()
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__exceptions_ & failbit)
throw;
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
bool

View File

@ -135,7 +135,7 @@ locale::__imp::__imp(const string& name, size_t refs)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
facets_ = locale::classic().__locale_->facets_;
for (unsigned i = 0; i < facets_.size(); ++i)
if (facets_[i])
@ -169,7 +169,7 @@ locale::__imp::__imp(const string& name, size_t refs)
facets_[i]->__release_shared();
throw;
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
locale::__imp::__imp(const __imp& other)
@ -193,7 +193,7 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
if (c & locale::collate)
{
install(new collate_byname<char>(name));
@ -241,7 +241,7 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
facets_[i]->__release_shared();
throw;
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
template<class F>
@ -264,7 +264,7 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
if (c & locale::collate)
{
install_from<_STD::collate<char> >(one);
@ -320,7 +320,7 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
facets_[i]->__release_shared();
throw;
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
locale::__imp::__imp(const __imp& other, facet* f, long id)
@ -361,7 +361,7 @@ locale::__imp::use_facet(long id) const
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!has_facet(id))
throw bad_cast();
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return facets_[id];
}
@ -431,7 +431,7 @@ locale::locale(const char* name)
#ifndef _LIBCPP_NO_EXCEPTIONS
: __locale_(name ? new __imp(name)
: throw runtime_error("locale constructed with null"))
#else
#else // _LIBCPP_NO_EXCEPTIONS
: __locale_(new __imp(name))
#endif
{
@ -448,7 +448,7 @@ 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
#else // _LIBCPP_NO_EXCEPTIONS
: __locale_(new __imp(*other.__locale_, name, c))
#endif
{
@ -571,7 +571,7 @@ collate_byname<char>::collate_byname(const char* n, size_t refs)
if (__l == 0)
throw runtime_error("collate_byname<char>::collate_byname"
" failed to construct for " + string(n));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
collate_byname<char>::collate_byname(const string& name, size_t refs)
@ -582,7 +582,7 @@ collate_byname<char>::collate_byname(const string& name, size_t refs)
if (__l == 0)
throw runtime_error("collate_byname<char>::collate_byname"
" failed to construct for " + name);
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
collate_byname<char>::~collate_byname()
@ -623,7 +623,7 @@ collate_byname<wchar_t>::collate_byname(const char* n, size_t refs)
if (__l == 0)
throw runtime_error("collate_byname<wchar_t>::collate_byname(size_t refs)"
" failed to construct for " + string(n));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
collate_byname<wchar_t>::collate_byname(const string& name, size_t refs)
@ -634,7 +634,7 @@ collate_byname<wchar_t>::collate_byname(const string& name, size_t refs)
if (__l == 0)
throw runtime_error("collate_byname<wchar_t>::collate_byname(size_t refs)"
" failed to construct for " + name);
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
collate_byname<wchar_t>::~collate_byname()
@ -862,7 +862,7 @@ ctype_byname<char>::ctype_byname(const char* name, size_t refs)
if (__l == 0)
throw runtime_error("ctype_byname<char>::ctype_byname"
" failed to construct for " + string(name));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
ctype_byname<char>::ctype_byname(const string& name, size_t refs)
@ -873,7 +873,7 @@ ctype_byname<char>::ctype_byname(const string& name, size_t refs)
if (__l == 0)
throw runtime_error("ctype_byname<char>::ctype_byname"
" failed to construct for " + name);
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
ctype_byname<char>::~ctype_byname()
@ -919,7 +919,7 @@ ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs)
if (__l == 0)
throw runtime_error("ctype_byname<wchar_t>::ctype_byname"
" failed to construct for " + string(name));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
ctype_byname<wchar_t>::ctype_byname(const string& name, size_t refs)
@ -930,7 +930,7 @@ ctype_byname<wchar_t>::ctype_byname(const string& name, size_t refs)
if (__l == 0)
throw runtime_error("ctype_byname<wchar_t>::ctype_byname"
" failed to construct for " + name);
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
ctype_byname<wchar_t>::~ctype_byname()
@ -1057,15 +1057,15 @@ ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, ch
// template <> class codecvt<char, char, mbstate_t>
locale::id codecvt<char, char, mbstate_t>::id;
locale::id codecvt<char, char, mbstate_t>::id;
codecvt<char, char, mbstate_t>::~codecvt()
{
}
codecvt<char, char, mbstate_t>::result
codecvt<char, char, mbstate_t>::do_out(state_type&,
const intern_type* frm, const intern_type*, const intern_type*& frm_nxt,
codecvt<char, char, mbstate_t>::do_out(state_type&,
const intern_type* frm, const intern_type*, const intern_type*& frm_nxt,
extern_type* to, extern_type*, extern_type*& to_nxt) const
{
frm_nxt = frm;
@ -1074,8 +1074,8 @@ codecvt<char, char, mbstate_t>::do_out(state_type&,
}
codecvt<char, char, mbstate_t>::result
codecvt<char, char, mbstate_t>::do_in(state_type&,
const extern_type* frm, const extern_type*, const extern_type*& frm_nxt,
codecvt<char, char, mbstate_t>::do_in(state_type&,
const extern_type* frm, const extern_type*, const extern_type*& frm_nxt,
intern_type* to, intern_type*, intern_type*& to_nxt) const
{
frm_nxt = frm;
@ -1084,7 +1084,7 @@ codecvt<char, char, mbstate_t>::do_in(state_type&,
}
codecvt<char, char, mbstate_t>::result
codecvt<char, char, mbstate_t>::do_unshift(state_type&,
codecvt<char, char, mbstate_t>::do_unshift(state_type&,
extern_type* to, extern_type*, extern_type*& to_nxt) const
{
to_nxt = to;
@ -1118,7 +1118,7 @@ codecvt<char, char, mbstate_t>::do_max_length() const throw()
// template <> class codecvt<wchar_t, char, mbstate_t>
locale::id codecvt<wchar_t, char, mbstate_t>::id;
locale::id codecvt<wchar_t, char, mbstate_t>::id;
codecvt<wchar_t, char, mbstate_t>::codecvt(size_t refs)
: locale::facet(refs),
@ -1134,7 +1134,7 @@ codecvt<wchar_t, char, mbstate_t>::codecvt(const char* nm, size_t refs)
if (__l == 0)
throw runtime_error("codecvt_byname<wchar_t, char, mbstate_t>::codecvt_byname"
" failed to construct for " + string(nm));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
codecvt<wchar_t, char, mbstate_t>::~codecvt()
@ -1145,7 +1145,7 @@ codecvt<wchar_t, char, mbstate_t>::~codecvt()
codecvt<wchar_t, char, mbstate_t>::result
codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
{
// look for first internal null in frm
@ -1201,7 +1201,7 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
codecvt<wchar_t, char, mbstate_t>::result
codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
{
// look for first internal null in frm
@ -2730,7 +2730,7 @@ utf16le_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
// template <> class codecvt<char16_t, char, mbstate_t>
locale::id codecvt<char16_t, char, mbstate_t>::id;
locale::id codecvt<char16_t, char, mbstate_t>::id;
codecvt<char16_t, char, mbstate_t>::~codecvt()
{
@ -2738,7 +2738,7 @@ codecvt<char16_t, char, mbstate_t>::~codecvt()
codecvt<char16_t, char, mbstate_t>::result
codecvt<char16_t, char, mbstate_t>::do_out(state_type&,
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
{
const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
@ -2755,7 +2755,7 @@ codecvt<char16_t, char, mbstate_t>::do_out(state_type&,
codecvt<char16_t, char, mbstate_t>::result
codecvt<char16_t, char, mbstate_t>::do_in(state_type&,
const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
{
const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
@ -2807,7 +2807,7 @@ codecvt<char16_t, char, mbstate_t>::do_max_length() const throw()
// template <> class codecvt<char32_t, char, mbstate_t>
locale::id codecvt<char32_t, char, mbstate_t>::id;
locale::id codecvt<char32_t, char, mbstate_t>::id;
codecvt<char32_t, char, mbstate_t>::~codecvt()
{
@ -2815,7 +2815,7 @@ codecvt<char32_t, char, mbstate_t>::~codecvt()
codecvt<char32_t, char, mbstate_t>::result
codecvt<char32_t, char, mbstate_t>::do_out(state_type&,
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
{
const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
@ -2832,7 +2832,7 @@ codecvt<char32_t, char, mbstate_t>::do_out(state_type&,
codecvt<char32_t, char, mbstate_t>::result
codecvt<char32_t, char, mbstate_t>::do_in(state_type&,
const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
{
const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
@ -3876,7 +3876,7 @@ numpunct_byname<char>::__init(const char* nm)
if (loc == 0)
throw runtime_error("numpunct_byname<char>::numpunct_byname"
" failed to construct for " + string(nm));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
lconv* lc = localeconv_l(loc.get());
if (*lc->decimal_point)
__decimal_point_ = *lc->decimal_point;
@ -3915,7 +3915,7 @@ numpunct_byname<wchar_t>::__init(const char* nm)
if (loc == 0)
throw runtime_error("numpunct_byname<char>::numpunct_byname"
" failed to construct for " + string(nm));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
lconv* lc = localeconv_l(loc.get());
if (*lc->decimal_point)
__decimal_point_ = *lc->decimal_point;
@ -4322,7 +4322,7 @@ __time_get::__time_get(const char* nm)
if (__loc_ == 0)
throw runtime_error("time_get_byname"
" failed to construct for " + string(nm));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
__time_get::__time_get(const string& nm)
@ -4332,7 +4332,7 @@ __time_get::__time_get(const string& nm)
if (__loc_ == 0)
throw runtime_error("time_get_byname"
" failed to construct for " + nm);
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
__time_get::~__time_get()
@ -4973,7 +4973,7 @@ __time_put::__time_put(const char* nm)
if (__loc_ == 0)
throw runtime_error("time_put_byname"
" failed to construct for " + string(nm));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
__time_put::__time_put(const string& nm)
@ -4983,7 +4983,7 @@ __time_put::__time_put(const string& nm)
if (__loc_ == 0)
throw runtime_error("time_put_byname"
" failed to construct for " + nm);
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
__time_put::~__time_put()
@ -5266,7 +5266,7 @@ moneypunct_byname<char, false>::init(const char* nm)
if (loc == 0)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
lconv* lc = localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = *lc->mon_decimal_point;
@ -5304,7 +5304,7 @@ moneypunct_byname<char, true>::init(const char* nm)
if (loc == 0)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
lconv* lc = localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = *lc->mon_decimal_point;
@ -5342,7 +5342,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
if (loc == 0)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
lconv* lc = localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
@ -5403,7 +5403,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
if (loc == 0)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
lconv* lc = localeconv_l(loc.get());
if (*lc->mon_decimal_point)
__decimal_point_ = static_cast<wchar_t>(*lc->mon_decimal_point);
@ -5526,4 +5526,4 @@ template class codecvt_byname<char32_t, char, mbstate_t>;
template class __vector_base_common<true>;
_LIBCPP_END_NAMESPACE_STD
#endif /* __APPLE__ */
#endif // __APPLE__

View File

@ -30,7 +30,6 @@ decrement(T& t)
} // namespace
const allocator_arg_t allocator_arg = allocator_arg_t();
bad_weak_ptr::~bad_weak_ptr() throw() {}
@ -115,7 +114,7 @@ __shared_weak_count::__get_deleter(const type_info&) const
return 0;
}
#endif
#endif // _LIBCPP_NO_RTTI
void
declare_reachable(void*)

View File

@ -223,7 +223,7 @@ __call_once(volatile unsigned long& flag, void* arg, void(*func)(void*))
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
flag = 1;
pthread_mutex_unlock(&mut);
func(arg);
@ -241,7 +241,7 @@ __call_once(volatile unsigned long& flag, void* arg, void(*func)(void*))
pthread_cond_broadcast(&cv);
throw;
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
else
pthread_mutex_unlock(&mut);

View File

@ -11,23 +11,20 @@
#include "new"
#if __APPLE__
#include <cxxabi.h>
#include <cxxabi.h>
// On Darwin, there are two STL shared libraries and a lower level ABI
// shared libray. The global holding the current new handler is
// in the ABI library and named __cxa_new_handler.
#define __new_handler __cxxabiapple::__cxa_new_handler
#else
#else // __APPLE__
static std::new_handler __new_handler;
#endif
// Implement all new and delete operators as weak definitions
// in this shared library, so that they can be overriden by programs
// that define non-weak copies of the functions.
__attribute__((__weak__, __visibility__("default")))
void *
operator new(std::size_t size) throw (std::bad_alloc)
@ -37,7 +34,7 @@ operator new(std::size_t size) throw (std::bad_alloc)
void* p;
while ((p = ::malloc(size)) == 0)
{
// If malloc fails and there is a new_handler,
// If malloc fails and there is a new_handler,
// call it to try free up memory.
if (__new_handler)
__new_handler();
@ -59,14 +56,14 @@ operator new(size_t size, const std::nothrow_t&) throw()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
p = ::operator new(size);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return p;
}
@ -85,14 +82,14 @@ operator new[](size_t size, const std::nothrow_t& nothrow) throw()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
p = ::operator new[](size);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return p;
}
@ -111,7 +108,6 @@ operator delete(void* ptr, const std::nothrow_t&) throw ()
::operator delete(ptr);
}
__attribute__((__weak__, __visibility__("default")))
void
operator delete[] (void* ptr) throw ()
@ -126,7 +122,6 @@ operator delete[] (void* ptr, const std::nothrow_t&) throw ()
::operator delete[](ptr);
}
namespace std
{
@ -140,21 +135,20 @@ set_new_handler(new_handler handler) throw()
return r;
}
bad_alloc::bad_alloc() throw()
{
bad_alloc::bad_alloc() throw()
{
}
bad_alloc::~bad_alloc() throw()
{
bad_alloc::~bad_alloc() throw()
{
}
const char*
const char*
bad_alloc::what() const throw()
{
return "std::bad_alloc";
}
bad_array_new_length::bad_array_new_length() throw()
{
}
@ -169,8 +163,6 @@ bad_array_new_length::what() const throw()
return "bad_array_new_length";
}
void
__throw_bad_alloc()
{

View File

@ -14,7 +14,6 @@
#include <unistd.h>
#include <errno.h>
_LIBCPP_BEGIN_NAMESPACE_STD
random_device::random_device(const string& __token)

View File

@ -312,6 +312,4 @@ __match_any_but_newline<wchar_t>::__exec(__state& __s) const
}
}
_LIBCPP_END_NAMESPACE_STD

View File

@ -83,7 +83,7 @@ stoi(const string& str, size_t* idx, int base)
if (r == 0)
throw invalid_argument("stoi: no conversion");
throw out_of_range("stoi: out of range");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (idx)
*idx = static_cast<size_t>(ptr - p);
@ -104,7 +104,7 @@ stoi(const wstring& str, size_t* idx, int base)
if (r == 0)
throw invalid_argument("stoi: no conversion");
throw out_of_range("stoi: out of range");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (idx)
*idx = static_cast<size_t>(ptr - p);
@ -123,7 +123,7 @@ stol(const string& str, size_t* idx, int base)
if (r == 0)
throw invalid_argument("stol: no conversion");
throw out_of_range("stol: out of range");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (idx)
*idx = static_cast<size_t>(ptr - p);
@ -142,7 +142,7 @@ stol(const wstring& str, size_t* idx, int base)
if (r == 0)
throw invalid_argument("stol: no conversion");
throw out_of_range("stol: out of range");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (idx)
*idx = static_cast<size_t>(ptr - p);
@ -161,7 +161,7 @@ stoul(const string& str, size_t* idx, int base)
if (r == 0)
throw invalid_argument("stoul: no conversion");
throw out_of_range("stoul: out of range");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (idx)
*idx = static_cast<size_t>(ptr - p);
@ -180,7 +180,7 @@ stoul(const wstring& str, size_t* idx, int base)
if (r == 0)
throw invalid_argument("stoul: no conversion");
throw out_of_range("stoul: out of range");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (idx)
*idx = static_cast<size_t>(ptr - p);
@ -199,7 +199,7 @@ stoll(const string& str, size_t* idx, int base)
if (r == 0)
throw invalid_argument("stoll: no conversion");
throw out_of_range("stoll: out of range");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (idx)
*idx = static_cast<size_t>(ptr - p);
@ -218,7 +218,7 @@ stoll(const wstring& str, size_t* idx, int base)
if (r == 0)
throw invalid_argument("stoll: no conversion");
throw out_of_range("stoll: out of range");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (idx)
*idx = static_cast<size_t>(ptr - p);
@ -237,7 +237,7 @@ stoull(const string& str, size_t* idx, int base)
if (r == 0)
throw invalid_argument("stoull: no conversion");
throw out_of_range("stoull: out of range");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (idx)
*idx = static_cast<size_t>(ptr - p);
@ -256,7 +256,7 @@ stoull(const wstring& str, size_t* idx, int base)
if (r == 0)
throw invalid_argument("stoull: no conversion");
throw out_of_range("stoull: out of range");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
if (idx)
*idx = static_cast<size_t>(ptr - p);
@ -277,7 +277,7 @@ stof(const string& str, size_t* idx)
throw out_of_range("stof: out of range");
if (ptr == p)
throw invalid_argument("stof: no conversion");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
if (idx)
*idx = static_cast<size_t>(ptr - p);
return static_cast<float>(r);
@ -297,7 +297,7 @@ stof(const wstring& str, size_t* idx)
throw out_of_range("stof: out of range");
if (ptr == p)
throw invalid_argument("stof: no conversion");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
if (idx)
*idx = static_cast<size_t>(ptr - p);
return static_cast<float>(r);
@ -317,7 +317,7 @@ stod(const string& str, size_t* idx)
throw out_of_range("stod: out of range");
if (ptr == p)
throw invalid_argument("stod: no conversion");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
if (idx)
*idx = static_cast<size_t>(ptr - p);
return r;
@ -337,7 +337,7 @@ stod(const wstring& str, size_t* idx)
throw out_of_range("stod: out of range");
if (ptr == p)
throw invalid_argument("stod: no conversion");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
if (idx)
*idx = static_cast<size_t>(ptr - p);
return r;
@ -357,7 +357,7 @@ stold(const string& str, size_t* idx)
throw out_of_range("stold: out of range");
if (ptr == p)
throw invalid_argument("stold: no conversion");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
if (idx)
*idx = static_cast<size_t>(ptr - p);
return r;
@ -377,7 +377,7 @@ stold(const wstring& str, size_t* idx)
throw out_of_range("stold: out of range");
if (ptr == p)
throw invalid_argument("stold: no conversion");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
if (idx)
*idx = static_cast<size_t>(ptr - p);
return r;

View File

@ -132,7 +132,7 @@ strstreambuf::operator=(strstreambuf&& __rhs)
__rhs.setp(nullptr, nullptr);
}
#endif
#endif // _LIBCPP_MOVE
strstreambuf::~strstreambuf()
{
@ -257,7 +257,6 @@ strstreambuf::underflow()
return int_type((unsigned char)*gptr());
}
strstreambuf::pos_type
strstreambuf::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __which)
{
@ -316,7 +315,6 @@ strstreambuf::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmod
return pos_type(__p);
}
strstreambuf::pos_type
strstreambuf::seekpos(pos_type __sp, ios_base::openmode __which)
{

View File

@ -67,7 +67,7 @@ __generic_error_category::message(int ev) const
#ifdef ELAST
if (ev > ELAST)
return string("unspecified generic_category error");
#endif
#endif // ELAST
return __do_message::message(ev);
}
@ -99,7 +99,7 @@ __system_error_category::message(int ev) const
#ifdef ELAST
if (ev > ELAST)
return string("unspecified system_category error");
#endif
#endif // ELAST
return __do_message::message(ev);
}
@ -109,7 +109,7 @@ __system_error_category::default_error_condition(int ev) const
#ifdef ELAST
if (ev > ELAST)
return error_condition(ev, system_category());
#endif
#endif // ELAST
return error_condition(ev, generic_category());
}

View File

@ -27,7 +27,7 @@ thread::join()
#ifndef _LIBCPP_NO_EXCEPTIONS
if (ec)
throw system_error(error_code(ec, system_category()), "thread::join failed");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
__t_ = 0;
}
@ -44,7 +44,7 @@ thread::detach()
#ifndef _LIBCPP_NO_EXCEPTIONS
if (ec)
throw system_error(error_code(ec, system_category()), "thread::detach failed");
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
unsigned
@ -56,11 +56,11 @@ thread::hardware_concurrency()
std::size_t s = sizeof(n);
sysctl(mib, 2, &n, &s, 0, 0);
return n;
#else // !defined(CTL_HW && HW_NCPU)
#else // defined(CTL_HW) && defined(HW_NCPU)
// TODO: grovel through /proc or check cpuid on x86 and similar
// instructions on other architectures.
return 0; // Means not computable [thread.thread.static]
#endif
#endif // defined(CTL_HW) && defined(HW_NCPU)
}
namespace this_thread

View File

@ -10,32 +10,30 @@
#include "typeinfo"
std::bad_cast::bad_cast() throw()
{
std::bad_cast::bad_cast() throw()
{
}
std::bad_cast::~bad_cast() throw()
{
std::bad_cast::~bad_cast() throw()
{
}
const char*
const char*
std::bad_cast::what() const throw()
{
return "std::bad_cast";
}
std::bad_typeid::bad_typeid() throw()
{
}
std::bad_typeid::~bad_typeid() throw()
std::bad_typeid::bad_typeid() throw()
{
}
const char*
std::bad_typeid::~bad_typeid() throw()
{
}
const char*
std::bad_typeid::what() const throw()
{
return "std::bad_typeid";
}