From 5a92c368c24ed6a03074f123f1835ad50d39ae49 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sun, 26 May 2024 15:39:00 -0700 Subject: [PATCH] ams: build with -std=gnu++23 --- config/common.mk | 2 +- libstratosphere/source/ams/ams_emummc_api.cpp | 2 +- libstratosphere/source/fs/fs_api.cpp | 4 ++-- libstratosphere/source/fssrv/impl/fssrv_program_info.cpp | 2 +- .../source/htc/server/rpc/htc_rpc_task_table.hpp | 2 +- libstratosphere/source/osdbg/impl/osdbg_types.hpp | 8 ++++++-- libvapours/include/vapours/util/util_typed_storage.hpp | 2 +- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/config/common.mk b/config/common.mk index 887a68c9..ed196586 100644 --- a/config/common.mk +++ b/config/common.mk @@ -44,7 +44,7 @@ else ifeq ($(strip $(ATMOSPHERE_COMPILER_NAME)),clang) export ATMOSPHERE_CFLAGS += -Wno-c99-designator -Wno-gnu-alignof-expression -Wno-unused-private-field endif -export ATMOSPHERE_CXXFLAGS := -fno-rtti -fno-exceptions -std=gnu++20 -Wno-invalid-offsetof +export ATMOSPHERE_CXXFLAGS := -fno-rtti -fno-exceptions -std=gnu++23 -Wno-invalid-offsetof export ATMOSPHERE_ASFLAGS := diff --git a/libstratosphere/source/ams/ams_emummc_api.cpp b/libstratosphere/source/ams/ams_emummc_api.cpp index ce3b7f9f..ca47cc45 100644 --- a/libstratosphere/source/ams/ams_emummc_api.cpp +++ b/libstratosphere/source/ams/ams_emummc_api.cpp @@ -73,7 +73,7 @@ namespace ams::emummc { /* Retrieve and cache values. */ { - typename std::aligned_storage<2 * (MaxDirLen + 1), os::MemoryPageSize>::type path_storage; + alignas(os::MemoryPageSize) std::byte path_storage[2 * (MaxDirLen + 1)]; struct { char file_path[MaxDirLen + 1]; diff --git a/libstratosphere/source/fs/fs_api.cpp b/libstratosphere/source/fs/fs_api.cpp index f04e3049..c548fc67 100644 --- a/libstratosphere/source/fs/fs_api.cpp +++ b/libstratosphere/source/fs/fs_api.cpp @@ -23,8 +23,8 @@ namespace ams::fs { #if defined(ATMOSPHERE_OS_HORIZON) namespace { - constinit std::aligned_storage_t<0x80> g_fsp_service_object_buffer; - constinit std::aligned_storage_t<0x80> g_fsp_ldr_service_object_buffer; + alignas(0x10) constinit std::byte g_fsp_service_object_buffer[0x80] = {}; + alignas(0x10) constinit std::byte g_fsp_ldr_service_object_buffer[0x80] = {}; constinit bool g_use_static_fsp_service_object_buffer = false; constinit bool g_use_static_fsp_ldr_service_object_buffer = false; diff --git a/libstratosphere/source/fssrv/impl/fssrv_program_info.cpp b/libstratosphere/source/fssrv/impl/fssrv_program_info.cpp index 7fe1ca96..18b157a4 100644 --- a/libstratosphere/source/fssrv/impl/fssrv_program_info.cpp +++ b/libstratosphere/source/fssrv/impl/fssrv_program_info.cpp @@ -20,7 +20,7 @@ namespace ams::fssrv::impl { namespace { - constinit std::aligned_storage<0x80>::type g_static_buffer_for_program_info_for_initial_process = {}; + alignas(0x10) constinit std::byte g_static_buffer_for_program_info_for_initial_process[0x80] = {}; template class StaticAllocatorForProgramInfoForInitialProcess : public std::allocator { diff --git a/libstratosphere/source/htc/server/rpc/htc_rpc_task_table.hpp b/libstratosphere/source/htc/server/rpc/htc_rpc_task_table.hpp index 62637b49..318c0164 100644 --- a/libstratosphere/source/htc/server/rpc/htc_rpc_task_table.hpp +++ b/libstratosphere/source/htc/server/rpc/htc_rpc_task_table.hpp @@ -41,7 +41,7 @@ namespace ams::htc::server::rpc { #else static constexpr size_t MaxTaskSize = 0xE1D8; #endif - using TaskStorage = typename std::aligned_storage::type; + struct TaskStorage { alignas(alignof(void *)) std::byte _storage[MaxTaskSize]; }; private: bool m_valid[MaxRpcCount]{}; TaskStorage m_storages[MaxRpcCount]{}; diff --git a/libstratosphere/source/osdbg/impl/osdbg_types.hpp b/libstratosphere/source/osdbg/impl/osdbg_types.hpp index 5f947f25..a579ff44 100644 --- a/libstratosphere/source/osdbg/impl/osdbg_types.hpp +++ b/libstratosphere/source/osdbg/impl/osdbg_types.hpp @@ -19,9 +19,13 @@ namespace ams::osdbg::impl { template - using AlignedStorageIlp32 = typename std::aligned_storage::type; + struct AlignedStorageIlp32 { + alignas(Alignment) std::byte _storage[Size + NumPointers * sizeof(u32)]; + }; template - using AlignedStorageLp64 = typename std::aligned_storage::type; + struct AlignedStorageLp64 { + alignas(Alignment) std::byte _storage[Size + NumPointers * sizeof(u64)]; + }; } diff --git a/libvapours/include/vapours/util/util_typed_storage.hpp b/libvapours/include/vapours/util/util_typed_storage.hpp index 71005046..50ebc372 100644 --- a/libvapours/include/vapours/util/util_typed_storage.hpp +++ b/libvapours/include/vapours/util/util_typed_storage.hpp @@ -22,7 +22,7 @@ namespace ams::util { template struct TypedStorage { - typename std::aligned_storage::type _storage; + alignas(Align) std::byte _storage[Size]; }; template