From 1609f804f2d272410803037e3ed6f54e37d10294 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 --- libraries/config/common.mk | 2 +- libraries/libstratosphere/source/ams/ams_emummc_api.cpp | 2 +- libraries/libstratosphere/source/fs/fs_api.cpp | 4 ++-- .../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 ++++++-- .../include/vapours/util/util_typed_storage.hpp | 2 +- troposphere/daybreak/Makefile | 2 +- troposphere/haze/Makefile | 2 +- 9 files changed, 15 insertions(+), 11 deletions(-) diff --git a/libraries/config/common.mk b/libraries/config/common.mk index 887a68c9c..ed1965866 100644 --- a/libraries/config/common.mk +++ b/libraries/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/libraries/libstratosphere/source/ams/ams_emummc_api.cpp b/libraries/libstratosphere/source/ams/ams_emummc_api.cpp index ce3b7f9f0..ca47cc455 100644 --- a/libraries/libstratosphere/source/ams/ams_emummc_api.cpp +++ b/libraries/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/libraries/libstratosphere/source/fs/fs_api.cpp b/libraries/libstratosphere/source/fs/fs_api.cpp index f04e3049b..c548fc674 100644 --- a/libraries/libstratosphere/source/fs/fs_api.cpp +++ b/libraries/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/libraries/libstratosphere/source/fssrv/impl/fssrv_program_info.cpp b/libraries/libstratosphere/source/fssrv/impl/fssrv_program_info.cpp index 7fe1ca96a..18b157a4a 100644 --- a/libraries/libstratosphere/source/fssrv/impl/fssrv_program_info.cpp +++ b/libraries/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/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_task_table.hpp b/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_task_table.hpp index 62637b490..318c01645 100644 --- a/libraries/libstratosphere/source/htc/server/rpc/htc_rpc_task_table.hpp +++ b/libraries/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/libraries/libstratosphere/source/osdbg/impl/osdbg_types.hpp b/libraries/libstratosphere/source/osdbg/impl/osdbg_types.hpp index 5f947f255..a579ff449 100644 --- a/libraries/libstratosphere/source/osdbg/impl/osdbg_types.hpp +++ b/libraries/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/libraries/libvapours/include/vapours/util/util_typed_storage.hpp b/libraries/libvapours/include/vapours/util/util_typed_storage.hpp index 710050465..50ebc3727 100644 --- a/libraries/libvapours/include/vapours/util/util_typed_storage.hpp +++ b/libraries/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 diff --git a/troposphere/daybreak/Makefile b/troposphere/daybreak/Makefile index f93397c1d..adb6339f1 100644 --- a/troposphere/daybreak/Makefile +++ b/troposphere/daybreak/Makefile @@ -61,7 +61,7 @@ CFLAGS := -g -Wall -O2 -ffunction-sections \ CFLAGS += $(INCLUDE) -D__SWITCH__ -CXXFLAGS := $(CFLAGS) -std=gnu++20 -fno-exceptions -fno-rtti +CXXFLAGS := $(CFLAGS) -std=gnu++23 -fno-exceptions -fno-rtti ASFLAGS := -g $(ARCH) LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) diff --git a/troposphere/haze/Makefile b/troposphere/haze/Makefile index b6d12ea14..e1e29949c 100644 --- a/troposphere/haze/Makefile +++ b/troposphere/haze/Makefile @@ -61,7 +61,7 @@ CFLAGS := -g -Wall -O2 -ffunction-sections \ CFLAGS += $(INCLUDE) -D__SWITCH__ -CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++20 +CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++23 ASFLAGS := -g $(ARCH) LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)