Fixes for FreeBSD, including some fairly obvious copy-and-paste errors.

libc++ now mostly works on FreeBSD with libcxxrt and this patch applied to the base system:

http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20110920/e666632c/xlocale-0001.obj

Summary of tests on FreeBSD:


****************************************************
Results for /root/libcxx/test:
using FreeBSD clang version 3.0 (trunk 135360) 20110717
Target: x86_64-unknown-freebsd9.0
Thread model: posix
with -std=c++0x -stdlib=libc++ -I/root/libcxx/include -L/root/libcxx/build/lib
----------------------------------------------------
sections without tests   : 1
sections with failures   : 48
sections without failures: 1015
                       +   ----
total number of sections : 1064
----------------------------------------------------
number of tests failed   : 145
number of tests passed   : 4179
                       +   ----
total number of tests    : 4324
****************************************************

(Many due to this clang version not supporting C++ atomics)

More fixes to follow...



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140245 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Chisnall
2011-09-21 08:39:44 +00:00
parent e2f2a15066
commit c512df1950
6 changed files with 60 additions and 46 deletions

View File

@@ -733,7 +733,7 @@ ctype<wchar_t>::do_scan_not(mask m, const char_type* low, const char_type* high)
wchar_t
ctype<wchar_t>::do_toupper(char_type c) const
{
#ifndef _LIBCPP_STABLE_APPLE_ABI
#if !(defined(_LIBCPP_STABLE_APPLE_ABI) || defined(__FreeBSD__))
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
#else
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
@@ -744,7 +744,7 @@ 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
#if !(defined(_LIBCPP_STABLE_APPLE_ABI) || defined(__FreeBSD__))
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
: *low;
#else
@@ -908,11 +908,12 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
const ctype<char>::mask*
ctype<char>::classic_table() _NOEXCEPT
{
#ifdef __APPLE__
#if defined(__APPLE__) || defined(__FreeBSD__)
return _DefaultRuneLocale.__runetype;
#elif defined(__GLIBC__)
return __cloc()->__ctype_b;
// This is assumed to be safe.
// This is assumed to be safe, which is a nonsense assumption because we're
// going to end up dereferencing it later...
#else
return NULL;
#endif
@@ -922,7 +923,7 @@ ctype<char>::classic_table() _NOEXCEPT
const int*
ctype<char>::__classic_lower_table() _NOEXCEPT
{
#ifdef __APPLE__
#if defined(__APPLE__) || defined(__FreeBSD__)
return _DefaultRuneLocale.__maplower;
#elif defined(__GLIBC__)
return __cloc()->__ctype_tolower;
@@ -934,7 +935,7 @@ ctype<char>::__classic_lower_table() _NOEXCEPT
const int*
ctype<char>::__classic_upper_table() _NOEXCEPT
{
#ifdef __APPLE__
#if defined(__APPLE__) || defined(__FreeBSD__)
return _DefaultRuneLocale.__mapupper;
#elif defined(__GLIBC__)
return __cloc()->__ctype_toupper;
@@ -1036,6 +1037,7 @@ ctype_byname<wchar_t>::do_is(mask m, char_type c) const
#ifdef _LIBCPP_WCTYPE_IS_MASK
return static_cast<bool>(iswctype_l(c, m, __l));
#else
// FIXME: This is broken for things that test more than one flag.
if (m & space && !iswspace_l(c, __l)) return false;
if (m & print && !iswprint_l(c, __l)) return false;
if (m & cntrl && !iswcntrl_l(c, __l)) return false;