[libcxx-commits] [PATCH] D78757: [libc++] Improve the detection of whether the blocks runtime is available
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Apr 24 04:18:02 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf76c42416cf4: [libc++] Improve the detection of whether the blocks runtime is available (authored by ldionne).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78757/new/
https://reviews.llvm.org/D78757
Files:
libcxx/include/__config
libcxx/include/functional
libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
Index: libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
===================================================================
--- libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
+++ libcxx/test/libcxx/utilities/function.objects/func.blocks.sh.cpp
@@ -9,14 +9,15 @@
// std::function support for the "blocks" extension
// UNSUPPORTED: c++98, c++03
-// REQUIRES: has-fblocks
+
+// This test requires the Blocks runtime, which is (only?) available
+// on Darwin out-of-the-box.
+// REQUIRES: has-fblocks && darwin
// FILE_DEPENDENCIES: %t.exe
// RUN: %{build} -fblocks
// RUN: %{run}
-#if __has_include(<Block.h>)
-
#include <functional>
#include <cstdlib>
#include <cassert>
@@ -143,9 +144,3 @@
return 0;
}
-
-#else
-
-int main() { }
-
-#endif
Index: libcxx/include/functional
===================================================================
--- libcxx/include/functional
+++ libcxx/include/functional
@@ -508,7 +508,7 @@
#include <__functional_base>
-#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && !defined(_LIBCPP_HAS_OBJC_ARC) && __has_include(<Block.h>)
+#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC)
#include <Block.h>
#endif
@@ -2255,7 +2255,7 @@
#endif // _LIBCPP_NO_RTTI
};
-#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && !defined(_LIBCPP_HAS_OBJC_ARC) && __has_include(<Block.h>)
+#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC)
template<class _Rp1, class ..._ArgTypes1, class _Alloc, class _Rp, class ..._ArgTypes>
class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -474,6 +474,10 @@
# define _LIBCPP_HAS_EXTENSION_BLOCKS
#endif
+#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__)
+# define _LIBCPP_HAS_BLOCKS_RUNTIME
+#endif
+
#if !(__has_feature(cxx_relaxed_constexpr))
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78757.259856.patch
Type: text/x-patch
Size: 2041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200424/cb10a30c/attachment.bin>
More information about the libcxx-commits
mailing list