strat: compat with gcc 11

This commit is contained in:
Michael Scire 2021-04-26 20:05:56 -07:00
parent 4f16106702
commit 21f3d29df7
11 changed files with 26 additions and 21 deletions

View file

@ -117,7 +117,7 @@ namespace ams {
StackFrame cur_frame;
svc::lp64::MemoryInfo mem_info;
svc::PageInfo page_info;
if (R_SUCCEEDED(svc::QueryMemory(std::addressof(mem_info), std::addressof(page_info), cur_fp)) && (mem_info.perm & Perm_R) == Perm_R) {
if (R_SUCCEEDED(svc::QueryMemory(std::addressof(mem_info), std::addressof(page_info), cur_fp)) && (mem_info.perm & svc::MemoryPermission_Read) == svc::MemoryPermission_Read) {
std::memcpy(&cur_frame, reinterpret_cast<void *>(cur_fp), sizeof(cur_frame));
} else {
break;
@ -136,7 +136,7 @@ namespace ams {
{
svc::lp64::MemoryInfo mem_info;
svc::PageInfo page_info;
if (R_SUCCEEDED(svc::QueryMemory(std::addressof(mem_info), std::addressof(page_info), ams_ctx.sp)) && (mem_info.perm & Perm_R) == Perm_R) {
if (R_SUCCEEDED(svc::QueryMemory(std::addressof(mem_info), std::addressof(page_info), ams_ctx.sp)) && (mem_info.perm & svc::MemoryPermission_Read) == svc::MemoryPermission_Read) {
size_t copy_size = std::min(FatalErrorContext::MaxStackDumpSize, static_cast<size_t>(mem_info.addr + mem_info.size - ams_ctx.sp));
ams_ctx.stack_dump_size = copy_size;
std::memcpy(ams_ctx.stack_dump, reinterpret_cast<void *>(ams_ctx.sp), copy_size);

View file

@ -29,7 +29,7 @@ namespace ams::fs {
virtual Result GenerateCommonMountName(char *dst, size_t dst_size) override {
/* Determine how much space we need. */
const char *bis_mount_name = GetBisMountName(this->id);
const size_t needed_size = strnlen(bis_mount_name, MountNameLengthMax) + 2;
const size_t needed_size = util::Strnlen(bis_mount_name, MountNameLengthMax) + 2;
AMS_ABORT_UNLESS(dst_size >= needed_size);
/* Generate the name. */

View file

@ -219,10 +219,11 @@ namespace ams::htcs::client {
sf::SharedPointer<tma::ISocket> socket = nullptr;
/* Find the socket. */
s32 index;
{
std::scoped_lock lk(m_mutex);
if (auto index = this->Find(id, std::addressof(error_code)); index >= 0) {
if (index = this->Find(id, std::addressof(error_code)); index >= 0) {
/* Get the socket's object. */
VirtualSocket *virt_socket = m_socket_list + index;
socket = virt_socket->m_socket;

View file

@ -21,7 +21,8 @@
namespace ams::i2c::driver::board::nintendo::nx::impl {
class I2cBusAccessorManager : public IAllocator<I2cBusAccessor::BusAccessorList> {
/* ... */
public:
using IAllocator<I2cBusAccessor::BusAccessorList>::IAllocator;
};
}

View file

@ -20,7 +20,8 @@
namespace ams::i2c::driver::board::nintendo::nx::impl {
class I2cDevicePropertyManager : public IAllocator<I2cDeviceProperty::DevicePropertyList> {
/* ... */
public:
using IAllocator<I2cDeviceProperty::DevicePropertyList>::IAllocator;
};
}

View file

@ -20,6 +20,8 @@ namespace ams::i2c::driver::board::nintendo::nx::impl {
template<typename ListType>
class IAllocator {
NON_COPYABLE(IAllocator);
NON_MOVEABLE(IAllocator);
private:
using T = typename ListType::value_type;
private:

View file

@ -20,9 +20,9 @@ namespace ams::mem::impl {
namespace {
os::Mutex g_virt_mem_enabled_lock(false);
bool g_virt_mem_enabled_detected;
bool g_virt_mem_enabled;
constinit os::SdkMutex g_virt_mem_enabled_lock;
constinit bool g_virt_mem_enabled_detected = false;
constinit bool g_virt_mem_enabled = false;
void EnsureVirtualAddressMemoryDetected() {
std::scoped_lock lk(g_virt_mem_enabled_lock);
@ -48,7 +48,8 @@ namespace ams::mem::impl {
ALWAYS_INLINE os::MemoryPermission ConvertToOsPermission(Prot prot) {
static_assert(static_cast<int>(Prot_read) == static_cast<int>(os::MemoryPermission_ReadOnly));
static_assert(static_cast<int>(Prot_write) == static_cast<int>(os::MemoryPermission_WriteOnly));
return static_cast<os::MemoryPermission>(prot & os::MemoryPermission_ReadWrite);
static_assert((util::ToUnderlying(Prot_read) | util::ToUnderlying(Prot_write)) == util::ToUnderlying(os::MemoryPermission_ReadWrite));
return static_cast<os::MemoryPermission>(prot & (Prot_read | Prot_write));
}
}

View file

@ -477,7 +477,6 @@ namespace ams::pinmux::driver::board::nintendo::nx {
u32 reg_address;
u32 reg_mask;
u32 reg_value;
u8 safe_func;
const char *pad_name;
private:
bool IsValidRegisterAddress() const {