Improve mkdeps

Our makefile generator now accepts badly formatted include lines. It's
now more hermetic with better error checking in the cosmo repo, and it
can be configured to not be hermetic at all.
This commit is contained in:
Justine Tunney 2023-11-10 04:14:27 -08:00
parent 241f949540
commit d2f49ca175
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
69 changed files with 466 additions and 533 deletions

View file

@ -303,7 +303,7 @@ struct __invoke_return
#else // defined(_LIBCPP_CXX03_LANG)
#include "third_party/libcxx/__functional_base_03"
//#include "third_party/libcxx/__functional_base_03"
#endif // !defined(_LIBCPP_CXX03_LANG)

View file

@ -1,223 +0,0 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_FUNCTIONAL_BASE_03
#define _LIBCPP_FUNCTIONAL_BASE_03
// manual variadic expansion for <functional>
// __invoke
template <class _Ret, class _T1, bool _IsFunc, bool _IsBase>
struct __enable_invoke_imp;
template <class _Ret, class _T1>
struct __enable_invoke_imp<_Ret, _T1, true, true> {
typedef _Ret _Bullet1;
typedef _Bullet1 type;
};
template <class _Ret, class _T1>
struct __enable_invoke_imp<_Ret, _T1, true, false> {
typedef _Ret _Bullet2;
typedef _Bullet2 type;
};
template <class _Ret, class _T1>
struct __enable_invoke_imp<_Ret, _T1, false, true> {
typedef typename add_lvalue_reference<
typename __apply_cv<_T1, _Ret>::type
>::type _Bullet3;
typedef _Bullet3 type;
};
template <class _Ret, class _T1>
struct __enable_invoke_imp<_Ret, _T1, false, false> {
typedef typename add_lvalue_reference<
typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _Ret>::type
>::type _Bullet4;
typedef _Bullet4 type;
};
template <class _Ret, class _T1>
struct __enable_invoke_imp<_Ret, _T1*, false, false> {
typedef typename add_lvalue_reference<
typename __apply_cv<_T1, _Ret>::type
>::type _Bullet4;
typedef _Bullet4 type;
};
template <class _Fn, class _T1,
class _Traits = __member_pointer_traits<_Fn>,
class _Ret = typename _Traits::_ReturnType,
class _Class = typename _Traits::_ClassType>
struct __enable_invoke : __enable_invoke_imp<
_Ret, _T1,
is_member_function_pointer<_Fn>::value,
is_base_of<_Class, typename remove_reference<_T1>::type>::value>
{
};
__nat __invoke(__any, ...);
// first bullet
template <class _Fn, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename __enable_invoke<_Fn, _T1>::_Bullet1
__invoke(_Fn __f, _T1& __t1) {
return (__t1.*__f)();
}
template <class _Fn, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename __enable_invoke<_Fn, _T1>::_Bullet1
__invoke(_Fn __f, _T1& __t1, _A0& __a0) {
return (__t1.*__f)(__a0);
}
template <class _Fn, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename __enable_invoke<_Fn, _T1>::_Bullet1
__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) {
return (__t1.*__f)(__a0, __a1);
}
template <class _Fn, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename __enable_invoke<_Fn, _T1>::_Bullet1
__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) {
return (__t1.*__f)(__a0, __a1, __a2);
}
template <class _Fn, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename __enable_invoke<_Fn, _T1>::_Bullet2
__invoke(_Fn __f, _T1& __t1) {
return ((*__t1).*__f)();
}
template <class _Fn, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename __enable_invoke<_Fn, _T1>::_Bullet2
__invoke(_Fn __f, _T1& __t1, _A0& __a0) {
return ((*__t1).*__f)(__a0);
}
template <class _Fn, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename __enable_invoke<_Fn, _T1>::_Bullet2
__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) {
return ((*__t1).*__f)(__a0, __a1);
}
template <class _Fn, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename __enable_invoke<_Fn, _T1>::_Bullet2
__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) {
return ((*__t1).*__f)(__a0, __a1, __a2);
}
template <class _Fn, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename __enable_invoke<_Fn, _T1>::_Bullet3
__invoke(_Fn __f, _T1& __t1) {
return __t1.*__f;
}
template <class _Fn, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename __enable_invoke<_Fn, _T1>::_Bullet4
__invoke(_Fn __f, _T1& __t1) {
return (*__t1).*__f;
}
// fifth bullet
template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
decltype(_VSTD::declval<_Fp&>()())
__invoke(_Fp& __f)
{
return __f();
}
template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>()))
__invoke(_Fp& __f, _A0& __a0)
{
return __f(__a0);
}
template <class _Fp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>()))
__invoke(_Fp& __f, _A0& __a0, _A1& __a1)
{
return __f(__a0, __a1);
}
template <class _Fp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>(), _VSTD::declval<_A2&>()))
__invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
{
return __f(__a0, __a1, __a2);
}
template <class _Fp, bool = __has_result_type<__weak_result_type<_Fp> >::value>
struct __invoke_return
{
typedef typename __weak_result_type<_Fp>::result_type type;
};
template <class _Fp>
struct __invoke_return<_Fp, false>
{
typedef decltype(__invoke(_VSTD::declval<_Fp&>())) type;
};
template <class _Tp, class _A0>
struct __invoke_return0
{
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>())) type;
};
template <class _Rp, class _Tp, class _A0>
struct __invoke_return0<_Rp _Tp::*, _A0>
{
typedef typename __enable_invoke<_Rp _Tp::*, _A0>::type type;
};
template <class _Tp, class _A0, class _A1>
struct __invoke_return1
{
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
_VSTD::declval<_A1&>())) type;
};
template <class _Rp, class _Class, class _A0, class _A1>
struct __invoke_return1<_Rp _Class::*, _A0, _A1> {
typedef typename __enable_invoke<_Rp _Class::*, _A0>::type type;
};
template <class _Tp, class _A0, class _A1, class _A2>
struct __invoke_return2
{
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
_VSTD::declval<_A1&>(),
_VSTD::declval<_A2&>())) type;
};
template <class _Ret, class _Class, class _A0, class _A1, class _A2>
struct __invoke_return2<_Ret _Class::*, _A0, _A1, _A2> {
typedef typename __enable_invoke<_Ret _Class::*, _A0>::type type;
};
#endif // _LIBCPP_FUNCTIONAL_BASE_03

View file

@ -18,29 +18,6 @@
#include "third_party/libcxx/cstdint"
#include "third_party/libcxx/cctype"
#include "third_party/libcxx/locale.h"
#if defined(_LIBCPP_MSVCRT_LIKE)
# include "third_party/libcxx/cstring"
# include "third_party/libcxx/support/win32/locale_win32.h"
#elif defined(_AIX)
# include "third_party/libcxx/support/ibm/xlocale.h"
#elif defined(__ANDROID__)
# include "third_party/libcxx/support/android/locale_bionic.h"
#elif defined(__sun__)
# include "third_party/libcxx/xlocale.h"
# include "third_party/libcxx/support/solaris/xlocale.h"
#elif defined(_NEWLIB_VERSION)
# include "third_party/libcxx/support/newlib/xlocale.h"
#elif (defined(__APPLE__) || defined(__FreeBSD__) \
|| defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
# include "third_party/libcxx/xlocale.h"
#elif defined(__Fuchsia__)
# include "third_party/libcxx/support/fuchsia/xlocale.h"
#elif defined(__wasi__)
// WASI libc uses musl's locales support.
# include "third_party/libcxx/support/musl/xlocale.h"
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
# include "third_party/libcxx/support/musl/xlocale.h"
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header

View file

@ -22,7 +22,7 @@
#endif
#if defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
# include "third_party/libcxx/__external_threading"
//# include "third_party/libcxx/__external_threading"
#elif !defined(_LIBCPP_HAS_NO_THREADS)
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)

View file

@ -23,7 +23,7 @@
#include "third_party/libcxx/version"
#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
# include "third_party/libcxx/__pstl_algorithm"
//# include "third_party/libcxx/__pstl_algorithm"
#endif
#include "third_party/libcxx/__debug"

View file

@ -14,7 +14,7 @@
#include "third_party/libcxx/__config"
#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
# include "third_party/libcxx/__pstl_execution"
//# include "third_party/libcxx/__pstl_execution"
#endif
#endif // _LIBCPP_EXECUTION

View file

@ -2528,7 +2528,7 @@ swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCE
#else // _LIBCPP_CXX03_LANG
# include "third_party/libcxx/__functional_03"
//# include "third_party/libcxx/__functional_03"
#endif

View file

@ -26,11 +26,11 @@
#include "third_party/libcxx/cstdio"
#ifdef _LIBCPP_HAS_CATOPEN
# include "libc/str/locale.h"
# include "third_party/libcxx/nl_types.h"
//# include "third_party/libcxx/nl_types.h"
#endif
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
# include "third_party/libcxx/__bsd_locale_defaults.h"
//# include "third_party/libcxx/__bsd_locale_defaults.h"
#else
#include "third_party/libcxx/__bsd_locale_fallbacks.h"
#endif

View file

@ -5364,7 +5364,7 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
# include "third_party/libcxx/__pstl_memory"
//# include "third_party/libcxx/__pstl_memory"
#endif
#endif // _LIBCPP_MEMORY

View file

@ -587,7 +587,7 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
# include "third_party/libcxx/__pstl_numeric"
//# include "third_party/libcxx/__pstl_numeric"
#endif
#endif // _LIBCPP_NUMERIC