]> xenbits.xensource.com Git - unikraft/libs/libcxx.git/commitdiff
patches: Backport upstream fix for __is_convertible
authorAndrei Tatar <andrei@unikraft.io>
Thu, 4 May 2023 14:20:31 +0000 (16:20 +0200)
committerUnikraft <monkey@unikraft.io>
Thu, 1 Jun 2023 19:30:34 +0000 (19:30 +0000)
Replicate upstream commit 484e64f7e7b2c0494d7b2dbfdd528bcd707ee652.
libcxx previously used the `__is_convertible_to` builtin which wasn't
supported by GCC; this patch adds support for `__is_convertible` which
is available as of GCC 13.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #28

patches/0001-Use-__is_convertible-built-in-when-available.patch [new file with mode: 0644]

diff --git a/patches/0001-Use-__is_convertible-built-in-when-available.patch b/patches/0001-Use-__is_convertible-built-in-when-available.patch
new file mode 100644 (file)
index 0000000..faf471c
--- /dev/null
@@ -0,0 +1,24 @@
+diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
+index 3391999675..ab126d000d 100644
+--- a/include/type_traits
++++ b/include/type_traits
+@@ -1659,11 +1659,18 @@ struct __is_core_convertible<_Tp, _Up, decltype(
+ // is_convertible
+-#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
++#if __has_builtin(__is_convertible) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
++
++template <class _T1, class _T2>
++struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant<bool, __is_convertible(_T1, _T2)> {};
++
++#elif __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
+ template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
+     : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
++// TODO: Remove this fallback when GCC < 13 support is no longer required.
++// GCC 13 has the __is_convertible built-in.
+ #else  // __has_feature(is_convertible_to)
+ namespace __is_convertible_imp