[cfe-dev] [PATCH] Libc++ Windows fixes

Ruben Van Boxem vanboxem.ruben at gmail.com
Wed Sep 28 14:35:30 PDT 2011


2011/9/28 Howard Hinnant <hhinnant at apple.com>

> On Sep 28, 2011, at 4:17 PM, Ruben Van Boxem wrote:
>
> > Hi,
> >
> > I have removed Windows' dependency on the ugly <locale> part that is
> going to be refactored by mirrorring Mac and FreeBSD through implementing
> all the necessary *_l functions and dependents.
> >
> > Other notable changes:
> >  - support/win32/locale.h: fixed uselocale to enable per-thread locale,
> because the POSIX definition of this function requires that it only set the
> current thread's locale. Consequence is that after a call to this function,
> per-thread locale will remain enabled. This is intended behavior as far as I
> can see. As a result, I'm fairly confident the __locale_raii trick works as
> it should even in multithreaded contexts.
> >  - include/locale: I still included the variadic template alternatives to
> the vararg functions. As these wrappers are going to be removed, You could
> leave this out, but libc++ won't compile for GCC without them.
> >  - include/cwchar: I included the support header in order to get the
> functions required by the standard. this solves the cwchar test issue, but
> the <wchar.h> test will need to do this manually for _WIN32.
> >
> > Please comment or apply, thanks.
> >
> > Ruben
> >
> >
> > <windows.patch>
>
> Thanks Ruben,
>
> Some minor comments:
>
> ---
>
> In buildit it looks like a line escaped outside of mingw:
>
> ar rcs libc++.a *.o
>

Yeah, that's a static library step I missed to remove. Feel free to delete
it.

>
> ---
>
> In <locale> it looks like you're making some changes under:
>
> #ifndef _LIBCPP_STABLE_APPLE_ABI
>
> which is contrary to your first sentence above.  Did you send the wrong
> patch?
>

I see, see below. I removed the now unnecessary workarounds.


>
> ---
>
> In <__config> don't you want to:
>
> #if __APPLE__ || _WIN32
> #define _LIBCPP_STABLE_APPLE_ABI
> #endif
>
> instead of:
>
> #if __APPLE__ || __FreeBSD__ || _WIN32
> #define _LIBCPP_LOCALE__L_EXTENSIONS 1
> #endif
>
> ?
>

I guess you're right. I defined both in the new patch. libc++ compiles, but
I'm kind of baffled by this because there are locale.cpp parts using
_DefaultRuneLocale if _LIBCPP_STABLE_APPLE_ABI is defined. I didn't touch
these at all :s so I'm kind of confused why this works at all for me... I'm
not seeing what the compiler is seeing :(

These parts of locale.cpp are standard C locale things, so I guess the
alternative I need to write is these bits using a hidden (static) C locale
object I can always access for the values needed (this would involve
modifying __cloc to not create a locale every time it is called, but I was
waiting for the <locale> refactoring...). Why does FreeBSD not define
_LLIBCPP_STABLE_APPLE_ABI?

I'm officially confumbled,

Ruben


>
> ---
>
> Howard
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110928/a1ca9f0f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: windows.patch
Type: application/octet-stream
Size: 10220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110928/a1ca9f0f/attachment.obj>


More information about the cfe-dev mailing list