mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-08-11 02:28:42 +00:00
Fix ALWAYS_INLINE_LAMBDA and parameter list relative order
While GCC doesn't seem to care about the position of the always_inline attribute relative to the parameter list, Clang is very picky and requires the attribute to appear after the parameter list (and before a trailing return type)
This commit is contained in:
parent
2b7acebb75
commit
d787bec63e
14 changed files with 29 additions and 29 deletions
|
@ -548,11 +548,11 @@ namespace ams::kern::board::nintendo::nx {
|
|||
|
||||
/* Print the interrupt. */
|
||||
{
|
||||
constexpr auto GetBits = [] ALWAYS_INLINE_LAMBDA (u32 value, size_t ofs, size_t count) {
|
||||
constexpr auto GetBits = [](u32 value, size_t ofs, size_t count) ALWAYS_INLINE_LAMBDA {
|
||||
return (value >> ofs) & ((1u << count) - 1);
|
||||
};
|
||||
|
||||
constexpr auto GetBit = [GetBits] ALWAYS_INLINE_LAMBDA (u32 value, size_t ofs) {
|
||||
constexpr auto GetBit = [GetBits](u32 value, size_t ofs) ALWAYS_INLINE_LAMBDA {
|
||||
return (value >> ofs) & 1u;
|
||||
};
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ namespace ams::kern::board::nintendo::nx {
|
|||
|
||||
size_t KSystemControl::Init::GetApplicationPoolSize() {
|
||||
/* Get the base pool size. */
|
||||
const size_t base_pool_size = [] ALWAYS_INLINE_LAMBDA () -> size_t {
|
||||
const size_t base_pool_size = []() ALWAYS_INLINE_LAMBDA -> size_t {
|
||||
switch (GetMemoryArrangeForInit()) {
|
||||
case smc::MemoryArrangement_4GB:
|
||||
default:
|
||||
|
@ -336,7 +336,7 @@ namespace ams::kern::board::nintendo::nx {
|
|||
|
||||
size_t KSystemControl::Init::GetAppletPoolSize() {
|
||||
/* Get the base pool size. */
|
||||
const size_t base_pool_size = [] ALWAYS_INLINE_LAMBDA () -> size_t {
|
||||
const size_t base_pool_size = []() ALWAYS_INLINE_LAMBDA -> size_t {
|
||||
switch (GetMemoryArrangeForInit()) {
|
||||
case smc::MemoryArrangement_4GB:
|
||||
default:
|
||||
|
@ -490,7 +490,7 @@ namespace ams::kern::board::nintendo::nx {
|
|||
|
||||
|
||||
if (AMS_LIKELY(s_initialized_random_generator)) {
|
||||
return KSystemControlBase::GenerateUniformRange(min, max, [] ALWAYS_INLINE_LAMBDA () -> u64 { return s_random_generator.GenerateRandomU64(); });
|
||||
return KSystemControlBase::GenerateUniformRange(min, max, []() ALWAYS_INLINE_LAMBDA -> u64 { return s_random_generator.GenerateRandomU64(); });
|
||||
} else {
|
||||
return KSystemControlBase::GenerateUniformRange(min, max, GenerateRandomU64FromSmc);
|
||||
}
|
||||
|
@ -680,4 +680,4 @@ namespace ams::kern::board::nintendo::nx {
|
|||
Kernel::GetMemoryManager().Close(KPageTable::GetHeapPhysicalAddress(address), size / PageSize);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ namespace ams::kern {
|
|||
static_assert(KMemoryManager::Pool_Secure == KMemoryManager::Pool_System);
|
||||
|
||||
/* Get Secure pool size. */
|
||||
const size_t secure_pool_size = [] ALWAYS_INLINE_LAMBDA (auto target_firmware) -> size_t {
|
||||
const size_t secure_pool_size = [](auto target_firmware) ALWAYS_INLINE_LAMBDA -> size_t {
|
||||
constexpr size_t LegacySecureKernelSize = 8_MB; /* KPageBuffer pages, other small kernel allocations. */
|
||||
constexpr size_t LegacySecureMiscSize = 1_MB; /* Miscellaneous pages for secure process mapping. */
|
||||
constexpr size_t LegacySecureHeapSize = 24_MB; /* Heap pages for secure process mapping (fs). */
|
||||
|
@ -274,4 +274,4 @@ namespace ams::kern {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2398,7 +2398,7 @@ namespace ams::kern {
|
|||
size_t cur_size = next_entry.block_size - (GetInteger(cur_addr) & (next_entry.block_size - 1));
|
||||
size_t tot_size = cur_size;
|
||||
|
||||
auto PerformCopy = [&] ALWAYS_INLINE_LAMBDA () -> Result {
|
||||
auto PerformCopy = [&]() ALWAYS_INLINE_LAMBDA -> Result {
|
||||
/* Ensure the address is linear mapped. */
|
||||
R_UNLESS(IsLinearMappedPhysicalAddress(cur_addr), svc::ResultInvalidCurrentMemory());
|
||||
|
||||
|
@ -2484,7 +2484,7 @@ namespace ams::kern {
|
|||
size_t cur_size = next_entry.block_size - (GetInteger(cur_addr) & (next_entry.block_size - 1));
|
||||
size_t tot_size = cur_size;
|
||||
|
||||
auto PerformCopy = [&] ALWAYS_INLINE_LAMBDA () -> Result {
|
||||
auto PerformCopy = [&]() ALWAYS_INLINE_LAMBDA -> Result {
|
||||
/* Ensure the address is linear mapped. */
|
||||
R_UNLESS(IsLinearMappedPhysicalAddress(cur_addr), svc::ResultInvalidCurrentMemory());
|
||||
|
||||
|
@ -2943,7 +2943,7 @@ namespace ams::kern {
|
|||
size_t cur_size = next_entry.block_size - (GetInteger(cur_addr) & (next_entry.block_size - 1));
|
||||
size_t tot_size = cur_size;
|
||||
|
||||
auto PerformCopy = [&] ALWAYS_INLINE_LAMBDA () -> Result {
|
||||
auto PerformCopy = [&]() ALWAYS_INLINE_LAMBDA -> Result {
|
||||
/* Ensure the address is linear mapped. */
|
||||
R_UNLESS(IsLinearMappedPhysicalAddress(cur_addr), svc::ResultInvalidCurrentMemory());
|
||||
|
||||
|
@ -3023,7 +3023,7 @@ namespace ams::kern {
|
|||
size_t cur_size = next_entry.block_size - (GetInteger(cur_addr) & (next_entry.block_size - 1));
|
||||
size_t tot_size = cur_size;
|
||||
|
||||
auto PerformCopy = [&] ALWAYS_INLINE_LAMBDA () -> Result {
|
||||
auto PerformCopy = [&]() ALWAYS_INLINE_LAMBDA -> Result {
|
||||
/* Ensure the address is linear mapped. */
|
||||
R_UNLESS(IsLinearMappedPhysicalAddress(cur_addr), svc::ResultInvalidCurrentMemory());
|
||||
|
||||
|
@ -3092,7 +3092,7 @@ namespace ams::kern {
|
|||
size_t cur_size = next_entry.block_size - (GetInteger(cur_addr) & (next_entry.block_size - 1));
|
||||
size_t tot_size = cur_size;
|
||||
|
||||
auto PerformCopy = [&] ALWAYS_INLINE_LAMBDA () -> Result {
|
||||
auto PerformCopy = [&]() ALWAYS_INLINE_LAMBDA -> Result {
|
||||
/* Ensure the address is linear mapped. */
|
||||
R_UNLESS(IsLinearMappedPhysicalAddress(cur_addr), svc::ResultInvalidCurrentMemory());
|
||||
|
||||
|
@ -3172,7 +3172,7 @@ namespace ams::kern {
|
|||
size_t cur_size = next_entry.block_size - (GetInteger(cur_addr) & (next_entry.block_size - 1));
|
||||
size_t tot_size = cur_size;
|
||||
|
||||
auto PerformCopy = [&] ALWAYS_INLINE_LAMBDA () -> Result {
|
||||
auto PerformCopy = [&]() ALWAYS_INLINE_LAMBDA -> Result {
|
||||
/* Ensure the address is linear mapped. */
|
||||
R_UNLESS(IsLinearMappedPhysicalAddress(cur_addr), svc::ResultInvalidCurrentMemory());
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace ams::kern {
|
|||
s_initialized_random_generator = true;
|
||||
}
|
||||
|
||||
return KSystemControlBase::GenerateUniformRange(min, max, [] ALWAYS_INLINE_LAMBDA () -> u64 { return s_random_generator.GenerateRandomU64(); });
|
||||
return KSystemControlBase::GenerateUniformRange(min, max, []() ALWAYS_INLINE_LAMBDA -> u64 { return s_random_generator.GenerateRandomU64(); });
|
||||
}
|
||||
|
||||
/* System Initialization. */
|
||||
|
@ -194,7 +194,7 @@ namespace ams::kern {
|
|||
KScopedInterruptDisable intr_disable;
|
||||
KScopedSpinLock lk(s_random_lock);
|
||||
|
||||
return KSystemControlBase::GenerateUniformRange(min, max, [] ALWAYS_INLINE_LAMBDA () -> u64 { return s_random_generator.GenerateRandomU64(); });
|
||||
return KSystemControlBase::GenerateUniformRange(min, max, []() ALWAYS_INLINE_LAMBDA -> u64 { return s_random_generator.GenerateRandomU64(); });
|
||||
}
|
||||
|
||||
u64 KSystemControlBase::GenerateRandomU64() {
|
||||
|
@ -292,4 +292,4 @@ namespace ams::kern {
|
|||
Kernel::GetMemoryManager().Close(KPageTable::GetHeapPhysicalAddress(address), size / PageSize);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1183,7 +1183,7 @@ namespace ams::kern {
|
|||
KScopedSchedulerLock sl;
|
||||
|
||||
/* Determine if this is the first termination request. */
|
||||
const bool first_request = [&] ALWAYS_INLINE_LAMBDA () -> bool {
|
||||
const bool first_request = [&]() ALWAYS_INLINE_LAMBDA -> bool {
|
||||
/* Perform an atomic compare-and-swap from false to true. */
|
||||
bool expected = false;
|
||||
return m_termination_requested.CompareExchangeStrong(expected, true);
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace ams::kern::svc {
|
|||
/* Check whether the address is aligned. */
|
||||
const bool aligned = util::IsAligned(phys_addr, PageSize);
|
||||
|
||||
auto QueryIoMappingFromPageTable = [&] ALWAYS_INLINE_LAMBDA (uint64_t phys_addr, size_t size) -> Result {
|
||||
auto QueryIoMappingFromPageTable = [&](uint64_t phys_addr, size_t size) ALWAYS_INLINE_LAMBDA -> Result {
|
||||
/* The size must be non-zero. */
|
||||
R_UNLESS(size > 0, svc::ResultInvalidSize());
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ namespace ams::kern::svc {
|
|||
KResourceLimit *process_resource_limit = resource_limit.IsNotNull() ? resource_limit.GetPointerUnsafe() : std::addressof(Kernel::GetSystemResourceLimit());
|
||||
|
||||
/* Get the pool for the process. */
|
||||
const auto pool = [] ALWAYS_INLINE_LAMBDA (u32 flags) -> KMemoryManager::Pool {
|
||||
const auto pool = [](u32 flags) ALWAYS_INLINE_LAMBDA -> KMemoryManager::Pool {
|
||||
if (GetTargetFirmware() >= TargetFirmware_5_0_0) {
|
||||
switch (flags & ams::svc::CreateProcessFlag_PoolPartitionMask) {
|
||||
case ams::svc::CreateProcessFlag_PoolPartitionApplication:
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace ams::time {
|
|||
AMS_ASSERT(rhs.IsValid());
|
||||
}
|
||||
|
||||
constexpr auto ToUint64 = [] ALWAYS_INLINE_LAMBDA (const time::CalendarTime &time) {
|
||||
constexpr auto ToUint64 = [](const time::CalendarTime &time) ALWAYS_INLINE_LAMBDA {
|
||||
return (static_cast<u64>(time.year) << 40) |
|
||||
(static_cast<u64>(time.month) << 32) |
|
||||
(static_cast<u64>(time.day) << 24) |
|
||||
|
|
|
@ -686,7 +686,7 @@ namespace ams::tipc {
|
|||
}
|
||||
|
||||
/* Try to reply/receive. */
|
||||
const Result result = [&] ALWAYS_INLINE_LAMBDA () -> Result {
|
||||
const Result result = [&]() ALWAYS_INLINE_LAMBDA -> Result {
|
||||
os::MultiWaitHolderType *signaled_holder = nullptr;
|
||||
ON_SCOPE_EXIT { AMS_ABORT_UNLESS(signaled_holder == nullptr); };
|
||||
return m_object_manager->ReplyAndReceive(std::addressof(signaled_holder), out_object, reply_target, std::addressof(m_multi_wait));
|
||||
|
|
|
@ -196,7 +196,7 @@ namespace ams::htclow::ctrl {
|
|||
/* Lock ourselves. */
|
||||
std::scoped_lock lk(m_mutex);
|
||||
|
||||
auto IsSupportedServiceChannel = [] ALWAYS_INLINE_LAMBDA (const impl::ChannelInternalType &channel, const impl::ChannelInternalType *supported, int num_supported) -> bool {
|
||||
auto IsSupportedServiceChannel = [](const impl::ChannelInternalType &channel, const impl::ChannelInternalType *supported, int num_supported) ALWAYS_INLINE_LAMBDA -> bool {
|
||||
for (auto i = 0; i < num_supported; ++i) {
|
||||
if (channel.module_id == supported[i].module_id && channel.channel_id == supported[i].channel_id) {
|
||||
return true;
|
||||
|
|
|
@ -308,7 +308,7 @@ namespace ams::ncm {
|
|||
out_orphaned[i] = true;
|
||||
}
|
||||
|
||||
auto IsOrphanedContent = [] ALWAYS_INLINE_LAMBDA (const sf::InArray<ContentId> &list, const ncm::ContentId &id) -> util::optional<size_t> {
|
||||
auto IsOrphanedContent = [](const sf::InArray<ContentId> &list, const ncm::ContentId &id) ALWAYS_INLINE_LAMBDA -> util::optional<size_t> {
|
||||
/* Check if any input content ids match our found content id. */
|
||||
for (size_t i = 0; i < list.GetSize(); i++) {
|
||||
if (list[i] == id) {
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace ams::mitm::sysupdater {
|
|||
ON_SCOPE_EXIT { std::free(data_buffer); };
|
||||
|
||||
/* Declare helper for result validation. */
|
||||
auto ValidateResult = [&] ALWAYS_INLINE_LAMBDA (Result result) -> Result {
|
||||
auto ValidateResult = [&](Result result) ALWAYS_INLINE_LAMBDA -> Result {
|
||||
*out_result = result;
|
||||
return result;
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace ams::sm {
|
|||
|
||||
Result GetServiceHandle(tipc::OutMoveHandle out_h, ServiceName service) {
|
||||
R_UNLESS(m_initialized, sm::ResultInvalidClient());
|
||||
return this->RegisterRetryIfDeferred(service, [&] ALWAYS_INLINE_LAMBDA () -> Result {
|
||||
return this->RegisterRetryIfDeferred(service, [&]() ALWAYS_INLINE_LAMBDA -> Result {
|
||||
return impl::GetServiceHandle(out_h.GetPointer(), m_process_id, service);
|
||||
});
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace ams::sm {
|
|||
/* Atmosphere commands. */
|
||||
Result AtmosphereInstallMitm(tipc::OutMoveHandle srv_h, tipc::OutMoveHandle qry_h, ServiceName service) {
|
||||
R_UNLESS(m_initialized, sm::ResultInvalidClient());
|
||||
return this->RegisterRetryIfDeferred(service, [&] ALWAYS_INLINE_LAMBDA () -> Result {
|
||||
return this->RegisterRetryIfDeferred(service, [&]() ALWAYS_INLINE_LAMBDA -> Result {
|
||||
return impl::InstallMitm(srv_h.GetPointer(), qry_h.GetPointer(), m_process_id, service);
|
||||
});
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace ams::sm {
|
|||
|
||||
Result AtmosphereWaitMitm(ServiceName service) {
|
||||
R_UNLESS(m_initialized, sm::ResultInvalidClient());
|
||||
return this->RegisterRetryIfDeferred(service, [&] ALWAYS_INLINE_LAMBDA () -> Result {
|
||||
return this->RegisterRetryIfDeferred(service, [&]() ALWAYS_INLINE_LAMBDA -> Result {
|
||||
return impl::WaitMitm(service);
|
||||
});
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ namespace ams::sm {
|
|||
|
||||
Result AtmosphereWaitService(ServiceName service) {
|
||||
R_UNLESS(m_initialized, sm::ResultInvalidClient());
|
||||
return this->RegisterRetryIfDeferred(service, [&] ALWAYS_INLINE_LAMBDA () -> Result {
|
||||
return this->RegisterRetryIfDeferred(service, [&]() ALWAYS_INLINE_LAMBDA -> Result {
|
||||
return impl::WaitService(service);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue