From 2916512fb7793c8d4f405fc42acfbda1eab179ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 7 Nov 2021 02:19:34 +0100 Subject: [PATCH] Minor header fixes to reduce parsing issues with Clang (#1700) * Work around Clang's incomplete C++20 support for omitting typename * vapours: fix Clang error about missing return in constexpr function * stratosphere: fix call to non-constexpr strlen in constexpr function strlen being constexpr is a non-compliant GCC extension; Clang explicitly rejects it: https://reviews.llvm.org/D23692 * stratosphere: add a bunch of missing override specifiers * stratosphere: work around Clang consteval bug Minimal example: https://godbolt.org/z/MoM64v93M The issue seems to be that Clang does not consider f(x) to be a constant expression if x comes from a template argument that isn't a non-type auto template argument (???) We can work around this by relaxing GetMessageHeaderForCheck (by using constexpr instead of consteval). This produces no functional changes because the result of GetMessageHeaderForCheck() is assigned to a constexpr variable, so the result is guaranteed to be computed at compile-time. * stratosphere: fix missing require clauses in definitions GCC not requiring the require clauses to be repeated for member definitions is actually a compiler bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96830 Clang rejects declarations with missing require clauses. * 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) * stratosphere: fix static constexpr member variable with incomplete type GCC accepts this for some reason (because of the lambda?) but Clang correctly rejects this. --- .../nintendo/nx/kern_k_device_page_table.cpp | 4 +- .../nintendo/nx/kern_k_system_control.cpp | 8 ++-- ...kern_k_memory_layout.board.nintendo_nx.cpp | 4 +- .../source/kern_k_page_table_base.cpp | 12 ++--- .../source/kern_k_system_control_base.cpp | 6 +-- libmesosphere/source/kern_k_thread.cpp | 2 +- .../svc/kern_svc_address_translation.cpp | 2 +- libmesosphere/source/svc/kern_svc_process.cpp | 2 +- .../stratosphere/settings/settings_types.hpp | 46 +++++++++---------- .../sf/cmif/sf_cmif_domain_manager.hpp | 4 +- .../stratosphere/sf/sf_lmem_utility.hpp | 6 +-- .../stratosphere/sf/sf_mem_utility.hpp | 4 +- .../sf/sf_object_impl_factory.hpp | 2 +- .../include/stratosphere/sm/sm_types.hpp | 4 +- .../stratosphere/time/time_calendar_time.hpp | 2 +- .../impl/tipc_impl_command_serialization.hpp | 4 +- .../tipc/tipc_deferral_manager.hpp | 4 +- .../stratosphere/tipc/tipc_server_manager.hpp | 4 +- .../htclow/ctrl/htclow_ctrl_state_machine.cpp | 2 +- .../ncm/ncm_content_meta_database_impl.cpp | 2 +- .../vapours/results/results_common.hpp | 6 ++- .../util/util_intrusive_red_black_tree.hpp | 2 +- .../include/vapours/util/util_optional.hpp | 2 +- 23 files changed, 67 insertions(+), 67 deletions(-) diff --git a/libmesosphere/source/board/nintendo/nx/kern_k_device_page_table.cpp b/libmesosphere/source/board/nintendo/nx/kern_k_device_page_table.cpp index 452ab289..bd132f3f 100644 --- a/libmesosphere/source/board/nintendo/nx/kern_k_device_page_table.cpp +++ b/libmesosphere/source/board/nintendo/nx/kern_k_device_page_table.cpp @@ -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; }; diff --git a/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp b/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp index ed1fc14b..432fe576 100644 --- a/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp +++ b/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp @@ -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); } -} \ No newline at end of file +} diff --git a/libmesosphere/source/kern_k_memory_layout.board.nintendo_nx.cpp b/libmesosphere/source/kern_k_memory_layout.board.nintendo_nx.cpp index a0b4d303..0f551fe9 100644 --- a/libmesosphere/source/kern_k_memory_layout.board.nintendo_nx.cpp +++ b/libmesosphere/source/kern_k_memory_layout.board.nintendo_nx.cpp @@ -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 { } -} \ No newline at end of file +} diff --git a/libmesosphere/source/kern_k_page_table_base.cpp b/libmesosphere/source/kern_k_page_table_base.cpp index 15099676..192487d8 100644 --- a/libmesosphere/source/kern_k_page_table_base.cpp +++ b/libmesosphere/source/kern_k_page_table_base.cpp @@ -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()); diff --git a/libmesosphere/source/kern_k_system_control_base.cpp b/libmesosphere/source/kern_k_system_control_base.cpp index a0cf3dfc..e2016612 100644 --- a/libmesosphere/source/kern_k_system_control_base.cpp +++ b/libmesosphere/source/kern_k_system_control_base.cpp @@ -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); } -} \ No newline at end of file +} diff --git a/libmesosphere/source/kern_k_thread.cpp b/libmesosphere/source/kern_k_thread.cpp index e6160548..3f892f24 100644 --- a/libmesosphere/source/kern_k_thread.cpp +++ b/libmesosphere/source/kern_k_thread.cpp @@ -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); diff --git a/libmesosphere/source/svc/kern_svc_address_translation.cpp b/libmesosphere/source/svc/kern_svc_address_translation.cpp index a1a6dca0..1e529ada 100644 --- a/libmesosphere/source/svc/kern_svc_address_translation.cpp +++ b/libmesosphere/source/svc/kern_svc_address_translation.cpp @@ -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()); diff --git a/libmesosphere/source/svc/kern_svc_process.cpp b/libmesosphere/source/svc/kern_svc_process.cpp index 6aaf240e..4cff6a1d 100644 --- a/libmesosphere/source/svc/kern_svc_process.cpp +++ b/libmesosphere/source/svc/kern_svc_process.cpp @@ -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: diff --git a/libstratosphere/include/stratosphere/settings/settings_types.hpp b/libstratosphere/include/stratosphere/settings/settings_types.hpp index 247063ab..6441fbb3 100644 --- a/libstratosphere/include/stratosphere/settings/settings_types.hpp +++ b/libstratosphere/include/stratosphere/settings/settings_types.hpp @@ -62,20 +62,16 @@ namespace ams::settings { char name[MaxLength]; - static constexpr LanguageCode Encode(const char *name, size_t name_size) { + static constexpr LanguageCode Encode(util::string_view name) { LanguageCode out{}; - for (size_t i = 0; i < MaxLength && i < name_size; i++) { + for (size_t i = 0; i < MaxLength && i < name.size(); i++) { out.name[i] = name[i]; } return out; } - static constexpr LanguageCode Encode(const char *name) { - return Encode(name, std::strlen(name)); - } - template - static constexpr inline LanguageCode EncodeLanguage = [] { + static constexpr inline LanguageCode EncodeLanguage() { if constexpr (false) { /* ... */ } #define AMS_MATCH_LANGUAGE(lang, enc) else if constexpr (Lang == Language_##lang) { return LanguageCode::Encode(enc); } AMS_MATCH_LANGUAGE(Japanese, "ja") @@ -98,28 +94,28 @@ namespace ams::settings { AMS_MATCH_LANGUAGE(TraditionalChinese, "zh-Hant") #undef AMS_MATCH_LANGUAGE else { static_assert(Lang != Language_Japanese); } - }(); + } static constexpr inline LanguageCode Encode(const Language language) { constexpr LanguageCode EncodedLanguages[Language_Count] = { - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, - EncodeLanguage, + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), + EncodeLanguage(), /* 4.0.0+ */ - EncodeLanguage, - EncodeLanguage, + EncodeLanguage(), + EncodeLanguage(), }; return EncodedLanguages[language]; } diff --git a/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_domain_manager.hpp b/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_domain_manager.hpp index b1b687af..287fd40c 100644 --- a/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_domain_manager.hpp +++ b/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_domain_manager.hpp @@ -54,11 +54,11 @@ namespace ams::sf::cmif { void DisposeImpl(); - virtual void AddReference() { + virtual void AddReference() override { ServiceObjectImplBase2::AddReferenceImpl(); } - virtual void Release() { + virtual void Release() override { if (ServiceObjectImplBase2::ReleaseImpl()) { this->DisposeImpl(); } diff --git a/libstratosphere/include/stratosphere/sf/sf_lmem_utility.hpp b/libstratosphere/include/stratosphere/sf/sf_lmem_utility.hpp index 27839e46..6dcdbca8 100644 --- a/libstratosphere/include/stratosphere/sf/sf_lmem_utility.hpp +++ b/libstratosphere/include/stratosphere/sf/sf_lmem_utility.hpp @@ -43,7 +43,7 @@ namespace ams::sf { return lmem::FreeToExpHeap(m_handle, buffer); } - virtual bool IsEqualImpl(const MemoryResource &resource) const { + virtual bool IsEqualImpl(const MemoryResource &resource) const override { return this == std::addressof(resource); } }; @@ -76,9 +76,9 @@ namespace ams::sf { return lmem::FreeToUnitHeap(m_handle, buffer); } - virtual bool IsEqualImpl(const MemoryResource &resource) const { + virtual bool IsEqualImpl(const MemoryResource &resource) const override { return this == std::addressof(resource); } }; -} \ No newline at end of file +} diff --git a/libstratosphere/include/stratosphere/sf/sf_mem_utility.hpp b/libstratosphere/include/stratosphere/sf/sf_mem_utility.hpp index c745ca59..7e6f7178 100644 --- a/libstratosphere/include/stratosphere/sf/sf_mem_utility.hpp +++ b/libstratosphere/include/stratosphere/sf/sf_mem_utility.hpp @@ -37,9 +37,9 @@ namespace ams::sf { return m_standard_allocator->Free(buffer); } - virtual bool IsEqualImpl(const MemoryResource &resource) const { + virtual bool IsEqualImpl(const MemoryResource &resource) const override { return this == std::addressof(resource); } }; -} \ No newline at end of file +} diff --git a/libstratosphere/include/stratosphere/sf/sf_object_impl_factory.hpp b/libstratosphere/include/stratosphere/sf/sf_object_impl_factory.hpp index 6c442fac..c0fb5a60 100644 --- a/libstratosphere/include/stratosphere/sf/sf_object_impl_factory.hpp +++ b/libstratosphere/include/stratosphere/sf/sf_object_impl_factory.hpp @@ -31,7 +31,7 @@ namespace ams::sf { public: class Object; using Allocator = StatelessDummyAllocator; - using StatelessAllocator = typename Policy::StatelessAllocator; + using StatelessAllocator = typename Policy::template StatelessAllocator; class Object final : private ::ams::sf::impl::ServiceObjectImplBase2, public Base { NON_COPYABLE(Object); diff --git a/libstratosphere/include/stratosphere/sm/sm_types.hpp b/libstratosphere/include/stratosphere/sm/sm_types.hpp index f9154637..675802be 100644 --- a/libstratosphere/include/stratosphere/sm/sm_types.hpp +++ b/libstratosphere/include/stratosphere/sm/sm_types.hpp @@ -40,8 +40,8 @@ namespace ams::sm { return out; } - static constexpr ServiceName Encode(const char *name) { - return Encode(name, std::strlen(name)); + static constexpr ServiceName Encode(util::string_view name) { + return Encode(name.data(), name.size()); } }; diff --git a/libstratosphere/include/stratosphere/time/time_calendar_time.hpp b/libstratosphere/include/stratosphere/time/time_calendar_time.hpp index cb69b107..56568b08 100644 --- a/libstratosphere/include/stratosphere/time/time_calendar_time.hpp +++ b/libstratosphere/include/stratosphere/time/time_calendar_time.hpp @@ -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(time.year) << 40) | (static_cast(time.month) << 32) | (static_cast(time.day) << 24) | diff --git a/libstratosphere/include/stratosphere/tipc/impl/tipc_impl_command_serialization.hpp b/libstratosphere/include/stratosphere/tipc/impl/tipc_impl_command_serialization.hpp index 6667dc39..52b4515e 100644 --- a/libstratosphere/include/stratosphere/tipc/impl/tipc_impl_command_serialization.hpp +++ b/libstratosphere/include/stratosphere/tipc/impl/tipc_impl_command_serialization.hpp @@ -472,7 +472,7 @@ namespace ams::tipc::impl { using OutRawHolderType = OutRawHolder; using OutHandleHolderType = OutHandleHolder; private: - static consteval u64 GetMessageHeaderForCheck(const svc::ipc::MessageBuffer::MessageHeader &header) { + static constexpr u64 GetMessageHeaderForCheck(const svc::ipc::MessageBuffer::MessageHeader &header) { using Value = util::BitPack32::Field<0, BITSIZEOF(util::BitPack32)>; const util::BitPack32 *data = header.GetData(); @@ -482,7 +482,7 @@ namespace ams::tipc::impl { return static_cast(lower) | (static_cast(upper) << BITSIZEOF(u32)); } - static consteval u32 GetSpecialHeaderForCheck(const svc::ipc::MessageBuffer::SpecialHeader &header) { + static constexpr u32 GetSpecialHeaderForCheck(const svc::ipc::MessageBuffer::SpecialHeader &header) { using Value = util::BitPack32::Field<0, BITSIZEOF(util::BitPack32)>; return header.GetHeader()->Get(); diff --git a/libstratosphere/include/stratosphere/tipc/tipc_deferral_manager.hpp b/libstratosphere/include/stratosphere/tipc/tipc_deferral_manager.hpp index c087c394..e07f4d4a 100644 --- a/libstratosphere/include/stratosphere/tipc/tipc_deferral_manager.hpp +++ b/libstratosphere/include/stratosphere/tipc/tipc_deferral_manager.hpp @@ -167,12 +167,12 @@ namespace ams::tipc { return AMS_OFFSETOF(DeferralManagerBase, m_objects_base); } - template + template requires (N > 0) consteval size_t DeferralManager::GetObjectPointersOffset() { return AMS_OFFSETOF(DeferralManager, m_objects); } - template + template requires (N > 0) inline DeferralManager::DeferralManager() : DeferralManagerBase() { static_assert(GetObjectPointersOffset() == GetObjectPointersOffsetBase()); static_assert(sizeof(DeferralManager) == sizeof(DeferralManagerBase) + N * sizeof(DeferrableBase *)); diff --git a/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp b/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp index 53c6b3f9..18deb2e6 100644 --- a/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp +++ b/libstratosphere/include/stratosphere/tipc/tipc_server_manager.hpp @@ -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)); @@ -747,7 +747,7 @@ namespace ams::tipc { using PortManager = PortManagerImpl; private: PortManager m_port_manager; - PortInfo::Allocator m_port_allocator; + typename PortInfo::Allocator m_port_allocator; public: constexpr ServerManagerImpl() : m_port_manager(), m_port_allocator() { /* ... */ } diff --git a/libstratosphere/source/htclow/ctrl/htclow_ctrl_state_machine.cpp b/libstratosphere/source/htclow/ctrl/htclow_ctrl_state_machine.cpp index 0014b41d..3cb4fc09 100644 --- a/libstratosphere/source/htclow/ctrl/htclow_ctrl_state_machine.cpp +++ b/libstratosphere/source/htclow/ctrl/htclow_ctrl_state_machine.cpp @@ -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; diff --git a/libstratosphere/source/ncm/ncm_content_meta_database_impl.cpp b/libstratosphere/source/ncm/ncm_content_meta_database_impl.cpp index 60fbfdc8..4e56f9cb 100644 --- a/libstratosphere/source/ncm/ncm_content_meta_database_impl.cpp +++ b/libstratosphere/source/ncm/ncm_content_meta_database_impl.cpp @@ -308,7 +308,7 @@ namespace ams::ncm { out_orphaned[i] = true; } - auto IsOrphanedContent = [] ALWAYS_INLINE_LAMBDA (const sf::InArray &list, const ncm::ContentId &id) -> util::optional { + auto IsOrphanedContent = [](const sf::InArray &list, const ncm::ContentId &id) ALWAYS_INLINE_LAMBDA -> util::optional { /* Check if any input content ids match our found content id. */ for (size_t i = 0; i < list.GetSize(); i++) { if (list[i] == id) { diff --git a/libvapours/include/vapours/results/results_common.hpp b/libvapours/include/vapours/results/results_common.hpp index 20601091..5112851c 100644 --- a/libvapours/include/vapours/results/results_common.hpp +++ b/libvapours/include/vapours/results/results_common.hpp @@ -177,7 +177,11 @@ namespace ams { static_assert(Value != Base::SuccessValue, "Value != Base::SuccessValue"); public: constexpr ALWAYS_INLINE operator Result() const { return MakeResult(Value); } - constexpr ALWAYS_INLINE operator ResultSuccess() const { OnResultAbort(Value); } + constexpr ALWAYS_INLINE operator ResultSuccess() const { + OnResultAbort(Value); + __builtin_unreachable(); + return ResultSuccess(); + } constexpr ALWAYS_INLINE bool IsSuccess() const { return false; } constexpr ALWAYS_INLINE bool IsFailure() const { return !this->IsSuccess(); } diff --git a/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp b/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp index f22f8ea6..00a7201e 100644 --- a/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp +++ b/libvapours/include/vapours/util/util_intrusive_red_black_tree.hpp @@ -295,7 +295,7 @@ namespace ams::util { private: constexpr explicit ALWAYS_INLINE Iterator(ImplIterator it) : m_impl(it) { /* ... */ } - constexpr explicit ALWAYS_INLINE Iterator(ImplIterator::pointer p) : m_impl(p) { /* ... */ } + constexpr explicit ALWAYS_INLINE Iterator(typename ImplIterator::pointer p) : m_impl(p) { /* ... */ } constexpr ALWAYS_INLINE ImplIterator GetImplIterator() const { return m_impl; diff --git a/libvapours/include/vapours/util/util_optional.hpp b/libvapours/include/vapours/util/util_optional.hpp index f5f0e9e3..873c1a1b 100644 --- a/libvapours/include/vapours/util/util_optional.hpp +++ b/libvapours/include/vapours/util/util_optional.hpp @@ -225,7 +225,7 @@ namespace ams::util { template class OptionalBaseImpl { protected: - using StoredType = std::remove_const::type; + using StoredType = std::remove_const_t; template constexpr void ConstructImpl(Args &&... args) { static_cast(this)->m_payload.Construct(std::forward(args)...); }