Switch atmosphere's build target to C++20. (#952)
* ams: update to build with gcc10/c++20 * remove mno-outline-atomics * ams: take care of most TODO C++20s * fusee/sept: update for gcc10 * whoosh, your code now uses pre-compiled headers * make: dependency fixes
This commit is contained in:
@@ -22,47 +22,35 @@ namespace ams::kern::svc {
|
||||
|
||||
namespace impl {
|
||||
|
||||
/* TODO: C++20
|
||||
template<typename T>
|
||||
concept Pointer = std::is_pointer<T>::value;
|
||||
|
||||
template<typename T>
|
||||
concept NonConstPointer = Pointer<T> && !std::is_const<typename std::remove_pointer<T>::type>::value;
|
||||
|
||||
template<typename T>
|
||||
concept ConstPointer = Pointer<T> && std::is_const<typename std::remove_pointer<T>::type>::value;
|
||||
|
||||
template<typename T, size_t N>
|
||||
concept AlignedNPointer = Pointer<T> && alignof(typename std::remove_pointer<T>::type) >= N && util::IsAligned(sizeof(typename std::remove_pointer<T>::type), N);
|
||||
|
||||
template<typename T>
|
||||
concept Aligned8Pointer = AlignedNPointer<T, sizeof(u8)>;
|
||||
|
||||
template<typename T>
|
||||
concept Aligned16Pointer = AlignedNPointer<T, sizeof(u16)> && Aligned8<T>;
|
||||
|
||||
template<typename T>
|
||||
concept Aligned32Pointer = AlignedNPointer<T, sizeof(u32)> && Aligned16<T>;
|
||||
|
||||
template<typename T>
|
||||
concept Aligned64Pointer = AlignedNPointer<T, sizeof(u64)> && Aligned32<T>;
|
||||
*/
|
||||
template<typename T>
|
||||
concept Pointer = std::is_pointer<T>::value;
|
||||
|
||||
template<typename T>
|
||||
constexpr inline bool IsPointer = std::is_pointer<T>::value;
|
||||
concept NonConstPointer = Pointer<T> && !std::is_const<typename std::remove_pointer<T>::type>::value;
|
||||
|
||||
template<typename T>
|
||||
constexpr inline bool IsConstPointer = IsPointer<T> && std::is_const<typename std::remove_pointer<T>::type>::value;
|
||||
|
||||
template<typename T>
|
||||
constexpr inline bool IsNonConstPointer = IsPointer<T> && !std::is_const<typename std::remove_pointer<T>::type>::value;
|
||||
concept ConstPointer = Pointer<T> && std::is_const<typename std::remove_pointer<T>::type>::value;
|
||||
|
||||
template<typename T, size_t N>
|
||||
constexpr inline bool IsAlignedNPointer = IsPointer<T> && alignof(typename std::remove_pointer<T>::type) >= N && util::IsAligned(sizeof(typename std::remove_pointer<T>::type), N);
|
||||
concept AlignedNPointer = Pointer<T> && alignof(typename std::remove_pointer<T>::type) >= N && util::IsAligned(sizeof(typename std::remove_pointer<T>::type), N);
|
||||
|
||||
template<typename _T, typename = void> /* requires Aligned8Pointer<_T> */
|
||||
class KUserPointerImplTraits {
|
||||
static_assert(IsAlignedNPointer<_T, sizeof(u8)>);
|
||||
template<typename T>
|
||||
concept Aligned8Pointer = AlignedNPointer<T, sizeof(u8)>;
|
||||
|
||||
template<typename T>
|
||||
concept Aligned16Pointer = AlignedNPointer<T, sizeof(u16)> && Aligned8Pointer<T>;
|
||||
|
||||
template<typename T>
|
||||
concept Aligned32Pointer = AlignedNPointer<T, sizeof(u32)> && Aligned16Pointer<T>;
|
||||
|
||||
template<typename T>
|
||||
concept Aligned64Pointer = AlignedNPointer<T, sizeof(u64)> && Aligned32Pointer<T>;
|
||||
|
||||
template<typename _T>
|
||||
class KUserPointerImplTraits;
|
||||
|
||||
template<typename _T> requires Aligned8Pointer<_T>
|
||||
class KUserPointerImplTraits<_T> {
|
||||
public:
|
||||
using T = typename std::remove_const<typename std::remove_pointer<_T>::type>::type;
|
||||
public:
|
||||
@@ -77,9 +65,8 @@ namespace ams::kern::svc {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _T> /* requires Aligned32Pointer<_T> */
|
||||
class KUserPointerImplTraits<_T, typename std::enable_if<IsAlignedNPointer<_T, sizeof(u32)> && !IsAlignedNPointer<_T, sizeof(u64)>>::type> {
|
||||
static_assert(IsAlignedNPointer<_T, sizeof(u32)>);
|
||||
template<typename _T> requires Aligned32Pointer<_T>
|
||||
class KUserPointerImplTraits<_T> {
|
||||
public:
|
||||
using T = typename std::remove_const<typename std::remove_pointer<_T>::type>::type;
|
||||
public:
|
||||
@@ -94,9 +81,8 @@ namespace ams::kern::svc {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _T> /* requires Aligned64Pointer<_T> */
|
||||
class KUserPointerImplTraits<_T, typename std::enable_if<IsAlignedNPointer<_T, sizeof(u64)>>::type> {
|
||||
static_assert(IsAlignedNPointer<_T, sizeof(u64)>);
|
||||
template<typename _T> requires Aligned64Pointer<_T>
|
||||
class KUserPointerImplTraits<_T> {
|
||||
public:
|
||||
using T = typename std::remove_const<typename std::remove_pointer<_T>::type>::type;
|
||||
public:
|
||||
@@ -111,8 +97,11 @@ namespace ams::kern::svc {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _T> /* requires Aligned8Pointer<_T> */
|
||||
class KUserPointerImpl : impl::KUserPointerTag {
|
||||
template<typename _T>
|
||||
class KUserPointerImpl;
|
||||
|
||||
template<typename _T> requires Aligned8Pointer<_T>
|
||||
class KUserPointerImpl<_T> : impl::KUserPointerTag {
|
||||
private:
|
||||
using Traits = KUserPointerImplTraits<_T>;
|
||||
protected:
|
||||
@@ -170,11 +159,11 @@ namespace ams::kern::svc {
|
||||
|
||||
}
|
||||
|
||||
template<typename T, typename = void>
|
||||
class KUserPointer;
|
||||
template<typename T>
|
||||
struct KUserPointer;
|
||||
|
||||
template<typename T> /* requires impl::ConstPointer<T> */
|
||||
struct KUserPointer<T, typename std::enable_if<impl::IsConstPointer<T>>::type> : public impl::KUserPointerImpl<T> {
|
||||
template<typename T> requires impl::ConstPointer<T>
|
||||
struct KUserPointer<T> : public impl::KUserPointerImpl<T> {
|
||||
public:
|
||||
static constexpr bool IsInput = true;
|
||||
public:
|
||||
@@ -186,8 +175,8 @@ namespace ams::kern::svc {
|
||||
using impl::KUserPointerImpl<T>::GetUnsafePointer;
|
||||
};
|
||||
|
||||
template<typename T> /* requires impl::NonConstPointer<T> */
|
||||
struct KUserPointer<T, typename std::enable_if<impl::IsNonConstPointer<T>>::type> : public impl::KUserPointerImpl<T> {
|
||||
template<typename T> requires impl::NonConstPointer<T>
|
||||
struct KUserPointer<T> : public impl::KUserPointerImpl<T> {
|
||||
public:
|
||||
static constexpr bool IsInput = false;
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user