1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-18 08:22:04 +00:00

ams: assume gcc 11

This commit is contained in:
Michael Scire 2021-04-27 23:16:31 -07:00 committed by SciresM
parent 21f3d29df7
commit 0767d9f8da
4 changed files with 20 additions and 25 deletions

View file

@ -20,14 +20,7 @@ namespace ams::dd {
using ProcessHandle = ::Handle; using ProcessHandle = ::Handle;
/* TODO gcc-11: using MemoryPermission = os::MemoryPermission; using enum os::MemoryPermission; */ using MemoryPermission = os::MemoryPermission;
using enum os::MemoryPermission;
enum MemoryPermission {
MemoryPermission_None = 0,
MemoryPermission_ReadOnly = (1u << 0),
MemoryPermission_WriteOnly = (1u << 1),
MemoryPermission_ReadWrite = MemoryPermission_ReadOnly | MemoryPermission_WriteOnly,
};
} }

View file

@ -54,24 +54,30 @@ namespace ams::tipc {
static constexpr inline bool IsDeferralSupported = !std::same_as<DeferralManagerType, DummyDeferralManager>; static constexpr inline bool IsDeferralSupported = !std::same_as<DeferralManagerType, DummyDeferralManager>;
using ResumeKey = typename DeferralManagerType::Key; using ResumeKey = typename DeferralManagerType::Key;
static ALWAYS_INLINE uintptr_t ConvertKeyToMessage(ResumeKey key) { static constexpr ALWAYS_INLINE uintptr_t ConvertKeyToMessage(ResumeKey key) {
static_assert(sizeof(key) <= sizeof(uintptr_t)); static_assert(sizeof(key) <= sizeof(uintptr_t));
static_assert(std::is_trivial<ResumeKey>::value); static_assert(std::is_trivial<ResumeKey>::value);
/* TODO: std::bit_cast */ if constexpr (sizeof(key) == sizeof(uintptr_t)) {
uintptr_t converted = 0; return std::bit_cast<uintptr_t>(key);
std::memcpy(std::addressof(converted), std::addressof(key), sizeof(key)); } else {
return converted; uintptr_t converted = 0;
std::memcpy(std::addressof(converted), std::addressof(key), sizeof(key));
return converted;
}
} }
static ALWAYS_INLINE ResumeKey ConvertMessageToKey(uintptr_t message) { static constexpr ALWAYS_INLINE ResumeKey ConvertMessageToKey(uintptr_t message) {
static_assert(sizeof(ResumeKey) <= sizeof(uintptr_t)); static_assert(sizeof(ResumeKey) <= sizeof(uintptr_t));
static_assert(std::is_trivial<ResumeKey>::value); static_assert(std::is_trivial<ResumeKey>::value);
/* TODO: std::bit_cast */ if constexpr (sizeof(ResumeKey) == sizeof(uintptr_t)) {
ResumeKey converted = {}; return std::bit_cast<ResumeKey>(message);
std::memcpy(std::addressof(converted), std::addressof(message), sizeof(converted)); } else {
return converted; ResumeKey converted = {};
std::memcpy(std::addressof(converted), std::addressof(message), sizeof(converted));
return converted;
}
} }
template<size_t Ix> requires (Ix < NumPorts) template<size_t Ix> requires (Ix < NumPorts)

View file

@ -308,7 +308,7 @@ namespace ams::ncm {
out_orphaned[i] = true; out_orphaned[i] = true;
} }
auto IsOrphanedContent = [](const sf::InArray<ContentId> &list, const ncm::ContentId &id) ALWAYS_INLINE_LAMBDA { auto IsOrphanedContent = [] ALWAYS_INLINE_LAMBDA (const sf::InArray<ContentId> &list, const ncm::ContentId &id) -> std::optional<size_t> {
/* Check if any input content ids match our found content id. */ /* Check if any input content ids match our found content id. */
for (size_t i = 0; i < list.GetSize(); i++) { for (size_t i = 0; i < list.GetSize(); i++) {
if (list[i] == id) { if (list[i] == id) {
@ -316,9 +316,7 @@ namespace ams::ncm {
} }
} }
/* TODO: C++20 (gcc 10) fixes ALWAYS_INLINE_LAMBDA in conjunction with trailing return types. */ return std::nullopt;
/* This should be changed to std::nullopt once possible. */
return std::optional<size_t>(std::nullopt);
}; };
/* Iterate over all entries. */ /* Iterate over all entries. */

View file

@ -133,7 +133,6 @@ namespace ams::util {
template<typename T> requires std::integral<T> template<typename T> requires std::integral<T>
constexpr ALWAYS_INLINE int PopCount(T x) { constexpr ALWAYS_INLINE int PopCount(T x) {
/* TODO: C++20 std::bit_cast */
using U = typename std::make_unsigned<T>::type; using U = typename std::make_unsigned<T>::type;
U u = static_cast<U>(x); U u = static_cast<U>(x);
@ -174,7 +173,6 @@ namespace ams::util {
} }
return PopCount(static_cast<T>(~x)); return PopCount(static_cast<T>(~x));
} else { } else {
/* TODO: C++20 std::bit_cast */
using U = typename std::make_unsigned<T>::type; using U = typename std::make_unsigned<T>::type;
const U u = static_cast<U>(x); const U u = static_cast<U>(x);
if constexpr (std::is_same<U, unsigned long long>::value) { if constexpr (std::is_same<U, unsigned long long>::value) {