[cfe-commits] [libcxx] r141672 - in /libcxx/trunk: CREDITS.TXT include/__locale include/locale
Howard Hinnant
hhinnant at apple.com
Tue Oct 11 09:00:46 PDT 2011
Author: hhinnant
Date: Tue Oct 11 11:00:46 2011
New Revision: 141672
URL: http://llvm.org/viewvc/llvm-project?rev=141672&view=rev
Log:
Starting on musl port by Arvid Picciani
Modified:
libcxx/trunk/CREDITS.TXT
libcxx/trunk/include/__locale
libcxx/trunk/include/locale
Modified: libcxx/trunk/CREDITS.TXT
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CREDITS.TXT?rev=141672&r1=141671&r2=141672&view=diff
==============================================================================
--- libcxx/trunk/CREDITS.TXT (original)
+++ libcxx/trunk/CREDITS.TXT Tue Oct 11 11:00:46 2011
@@ -28,3 +28,7 @@
N: Ruben Van Boxem
E: vanboxem dot ruben at gmail dot com
D: Initial Windows patches.
+
+N: Arvid Picciani
+E: aep at exys dot org
+D: Minor patches and musl port.
Modified: libcxx/trunk/include/__locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=141672&r1=141671&r2=141672&view=diff
==============================================================================
--- libcxx/trunk/include/__locale (original)
+++ libcxx/trunk/include/__locale Tue Oct 11 11:00:46 2011
@@ -21,9 +21,9 @@
#include <locale.h>
#if _WIN32
# include <support/win32/locale_win32.h>
-#else // _WIN32
+#elif (__GLIBC__ || __APPLE__ || __FreeBSD__)
# include <xlocale.h>
-#endif // _WIN32
+#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
#pragma GCC system_header
@@ -231,18 +231,18 @@
template <class _CharT>
long
-collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const
+collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
{
- size_t h = 0;
- const size_t sr = __CHAR_BIT__ * sizeof(size_t) - 8;
- const size_t mask = size_t(0xF) << (sr + 4);
- for(const char_type* p = lo; p != hi; ++p)
- {
- h = (h << 4) + *p;
- size_t g = h & mask;
- h ^= g | (g >> sr);
+ size_t __h = 0;
+ const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
+ const size_t __mask = size_t(0xF) << (__sr + 4);
+ for(const char_type* __p = __lo; __p != __hi; ++__p)
+ {
+ __h = (__h << 4) + *__p;
+ size_t __g = __h & __mask;
+ __h ^= __g | (__g >> __sr);
}
- return static_cast<long>(h);
+ return static_cast<long>(__h);
}
extern template class _LIBCPP_VISIBLE collate<char>;
@@ -330,7 +330,7 @@
static const mask punct = _PUNCT;
static const mask xdigit = _HEX;
static const mask blank = _BLANK;
-#else // __GLIBC__ || _WIN32
+#elif (__APPLE__ || __FreeBSD__)
#if __APPLE__
typedef __uint32_t mask;
#elif __FreeBSD__
@@ -346,7 +346,19 @@
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B;
-#endif // __GLIBC__ || _WIN32
+#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
+ typedef unsigned long mask;
+ static const mask space = 1<<0;
+ static const mask print = 1<<1;
+ static const mask cntrl = 1<<2;
+ static const mask upper = 1<<3;
+ static const mask lower = 1<<4;
+ static const mask alpha = 1<<5;
+ static const mask digit = 1<<6;
+ static const mask punct = 1<<7;
+ static const mask xdigit = 1<<8;
+ static const mask blank = 1<<9;
+#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
static const mask alnum = alpha | digit;
static const mask graph = alnum | punct;
Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=141672&r1=141671&r2=141672&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Tue Oct 11 11:00:46 2011
@@ -3696,7 +3696,7 @@
#if _WIN32
return -1;
#else // _WIN32
- catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
+ catalog __cat = (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
if (__cat != -1)
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
return __cat;
@@ -3717,7 +3717,7 @@
__dflt.c_str() + __dflt.size());
if (__c != -1)
__c <<= 1;
- nl_catd __cat = reinterpret_cast<nl_catd>(__c);
+ nl_catd __cat = (nl_catd)__c;
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
string_type __w;
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
@@ -3733,7 +3733,7 @@
#if !_WIN32
if (__c != -1)
__c <<= 1;
- nl_catd __cat = reinterpret_cast<nl_catd>(__c);
+ nl_catd __cat = (nl_catd)__c;
catclose(__cat);
#endif // !_WIN32
}
More information about the cfe-commits
mailing list