Re: [libcxx] r290889 - [libcxx] Add build/test support for the externally threaded libc++abi variant

2017-01-26 Thread Nico Weber via cfe-commits
Yes, things are happy again, thanks!

Our bots currently use the macOS 10.10 SDK.

On Thu, Jan 26, 2017 at 6:56 AM, Asiri Rathnayake <
asiri.rathnay...@gmail.com> wrote:

> Hi Nico,
>
> Hopefully I've sorted this out in r293166/r293167. Please let me know if
> things are not back to normal.
>
> (I'll keep an eye on your builder too)
>
> / Asiri
>
> On Wed, Jan 25, 2017 at 8:42 PM, Asiri Rathnayake <
> asiri.rathnay...@gmail.com> wrote:
>
>> Hi Nico,
>>
>> Thanks for the links. I may have a clue to what is going on.
>>
>> I think in your Mac environment,  does not provide
>> either pthread_mach_thread_np() function or define the type mach_port_t
>> (is there a way for you to check this btw? just to make sure).
>>
>> This was not a problem before (for your builds) because this function was
>> only used in libcxxabi sources. In my eagerness to get rid of all pthread
>> dependencies in libcxx/libcxxabi, I have lifted this out into
>> __threading_support header in libcxx (which is our new threading API for
>> both libcxx and libcxxabi).
>>
>> @Eric: would it be OK to leave this Mac-specific pthread dependency in
>> libcxxabi sources as it was? In that way, libcxx builds like Nico's won't
>> be affected.
>>
>> Another option is to try and detect the conditions (on Mac environments)
>> where pthread_mach_thread_np/mach_port_t is available, and only define
>> the corresponding libcxx thread-api function (__libcpp_thread_get_port)
>> when this condition is true. Unfortunately I'm not familiar with Mac enough
>> to know this. Any thoughts?
>>
>> Side note:- Btw, if I'm correct with the above analysis, it won't be
>> possible to build libcxxabi in Nico's environment (even before my changes).
>> The dependency on pthread_mach_thread_np() was already there
>> in __cxa_guard_acquire().
>>
>> Thanks.
>>
>> / Asiri
>>
>>
>> On Wed, Jan 25, 2017 at 7:34 PM, Nico Weber  wrote:
>>
>>> Sure! https://build.chromium.org/p/chromium.fyi/builders/Cla
>>> ngToTMacASan/builds/8565/steps/gclient%20runhooks/logs/stdio has the
>>> invocations to build llvm/clang/compiler/rt, and
>>> https://build.chromium.org/p/chromium.fyi/builders/Clang
>>> ToTMacASan/builds/8565/steps/compile/logs/stdio is the actual build
>>> using that setup.
>>>
>>> On Wed, Jan 25, 2017 at 1:57 PM, Asiri Rathnayake <
>>> asiri.rathnay...@gmail.com> wrote:
>>>
 @Nico: could you let me know your build configuration? (cmake options)

 I'm surprised this went unnoticed for so long.

 Thanks.

 / Asiri

 On 25 Jan 2017 5:52 p.m., "Asiri Rathnayake" <
 asiri.rathnay...@gmail.com> wrote:

> (including cfe-commits)
>
> On Wed, Jan 25, 2017 at 5:51 PM, Asiri Rathnayake <
> asiri.rathnay...@gmail.com> wrote:
>
>> Hi Nico,
>>
>> On Wed, Jan 25, 2017 at 5:32 PM, Nico Weber via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Is it intentional that this change affects
>>> non-LIBCXX_HAS_EXTERNAL_THREAD_API builds at all?#
>>>
>>
>> Nope. But I'm not sure how this got broken on Mac.
>>
>> IIRC,  defines mach_port_t type on Mac, which gets
>> included when _LIBCPP_HAS_THREAD_API_PTHREAD is defined (which is
>> what we expect to be the case on Mac, normally).
>>
>> I'll have to build this on a Mac tomorrow. Hopefully that's OK?
>>
>> Cheers,
>>
>> / Asiri
>>
>>
>>
>>>
>>> On Wed, Jan 25, 2017 at 12:31 PM, Nico Weber 
>>> wrote:
>>>
 This breaks all our mac builds with:

 /b/c/b/ClangToTMac__dbg_/src/third_party/llvm-build/Release+
 Asserts/bin/../include/c++/v1/__threading_support:154:1: error:
 unknown type name 'mach_port_t'
 mach_port_t __libcpp_thread_get_port();

 On Tue, Jan 3, 2017 at 7:59 AM, Asiri Rathnayake via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:

> Author: asiri
> Date: Tue Jan  3 06:59:50 2017
> New Revision: 290889
>
> URL: http://llvm.org/viewvc/llvm-project?rev=290889=rev
> Log:
> [libcxx] Add build/test support for the externally threaded
> libc++abi variant
>
> Differential revision: https://reviews.llvm.org/D27576
>
> Reviewers: EricWF
>
> Modified:
> libcxx/trunk/CMakeLists.txt
> libcxx/trunk/include/__threading_support
> libcxx/trunk/test/CMakeLists.txt
> libcxx/trunk/test/libcxx/test/config.py
> libcxx/trunk/test/lit.site.cfg.in
>
> Modified: libcxx/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.
> txt?rev=290889=290888=290889=diff
> 
> ==
> --- libcxx/trunk/CMakeLists.txt (original)
> +++ 

Re: [libcxx] r290889 - [libcxx] Add build/test support for the externally threaded libc++abi variant

2017-01-26 Thread Asiri Rathnayake via cfe-commits
Hi Nico,

Hopefully I've sorted this out in r293166/r293167. Please let me know if
things are not back to normal.

(I'll keep an eye on your builder too)

/ Asiri

On Wed, Jan 25, 2017 at 8:42 PM, Asiri Rathnayake <
asiri.rathnay...@gmail.com> wrote:

> Hi Nico,
>
> Thanks for the links. I may have a clue to what is going on.
>
> I think in your Mac environment,  does not provide
> either pthread_mach_thread_np() function or define the type mach_port_t
> (is there a way for you to check this btw? just to make sure).
>
> This was not a problem before (for your builds) because this function was
> only used in libcxxabi sources. In my eagerness to get rid of all pthread
> dependencies in libcxx/libcxxabi, I have lifted this out into
> __threading_support header in libcxx (which is our new threading API for
> both libcxx and libcxxabi).
>
> @Eric: would it be OK to leave this Mac-specific pthread dependency in
> libcxxabi sources as it was? In that way, libcxx builds like Nico's won't
> be affected.
>
> Another option is to try and detect the conditions (on Mac environments)
> where pthread_mach_thread_np/mach_port_t is available, and only define
> the corresponding libcxx thread-api function (__libcpp_thread_get_port)
> when this condition is true. Unfortunately I'm not familiar with Mac enough
> to know this. Any thoughts?
>
> Side note:- Btw, if I'm correct with the above analysis, it won't be
> possible to build libcxxabi in Nico's environment (even before my changes).
> The dependency on pthread_mach_thread_np() was already there
> in __cxa_guard_acquire().
>
> Thanks.
>
> / Asiri
>
>
> On Wed, Jan 25, 2017 at 7:34 PM, Nico Weber  wrote:
>
>> Sure! https://build.chromium.org/p/chromium.fyi/builders/Cla
>> ngToTMacASan/builds/8565/steps/gclient%20runhooks/logs/stdio has the
>> invocations to build llvm/clang/compiler/rt, and
>> https://build.chromium.org/p/chromium.fyi/builders/Clang
>> ToTMacASan/builds/8565/steps/compile/logs/stdio is the actual build
>> using that setup.
>>
>> On Wed, Jan 25, 2017 at 1:57 PM, Asiri Rathnayake <
>> asiri.rathnay...@gmail.com> wrote:
>>
>>> @Nico: could you let me know your build configuration? (cmake options)
>>>
>>> I'm surprised this went unnoticed for so long.
>>>
>>> Thanks.
>>>
>>> / Asiri
>>>
>>> On 25 Jan 2017 5:52 p.m., "Asiri Rathnayake" 
>>> wrote:
>>>
 (including cfe-commits)

 On Wed, Jan 25, 2017 at 5:51 PM, Asiri Rathnayake <
 asiri.rathnay...@gmail.com> wrote:

> Hi Nico,
>
> On Wed, Jan 25, 2017 at 5:32 PM, Nico Weber via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Is it intentional that this change affects
>> non-LIBCXX_HAS_EXTERNAL_THREAD_API builds at all?#
>>
>
> Nope. But I'm not sure how this got broken on Mac.
>
> IIRC,  defines mach_port_t type on Mac, which gets included
> when _LIBCPP_HAS_THREAD_API_PTHREAD is defined (which is what we
> expect to be the case on Mac, normally).
>
> I'll have to build this on a Mac tomorrow. Hopefully that's OK?
>
> Cheers,
>
> / Asiri
>
>
>
>>
>> On Wed, Jan 25, 2017 at 12:31 PM, Nico Weber 
>> wrote:
>>
>>> This breaks all our mac builds with:
>>>
>>> /b/c/b/ClangToTMac__dbg_/src/third_party/llvm-build/Release+
>>> Asserts/bin/../include/c++/v1/__threading_support:154:1: error:
>>> unknown type name 'mach_port_t'
>>> mach_port_t __libcpp_thread_get_port();
>>>
>>> On Tue, Jan 3, 2017 at 7:59 AM, Asiri Rathnayake via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: asiri
 Date: Tue Jan  3 06:59:50 2017
 New Revision: 290889

 URL: http://llvm.org/viewvc/llvm-project?rev=290889=rev
 Log:
 [libcxx] Add build/test support for the externally threaded
 libc++abi variant

 Differential revision: https://reviews.llvm.org/D27576

 Reviewers: EricWF

 Modified:
 libcxx/trunk/CMakeLists.txt
 libcxx/trunk/include/__threading_support
 libcxx/trunk/test/CMakeLists.txt
 libcxx/trunk/test/libcxx/test/config.py
 libcxx/trunk/test/lit.site.cfg.in

 Modified: libcxx/trunk/CMakeLists.txt
 URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.
 txt?rev=290889=290888=290889=diff
 
 ==
 --- libcxx/trunk/CMakeLists.txt (original)
 +++ libcxx/trunk/CMakeLists.txt Tue Jan  3 06:59:50 2017
 @@ -221,14 +221,21 @@ if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_
" when LIBCXX_ENABLE_THREADS is also set to
 OFF.")
  endif()

 -if(LIBCXX_HAS_PTHREAD_API AND NOT LIBCXX_ENABLE_THREADS)
 -  

Re: [libcxx] r290889 - [libcxx] Add build/test support for the externally threaded libc++abi variant

2017-01-25 Thread Asiri Rathnayake via cfe-commits
Hi Nico,

Thanks for the links. I may have a clue to what is going on.

I think in your Mac environment,  does not provide
either pthread_mach_thread_np() function or define the type mach_port_t (is
there a way for you to check this btw? just to make sure).

This was not a problem before (for your builds) because this function was
only used in libcxxabi sources. In my eagerness to get rid of all pthread
dependencies in libcxx/libcxxabi, I have lifted this out into
__threading_support header in libcxx (which is our new threading API for
both libcxx and libcxxabi).

@Eric: would it be OK to leave this Mac-specific pthread dependency in
libcxxabi sources as it was? In that way, libcxx builds like Nico's won't
be affected.

Another option is to try and detect the conditions (on Mac environments)
where pthread_mach_thread_np/mach_port_t is available, and only define the
corresponding libcxx thread-api function (__libcpp_thread_get_port) when
this condition is true. Unfortunately I'm not familiar with Mac enough to
know this. Any thoughts?

Side note:- Btw, if I'm correct with the above analysis, it won't be
possible to build libcxxabi in Nico's environment (even before my changes).
The dependency on pthread_mach_thread_np() was already there
in __cxa_guard_acquire().

Thanks.

/ Asiri


On Wed, Jan 25, 2017 at 7:34 PM, Nico Weber  wrote:

> Sure! https://build.chromium.org/p/chromium.fyi/builders/
> ClangToTMacASan/builds/8565/steps/gclient%20runhooks/logs/stdio has the
> invocations to build llvm/clang/compiler/rt, and https://build.chromium.
> org/p/chromium.fyi/builders/ClangToTMacASan/builds/8565/
> steps/compile/logs/stdio is the actual build using that setup.
>
> On Wed, Jan 25, 2017 at 1:57 PM, Asiri Rathnayake <
> asiri.rathnay...@gmail.com> wrote:
>
>> @Nico: could you let me know your build configuration? (cmake options)
>>
>> I'm surprised this went unnoticed for so long.
>>
>> Thanks.
>>
>> / Asiri
>>
>> On 25 Jan 2017 5:52 p.m., "Asiri Rathnayake" 
>> wrote:
>>
>>> (including cfe-commits)
>>>
>>> On Wed, Jan 25, 2017 at 5:51 PM, Asiri Rathnayake <
>>> asiri.rathnay...@gmail.com> wrote:
>>>
 Hi Nico,

 On Wed, Jan 25, 2017 at 5:32 PM, Nico Weber via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:

> Is it intentional that this change affects
> non-LIBCXX_HAS_EXTERNAL_THREAD_API builds at all?#
>

 Nope. But I'm not sure how this got broken on Mac.

 IIRC,  defines mach_port_t type on Mac, which gets included
 when _LIBCPP_HAS_THREAD_API_PTHREAD is defined (which is what we
 expect to be the case on Mac, normally).

 I'll have to build this on a Mac tomorrow. Hopefully that's OK?

 Cheers,

 / Asiri



>
> On Wed, Jan 25, 2017 at 12:31 PM, Nico Weber 
> wrote:
>
>> This breaks all our mac builds with:
>>
>> /b/c/b/ClangToTMac__dbg_/src/third_party/llvm-build/Release+
>> Asserts/bin/../include/c++/v1/__threading_support:154:1: error:
>> unknown type name 'mach_port_t'
>> mach_port_t __libcpp_thread_get_port();
>>
>> On Tue, Jan 3, 2017 at 7:59 AM, Asiri Rathnayake via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: asiri
>>> Date: Tue Jan  3 06:59:50 2017
>>> New Revision: 290889
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=290889=rev
>>> Log:
>>> [libcxx] Add build/test support for the externally threaded
>>> libc++abi variant
>>>
>>> Differential revision: https://reviews.llvm.org/D27576
>>>
>>> Reviewers: EricWF
>>>
>>> Modified:
>>> libcxx/trunk/CMakeLists.txt
>>> libcxx/trunk/include/__threading_support
>>> libcxx/trunk/test/CMakeLists.txt
>>> libcxx/trunk/test/libcxx/test/config.py
>>> libcxx/trunk/test/lit.site.cfg.in
>>>
>>> Modified: libcxx/trunk/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.
>>> txt?rev=290889=290888=290889=diff
>>> 
>>> ==
>>> --- libcxx/trunk/CMakeLists.txt (original)
>>> +++ libcxx/trunk/CMakeLists.txt Tue Jan  3 06:59:50 2017
>>> @@ -221,14 +221,21 @@ if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_
>>>" when LIBCXX_ENABLE_THREADS is also set to
>>> OFF.")
>>>  endif()
>>>
>>> -if(LIBCXX_HAS_PTHREAD_API AND NOT LIBCXX_ENABLE_THREADS)
>>> -  message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
>>> -  " when LIBCXX_ENABLE_THREADS is also set to
>>> ON.")
>>> +if(NOT LIBCXX_ENABLE_THREADS)
>>> +  if(LIBCXX_HAS_PTHREAD_API)
>>> +message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to
>>> ON"
>>> +" when LIBCXX_ENABLE_THREADS is also set to
>>> ON.")

Re: [libcxx] r290889 - [libcxx] Add build/test support for the externally threaded libc++abi variant

2017-01-25 Thread Nico Weber via cfe-commits
Sure!
https://build.chromium.org/p/chromium.fyi/builders/ClangToTMacASan/builds/8565/steps/gclient%20runhooks/logs/stdio
has the invocations to build llvm/clang/compiler/rt, and
https://build.chromium.org/p/chromium.fyi/builders/ClangToTMacASan/builds/8565/steps/compile/logs/stdio
is the actual build using that setup.

On Wed, Jan 25, 2017 at 1:57 PM, Asiri Rathnayake <
asiri.rathnay...@gmail.com> wrote:

> @Nico: could you let me know your build configuration? (cmake options)
>
> I'm surprised this went unnoticed for so long.
>
> Thanks.
>
> / Asiri
>
> On 25 Jan 2017 5:52 p.m., "Asiri Rathnayake" 
> wrote:
>
>> (including cfe-commits)
>>
>> On Wed, Jan 25, 2017 at 5:51 PM, Asiri Rathnayake <
>> asiri.rathnay...@gmail.com> wrote:
>>
>>> Hi Nico,
>>>
>>> On Wed, Jan 25, 2017 at 5:32 PM, Nico Weber via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Is it intentional that this change affects
 non-LIBCXX_HAS_EXTERNAL_THREAD_API builds at all?#

>>>
>>> Nope. But I'm not sure how this got broken on Mac.
>>>
>>> IIRC,  defines mach_port_t type on Mac, which gets included
>>> when _LIBCPP_HAS_THREAD_API_PTHREAD is defined (which is what we expect
>>> to be the case on Mac, normally).
>>>
>>> I'll have to build this on a Mac tomorrow. Hopefully that's OK?
>>>
>>> Cheers,
>>>
>>> / Asiri
>>>
>>>
>>>

 On Wed, Jan 25, 2017 at 12:31 PM, Nico Weber 
 wrote:

> This breaks all our mac builds with:
>
> /b/c/b/ClangToTMac__dbg_/src/third_party/llvm-build/Release+
> Asserts/bin/../include/c++/v1/__threading_support:154:1: error:
> unknown type name 'mach_port_t'
> mach_port_t __libcpp_thread_get_port();
>
> On Tue, Jan 3, 2017 at 7:59 AM, Asiri Rathnayake via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: asiri
>> Date: Tue Jan  3 06:59:50 2017
>> New Revision: 290889
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=290889=rev
>> Log:
>> [libcxx] Add build/test support for the externally threaded libc++abi
>> variant
>>
>> Differential revision: https://reviews.llvm.org/D27576
>>
>> Reviewers: EricWF
>>
>> Modified:
>> libcxx/trunk/CMakeLists.txt
>> libcxx/trunk/include/__threading_support
>> libcxx/trunk/test/CMakeLists.txt
>> libcxx/trunk/test/libcxx/test/config.py
>> libcxx/trunk/test/lit.site.cfg.in
>>
>> Modified: libcxx/trunk/CMakeLists.txt
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.
>> txt?rev=290889=290888=290889=diff
>> 
>> ==
>> --- libcxx/trunk/CMakeLists.txt (original)
>> +++ libcxx/trunk/CMakeLists.txt Tue Jan  3 06:59:50 2017
>> @@ -221,14 +221,21 @@ if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_
>>" when LIBCXX_ENABLE_THREADS is also set to
>> OFF.")
>>  endif()
>>
>> -if(LIBCXX_HAS_PTHREAD_API AND NOT LIBCXX_ENABLE_THREADS)
>> -  message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
>> -  " when LIBCXX_ENABLE_THREADS is also set to
>> ON.")
>> +if(NOT LIBCXX_ENABLE_THREADS)
>> +  if(LIBCXX_HAS_PTHREAD_API)
>> +message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to
>> ON"
>> +" when LIBCXX_ENABLE_THREADS is also set to
>> ON.")
>> +  endif()
>> +  if(LIBCXX_HAS_EXTERNAL_THREAD_API)
>> +message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be
>> set to ON"
>> +" when LIBCXX_ENABLE_THREADS is also set to
>> ON.")
>> +  endif()
>>  endif()
>>
>> -if(LIBCXX_HAS_EXTERNAL_THREAD_API AND NOT LIBCXX_ENABLE_THREADS)
>> -  message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be
>> set to ON"
>> -  " when LIBCXX_ENABLE_THREADS is also set to
>> ON.")
>> +if(LIBCXX_HAS_PTHREAD_API AND LIBCXX_HAS_EXTERNAL_THREAD_API)
>> +  message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
>> +  "and LIBCXX_HAS_PTHREAD_API cannot be both"
>> +  "set to ON at the same time.")
>>  endif()
>>
>>  # Ensure LLVM_USE_SANITIZER is not specified when
>> LIBCXX_GENERATE_COVERAGE
>>
>> Modified: libcxx/trunk/include/__threading_support
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__t
>> hreading_support?rev=290889=290888=290889=diff
>> 
>> ==
>> --- libcxx/trunk/include/__threading_support (original)
>> +++ libcxx/trunk/include/__threading_support Tue Jan  3 06:59:50 2017
>> @@ -67,7 +67,11 @@ typedef pthread_mutex_t __libcpp_mutex_t
>>  typedef pthread_cond_t __libcpp_condvar_t;
>>  #define 

Re: [libcxx] r290889 - [libcxx] Add build/test support for the externally threaded libc++abi variant

2017-01-25 Thread Asiri Rathnayake via cfe-commits
@Nico: could you let me know your build configuration? (cmake options)

I'm surprised this went unnoticed for so long.

Thanks.

/ Asiri

On 25 Jan 2017 5:52 p.m., "Asiri Rathnayake" 
wrote:

> (including cfe-commits)
>
> On Wed, Jan 25, 2017 at 5:51 PM, Asiri Rathnayake <
> asiri.rathnay...@gmail.com> wrote:
>
>> Hi Nico,
>>
>> On Wed, Jan 25, 2017 at 5:32 PM, Nico Weber via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Is it intentional that this change affects 
>>> non-LIBCXX_HAS_EXTERNAL_THREAD_API
>>> builds at all?#
>>>
>>
>> Nope. But I'm not sure how this got broken on Mac.
>>
>> IIRC,  defines mach_port_t type on Mac, which gets included
>> when _LIBCPP_HAS_THREAD_API_PTHREAD is defined (which is what we expect
>> to be the case on Mac, normally).
>>
>> I'll have to build this on a Mac tomorrow. Hopefully that's OK?
>>
>> Cheers,
>>
>> / Asiri
>>
>>
>>
>>>
>>> On Wed, Jan 25, 2017 at 12:31 PM, Nico Weber 
>>> wrote:
>>>
 This breaks all our mac builds with:

 /b/c/b/ClangToTMac__dbg_/src/third_party/llvm-build/Release+
 Asserts/bin/../include/c++/v1/__threading_support:154:1: error:
 unknown type name 'mach_port_t'
 mach_port_t __libcpp_thread_get_port();

 On Tue, Jan 3, 2017 at 7:59 AM, Asiri Rathnayake via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:

> Author: asiri
> Date: Tue Jan  3 06:59:50 2017
> New Revision: 290889
>
> URL: http://llvm.org/viewvc/llvm-project?rev=290889=rev
> Log:
> [libcxx] Add build/test support for the externally threaded libc++abi
> variant
>
> Differential revision: https://reviews.llvm.org/D27576
>
> Reviewers: EricWF
>
> Modified:
> libcxx/trunk/CMakeLists.txt
> libcxx/trunk/include/__threading_support
> libcxx/trunk/test/CMakeLists.txt
> libcxx/trunk/test/libcxx/test/config.py
> libcxx/trunk/test/lit.site.cfg.in
>
> Modified: libcxx/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.
> txt?rev=290889=290888=290889=diff
> 
> ==
> --- libcxx/trunk/CMakeLists.txt (original)
> +++ libcxx/trunk/CMakeLists.txt Tue Jan  3 06:59:50 2017
> @@ -221,14 +221,21 @@ if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_
>" when LIBCXX_ENABLE_THREADS is also set to
> OFF.")
>  endif()
>
> -if(LIBCXX_HAS_PTHREAD_API AND NOT LIBCXX_ENABLE_THREADS)
> -  message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
> -  " when LIBCXX_ENABLE_THREADS is also set to
> ON.")
> +if(NOT LIBCXX_ENABLE_THREADS)
> +  if(LIBCXX_HAS_PTHREAD_API)
> +message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
> +" when LIBCXX_ENABLE_THREADS is also set to
> ON.")
> +  endif()
> +  if(LIBCXX_HAS_EXTERNAL_THREAD_API)
> +message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be
> set to ON"
> +" when LIBCXX_ENABLE_THREADS is also set to
> ON.")
> +  endif()
>  endif()
>
> -if(LIBCXX_HAS_EXTERNAL_THREAD_API AND NOT LIBCXX_ENABLE_THREADS)
> -  message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be
> set to ON"
> -  " when LIBCXX_ENABLE_THREADS is also set to
> ON.")
> +if(LIBCXX_HAS_PTHREAD_API AND LIBCXX_HAS_EXTERNAL_THREAD_API)
> +  message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
> +  "and LIBCXX_HAS_PTHREAD_API cannot be both"
> +  "set to ON at the same time.")
>  endif()
>
>  # Ensure LLVM_USE_SANITIZER is not specified when
> LIBCXX_GENERATE_COVERAGE
>
> Modified: libcxx/trunk/include/__threading_support
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__t
> hreading_support?rev=290889=290888=290889=diff
> 
> ==
> --- libcxx/trunk/include/__threading_support (original)
> +++ libcxx/trunk/include/__threading_support Tue Jan  3 06:59:50 2017
> @@ -67,7 +67,11 @@ typedef pthread_mutex_t __libcpp_mutex_t
>  typedef pthread_cond_t __libcpp_condvar_t;
>  #define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER
>
> -// THread ID
> +// Execute once
> +typedef pthread_once_t __libcpp_exec_once_flag;
> +#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
> +
> +// Thread id
>  typedef pthread_t __libcpp_thread_id;
>
>  // Thread
> @@ -110,7 +114,17 @@ int __libcpp_condvar_timedwait(__libcpp_
>  _LIBCPP_THREAD_ABI_VISIBILITY
>  int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
>
> -// Thread ID
> +// Execute once
> 

Re: [libcxx] r290889 - [libcxx] Add build/test support for the externally threaded libc++abi variant

2017-01-25 Thread Asiri Rathnayake via cfe-commits
(including cfe-commits)

On Wed, Jan 25, 2017 at 5:51 PM, Asiri Rathnayake <
asiri.rathnay...@gmail.com> wrote:

> Hi Nico,
>
> On Wed, Jan 25, 2017 at 5:32 PM, Nico Weber via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Is it intentional that this change affects non-LIBCXX_HAS_EXTERNAL_THREAD_API
>> builds at all?#
>>
>
> Nope. But I'm not sure how this got broken on Mac.
>
> IIRC,  defines mach_port_t type on Mac, which gets included
> when _LIBCPP_HAS_THREAD_API_PTHREAD is defined (which is what we expect
> to be the case on Mac, normally).
>
> I'll have to build this on a Mac tomorrow. Hopefully that's OK?
>
> Cheers,
>
> / Asiri
>
>
>
>>
>> On Wed, Jan 25, 2017 at 12:31 PM, Nico Weber  wrote:
>>
>>> This breaks all our mac builds with:
>>>
>>> /b/c/b/ClangToTMac__dbg_/src/third_party/llvm-build/Release+
>>> Asserts/bin/../include/c++/v1/__threading_support:154:1: error: unknown
>>> type name 'mach_port_t'
>>> mach_port_t __libcpp_thread_get_port();
>>>
>>> On Tue, Jan 3, 2017 at 7:59 AM, Asiri Rathnayake via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: asiri
 Date: Tue Jan  3 06:59:50 2017
 New Revision: 290889

 URL: http://llvm.org/viewvc/llvm-project?rev=290889=rev
 Log:
 [libcxx] Add build/test support for the externally threaded libc++abi
 variant

 Differential revision: https://reviews.llvm.org/D27576

 Reviewers: EricWF

 Modified:
 libcxx/trunk/CMakeLists.txt
 libcxx/trunk/include/__threading_support
 libcxx/trunk/test/CMakeLists.txt
 libcxx/trunk/test/libcxx/test/config.py
 libcxx/trunk/test/lit.site.cfg.in

 Modified: libcxx/trunk/CMakeLists.txt
 URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.
 txt?rev=290889=290888=290889=diff
 
 ==
 --- libcxx/trunk/CMakeLists.txt (original)
 +++ libcxx/trunk/CMakeLists.txt Tue Jan  3 06:59:50 2017
 @@ -221,14 +221,21 @@ if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_
" when LIBCXX_ENABLE_THREADS is also set to
 OFF.")
  endif()

 -if(LIBCXX_HAS_PTHREAD_API AND NOT LIBCXX_ENABLE_THREADS)
 -  message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
 -  " when LIBCXX_ENABLE_THREADS is also set to ON.")
 +if(NOT LIBCXX_ENABLE_THREADS)
 +  if(LIBCXX_HAS_PTHREAD_API)
 +message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
 +" when LIBCXX_ENABLE_THREADS is also set to
 ON.")
 +  endif()
 +  if(LIBCXX_HAS_EXTERNAL_THREAD_API)
 +message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be
 set to ON"
 +" when LIBCXX_ENABLE_THREADS is also set to
 ON.")
 +  endif()
  endif()

 -if(LIBCXX_HAS_EXTERNAL_THREAD_API AND NOT LIBCXX_ENABLE_THREADS)
 -  message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set
 to ON"
 -  " when LIBCXX_ENABLE_THREADS is also set to ON.")
 +if(LIBCXX_HAS_PTHREAD_API AND LIBCXX_HAS_EXTERNAL_THREAD_API)
 +  message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
 +  "and LIBCXX_HAS_PTHREAD_API cannot be both"
 +  "set to ON at the same time.")
  endif()

  # Ensure LLVM_USE_SANITIZER is not specified when
 LIBCXX_GENERATE_COVERAGE

 Modified: libcxx/trunk/include/__threading_support
 URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__t
 hreading_support?rev=290889=290888=290889=diff
 
 ==
 --- libcxx/trunk/include/__threading_support (original)
 +++ libcxx/trunk/include/__threading_support Tue Jan  3 06:59:50 2017
 @@ -67,7 +67,11 @@ typedef pthread_mutex_t __libcpp_mutex_t
  typedef pthread_cond_t __libcpp_condvar_t;
  #define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER

 -// THread ID
 +// Execute once
 +typedef pthread_once_t __libcpp_exec_once_flag;
 +#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
 +
 +// Thread id
  typedef pthread_t __libcpp_thread_id;

  // Thread
 @@ -110,7 +114,17 @@ int __libcpp_condvar_timedwait(__libcpp_
  _LIBCPP_THREAD_ABI_VISIBILITY
  int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);

 -// Thread ID
 +// Execute once
 +_LIBCPP_THREAD_ABI_VISIBILITY
 +int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
 +  void (*init_routine)(void));
 +
 +// Thread id
 +#if defined(__APPLE__) && !defined(__arm__)
 +_LIBCPP_THREAD_ABI_VISIBILITY
 +mach_port_t __libcpp_thread_get_port();
 +#endif
 +
  _LIBCPP_THREAD_ABI_VISIBILITY
  bool 

Re: [libcxx] r290889 - [libcxx] Add build/test support for the externally threaded libc++abi variant

2017-01-25 Thread Nico Weber via cfe-commits
Is it intentional that this change affects
non-LIBCXX_HAS_EXTERNAL_THREAD_API builds at all?

On Wed, Jan 25, 2017 at 12:31 PM, Nico Weber  wrote:

> This breaks all our mac builds with:
>
> /b/c/b/ClangToTMac__dbg_/src/third_party/llvm-build/
> Release+Asserts/bin/../include/c++/v1/__threading_support:154:1: error:
> unknown type name 'mach_port_t'
> mach_port_t __libcpp_thread_get_port();
>
> On Tue, Jan 3, 2017 at 7:59 AM, Asiri Rathnayake via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: asiri
>> Date: Tue Jan  3 06:59:50 2017
>> New Revision: 290889
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=290889=rev
>> Log:
>> [libcxx] Add build/test support for the externally threaded libc++abi
>> variant
>>
>> Differential revision: https://reviews.llvm.org/D27576
>>
>> Reviewers: EricWF
>>
>> Modified:
>> libcxx/trunk/CMakeLists.txt
>> libcxx/trunk/include/__threading_support
>> libcxx/trunk/test/CMakeLists.txt
>> libcxx/trunk/test/libcxx/test/config.py
>> libcxx/trunk/test/lit.site.cfg.in
>>
>> Modified: libcxx/trunk/CMakeLists.txt
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.
>> txt?rev=290889=290888=290889=diff
>> 
>> ==
>> --- libcxx/trunk/CMakeLists.txt (original)
>> +++ libcxx/trunk/CMakeLists.txt Tue Jan  3 06:59:50 2017
>> @@ -221,14 +221,21 @@ if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_
>>" when LIBCXX_ENABLE_THREADS is also set to OFF.")
>>  endif()
>>
>> -if(LIBCXX_HAS_PTHREAD_API AND NOT LIBCXX_ENABLE_THREADS)
>> -  message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
>> -  " when LIBCXX_ENABLE_THREADS is also set to ON.")
>> +if(NOT LIBCXX_ENABLE_THREADS)
>> +  if(LIBCXX_HAS_PTHREAD_API)
>> +message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
>> +" when LIBCXX_ENABLE_THREADS is also set to ON.")
>> +  endif()
>> +  if(LIBCXX_HAS_EXTERNAL_THREAD_API)
>> +message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set
>> to ON"
>> +" when LIBCXX_ENABLE_THREADS is also set to ON.")
>> +  endif()
>>  endif()
>>
>> -if(LIBCXX_HAS_EXTERNAL_THREAD_API AND NOT LIBCXX_ENABLE_THREADS)
>> -  message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set
>> to ON"
>> -  " when LIBCXX_ENABLE_THREADS is also set to ON.")
>> +if(LIBCXX_HAS_PTHREAD_API AND LIBCXX_HAS_EXTERNAL_THREAD_API)
>> +  message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
>> +  "and LIBCXX_HAS_PTHREAD_API cannot be both"
>> +  "set to ON at the same time.")
>>  endif()
>>
>>  # Ensure LLVM_USE_SANITIZER is not specified when
>> LIBCXX_GENERATE_COVERAGE
>>
>> Modified: libcxx/trunk/include/__threading_support
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__
>> threading_support?rev=290889=290888=290889=diff
>> 
>> ==
>> --- libcxx/trunk/include/__threading_support (original)
>> +++ libcxx/trunk/include/__threading_support Tue Jan  3 06:59:50 2017
>> @@ -67,7 +67,11 @@ typedef pthread_mutex_t __libcpp_mutex_t
>>  typedef pthread_cond_t __libcpp_condvar_t;
>>  #define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER
>>
>> -// THread ID
>> +// Execute once
>> +typedef pthread_once_t __libcpp_exec_once_flag;
>> +#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
>> +
>> +// Thread id
>>  typedef pthread_t __libcpp_thread_id;
>>
>>  // Thread
>> @@ -110,7 +114,17 @@ int __libcpp_condvar_timedwait(__libcpp_
>>  _LIBCPP_THREAD_ABI_VISIBILITY
>>  int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
>>
>> -// Thread ID
>> +// Execute once
>> +_LIBCPP_THREAD_ABI_VISIBILITY
>> +int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
>> +  void (*init_routine)(void));
>> +
>> +// Thread id
>> +#if defined(__APPLE__) && !defined(__arm__)
>> +_LIBCPP_THREAD_ABI_VISIBILITY
>> +mach_port_t __libcpp_thread_get_port();
>> +#endif
>> +
>>  _LIBCPP_THREAD_ABI_VISIBILITY
>>  bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id
>> t2);
>>
>> @@ -145,7 +159,7 @@ _LIBCPP_THREAD_ABI_VISIBILITY
>>  void *__libcpp_tls_get(__libcpp_tls_key __key);
>>
>>  _LIBCPP_THREAD_ABI_VISIBILITY
>> -void __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
>> +int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
>>
>>  #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \
>>  defined(_LIBCPP_BUILDING_THREAD_API_EXTERNAL_PTHREAD)
>> @@ -221,6 +235,19 @@ int __libcpp_condvar_destroy(__libcpp_co
>>return pthread_cond_destroy(__cv);
>>  }
>>
>> +// Execute once
>> +int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
>> +  void (*init_routine)(void)) {
>> +  return pthread_once(flag, init_routine);
>> +}
>> +
>> +// Thread id
>> +#if 

Re: [libcxx] r290889 - [libcxx] Add build/test support for the externally threaded libc++abi variant

2017-01-25 Thread Nico Weber via cfe-commits
This breaks all our mac builds with:

/b/c/b/ClangToTMac__dbg_/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__threading_support:154:1:
error: unknown type name 'mach_port_t'
mach_port_t __libcpp_thread_get_port();

On Tue, Jan 3, 2017 at 7:59 AM, Asiri Rathnayake via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: asiri
> Date: Tue Jan  3 06:59:50 2017
> New Revision: 290889
>
> URL: http://llvm.org/viewvc/llvm-project?rev=290889=rev
> Log:
> [libcxx] Add build/test support for the externally threaded libc++abi
> variant
>
> Differential revision: https://reviews.llvm.org/D27576
>
> Reviewers: EricWF
>
> Modified:
> libcxx/trunk/CMakeLists.txt
> libcxx/trunk/include/__threading_support
> libcxx/trunk/test/CMakeLists.txt
> libcxx/trunk/test/libcxx/test/config.py
> libcxx/trunk/test/lit.site.cfg.in
>
> Modified: libcxx/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/
> CMakeLists.txt?rev=290889=290888=290889=diff
> 
> ==
> --- libcxx/trunk/CMakeLists.txt (original)
> +++ libcxx/trunk/CMakeLists.txt Tue Jan  3 06:59:50 2017
> @@ -221,14 +221,21 @@ if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_
>" when LIBCXX_ENABLE_THREADS is also set to OFF.")
>  endif()
>
> -if(LIBCXX_HAS_PTHREAD_API AND NOT LIBCXX_ENABLE_THREADS)
> -  message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
> -  " when LIBCXX_ENABLE_THREADS is also set to ON.")
> +if(NOT LIBCXX_ENABLE_THREADS)
> +  if(LIBCXX_HAS_PTHREAD_API)
> +message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
> +" when LIBCXX_ENABLE_THREADS is also set to ON.")
> +  endif()
> +  if(LIBCXX_HAS_EXTERNAL_THREAD_API)
> +message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set
> to ON"
> +" when LIBCXX_ENABLE_THREADS is also set to ON.")
> +  endif()
>  endif()
>
> -if(LIBCXX_HAS_EXTERNAL_THREAD_API AND NOT LIBCXX_ENABLE_THREADS)
> -  message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set to
> ON"
> -  " when LIBCXX_ENABLE_THREADS is also set to ON.")
> +if(LIBCXX_HAS_PTHREAD_API AND LIBCXX_HAS_EXTERNAL_THREAD_API)
> +  message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
> +  "and LIBCXX_HAS_PTHREAD_API cannot be both"
> +  "set to ON at the same time.")
>  endif()
>
>  # Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
>
> Modified: libcxx/trunk/include/__threading_support
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/_
> _threading_support?rev=290889=290888=290889=diff
> 
> ==
> --- libcxx/trunk/include/__threading_support (original)
> +++ libcxx/trunk/include/__threading_support Tue Jan  3 06:59:50 2017
> @@ -67,7 +67,11 @@ typedef pthread_mutex_t __libcpp_mutex_t
>  typedef pthread_cond_t __libcpp_condvar_t;
>  #define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER
>
> -// THread ID
> +// Execute once
> +typedef pthread_once_t __libcpp_exec_once_flag;
> +#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
> +
> +// Thread id
>  typedef pthread_t __libcpp_thread_id;
>
>  // Thread
> @@ -110,7 +114,17 @@ int __libcpp_condvar_timedwait(__libcpp_
>  _LIBCPP_THREAD_ABI_VISIBILITY
>  int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
>
> -// Thread ID
> +// Execute once
> +_LIBCPP_THREAD_ABI_VISIBILITY
> +int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
> +  void (*init_routine)(void));
> +
> +// Thread id
> +#if defined(__APPLE__) && !defined(__arm__)
> +_LIBCPP_THREAD_ABI_VISIBILITY
> +mach_port_t __libcpp_thread_get_port();
> +#endif
> +
>  _LIBCPP_THREAD_ABI_VISIBILITY
>  bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id
> t2);
>
> @@ -145,7 +159,7 @@ _LIBCPP_THREAD_ABI_VISIBILITY
>  void *__libcpp_tls_get(__libcpp_tls_key __key);
>
>  _LIBCPP_THREAD_ABI_VISIBILITY
> -void __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
> +int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
>
>  #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \
>  defined(_LIBCPP_BUILDING_THREAD_API_EXTERNAL_PTHREAD)
> @@ -221,6 +235,19 @@ int __libcpp_condvar_destroy(__libcpp_co
>return pthread_cond_destroy(__cv);
>  }
>
> +// Execute once
> +int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
> +  void (*init_routine)(void)) {
> +  return pthread_once(flag, init_routine);
> +}
> +
> +// Thread id
> +#if defined(__APPLE__) && !defined(__arm__)
> +mach_port_t __libcpp_thread_get_port() {
> +return pthread_mach_thread_np(pthread_self());
> +}
> +#endif
> +
>  // Returns non-zero if the thread ids are equal, otherwise 0
>  bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id
> t2)
>  {
> @@ 

[libcxx] r290889 - [libcxx] Add build/test support for the externally threaded libc++abi variant

2017-01-03 Thread Asiri Rathnayake via cfe-commits
Author: asiri
Date: Tue Jan  3 06:59:50 2017
New Revision: 290889

URL: http://llvm.org/viewvc/llvm-project?rev=290889=rev
Log:
[libcxx] Add build/test support for the externally threaded libc++abi variant

Differential revision: https://reviews.llvm.org/D27576

Reviewers: EricWF

Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/include/__threading_support
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/config.py
libcxx/trunk/test/lit.site.cfg.in

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=290889=290888=290889=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Tue Jan  3 06:59:50 2017
@@ -221,14 +221,21 @@ if(LIBCXX_ENABLE_THREADS AND NOT LIBCXX_
   " when LIBCXX_ENABLE_THREADS is also set to OFF.")
 endif()
 
-if(LIBCXX_HAS_PTHREAD_API AND NOT LIBCXX_ENABLE_THREADS)
-  message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
-  " when LIBCXX_ENABLE_THREADS is also set to ON.")
+if(NOT LIBCXX_ENABLE_THREADS)
+  if(LIBCXX_HAS_PTHREAD_API)
+message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON"
+" when LIBCXX_ENABLE_THREADS is also set to ON.")
+  endif()
+  if(LIBCXX_HAS_EXTERNAL_THREAD_API)
+message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set to ON"
+" when LIBCXX_ENABLE_THREADS is also set to ON.")
+  endif()
 endif()
 
-if(LIBCXX_HAS_EXTERNAL_THREAD_API AND NOT LIBCXX_ENABLE_THREADS)
-  message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set to ON"
-  " when LIBCXX_ENABLE_THREADS is also set to ON.")
+if(LIBCXX_HAS_PTHREAD_API AND LIBCXX_HAS_EXTERNAL_THREAD_API)
+  message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
+  "and LIBCXX_HAS_PTHREAD_API cannot be both"
+  "set to ON at the same time.")
 endif()
 
 # Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE

Modified: libcxx/trunk/include/__threading_support
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=290889=290888=290889=diff
==
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Tue Jan  3 06:59:50 2017
@@ -67,7 +67,11 @@ typedef pthread_mutex_t __libcpp_mutex_t
 typedef pthread_cond_t __libcpp_condvar_t;
 #define _LIBCPP_CONDVAR_INITIALIZER PTHREAD_COND_INITIALIZER
 
-// THread ID
+// Execute once
+typedef pthread_once_t __libcpp_exec_once_flag;
+#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
+
+// Thread id
 typedef pthread_t __libcpp_thread_id;
 
 // Thread
@@ -110,7 +114,17 @@ int __libcpp_condvar_timedwait(__libcpp_
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_condvar_destroy(__libcpp_condvar_t* __cv);
 
-// Thread ID
+// Execute once
+_LIBCPP_THREAD_ABI_VISIBILITY
+int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
+  void (*init_routine)(void));
+
+// Thread id
+#if defined(__APPLE__) && !defined(__arm__)
+_LIBCPP_THREAD_ABI_VISIBILITY
+mach_port_t __libcpp_thread_get_port();
+#endif
+
 _LIBCPP_THREAD_ABI_VISIBILITY
 bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2);
 
@@ -145,7 +159,7 @@ _LIBCPP_THREAD_ABI_VISIBILITY
 void *__libcpp_tls_get(__libcpp_tls_key __key);
 
 _LIBCPP_THREAD_ABI_VISIBILITY
-void __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
+int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
 
 #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) || \
 defined(_LIBCPP_BUILDING_THREAD_API_EXTERNAL_PTHREAD)
@@ -221,6 +235,19 @@ int __libcpp_condvar_destroy(__libcpp_co
   return pthread_cond_destroy(__cv);
 }
 
+// Execute once
+int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
+  void (*init_routine)(void)) {
+  return pthread_once(flag, init_routine);
+}
+
+// Thread id
+#if defined(__APPLE__) && !defined(__arm__)
+mach_port_t __libcpp_thread_get_port() {
+return pthread_mach_thread_np(pthread_self());
+}
+#endif
+
 // Returns non-zero if the thread ids are equal, otherwise 0
 bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
 {
@@ -276,9 +303,9 @@ void *__libcpp_tls_get(__libcpp_tls_key
   return pthread_getspecific(__key);
 }
 
-void __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
+int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
 {
-  pthread_setspecific(__key, __p);
+return pthread_setspecific(__key, __p);
 }
 
 #endif // _LIBCPP_HAS_THREAD_API_PTHREAD

Modified: libcxx/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=290889=290888=290889=diff