From nobody Sat Apr 13 08:46:07 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VGn8b4wnkz5H2X4; Sat, 13 Apr 2024 08:46:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VGn8b4LByz4WvL; Sat, 13 Apr 2024 08:46:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712997967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6lhWUeg1CI4JqYh52Y3fzf7YTbLtk3v0wx/O5qF0KiQ=; b=eYYme7ybMczG/w9ucatpkSyt0/piwOs8vgUjPc0cmMCOvAwXt1A6tgkqxSUJe+wR/8oETU enHBKJVea8qNpRc4Vjln8CZ7O0Rv0QQkrOrM8sXMHsadAyFc0nqYa5EcQsraXLufpvph49 jeYgqrnEc16Au8KKXm2ViMkQawaJtDzXxzFhWrU3Oi8ihNX8Jjo8T/zjZmj4+8DEhUYSI1 8GXlxmUVcAwnpMDKdYKJW08uroUp1Km+2+8dR/2Urc/jLiVhTxJgqjTPAwvOqSLL6GtmoN gVtqLIwtIMQY+o1Dwa0I1/Mx2wyGeVnzBusHuBG7S5l4o++Ns39vYHcfH0S2vA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712997967; a=rsa-sha256; cv=none; b=rgCby0nY1Zye+bs88fcl6COUU7NT25oLZLftWV/ztwrsyEGe1BFuWsNu0eGbUoLgJY2o5w 3K0wmv5WXheq2yYN2LdCZokTftK0rgg1wKDqQAlnI8/A6187aX8jRZFgzj+aNXQQpMfnt3 KExBvY6d3U+uQKpVK/q9GbESAGJDT+uK8ng4K0J2qlklYo3h4FLzQo09bWcnZKwbqFYGib ZRw/S4+Xr4sRIaOwEbD/gCsMvCYYJvGups2V9UbKgDZdwRstNBHJIS5cZtReH/uyBmx3Fe iRPCRe4jb3IN6AjCXEAvzFLctG/sJAZLwGIiwKslvpaYjBFoRLMYk6jDrgAZPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712997967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6lhWUeg1CI4JqYh52Y3fzf7YTbLtk3v0wx/O5qF0KiQ=; b=ZILIC44LN58BeJ3uvgUwMHs4dK/bxFxB1vwuhjgHE9O26PWcgL8N/71oDDfCxmWoutBTOT o+ts9tf6Gr7mO0LpKM9ExhkguOyWJQuMhEpjSm8Nd9ihAexxtDEr0FUPBBe5bLZJf6GnhK EAL2V6wetkacERsTvETX5Vq/aE2vQkSbPPukQPRWCmjizcSA3mULKozIC9gHhYZ053OVFJ IfpELdjXCpWW4+hurvF+cX20T16N4nLfP1vTzLOp16bQGe02zyBCgGQ/jvFAT6JnuObVry 0uRF/FvzMbHFu8i8dBktl9fN4zft2sHvlT3CiRAZQ6K6lLBmSaP0NX83BFHURQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VGn8b3x6kzQZp; Sat, 13 Apr 2024 08:46:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43D8k7NX049574; Sat, 13 Apr 2024 08:46:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43D8k7sT049571; Sat, 13 Apr 2024 08:46:07 GMT (envelope-from git) Date: Sat, 13 Apr 2024 08:46:07 GMT Message-Id: <202404130846.43D8k7sT049571@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 2365f012951e - main - Revert commit 925a11a5f221 from llvm-project (by Nikolas Klauser): List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2365f012951e5f0333cf31c690f668299c86b30e Auto-Submitted: auto-generated The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=2365f012951e5f0333cf31c690f668299c86b30e commit 2365f012951e5f0333cf31c690f668299c86b30e Author: Dimitry Andric AuthorDate: 2024-04-13 08:44:26 +0000 Commit: Dimitry Andric CommitDate: 2024-04-13 08:45:15 +0000 Revert commit 925a11a5f221 from llvm-project (by Nikolas Klauser): [libc++] Simplify is_convertible GCC 13 has added __is_convertible(), so we don't need to keep the fallback implementation around. Reviewed By: #libc, Mordante Spies: Mordante, libcxx-commits Differential Revision: https://reviews.llvm.org/D157939 This should allow buildworld with gcc 12 to work again. PR: 276104 MFC after: 1 month --- .../libcxx/include/__type_traits/is_convertible.h | 79 +++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h b/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h index bc91d8b23430..b378a20cedeb 100644 --- a/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h +++ b/contrib/llvm-project/libcxx/include/__type_traits/is_convertible.h @@ -24,12 +24,89 @@ _LIBCPP_BEGIN_NAMESPACE_STD +#if __has_builtin(__is_convertible) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) + template struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant {}; +#elif __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) + +template +struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant {}; + +// TODO: Remove this fallback when GCC < 13 support is no longer required. +// GCC 13 has the __is_convertible built-in. +#else // __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) + +namespace __is_convertible_imp { +template +void __test_convert(_Tp); + +template +struct __is_convertible_test : public false_type {}; + +template +struct __is_convertible_test<_From, _To, decltype(__is_convertible_imp::__test_convert<_To>(std::declval<_From>()))> + : public true_type {}; + +// clang-format off +template ::value, + bool _IsFunction = is_function<_Tp>::value, + bool _IsVoid = is_void<_Tp>::value> + struct __is_array_function_or_void { enum { value = 0 }; }; +template struct __is_array_function_or_void<_Tp, true, false, false> { enum { value = 1 }; }; +template struct __is_array_function_or_void<_Tp, false, true, false> { enum { value = 2 }; }; +template struct __is_array_function_or_void<_Tp, false, false, true> { enum { value = 3 }; }; +// clang-format on +} // namespace __is_convertible_imp + +template >::value> +struct __is_convertible_check { + static const size_t __v = 0; +}; + +template +struct __is_convertible_check<_Tp, 0> { + static const size_t __v = sizeof(_Tp); +}; + +template ::value, + unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> +struct __is_convertible + : public integral_constant::value >{}; + +// clang-format off +template struct __is_convertible<_T1, _T2, 0, 1> : public false_type{}; +template struct __is_convertible<_T1, _T2, 1, 1> : public false_type{}; +template struct __is_convertible<_T1, _T2, 2, 1> : public false_type{}; +template struct __is_convertible<_T1, _T2, 3, 1> : public false_type{}; + +template struct __is_convertible<_T1, _T2, 0, 2> : public false_type{}; +template struct __is_convertible<_T1, _T2, 1, 2> : public false_type{}; +template struct __is_convertible<_T1, _T2, 2, 2> : public false_type{}; +template struct __is_convertible<_T1, _T2, 3, 2> : public false_type{}; + +template struct __is_convertible<_T1, _T2, 0, 3> : public false_type{}; +template struct __is_convertible<_T1, _T2, 1, 3> : public false_type{}; +template struct __is_convertible<_T1, _T2, 2, 3> : public false_type{}; +template struct __is_convertible<_T1, _T2, 3, 3> : public true_type{}; +// clang-format on + +template +struct _LIBCPP_TEMPLATE_VIS is_convertible : public __is_convertible<_T1, _T2> { + static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; + static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; +}; + +#endif // __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) + #if _LIBCPP_STD_VER >= 17 template -inline constexpr bool is_convertible_v = __is_convertible(_From, _To); +inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value; #endif _LIBCPP_END_NAMESPACE_STD