[cfe-commits] [libcxx] r134783 - in /libcxx/trunk: include/__config include/__locale include/locale src/locale.cpp
Sean Hunt
scshunt at csclub.uwaterloo.ca
Fri Jul 8 18:09:31 PDT 2011
Author: coppro
Date: Fri Jul 8 20:09:31 2011
New Revision: 134783
URL: http://llvm.org/viewvc/llvm-project?rev=134783&view=rev
Log:
Conditionally wrap the changes from r134781.
Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/__locale
libcxx/trunk/include/locale
libcxx/trunk/src/locale.cpp
Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=134783&r1=134782&r2=134783&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Jul 8 20:09:31 2011
@@ -285,4 +285,8 @@
#define __has_feature(__x) 0
#endif
+#ifdef __APPLE__
+#define _LIBCPP_STABLE_APPLE_ABI
+#endif
+
#endif // _LIBCPP_CONFIG
Modified: libcxx/trunk/include/__locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=134783&r1=134782&r2=134783&view=diff
==============================================================================
--- libcxx/trunk/include/__locale (original)
+++ libcxx/trunk/include/__locale Fri Jul 8 20:09:31 2011
@@ -541,8 +541,10 @@
#endif
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
static const mask* classic_table() _NOEXCEPT;
+#ifndef _LIBCPP_STABLE_APPLE_ABI
static const int* __classic_upper_table() _NOEXCEPT;
static const int* __classic_lower_table() _NOEXCEPT;
+#endif
protected:
~ctype();
Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=134783&r1=134782&r2=134783&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Fri Jul 8 20:09:31 2011
@@ -192,8 +192,10 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+#ifndef _LIBCPP_STABLE_APPLE_ABI
// Get the C locale object
locale_t __cloc();
+#endif
// OSX has nice foo_l() functions that let you turn off use of the global
// locale. Linux, not so much. The following functions avoid the locale when
Modified: libcxx/trunk/src/locale.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=134783&r1=134782&r2=134783&view=diff
==============================================================================
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Fri Jul 8 20:09:31 2011
@@ -116,6 +116,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+#ifndef _LIBCPP_APPLE_STABLE_ABI
locale_t __cloc() {
// In theory this could create a race condition. In practice
// the race condition is non-fatal since it will just create
@@ -127,6 +128,7 @@
return result;
#endif
}
+#endif // _LIBCPP_APPLE_STABLE_ABI
namespace {
@@ -812,30 +814,46 @@
wchar_t
ctype<wchar_t>::do_toupper(char_type c) const
{
+#ifndef _LIBCPP_STABLE_APPLE_ABI
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
+#else
+ return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
+#endif
}
const wchar_t*
ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
+#ifndef _LIBCPP_STABLE_APPLE_ABI
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
: *low;
+#else
+ *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
+#endif
return low;
}
wchar_t
ctype<wchar_t>::do_tolower(char_type c) const
{
+#ifndef _LIBCPP_STABLE_APPLE_ABI
return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
+#else
+ return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
+#endif
}
const wchar_t*
ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
+#ifndef _LIBCPP_STABLE_APPLE_ABI
*low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
: *low;
+#else
+ *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
+#endif
return low;
}
@@ -894,28 +912,44 @@
char
ctype<char>::do_toupper(char_type c) const
{
+#ifndef _LIBCPP_STABLE_APPLE_ABI
return isascii(c) ? __classic_upper_table()[c] : c;
+#else
+ return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
+#endif
}
const char*
ctype<char>::do_toupper(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
+#ifndef _LIBCPP_STABLE_APPLE_ABI
*low = isascii(*low) ? __classic_upper_table()[*low] : *low;
+#else
+ *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[c] : c;
+#endif
return low;
}
char
ctype<char>::do_tolower(char_type c) const
{
+#ifndef _LIBCPP_STABLE_APPLE_ABI
return isascii(c) ? __classic_lower_table()[c] : c;
+#else
+ return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
+#endif
}
const char*
ctype<char>::do_tolower(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
+#ifndef _LIBCPP_STABLE_APPLE_ABI
*low = isascii(*low) ? __classic_lower_table()[*low] : *low;
+#else
+ *low = isascii(*low) ? _DefaultRuneLocale.__maplower[c] : c;
+#endif
return low;
}
@@ -965,6 +999,7 @@
#endif
}
+#ifndef _LIBCPP_APPLE_STABLE_ABI
const int*
ctype<char>::__classic_lower_table() _NOEXCEPT
{
@@ -988,6 +1023,7 @@
return NULL;
#endif
}
+#endif // _LIBCPP_APPLE_STABLE_ABI
// template <> class ctype_byname<char>
More information about the cfe-commits
mailing list