[libcxx-commits] [libcxx] cd66970 - [libc++] Don't try to include <Block.h> when not available

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 23 13:51:36 PDT 2020



> On Apr 23, 2020, at 05:56, David Zarzycki <dave at znu.io> wrote:
> 
> Hi Louis:
> 
> FYI – This still isn't sufficient:
> 
> 1) `REQUIRES: has-fblocks` and  `__has_include(<Block.h>)` does not imply anything about whether the blocks runtime is available.
> 2) The blocks runtime is not built into libc/libsystem on non-Apple platforms, therefore it must be explicitly linked against but the test fails to do so.
> 
> I've worked around the build/test failure by removing the `libblocksruntime` and `libblocksruntime-devel` packages from my system, but not every non-Apple platform/user might be able to do this.

Thanks a lot for the heads up! I've created a patch to fix this here: https://reviews.llvm.org/D78757 <https://reviews.llvm.org/D78757>. Please let me know what you think.

Louis

> 
> Dave
> 
> 
> On Wed, Apr 22, 2020, at 3:22 PM, Louis Dionne via libcxx-commits wrote:
>> 
>> Author: Louis Dionne
>> Date: 2020-04-22T15:22:12-04:00
>> New Revision: cd66970b371240d90e163d2020c1a42bb2b7e1b9
>> 
>> URL: 
>> https://github.com/llvm/llvm-project/commit/cd66970b371240d90e163d2020c1a42bb2b7e1b9
>> DIFF: 
>> https://github.com/llvm/llvm-project/commit/cd66970b371240d90e163d2020c1a42bb2b7e1b9.diff
>> 
>> LOG: [libc++] Don't try to include <Block.h> when not available
>> 
>> Added: 
>> 
>> 
>> Modified: 
>>    libcxx/include/functional
>>    libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
>> 
>> Removed: 
>> 
>> 
>> 
>> ################################################################################
>> diff  --git a/libcxx/include/functional b/libcxx/include/functional
>> index f03ba8bb5541..360ca6e32005 100644
>> --- a/libcxx/include/functional
>> +++ b/libcxx/include/functional
>> @@ -508,7 +508,7 @@ POLICY:  For non-variadic implementations, the 
>> number of arguments is limited
>> 
>> #include <__functional_base>
>> 
>> -#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && 
>> !defined(_LIBCPP_HAS_OBJC_ARC)
>> +#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && 
>> !defined(_LIBCPP_HAS_OBJC_ARC) && __has_include(<Block.h>)
>> #include <Block.h>
>> #endif
>> 
>> @@ -2255,7 +2255,7 @@ template <class _Rp, class... _ArgTypes> class 
>> __policy_func<_Rp(_ArgTypes...)>
>> #endif // _LIBCPP_NO_RTTI
>> };
>> 
>> -#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && 
>> !defined(_LIBCPP_HAS_OBJC_ARC)
>> +#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && 
>> !defined(_LIBCPP_HAS_OBJC_ARC) && __has_include(<Block.h>)
>> 
>> template<class _Rp1, class ..._ArgTypes1, class _Alloc, class _Rp, 
>> class ..._ArgTypes>
>> class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
>> 
>> diff  --git 
>> a/libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp 
>> b/libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
>> index a608d42eb515..25b95465485e 100644
>> --- a/libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
>> +++ b/libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
>> @@ -14,6 +14,8 @@
>> // RUN: %{build} -fblocks
>> // RUN: %{run}
>> 
>> +#if __has_include(<Block.h>)
>> +
>> #include <functional>
>> #include <cstdlib>
>> #include <cassert>
>> @@ -140,3 +142,9 @@ int main(int, char**)
>> 
>>     return 0;
>> }
>> +
>> +#else
>> +
>> +int main() { }
>> +
>> +#endif
>> 
>> 
>> 
>> _______________________________________________
>> libcxx-commits mailing list
>> libcxx-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200423/8d1ddb78/attachment-0001.html>


More information about the libcxx-commits mailing list