From 3a3a2ca99b0b6d0d77573c2b3422afb62200df8f Mon Sep 17 00:00:00 2001 From: hexkyz Date: Tue, 16 Jun 2026 21:10:23 +0100 Subject: [PATCH] ams: basic support for compiling with gcc 16 --- fusee/program/source/mtc/fusee_mtc_erista.cpp | 3 ++ libraries/libexosphere/source/se/se_rsa.cpp | 5 +++- .../source/arch/arm64/kern_k_page_table.cpp | 3 ++ .../source/kern_k_debug_base.cpp | 28 ++++++++++++------- .../source/hos/hos_version_api.cpp | 2 +- .../source/ncm/ncm_content_meta.cpp | 6 ++++ .../codegen/impl/svc_codegen_impl_layout.hpp | 5 +++- 7 files changed, 39 insertions(+), 13 deletions(-) diff --git a/fusee/program/source/mtc/fusee_mtc_erista.cpp b/fusee/program/source/mtc/fusee_mtc_erista.cpp index 2eb4bcef1..0981f3769 100644 --- a/fusee/program/source/mtc/fusee_mtc_erista.cpp +++ b/fusee/program/source/mtc/fusee_mtc_erista.cpp @@ -1355,6 +1355,9 @@ namespace ams::nxboot { uint32_t emc_zcal_wait_cnt_new = dst_timing->burst_regs.emc_zcal_wait_cnt; emc_zcal_wait_cnt_old &= ~0x7ff; emc_zcal_wait_cnt_new &= ~0x7ff; + + /* TODO: Unused variable. */ + AMS_UNUSED(emc_zcal_wait_cnt_old); if (dram_type == DRAM_TYPE_LPDDR4) { zq_wait_long = std::max(1, util::DivideUp(1000000, destination_clock_period)); diff --git a/libraries/libexosphere/source/se/se_rsa.cpp b/libraries/libexosphere/source/se/se_rsa.cpp index b3700078b..3317a46ba 100644 --- a/libraries/libexosphere/source/se/se_rsa.cpp +++ b/libraries/libexosphere/source/se/se_rsa.cpp @@ -104,7 +104,10 @@ namespace ams::se { value |= ((flags & KeySlotLockFlags_KeyRead) == 0) ? (1u << 0) : 0; value |= ((flags & KeySlotLockFlags_KeyRead) == 0) ? (1u << 1) : 0; value |= ((flags & KeySlotLockFlags_KeyRead) == 0) ? (1u << 2) : 0; - + + /* TODO: Unused variable. */ + AMS_UNUSED(value); + reg::Write(SE->SE_RSA_KEYTABLE_ACCESS[slot], SE_REG_BITS_ENUM_SEL(RSA_KEYTABLE_ACCESS_KEYREAD, (flags & KeySlotLockFlags_KeyRead) != 0, DISABLE, ENABLE), SE_REG_BITS_ENUM_SEL(RSA_KEYTABLE_ACCESS_KEYUPDATE, (flags & KeySlotLockFlags_KeyWrite) != 0, DISABLE, ENABLE), SE_REG_BITS_ENUM_SEL(RSA_KEYTABLE_ACCESS_KEYUSE, (flags & KeySlotLockFlags_KeyUse) != 0, DISABLE, ENABLE)); diff --git a/libraries/libmesosphere/source/arch/arm64/kern_k_page_table.cpp b/libraries/libmesosphere/source/arch/arm64/kern_k_page_table.cpp index b8bce7b56..6992281dd 100644 --- a/libraries/libmesosphere/source/arch/arm64/kern_k_page_table.cpp +++ b/libraries/libmesosphere/source/arch/arm64/kern_k_page_table.cpp @@ -729,6 +729,9 @@ namespace ams::kern::arch::arm64 { } } MESOSPHERE_ASSERT(mapped_pages == num_pages); + + /* TODO: Unused variable. */ + AMS_UNUSED(mapped_pages); /* Perform what coalescing we can. */ this->MergePages(orig_virt_addr, num_pages, page_list); diff --git a/libraries/libmesosphere/source/kern_k_debug_base.cpp b/libraries/libmesosphere/source/kern_k_debug_base.cpp index 88ec79185..453eb745c 100644 --- a/libraries/libmesosphere/source/kern_k_debug_base.cpp +++ b/libraries/libmesosphere/source/kern_k_debug_base.cpp @@ -756,11 +756,13 @@ namespace ams::kern { case ams::svc::DebugException_UndefinedSystemCall: { MESOSPHERE_ASSERT(num_params >= 3); - - info->info.exception.exception_address = params[1]; - - info->info.exception.exception_data_count = 1; - info->info.exception.exception_data[0] = params[2]; + + /* Keep the compiler happy, even though the assert has us covered. */ + if (num_params >= 3) { + info->info.exception.exception_address = params[1]; + info->info.exception.exception_data_count = 1; + info->info.exception.exception_data[0] = params[2]; + } } break; case ams::svc::DebugException_DebuggerAttached: @@ -773,9 +775,12 @@ namespace ams::kern { case ams::svc::DebugException_UserBreak: { MESOSPHERE_ASSERT(num_params >= 2); - - info->info.exception.exception_address = params[1]; - + + /* Keep the compiler happy, even though the assert has us covered. */ + if (num_params >= 2) { + info->info.exception.exception_address = params[1]; + } + info->info.exception.exception_data_count = 0; for (size_t i = 2; i < num_params; ++i) { info->info.exception.exception_data[info->info.exception.exception_data_count++] = params[i]; @@ -805,8 +810,11 @@ namespace ams::kern { default: { MESOSPHERE_ASSERT(num_params >= 2); - - info->info.exception.exception_address = params[1]; + + /* Keep the compiler happy, even though the assert has us covered. */ + if (num_params >= 2) { + info->info.exception.exception_address = params[1]; + } } break; } diff --git a/libraries/libstratosphere/source/hos/hos_version_api.cpp b/libraries/libstratosphere/source/hos/hos_version_api.cpp index db3d6f623..511559d49 100644 --- a/libraries/libstratosphere/source/hos/hos_version_api.cpp +++ b/libraries/libstratosphere/source/hos/hos_version_api.cpp @@ -47,7 +47,7 @@ namespace ams::hos { #endif exosphere::ApiInfo GetExosphereApiInfo(bool allow_approximate) { - exosphere::ApiInfo info; + exosphere::ApiInfo info = exosphere::ApiInfo{ util::BitPack64{0} }; #if defined(ATMOSPHERE_OS_HORIZON) while (true) { if (R_SUCCEEDED(GetExosphereApiInfo(std::addressof(info)))) { diff --git a/libraries/libstratosphere/source/ncm/ncm_content_meta.cpp b/libraries/libstratosphere/source/ncm/ncm_content_meta.cpp index 02f648a50..298de53d6 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_meta.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_meta.cpp @@ -220,6 +220,9 @@ namespace ams::ncm { /* Assert that we copied the right number of infos. */ AMS_ASSERT(count == fragment_count); + + /* TODO: Unused variable. */ + AMS_UNUSED(count); R_SUCCEED(); } @@ -432,6 +435,9 @@ namespace ams::ncm { /* Assert that we copied the right number of infos. */ AMS_ASSERT(count == fragment_count); + + /* TODO: Unused variable. */ + AMS_UNUSED(count); R_SUCCEED(); } diff --git a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_layout.hpp b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_layout.hpp index e22a3a3c8..741445c51 100644 --- a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_layout.hpp +++ b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_layout.hpp @@ -185,7 +185,10 @@ namespace ams::svc::codegen::impl { /* Process all arguments, in order. */ size_t i = 0; (layout.ProcessArgument(i++, NGRN, NSAA), ...); - + + /* TODO: Unused variable. */ + AMS_UNUSED(i); + return layout; }