aboutsummaryrefslogtreecommitdiff
path: root/system/lib
diff options
context:
space:
mode:
authorBruce Mitchener <bruce.mitchener@gmail.com>2013-03-29 16:19:55 +0700
committerBruce Mitchener <bruce.mitchener@gmail.com>2013-03-29 16:19:55 +0700
commitaa0108c75e4177b6db0705ce42998e92c6ac734f (patch)
treec0ec6d57dcb70dfaba808a8c74b8e892d712051b /system/lib
parente3d12277cdbb3c47ddeacf1fa005f2964debefbb (diff)
Update to r178253 from March 29, 2013.
Diffstat (limited to 'system/lib')
-rw-r--r--system/lib/libcxx/chrono.cpp4
-rw-r--r--system/lib/libcxx/debug.cpp4
-rw-r--r--system/lib/libcxx/exception.cpp8
-rw-r--r--system/lib/libcxx/iostream.cpp14
-rw-r--r--system/lib/libcxx/locale.cpp54
-rw-r--r--system/lib/libcxx/memory.cpp10
-rw-r--r--system/lib/libcxx/new.cpp2
-rw-r--r--system/lib/libcxx/readme.txt2
-rw-r--r--system/lib/libcxx/stdexcept.cpp2
-rw-r--r--system/lib/libcxx/string.cpp2
-rw-r--r--system/lib/libcxx/strstream.cpp2
-rw-r--r--system/lib/libcxx/thread.cpp6
-rw-r--r--system/lib/libcxx/typeinfo.cpp4
13 files changed, 51 insertions, 63 deletions
diff --git a/system/lib/libcxx/chrono.cpp b/system/lib/libcxx/chrono.cpp
index 1ce2e280..15a6f466 100644
--- a/system/lib/libcxx/chrono.cpp
+++ b/system/lib/libcxx/chrono.cpp
@@ -9,7 +9,7 @@
#include "chrono"
#include <sys/time.h> //for gettimeofday and timeval
-#if __APPLE__
+#ifdef __APPLE__
#include <mach/mach_time.h> // mach_absolute_time, mach_timebase_info_data_t
#else /* !__APPLE__ */
#include <cerrno> // errno
@@ -50,7 +50,7 @@ system_clock::from_time_t(time_t t) _NOEXCEPT
const bool steady_clock::is_steady;
-#if __APPLE__
+#ifdef __APPLE__
// mach_absolute_time() * MachInfo.numer / MachInfo.denom is the number of
// nanoseconds since the computer booted up. MachInfo.numer and MachInfo.denom
// are run time constants supplied by the OS. This clock has no relationship
diff --git a/system/lib/libcxx/debug.cpp b/system/lib/libcxx/debug.cpp
index f3a0262d..2d4b094b 100644
--- a/system/lib/libcxx/debug.cpp
+++ b/system/lib/libcxx/debug.cpp
@@ -17,7 +17,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_VISIBLE
+_LIBCPP_FUNC_VIS
__libcpp_db*
__get_db()
{
@@ -25,7 +25,7 @@ __get_db()
return &db;
}
-_LIBCPP_VISIBLE
+_LIBCPP_FUNC_VIS
const __libcpp_db*
__get_const_db()
{
diff --git a/system/lib/libcxx/exception.cpp b/system/lib/libcxx/exception.cpp
index 8d5ded4d..7db304d8 100644
--- a/system/lib/libcxx/exception.cpp
+++ b/system/lib/libcxx/exception.cpp
@@ -14,7 +14,7 @@
#define __has_include(inc) 0
#endif
-#if __APPLE__
+#ifdef __APPLE__
#include <cxxabi.h>
using namespace __cxxabiv1;
@@ -77,7 +77,6 @@ get_terminate() _NOEXCEPT
return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
}
-#ifndef EMSCRIPTEN // We provide this in JS
_LIBCPP_NORETURN
void
terminate() _NOEXCEPT
@@ -98,13 +97,12 @@ terminate() _NOEXCEPT
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
-#endif // !EMSCRIPTEN
#endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
-#if !defined(LIBCXXRT) && !defined(__GLIBCXX__) && !defined(EMSCRIPTEN)
+#if !defined(LIBCXXRT) && !defined(__GLIBCXX__)
bool uncaught_exception() _NOEXCEPT
{
-#if __APPLE__ || defined(_LIBCPPABI_VERSION)
+#if defined(__APPLE__) || defined(_LIBCPPABI_VERSION)
// on Darwin, there is a helper function so __cxa_get_globals is private
return __cxa_uncaught_exception();
#else // __APPLE__
diff --git a/system/lib/libcxx/iostream.cpp b/system/lib/libcxx/iostream.cpp
index f5b959b4..7fc71df4 100644
--- a/system/lib/libcxx/iostream.cpp
+++ b/system/lib/libcxx/iostream.cpp
@@ -13,6 +13,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+static mbstate_t state_types[6] = {};
+
_ALIGNAS_TYPE (__stdinbuf<char> ) static char __cin [sizeof(__stdinbuf <char>)];
_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)];
_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)];
@@ -33,17 +35,17 @@ ios_base::Init __start_std_streams;
ios_base::Init::Init()
{
- istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin) );
- ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf<char>(stdout));
- ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf<char>(stderr));
+ istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin, state_types+0) );
+ ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf<char>(stdout, state_types+1));
+ ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf<char>(stderr, state_types+2));
::new(clog) ostream(cerr_ptr->rdbuf());
cin_ptr->tie(cout_ptr);
_VSTD::unitbuf(*cerr_ptr);
cerr_ptr->tie(cout_ptr);
- wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin) );
- wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout));
- wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar_t>(stderr));
+ wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin, state_types+3) );
+ wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout, state_types+4));
+ wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar_t>(stderr, state_types+5));
::new(wclog) wostream(wcerr_ptr->rdbuf());
wcin_ptr->tie(wcout_ptr);
_VSTD::unitbuf(*wcerr_ptr);
diff --git a/system/lib/libcxx/locale.cpp b/system/lib/libcxx/locale.cpp
index 35a65086..b7a47843 100644
--- a/system/lib/libcxx/locale.cpp
+++ b/system/lib/libcxx/locale.cpp
@@ -25,7 +25,7 @@
#include "cstring"
#include "cwctype"
#include "__sso_allocator"
-#if _WIN32
+#ifdef _WIN32
#include <support/win32/locale_win32.h>
#else // _WIN32
#include <langinfo.h>
@@ -786,7 +786,7 @@ ctype<wchar_t>::do_toupper(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
-#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
+#elif defined(__GLIBC__)
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
#else
return (isascii(c) && iswlower_l(c, __cloc())) ? c-L'a'+L'A' : c;
@@ -799,7 +799,7 @@ ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
-#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
+#elif defined(__GLIBC__)
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
: *low;
#else
@@ -813,7 +813,7 @@ ctype<wchar_t>::do_tolower(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
-#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
+#elif defined(__GLIBC__)
return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
#else
return (isascii(c) && isupper_l(c, __cloc())) ? c-L'A'+'a' : c;
@@ -826,7 +826,7 @@ ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
-#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
+#elif defined(__GLIBC__)
*low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
: *low;
#else
@@ -893,7 +893,7 @@ ctype<char>::do_toupper(char_type c) const
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ?
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c;
-#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
+#elif defined(__GLIBC__)
return isascii(c) ?
static_cast<char>(__classic_upper_table()[static_cast<size_t>(c)]) : c;
#else
@@ -908,7 +908,7 @@ ctype<char>::do_toupper(char_type* low, const char_type* high) const
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ?
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low;
-#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
+#elif defined(__GLIBC__)
*low = isascii(*low) ?
static_cast<char>(__classic_upper_table()[static_cast<size_t>(*low)]) : *low;
#else
@@ -923,7 +923,7 @@ ctype<char>::do_tolower(char_type c) const
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ?
static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c;
-#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
+#elif defined(__GLIBC__)
return isascii(c) ?
static_cast<char>(__classic_lower_table()[static_cast<size_t>(c)]) : c;
#else
@@ -937,7 +937,7 @@ ctype<char>::do_tolower(char_type* low, const char_type* high) const
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low;
-#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
+#elif defined(__GLIBC__)
*low = isascii(*low) ? static_cast<char>(__classic_lower_table()[static_cast<size_t>(*low)]) : *low;
#else
*low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low;
@@ -978,12 +978,6 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
return low;
}
-#ifdef EMSCRIPTEN
-extern "C" const unsigned short ** __ctype_b_loc();
-extern "C" const int ** __ctype_tolower_loc();
-extern "C" const int ** __ctype_toupper_loc();
-#endif
-
const ctype<char>::mask*
ctype<char>::classic_table() _NOEXCEPT
{
@@ -993,12 +987,10 @@ ctype<char>::classic_table() _NOEXCEPT
return __cloc()->__ctype_b;
#elif __sun__
return __ctype_mask;
-#elif _WIN32
+#elif defined(_WIN32)
return _ctype+1; // internal ctype mask table defined in msvcrt.dll
// This is assumed to be safe, which is a nonsense assumption because we're
// going to end up dereferencing it later...
-#elif EMSCRIPTEN
- return *__ctype_b_loc();
#else
// Platform not supported: abort so the person doing the port knows what to
// fix
@@ -1022,20 +1014,6 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
}
#endif // __GLIBC__
-#if defined(EMSCRIPTEN)
-const int*
-ctype<char>::__classic_lower_table() _NOEXCEPT
-{
- return *__ctype_tolower_loc();
-}
-
-const int*
-ctype<char>::__classic_upper_table() _NOEXCEPT
-{
- return *__ctype_toupper_loc();
-}
-#endif // EMSCRIPTEN
-
// template <> class ctype_byname<char>
ctype_byname<char>::ctype_byname(const char* name, size_t refs)
@@ -5801,7 +5779,7 @@ moneypunct_byname<char, true>::init(const char* nm)
__frac_digits_ = lc->int_frac_digits;
else
__frac_digits_ = base::do_frac_digits();
-#if _WIN32
+#ifdef _WIN32
if (lc->p_sign_posn == 0)
#else // _WIN32
if (lc->int_p_sign_posn == 0)
@@ -5809,7 +5787,7 @@ moneypunct_byname<char, true>::init(const char* nm)
__positive_sign_ = "()";
else
__positive_sign_ = lc->positive_sign;
-#if _WIN32
+#ifdef _WIN32
if(lc->n_sign_posn == 0)
#else // _WIN32
if (lc->int_n_sign_posn == 0)
@@ -5821,7 +5799,7 @@ moneypunct_byname<char, true>::init(const char* nm)
// the same places in curr_symbol since there's no way to
// represent anything else.
string_type __dummy_curr_symbol = __curr_symbol_;
-#if _WIN32
+#ifdef _WIN32
__init_pat(__pos_format_, __dummy_curr_symbol, true,
lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
__init_pat(__neg_format_, __curr_symbol_, true,
@@ -5960,7 +5938,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
__frac_digits_ = lc->int_frac_digits;
else
__frac_digits_ = base::do_frac_digits();
-#if _WIN32
+#ifdef _WIN32
if (lc->p_sign_posn == 0)
#else // _WIN32
if (lc->int_p_sign_posn == 0)
@@ -5980,7 +5958,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
wbe = wbuf + j;
__positive_sign_.assign(wbuf, wbe);
}
-#if _WIN32
+#ifdef _WIN32
if (lc->n_sign_posn == 0)
#else // _WIN32
if (lc->int_n_sign_posn == 0)
@@ -6004,7 +5982,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
// the same places in curr_symbol since there's no way to
// represent anything else.
string_type __dummy_curr_symbol = __curr_symbol_;
-#if _WIN32
+#ifdef _WIN32
__init_pat(__pos_format_, __dummy_curr_symbol, true,
lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
__init_pat(__neg_format_, __curr_symbol_, true,
diff --git a/system/lib/libcxx/memory.cpp b/system/lib/libcxx/memory.cpp
index 14084a52..98bcc864 100644
--- a/system/lib/libcxx/memory.cpp
+++ b/system/lib/libcxx/memory.cpp
@@ -122,7 +122,15 @@ __shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
#if __has_feature(cxx_atomic)
static const std::size_t __sp_mut_count = 16;
-static mutex mut_back[__sp_mut_count];
+static pthread_mutex_t mut_back_imp[__sp_mut_count] =
+{
+ PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER,
+ PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER,
+ PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER,
+ PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER
+};
+
+static mutex* mut_back = reinterpret_cast<std::mutex*>(mut_back_imp);
_LIBCPP_CONSTEXPR __sp_mut::__sp_mut(void* p) _NOEXCEPT
: __lx(p)
diff --git a/system/lib/libcxx/new.cpp b/system/lib/libcxx/new.cpp
index 3ad593a3..b23a516f 100644
--- a/system/lib/libcxx/new.cpp
+++ b/system/lib/libcxx/new.cpp
@@ -15,7 +15,7 @@
#define __has_include(inc) 0
#endif
-#if __APPLE__
+#ifdef __APPLE__
#include <cxxabi.h>
#ifndef _LIBCPPABI_VERSION
diff --git a/system/lib/libcxx/readme.txt b/system/lib/libcxx/readme.txt
index c0c90c3a..97d8db86 100644
--- a/system/lib/libcxx/readme.txt
+++ b/system/lib/libcxx/readme.txt
@@ -1 +1 @@
-These files are from libc++, svn revision 176559, Mar 7 2013
+These files are from libc++, svn revision 178253, Mar 29 2013
diff --git a/system/lib/libcxx/stdexcept.cpp b/system/lib/libcxx/stdexcept.cpp
index 660ebfe2..0c4e8323 100644
--- a/system/lib/libcxx/stdexcept.cpp
+++ b/system/lib/libcxx/stdexcept.cpp
@@ -20,7 +20,7 @@
#define __has_include(inc) 0
#endif
-#if __APPLE__
+#ifdef __APPLE__
#include <cxxabi.h>
#elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
#include <cxxabi.h>
diff --git a/system/lib/libcxx/string.cpp b/system/lib/libcxx/string.cpp
index 40723e74..c71af4fe 100644
--- a/system/lib/libcxx/string.cpp
+++ b/system/lib/libcxx/string.cpp
@@ -11,7 +11,7 @@
#include "cstdlib"
#include "cwchar"
#include "cerrno"
-#if _WIN32
+#ifdef _WIN32
#include "support/win32/support.h"
#endif // _WIN32
diff --git a/system/lib/libcxx/strstream.cpp b/system/lib/libcxx/strstream.cpp
index 8cd19e6a..518422bd 100644
--- a/system/lib/libcxx/strstream.cpp
+++ b/system/lib/libcxx/strstream.cpp
@@ -158,6 +158,8 @@ strstreambuf::overflow(int_type __c)
return int_type(EOF);
streamsize old_size = (epptr() ? epptr() : egptr()) - eback();
streamsize new_size = max<streamsize>(__alsize_, 2*old_size);
+ if (new_size == 0)
+ new_size = __default_alsize;
char* buf = nullptr;
if (__palloc_)
buf = static_cast<char*>(__palloc_(static_cast<size_t>(new_size)));
diff --git a/system/lib/libcxx/thread.cpp b/system/lib/libcxx/thread.cpp
index a2d95bb2..7a06b296 100644
--- a/system/lib/libcxx/thread.cpp
+++ b/system/lib/libcxx/thread.cpp
@@ -13,8 +13,8 @@
#include "future"
#include "limits"
#include <sys/types.h>
-#if !_WIN32
-#if !__sun__ && !__linux__
+#if !defined(_WIN32)
+#if !defined(__sun__) && !defined(__linux__)
#include <sys/sysctl.h>
#else
#include <unistd.h>
@@ -65,7 +65,7 @@ thread::hardware_concurrency() _NOEXCEPT
std::size_t s = sizeof(n);
sysctl(mib, 2, &n, &s, 0, 0);
return n;
-#elif (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && defined(_SC_NPROCESSORS_ONLN)) || defined(EMSCRIPTEN)
+#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && defined(_SC_NPROCESSORS_ONLN)
long result = sysconf(_SC_NPROCESSORS_ONLN);
// sysconf returns -1 if the name is invalid, the option does not exist or
// does not have a definite limit.
diff --git a/system/lib/libcxx/typeinfo.cpp b/system/lib/libcxx/typeinfo.cpp
index 6bab0771..7b47d741 100644
--- a/system/lib/libcxx/typeinfo.cpp
+++ b/system/lib/libcxx/typeinfo.cpp
@@ -12,7 +12,7 @@
#define __has_include(inc) 0
#endif
-#if __APPLE__
+#ifdef __APPLE__
#include <cxxabi.h>
#elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
#include <cxxabi.h>
@@ -50,7 +50,7 @@ std::bad_typeid::what() const _NOEXCEPT
return "std::bad_typeid";
}
-#if __APPLE__
+#ifdef __APPLE__
// On Darwin, the cxa_bad_* functions cannot be in the lower level library
// because bad_cast and bad_typeid are defined in his higher level library
void __cxxabiv1::__cxa_bad_typeid() { throw std::bad_typeid(); }