From 492a9e1849eb1b1633ce89e71be3c865f1a42229 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 5 May 2020 18:16:13 -0700 Subject: [PATCH] ams: update to build with gcc10/c++20 --- exosphere/Makefile | 4 +- exosphere/src/mmu.h | 4 +- exosphere/src/my_libc.c | 24 ++-- libraries/config/arch/arm64/arch.mk | 2 +- libraries/config/common.mk | 2 +- libraries/libmesosphere/Makefile | 2 + .../arm64/kern_k_interrupt_controller.hpp | 8 +- .../mesosphere/init/kern_init_layout.hpp | 2 +- .../mesosphere/kern_k_current_context.hpp | 4 +- .../mesosphere/kern_k_page_table_base.hpp | 2 +- .../source/kern_k_address_space_info.cpp | 26 ++-- .../include/stratosphere/ams/ams_types.hpp | 2 +- .../capsrv_screen_shot_decode_option.hpp | 2 +- .../include/stratosphere/cfg/cfg_types.hpp | 2 +- .../stratosphere/dmnt/dmnt_cheat_types.hpp | 6 +- .../include/stratosphere/erpt/erpt_types.hpp | 4 +- .../stratosphere/fatal/fatal_types.hpp | 124 +++++++++--------- .../include/stratosphere/fs/fs_common.hpp | 2 +- .../fs/fs_dbm_hierarchical_rom_file_table.hpp | 10 +- .../fs/fs_dbm_rom_key_value_storage.hpp | 4 +- .../stratosphere/fs/fs_dbm_rom_path_tool.hpp | 2 +- .../stratosphere/fs/fs_dbm_rom_types.hpp | 6 +- .../include/stratosphere/fs/fs_file.hpp | 4 +- .../stratosphere/fs/fs_memory_management.hpp | 2 +- .../stratosphere/fs/fs_query_range.hpp | 2 +- .../include/stratosphere/fs/fs_rights_id.hpp | 2 +- .../stratosphere/fs/fs_save_data_types.hpp | 6 +- .../stratosphere/fssrv/fssrv_sf_path.hpp | 2 +- .../fssystem_file_system_buddy_heap.hpp | 2 +- ...system_dbm_hierarchical_rom_file_table.hpp | 10 +- .../fssystem_dbm_rom_key_value_storage.hpp | 4 +- .../fssystem/fssystem_dbm_rom_path_tool.hpp | 2 +- .../fssystem/fssystem_dbm_rom_types.hpp | 6 +- .../fssystem_partition_file_system_meta.hpp | 4 +- .../kvdb/kvdb_file_key_value_cache.hpp | 2 +- .../kvdb/kvdb_file_key_value_store.hpp | 10 +- .../kvdb/kvdb_memory_key_value_store.hpp | 10 +- .../include/stratosphere/ldr/ldr_types.hpp | 12 +- .../include/stratosphere/lr/lr_types.hpp | 2 +- .../stratosphere/mem/impl/mem_impl_common.hpp | 2 +- .../stratosphere/ncm/ncm_content_info.hpp | 2 +- .../ncm/ncm_content_manager_impl.hpp | 2 +- .../stratosphere/ncm/ncm_program_location.hpp | 2 +- .../stratosphere/ncm/ncm_rights_id.hpp | 2 +- .../stratosphere/os/os_rw_lock_types.hpp | 2 +- .../include/stratosphere/pgl/pgl_types.hpp | 2 +- .../include/stratosphere/pm/pm_types.hpp | 2 +- .../include/stratosphere/reg.hpp | 6 +- .../factory/settings_device_certificate.hpp | 6 +- .../factory/settings_serial_number.hpp | 2 +- .../settings/settings_fwdbg_types.hpp | 4 +- .../stratosphere/settings/settings_types.hpp | 4 +- .../cmif/sf_cmif_server_message_processor.hpp | 2 +- .../sf/cmif/sf_cmif_service_dispatch.hpp | 2 +- .../sf/impl/sf_impl_command_serialization.hpp | 2 +- .../source/ams/ams_environment.cpp | 3 + .../decodersrv_decoder_work_memory.hpp | 2 +- .../source/fs/fs_file_path_hash.hpp | 2 +- .../source/fs/fsa/fs_mount_name.hpp | 2 +- .../fssystem_partition_file_system_meta.cpp | 2 +- .../fssystem/fssystem_romfs_filesystem.cpp | 10 +- .../source/kvdb/kvdb_archive.cpp | 4 +- .../heap/mem_impl_heap_tls_heap_static.hpp | 8 +- .../source/pgl/srv/pgl_srv_shell.cpp | 2 +- libraries/libstratosphere/source/util/ini.c | 3 + .../libvapours/include/vapours/defines.hpp | 3 - .../impl/svc_codegen_impl_code_generator.hpp | 7 +- .../codegen/impl/svc_codegen_impl_common.hpp | 2 +- .../svc_codegen_impl_kernel_svc_wrapper.hpp | 93 ++++++------- .../codegen/impl/svc_codegen_impl_layout.hpp | 6 +- .../svc_codegen_impl_layout_conversion.hpp | 15 +-- .../impl/svc_codegen_impl_meta_code.hpp | 19 ++- .../impl/svc_codegen_impl_parameter.hpp | 6 +- .../vapours/svc/ipc/svc_message_buffer.hpp | 26 ++-- libraries/libvapours/include/vapours/util.hpp | 1 + .../include/vapours/util/util_bitpack.hpp | 10 +- .../include/vapours/util/util_type_traits.hpp | 26 ++++ .../ams_mitm/source/fs_mitm/fsmitm_romfs.cpp | 6 +- .../source/set_mitm/settings_sd_kvs.cpp | 2 +- stratosphere/boot2/source/boot2_main.cpp | 2 + .../creport/source/creport_crash_report.cpp | 2 +- .../dmnt/source/cheat/impl/dmnt_cheat_api.cpp | 2 +- stratosphere/dmnt/source/dmnt_service.hpp | 2 +- stratosphere/fatal/source/fatal_config.cpp | 24 ++-- .../fatal/source/fatal_task_error_report.cpp | 4 +- .../fatal/source/fatal_task_screen.cpp | 14 +- thermosphere/src/lib/ini.c | 3 + 87 files changed, 361 insertions(+), 322 deletions(-) create mode 100644 libraries/libvapours/include/vapours/util/util_type_traits.hpp diff --git a/exosphere/Makefile b/exosphere/Makefile index 09630e14d..c51328901 100644 --- a/exosphere/Makefile +++ b/exosphere/Makefile @@ -33,7 +33,7 @@ INCLUDES := include ../libraries/libvapours/include #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- -ARCH := -march=armv8-a -mtune=cortex-a57 -mgeneral-regs-only #<- important +ARCH := -march=armv8-a -mtune=cortex-a57 -mgeneral-regs-only -mno-outline-atomics #<- important DEFINES := -D__CCPLEX__ -DATMOSPHERE_GIT_BRANCH=\"$(AMSBRANCH)\" -DATMOSPHERE_GIT_REV=\"$(AMSREV)\" -DATMOSPHERE_RELEASE_VERSION_HASH="0x$(AMSHASH)" CFLAGS := \ -g \ @@ -156,6 +156,8 @@ $(OUTPUT).bin : $(OUTPUT).elf $(OUTPUT).elf : $(OFILES) +my_libc.o: CFLAGS += -fno-builtin + %.elf: @echo linking $(notdir $@) $(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@ diff --git a/exosphere/src/mmu.h b/exosphere/src/mmu.h index e1ded58fe..ed4cba784 100644 --- a/exosphere/src/mmu.h +++ b/exosphere/src/mmu.h @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #ifndef EXOSPHERE_MMU_H #define EXOSPHERE_MMU_H @@ -134,7 +134,7 @@ #define TCR_EL2_RSVD (BIT(31) | BIT(23)) #define TCR_EL3_RSVD (BIT(31) | BIT(23)) -static inline void mmu_init_table(uintptr_t *tbl, size_t num_entries) { +static inline void mmu_init_table(volatile uintptr_t *tbl, size_t num_entries) { for(size_t i = 0; i < num_entries / 8; i++) { tbl[i] = MMU_PTE_TYPE_FAULT; } diff --git a/exosphere/src/my_libc.c b/exosphere/src/my_libc.c index 2117f2483..ffd1b595b 100644 --- a/exosphere/src/my_libc.c +++ b/exosphere/src/my_libc.c @@ -75,7 +75,7 @@ __libc_fini_array (void) { size_t count; size_t i; - + count = __fini_array_end - __fini_array_start; for (i = count; i > 0; i--) __fini_array_start[i-1] (); @@ -170,7 +170,7 @@ memmove (void *dst_void, } else { - /* Use optimizing algorithm for a non-destructive copy to closely + /* Use optimizing algorithm for a non-destructive copy to closely match memcpy. If the size is small or either SRC or DST is unaligned, then punt into the byte copy loop. This should be rare. */ if (!TOO_SMALL(length) && !UNALIGNED (src, dst)) @@ -561,7 +561,7 @@ memcmp (const void *m1, s2++; } return 0; -#else +#else unsigned char *s1 = (unsigned char *) m1; unsigned char *s2 = (unsigned char *) m2; unsigned long *a1; @@ -572,13 +572,13 @@ memcmp (const void *m1, not turn up in inner loops. */ if (!TOO_SMALL(n) && !UNALIGNED(s1,s2)) { - /* Otherwise, load and compare the blocks of memory one + /* Otherwise, load and compare the blocks of memory one word at a time. */ a1 = (unsigned long*) s1; a2 = (unsigned long*) s2; while (n >= LBLOCKSIZE) { - if (*a1 != *a2) + if (*a1 != *a2) break; a1++; a2++; @@ -703,7 +703,7 @@ strchr (const char *s1, /* FUNCTION <>---character string compare - + INDEX strcmp SYNOPSIS @@ -736,7 +736,7 @@ QUICKREF int strcmp (const char *s1, const char *s2) -{ +{ #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) while (*s1 != '\0' && *s1 == *s2) { @@ -751,7 +751,7 @@ strcmp (const char *s1, /* If s1 or s2 are unaligned, then compare bytes. */ if (!UNALIGNED (s1, s2)) - { + { /* If s1 and s2 are word-aligned, compare them a word at a time. */ a1 = (unsigned long*)s1; a2 = (unsigned long*)s2; @@ -915,7 +915,7 @@ strlen (const char *str) /* FUNCTION <>---character string compare - + INDEX strncmp SYNOPSIS @@ -944,7 +944,7 @@ QUICKREF #define UNALIGNED(X, Y) \ (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) -int +int strncmp (const char *s1, const char *s2, size_t n) @@ -1103,10 +1103,10 @@ strncpy (char *__restrict dst0, #endif /* not PREFER_SIZE_OVER_SPEED */ } -/* +/* FUNCTION <>---character string length - + INDEX strnlen SYNOPSIS diff --git a/libraries/config/arch/arm64/arch.mk b/libraries/config/arch/arm64/arch.mk index e3162d2dd..960cbabf5 100644 --- a/libraries/config/arch/arm64/arch.mk +++ b/libraries/config/arch/arm64/arch.mk @@ -5,7 +5,7 @@ endif include $(DEVKITPRO)/devkitA64/base_rules export ATMOSPHERE_DEFINES += -DATMOSPHERE_ARCH_ARM64 -export ATMOSPHERE_SETTINGS += -march=armv8-a+crc+crypto -mtp=soft +export ATMOSPHERE_SETTINGS += -march=armv8-a+crc+crypto -mno-outline-atomics -mtp=soft export ATMOSPHERE_CFLAGS += export ATMOSPHERE_CXXFLAGS += export ATMOSPHERE_ASFLAGS += diff --git a/libraries/config/common.mk b/libraries/config/common.mk index 964a7d0aa..5bd48dfb3 100644 --- a/libraries/config/common.mk +++ b/libraries/config/common.mk @@ -18,7 +18,7 @@ export ATMOSPHERE_DEFINES := -DATMOSPHERE export ATMOSPHERE_SETTINGS := -fPIE -g export ATMOSPHERE_CFLAGS := -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -fwrapv \ -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector -export ATMOSPHERE_CXXFLAGS := -fno-rtti -fno-exceptions -std=gnu++17 +export ATMOSPHERE_CXXFLAGS := -fno-rtti -fno-exceptions -std=gnu++2a export ATMOSPHERE_ASFLAGS := diff --git a/libraries/libmesosphere/Makefile b/libraries/libmesosphere/Makefile index c9c190e90..a4744653d 100644 --- a/libraries/libmesosphere/Makefile +++ b/libraries/libmesosphere/Makefile @@ -122,6 +122,8 @@ $(filter-out kern_svc_tables.o, $(OFILES)) : $(GCH_FILES) $(OFILES_SRC) : $(HFILES_BIN) +kern_libc_generic.o: CFLAGS += -fno-builtin + #--------------------------------------------------------------------------------- %_bin.h %.bin.o : %.bin #--------------------------------------------------------------------------------- diff --git a/libraries/libmesosphere/include/mesosphere/arch/arm64/kern_k_interrupt_controller.hpp b/libraries/libmesosphere/include/mesosphere/arch/arm64/kern_k_interrupt_controller.hpp index a6d7a180e..ce276c1a7 100644 --- a/libraries/libmesosphere/include/mesosphere/arch/arm64/kern_k_interrupt_controller.hpp +++ b/libraries/libmesosphere/include/mesosphere/arch/arm64/kern_k_interrupt_controller.hpp @@ -72,7 +72,7 @@ namespace ams::kern::arch::arm64 { SgirTargetListFilter_Reserved = (3 << 24), }; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(GicDistributor) == 0x1000); struct GicCpuInterface { @@ -98,7 +98,7 @@ namespace ams::kern::arch::arm64 { u32 dir; u32 _0x1004[1023]; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(GicCpuInterface) == 0x2000); struct KInterruptController { @@ -164,11 +164,11 @@ namespace ams::kern::arch::arm64 { } void SetTarget(s32 irq, s32 core_id) const { - this->gicd->itargetsr.bytes[irq] |= GetGicMask(core_id); + this->gicd->itargetsr.bytes[irq] = this->gicd->itargetsr.bytes[irq] | GetGicMask(core_id); } void ClearTarget(s32 irq, s32 core_id) const { - this->gicd->itargetsr.bytes[irq] &= ~GetGicMask(core_id); + this->gicd->itargetsr.bytes[irq] = this->gicd->itargetsr.bytes[irq] & ~GetGicMask(core_id); } void SetPriorityLevel(s32 irq, s32 level) const { diff --git a/libraries/libmesosphere/include/mesosphere/init/kern_init_layout.hpp b/libraries/libmesosphere/include/mesosphere/init/kern_init_layout.hpp index 620ef85fe..3d379ca03 100644 --- a/libraries/libmesosphere/include/mesosphere/init/kern_init_layout.hpp +++ b/libraries/libmesosphere/include/mesosphere/init/kern_init_layout.hpp @@ -32,7 +32,7 @@ namespace ams::kern::init { u32 init_array_offset; u32 init_array_end_offset; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(KernelLayout) == 0x30); } \ No newline at end of file diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_current_context.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_current_context.hpp index ae8a7947d..442f04fed 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_current_context.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_current_context.hpp @@ -31,8 +31,10 @@ namespace ams::kern { s32 core_id; void *exception_stack_top; }; - static_assert(std::is_pod::value); + static_assert(std::is_standard_layout::value && std::is_trivially_destructible::value); static_assert(sizeof(KCurrentContext) <= cpu::DataCacheLineSize); + static_assert(sizeof(std::atomic) == sizeof(KThread *)); + static_assert(sizeof(std::atomic) == sizeof(KProcess *)); namespace impl { diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_page_table_base.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_page_table_base.hpp index 0ebfb206d..2298dd9dd 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_page_table_base.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_page_table_base.hpp @@ -65,7 +65,7 @@ namespace ams::kern { Node *next; u8 buffer[PageSize - sizeof(Node *)]; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); private: Node *root; public: diff --git a/libraries/libmesosphere/source/kern_k_address_space_info.cpp b/libraries/libmesosphere/source/kern_k_address_space_info.cpp index e8c04ec91..1d81e14d7 100644 --- a/libraries/libmesosphere/source/kern_k_address_space_info.cpp +++ b/libraries/libmesosphere/source/kern_k_address_space_info.cpp @@ -22,19 +22,19 @@ namespace ams::kern { constexpr uintptr_t Invalid = std::numeric_limits::max(); constexpr KAddressSpaceInfo AddressSpaceInfos[] = { - { .bit_width = 32, .address = 2_MB, .size = 1_GB - 2_MB, KAddressSpaceInfo::Type_32Bit, }, - { .bit_width = 32, .address = 1_GB, .size = 4_GB - 1_GB, KAddressSpaceInfo::Type_Small64Bit, }, - { .bit_width = 32, .address = Invalid, .size = 1_GB, KAddressSpaceInfo::Type_Heap, }, - { .bit_width = 32, .address = Invalid, .size = 1_GB, KAddressSpaceInfo::Type_Alias, }, - { .bit_width = 36, .address = 128_MB, .size = 2_GB - 128_MB, KAddressSpaceInfo::Type_32Bit, }, - { .bit_width = 36, .address = 2_GB, .size = 64_GB - 2_GB, KAddressSpaceInfo::Type_Small64Bit, }, - { .bit_width = 36, .address = Invalid, .size = 6_GB, KAddressSpaceInfo::Type_Heap, }, - { .bit_width = 36, .address = Invalid, .size = 6_GB, KAddressSpaceInfo::Type_Alias, }, - { .bit_width = 39, .address = 128_MB, .size = 512_GB - 128_MB, KAddressSpaceInfo::Type_Large64Bit, }, - { .bit_width = 39, .address = Invalid, .size = 64_GB, KAddressSpaceInfo::Type_32Bit, }, - { .bit_width = 39, .address = Invalid, .size = 6_GB, KAddressSpaceInfo::Type_Heap, }, - { .bit_width = 39, .address = Invalid, .size = 64_GB, KAddressSpaceInfo::Type_Alias, }, - { .bit_width = 39, .address = Invalid, .size = 2_GB, KAddressSpaceInfo::Type_Stack, }, + { .bit_width = 32, .address = 2_MB, .size = 1_GB - 2_MB, .type = KAddressSpaceInfo::Type_32Bit, }, + { .bit_width = 32, .address = 1_GB, .size = 4_GB - 1_GB, .type = KAddressSpaceInfo::Type_Small64Bit, }, + { .bit_width = 32, .address = Invalid, .size = 1_GB, .type = KAddressSpaceInfo::Type_Heap, }, + { .bit_width = 32, .address = Invalid, .size = 1_GB, .type = KAddressSpaceInfo::Type_Alias, }, + { .bit_width = 36, .address = 128_MB, .size = 2_GB - 128_MB, .type = KAddressSpaceInfo::Type_32Bit, }, + { .bit_width = 36, .address = 2_GB, .size = 64_GB - 2_GB, .type = KAddressSpaceInfo::Type_Small64Bit, }, + { .bit_width = 36, .address = Invalid, .size = 6_GB, .type = KAddressSpaceInfo::Type_Heap, }, + { .bit_width = 36, .address = Invalid, .size = 6_GB, .type = KAddressSpaceInfo::Type_Alias, }, + { .bit_width = 39, .address = 128_MB, .size = 512_GB - 128_MB, .type = KAddressSpaceInfo::Type_Large64Bit, }, + { .bit_width = 39, .address = Invalid, .size = 64_GB, .type = KAddressSpaceInfo::Type_32Bit, }, + { .bit_width = 39, .address = Invalid, .size = 6_GB, .type = KAddressSpaceInfo::Type_Heap, }, + { .bit_width = 39, .address = Invalid, .size = 64_GB, .type = KAddressSpaceInfo::Type_Alias, }, + { .bit_width = 39, .address = Invalid, .size = 2_GB, .type = KAddressSpaceInfo::Type_Stack, }, }; constexpr bool IsAllowedIndexForAddress(size_t index) { diff --git a/libraries/libstratosphere/include/stratosphere/ams/ams_types.hpp b/libraries/libstratosphere/include/stratosphere/ams/ams_types.hpp index 73b69fba7..b16de724b 100644 --- a/libraries/libstratosphere/include/stratosphere/ams/ams_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/ams/ams_types.hpp @@ -104,7 +104,7 @@ namespace ams { }; static_assert(sizeof(FatalErrorContext) == 0x450, "sizeof(FatalErrorContext)"); - static_assert(std::is_pod::value, "FatalErrorContext"); + static_assert(util::is_pod::value, "FatalErrorContext"); #ifdef ATMOSPHERE_GIT_BRANCH NX_CONSTEXPR const char *GetGitBranch() { diff --git a/libraries/libstratosphere/include/stratosphere/capsrv/capsrv_screen_shot_decode_option.hpp b/libraries/libstratosphere/include/stratosphere/capsrv/capsrv_screen_shot_decode_option.hpp index 5b0ba29e1..6606470b5 100644 --- a/libraries/libstratosphere/include/stratosphere/capsrv/capsrv_screen_shot_decode_option.hpp +++ b/libraries/libstratosphere/include/stratosphere/capsrv/capsrv_screen_shot_decode_option.hpp @@ -41,6 +41,6 @@ namespace ams::capsrv { }; static_assert(sizeof(ScreenShotDecodeOption) == 0x20); static_assert(sizeof(ScreenShotDecodeOption) == sizeof(::CapsScreenShotDecodeOption)); - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); } diff --git a/libraries/libstratosphere/include/stratosphere/cfg/cfg_types.hpp b/libraries/libstratosphere/include/stratosphere/cfg/cfg_types.hpp index 6f2bffc40..b7d5847f0 100644 --- a/libraries/libstratosphere/include/stratosphere/cfg/cfg_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/cfg/cfg_types.hpp @@ -49,7 +49,7 @@ namespace ams::cfg { }; static_assert(sizeof(OverrideStatus) == 0x10, "sizeof(OverrideStatus)"); - static_assert(std::is_pod::value, "std::is_pod::value"); + static_assert(util::is_pod::value, "util::is_pod::value"); constexpr inline bool operator==(const OverrideStatus &lhs, const OverrideStatus &rhs) { return std::memcmp(&lhs, &rhs, sizeof(lhs)) == 0; diff --git a/libraries/libstratosphere/include/stratosphere/dmnt/dmnt_cheat_types.hpp b/libraries/libstratosphere/include/stratosphere/dmnt/dmnt_cheat_types.hpp index 017e73407..53ab40bf8 100644 --- a/libraries/libstratosphere/include/stratosphere/dmnt/dmnt_cheat_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/dmnt/dmnt_cheat_types.hpp @@ -36,7 +36,7 @@ namespace ams::dmnt::cheat { u8 main_nso_build_id[0x20]; }; - static_assert(std::is_pod::value && sizeof(CheatProcessMetadata) == 0x70, "CheatProcessMetadata definition!"); + static_assert(util::is_pod::value && sizeof(CheatProcessMetadata) == 0x70, "CheatProcessMetadata definition!"); struct CheatDefinition : sf::LargeData, sf::PrefersMapAliasTransferMode { char readable_name[0x40]; @@ -50,8 +50,8 @@ namespace ams::dmnt::cheat { CheatDefinition definition; }; - static_assert(std::is_pod::value, "CheatDefinition"); - static_assert(std::is_pod::value, "CheatEntry"); + static_assert(util::is_pod::value, "CheatDefinition"); + static_assert(util::is_pod::value, "CheatEntry"); struct FrozenAddressValue { u64 value; diff --git a/libraries/libstratosphere/include/stratosphere/erpt/erpt_types.hpp b/libraries/libstratosphere/include/stratosphere/erpt/erpt_types.hpp index bc29605e2..d26cf6e16 100644 --- a/libraries/libstratosphere/include/stratosphere/erpt/erpt_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/erpt/erpt_types.hpp @@ -108,7 +108,7 @@ namespace ams::erpt { }; using ReportFlagSet = util::BitFlagSet; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(ReportFlagSet) == sizeof(u32)); struct ReportInfo { @@ -149,7 +149,7 @@ namespace ams::erpt { }; using AttachmentFlagSet = util::BitFlagSet; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(AttachmentFlagSet) == sizeof(u32)); constexpr inline u32 AttachmentNameSizeMax = 0x20; diff --git a/libraries/libstratosphere/include/stratosphere/fatal/fatal_types.hpp b/libraries/libstratosphere/include/stratosphere/fatal/fatal_types.hpp index f2a9dc917..1228e7af5 100644 --- a/libraries/libstratosphere/include/stratosphere/fatal/fatal_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/fatal/fatal_types.hpp @@ -75,44 +75,44 @@ namespace ams::fatal { static constexpr size_t MaxStackTraceDepth = 0x20; static constexpr const char *RegisterNameStrings[RegisterName_Count] = { - u8"X0", - u8"X1", - u8"X2", - u8"X3", - u8"X4", - u8"X5", - u8"X6", - u8"X7", - u8"X8", - u8"X9", - u8"X10", - u8"X11", - u8"X12", - u8"X13", - u8"X14", - u8"X15", - u8"X16", - u8"X17", - u8"X18", - u8"X19", - u8"X20", - u8"X21", - u8"X22", - u8"X23", - u8"X24", - u8"X25", - u8"X26", - u8"X27", - u8"X28", - u8"FP", - u8"LR", - u8"SP", - u8"PC", - u8"PState", - u8"Afsr0", - u8"Afsr1", - u8"Esr", - u8"Far", + "X0", + "X1", + "X2", + "X3", + "X4", + "X5", + "X6", + "X7", + "X8", + "X9", + "X10", + "X11", + "X12", + "X13", + "X14", + "X15", + "X16", + "X17", + "X18", + "X19", + "X20", + "X21", + "X22", + "X23", + "X24", + "X25", + "X26", + "X27", + "X28", + "FP", + "LR", + "SP", + "PC", + "PState", + "Afsr0", + "Afsr1", + "Esr", + "Far", }; /* Registers, exception context. N left names for these fields in fatal .rodata. */ @@ -209,27 +209,27 @@ namespace ams::fatal { static constexpr size_t MaxStackTraceDepth = 0x20; static constexpr const char *RegisterNameStrings[RegisterName_Count] = { - u8"R0", - u8"R1", - u8"R2", - u8"R3", - u8"R4", - u8"R5", - u8"R6", - u8"R7", - u8"R8", - u8"R9", - u8"R10", - u8"FP", - u8"IP", - u8"LR", - u8"SP", - u8"PC", - u8"PState", - u8"Afsr0", - u8"Afsr1", - u8"Esr", - u8"Far", + "R0", + "R1", + "R2", + "R3", + "R4", + "R5", + "R6", + "R7", + "R8", + "R9", + "R10", + "FP", + "IP", + "LR", + "SP", + "PC", + "PState", + "Afsr0", + "Afsr1", + "Esr", + "Far", }; /* Registers, exception context. N left names for these fields in fatal .rodata. */ @@ -311,9 +311,9 @@ namespace ams::fatal { } }; - static_assert(std::is_pod::value && sizeof(aarch64::CpuContext) == 0x248, "aarch64::CpuContext definition!"); - static_assert(std::is_pod::value && sizeof(aarch32::CpuContext) == 0xE0, "aarch32::CpuContext definition!"); - static_assert(std::is_pod::value && sizeof(CpuContext) == 0x250, "CpuContext definition!"); + static_assert(util::is_pod::value && sizeof(aarch64::CpuContext) == 0x248, "aarch64::CpuContext definition!"); + static_assert(util::is_pod::value && sizeof(aarch32::CpuContext) == 0xE0, "aarch32::CpuContext definition!"); + static_assert(util::is_pod::value && sizeof(CpuContext) == 0x250, "CpuContext definition!"); namespace srv { diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_common.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_common.hpp index 4f6a6436d..e91ae9835 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_common.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_common.hpp @@ -43,6 +43,6 @@ namespace ams::fs { return this->Get(); } }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); } \ No newline at end of file diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_hierarchical_rom_file_table.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_hierarchical_rom_file_table.hpp index d2306154b..25651f7e3 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_hierarchical_rom_file_table.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_hierarchical_rom_file_table.hpp @@ -28,7 +28,7 @@ namespace ams::fs { Position next_dir; Position next_file; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); using DirectoryInfo = RomDirectoryInfo; using FileInfo = RomFileInfo; @@ -56,13 +56,13 @@ namespace ams::fs { Position dir; Position file; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); struct RomFileEntry { Position next; FileInfo info; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static constexpr inline u32 MaxKeyLength = RomPathTool::MaxPathLength; @@ -109,7 +109,7 @@ namespace ams::fs { return RomPathTool::IsEqualPath(reinterpret_cast(aux_lhs), reinterpret_cast(aux_rhs), aux_lhs_size / sizeof(RomPathChar)); } }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); struct EntryKey { RomEntryKey key; @@ -126,7 +126,7 @@ namespace ams::fs { return hash; } }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); using DirectoryEntryMapTable = EntryMapTable; using FileEntryMapTable = EntryMapTable; diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_key_value_storage.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_key_value_storage.hpp index 044e17b78..455f1cdff 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_key_value_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_key_value_storage.hpp @@ -31,7 +31,7 @@ namespace ams::fs { BucketIndex ind; Position pos; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); private: static constexpr inline Position InvalidPosition = ~Position(); @@ -41,7 +41,7 @@ namespace ams::fs { Position next; u32 size; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); private: s64 bucket_count; SubStorage bucket_storage; diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_path_tool.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_path_tool.hpp index c57b1fe9d..7fc957c92 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_path_tool.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_path_tool.hpp @@ -26,7 +26,7 @@ namespace ams::fs { size_t length; const RomPathChar *path; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); constexpr void InitializeRomEntryName(RomEntryName *entry) { AMS_ABORT_UNLESS(entry != nullptr); diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_types.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_types.hpp index 86a646e45..f746af65e 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_dbm_rom_types.hpp @@ -34,19 +34,19 @@ namespace ams::fs { s64 file_entry_size; s64 body_offset; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(RomFileSystemInformation) == 0x50); struct RomDirectoryInfo { /* ... */ }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); struct RomFileInfo { Int64 offset; Int64 size; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); namespace RomStringTraits { diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_file.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_file.hpp index 51fab7070..36e7d790b 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_file.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_file.hpp @@ -34,7 +34,7 @@ namespace ams::fs { return !(lhs == rhs); } - static_assert(std::is_pod::value && sizeof(ReadOption) == sizeof(u32)); + static_assert(util::is_pod::value && sizeof(ReadOption) == sizeof(u32)); struct WriteOption { u32 value; @@ -58,7 +58,7 @@ namespace ams::fs { return !(lhs == rhs); } - static_assert(std::is_pod::value && sizeof(WriteOption) == sizeof(u32)); + static_assert(util::is_pod::value && sizeof(WriteOption) == sizeof(u32)); struct FileHandle { void *handle; diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_memory_management.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_memory_management.hpp index cc9a31a2f..03e344745 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_memory_management.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_memory_management.hpp @@ -42,7 +42,7 @@ namespace ams::fs { template std::unique_ptr MakeUnique() { - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); return std::unique_ptr(static_cast(::ams::fs::impl::Allocate(sizeof(T))), Deleter(sizeof(T))); } diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_query_range.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_query_range.hpp index 5cdc45c21..1c0fbdebf 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_query_range.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_query_range.hpp @@ -36,7 +36,7 @@ namespace ams::fs { } }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(QueryRangeInfo) == 0x40); static_assert(sizeof(QueryRangeInfo) == sizeof(::FsRangeInfo)); diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_rights_id.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_rights_id.hpp index e13bca7bf..9dae55eb5 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_rights_id.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_rights_id.hpp @@ -23,7 +23,7 @@ namespace ams::fs { u64 data64[2]; }; static_assert(sizeof(RightsId) == 0x10); - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); inline bool operator==(const RightsId &lhs, const RightsId &rhs) { return std::memcmp(std::addressof(lhs), std::addressof(rhs), sizeof(RightsId)) == 0; diff --git a/libraries/libstratosphere/include/stratosphere/fs/fs_save_data_types.hpp b/libraries/libstratosphere/include/stratosphere/fs/fs_save_data_types.hpp index 8d49efe3f..e663d67dc 100644 --- a/libraries/libstratosphere/include/stratosphere/fs/fs_save_data_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/fs/fs_save_data_types.hpp @@ -51,7 +51,7 @@ namespace ams::fs { struct UserId { u64 data[2]; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); constexpr inline bool operator<(const UserId &lhs, const UserId &rhs) { if (lhs.data[0] < rhs.data[0]) { @@ -92,7 +92,7 @@ namespace ams::fs { bool pseudo; u8 reserved[0x1A]; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(SaveDataCreationInfo) == 0x40); struct SaveDataAttribute { @@ -154,6 +154,6 @@ namespace ams::fs { u8 unused[0x190]; }; static_assert(sizeof(SaveDataExtraData) == 0x200); - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); } diff --git a/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_sf_path.hpp b/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_sf_path.hpp index a847a258d..16d7976de 100644 --- a/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_sf_path.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssrv/fssrv_sf_path.hpp @@ -43,7 +43,7 @@ namespace ams::fssrv::sf { } }; - static_assert(std::is_pod::value && sizeof(Path) == FS_MAX_PATH); + static_assert(util::is_pod::value && sizeof(Path) == FS_MAX_PATH); using FspPath = Path; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buddy_heap.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buddy_heap.hpp index 0da255696..dad54e2a6 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buddy_heap.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/buffers/fssystem_file_system_buddy_heap.hpp @@ -30,7 +30,7 @@ namespace ams::fssystem { class PageList; struct PageEntry { PageEntry *next; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(PageEntry) <= BlockSizeMin); class PageList : public ::ams::fs::impl::Newable { diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_hierarchical_rom_file_table.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_hierarchical_rom_file_table.hpp index 98d27b059..8ee5f4da6 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_hierarchical_rom_file_table.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_hierarchical_rom_file_table.hpp @@ -35,7 +35,7 @@ namespace ams::fssystem { Position next_dir; Position next_file; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); using DirectoryInfo = RomDirectoryInfo; using FileInfo = RomFileInfo; @@ -63,13 +63,13 @@ namespace ams::fssystem { Position dir; Position file; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); struct RomFileEntry { Position next; FileInfo info; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static constexpr inline u32 MaxKeyLength = RomPathTool::MaxPathLength; @@ -115,7 +115,7 @@ namespace ams::fssystem { return RomPathTool::IsEqualPath(reinterpret_cast(aux_lhs), reinterpret_cast(aux_rhs), aux_lhs_size / sizeof(RomPathChar)); } }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); struct EntryKey { RomEntryKey key; @@ -132,7 +132,7 @@ namespace ams::fssystem { return hash; } }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); using DirectoryEntryMapTable = EntryMapTable; using FileEntryMapTable = EntryMapTable; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_key_value_storage.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_key_value_storage.hpp index f47569f68..1bbea7a5c 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_key_value_storage.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_key_value_storage.hpp @@ -37,7 +37,7 @@ namespace ams::fssystem { BucketIndex ind; Position pos; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); private: static constexpr inline Position InvalidPosition = ~Position(); @@ -47,7 +47,7 @@ namespace ams::fssystem { Position next; u32 size; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); private: s64 bucket_offset; u32 bucket_count; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_path_tool.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_path_tool.hpp index d6cd961ac..6c40eac59 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_path_tool.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_path_tool.hpp @@ -26,7 +26,7 @@ namespace ams::fssystem { size_t length; const RomPathChar *path; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); constexpr void InitializeRomEntryName(RomEntryName *entry) { entry->length = 0; diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_types.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_types.hpp index 304cf9dd5..1baf32eb6 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_dbm_rom_types.hpp @@ -34,19 +34,19 @@ namespace ams::fssystem { s64 file_entry_size; s64 body_offset; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(RomFileSystemInformation) == 0x50); struct RomDirectoryInfo { /* ... */ }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); struct RomFileInfo { fs::Int64 offset; fs::Int64 size; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); namespace RomStringTraits { diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_partition_file_system_meta.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_partition_file_system_meta.hpp index 5e34906d6..a45ad3d02 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_partition_file_system_meta.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_partition_file_system_meta.hpp @@ -29,7 +29,7 @@ namespace ams::fssystem { u32 name_offset; u32 reserved; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); #pragma pack(pop) static constexpr const char VersionSignature[] = { 'P', 'F', 'S', '0' }; @@ -52,7 +52,7 @@ namespace ams::fssystem { u64 hash_target_offset; char hash[HashSize]; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); #pragma pack(pop) static constexpr const char VersionSignature[] = { 'H', 'F', 'S', '0' }; diff --git a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp index 52f8b2708..07c7008a9 100644 --- a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp +++ b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp @@ -186,7 +186,7 @@ namespace ams::kvdb { template class FileKeyValueCache { - static_assert(std::is_pod::value, "FileKeyValueCache Key must be pod!"); + static_assert(util::is_pod::value, "FileKeyValueCache Key must be pod!"); static_assert(sizeof(Key) <= FileKeyValueStore::MaxKeySize, "FileKeyValueCache Key is too big!"); public: using LeastRecentlyUsedList = impl::LruList; diff --git a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp index ce204dfbe..047562ff1 100644 --- a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp +++ b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_store.hpp @@ -38,7 +38,7 @@ namespace ams::kvdb { size_t key_size; size_t value_size; }; - static_assert(std::is_pod::value, "FileKeyValueStore::Entry definition!"); + static_assert(util::is_pod::value, "FileKeyValueStore::Entry definition!"); class Cache { private: @@ -83,13 +83,13 @@ namespace ams::kvdb { /* Niceties. */ template Result Get(size_t *out_size, void *out_value, size_t max_out_size, const Key &key) { - static_assert(std::is_pod::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!"); + static_assert(util::is_pod::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!"); return this->Get(out_size, out_value, max_out_size, &key, sizeof(Key)); } template Result Get(Value *out_value, const Key &key) { - static_assert(std::is_pod::value && !std::is_pointer::value, "Invalid FileKeyValueStore Value!"); + static_assert(util::is_pod::value && !std::is_pointer::value, "Invalid FileKeyValueStore Value!"); size_t size = 0; R_TRY(this->Get(&size, out_value, sizeof(Value), key)); AMS_ABORT_UNLESS(size >= sizeof(Value)); @@ -103,13 +103,13 @@ namespace ams::kvdb { template Result Set(const Key &key, const void *value, size_t value_size) { - static_assert(std::is_pod::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!"); + static_assert(util::is_pod::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!"); return this->Set(&key, sizeof(Key), value, value_size); } template Result Set(const Key &key, const Value &value) { - static_assert(std::is_pod::value && !std::is_pointer::value, "Invalid FileKeyValueStore Value!"); + static_assert(util::is_pod::value && !std::is_pointer::value, "Invalid FileKeyValueStore Value!"); return this->Set(key, &value, sizeof(Value)); } diff --git a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp index 1ec2b2fc7..f64ee96f2 100644 --- a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp +++ b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_memory_key_value_store.hpp @@ -26,7 +26,7 @@ namespace ams::kvdb { template class MemoryKeyValueStore { - static_assert(std::is_pod::value, "KeyValueStore Keys must be pod!"); + static_assert(util::is_pod::value, "KeyValueStore Keys must be pod!"); NON_COPYABLE(MemoryKeyValueStore); NON_MOVEABLE(MemoryKeyValueStore); public: @@ -49,7 +49,7 @@ namespace ams::kvdb { if constexpr (!std::is_same::value) { AMS_ABORT_UNLESS(sizeof(Value) <= this->value_size); /* Ensure we only get pod. */ - static_assert(std::is_pod::value, "KeyValueStore Values must be pod"); + static_assert(util::is_pod::value, "KeyValueStore Values must be pod"); } return reinterpret_cast(this->value); } @@ -60,7 +60,7 @@ namespace ams::kvdb { if constexpr (!std::is_same::value) { AMS_ABORT_UNLESS(sizeof(Value) <= this->value_size); /* Ensure we only get pod. */ - static_assert(std::is_pod::value, "KeyValueStore Values must be pod"); + static_assert(util::is_pod::value, "KeyValueStore Values must be pod"); } return reinterpret_cast(this->value); } @@ -366,14 +366,14 @@ namespace ams::kvdb { template Result Set(const Key &key, const Value &value) { /* Only allow setting pod. */ - static_assert(std::is_pod::value, "KeyValueStore Values must be pod"); + static_assert(util::is_pod::value, "KeyValueStore Values must be pod"); return this->Set(key, &value, sizeof(Value)); } template Result Set(const Key &key, const Value *value) { /* Only allow setting pod. */ - static_assert(std::is_pod::value, "KeyValueStore Values must be pod"); + static_assert(util::is_pod::value, "KeyValueStore Values must be pod"); return this->Set(key, value, sizeof(Value)); } diff --git a/libraries/libstratosphere/include/stratosphere/ldr/ldr_types.hpp b/libraries/libstratosphere/include/stratosphere/ldr/ldr_types.hpp index 933fc1d99..4c83687c4 100644 --- a/libraries/libstratosphere/include/stratosphere/ldr/ldr_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/ldr/ldr_types.hpp @@ -35,7 +35,7 @@ namespace ams::ldr { u32 aci_fah_size; u8 ac_buffer[0x3E0]; }; - static_assert(std::is_pod::value && sizeof(ProgramInfo) == 0x400, "ProgramInfo definition!"); + static_assert(util::is_pod::value && sizeof(ProgramInfo) == 0x400, "ProgramInfo definition!"); enum ProgramInfoFlag { ProgramInfoFlag_SystemModule = (0 << 0), @@ -71,7 +71,7 @@ namespace ams::ldr { inline bool operator!=(const PinId &lhs, const PinId &rhs) { return lhs.value != rhs.value; } - static_assert(sizeof(PinId) == sizeof(u64) && std::is_pod::value, "PinId definition!"); + static_assert(sizeof(PinId) == sizeof(u64) && util::is_pod::value, "PinId definition!"); /* Import ModuleInfo from libnx. */ using ModuleInfo = ::LoaderModuleInfo; @@ -142,7 +142,7 @@ namespace ams::ldr { }; }; }; - static_assert(sizeof(NsoHeader) == 0x100 && std::is_pod::value, "NsoHeader definition!"); + static_assert(sizeof(NsoHeader) == 0x100 && util::is_pod::value, "NsoHeader definition!"); /* NPDM types. */ struct Aci { @@ -160,7 +160,7 @@ namespace ams::ldr { u32 kac_size; u8 reserved_38[0x8]; }; - static_assert(sizeof(Aci) == 0x40 && std::is_pod::value, "Aci definition!"); + static_assert(sizeof(Aci) == 0x40 && util::is_pod::value, "Aci definition!"); struct Acid { static constexpr u32 Magic = util::FourCC<'A','C','I','D'>::Code; @@ -199,7 +199,7 @@ namespace ams::ldr { u32 kac_size; u8 reserved_238[0x8]; }; - static_assert(sizeof(Acid) == 0x240 && std::is_pod::value, "Acid definition!"); + static_assert(sizeof(Acid) == 0x240 && util::is_pod::value, "Acid definition!"); struct Npdm { static constexpr u32 Magic = util::FourCC<'M','E','T','A'>::Code; @@ -239,6 +239,6 @@ namespace ams::ldr { u32 acid_offset; u32 acid_size; }; - static_assert(sizeof(Npdm) == 0x80 && std::is_pod::value, "Npdm definition!"); + static_assert(sizeof(Npdm) == 0x80 && util::is_pod::value, "Npdm definition!"); } diff --git a/libraries/libstratosphere/include/stratosphere/lr/lr_types.hpp b/libraries/libstratosphere/include/stratosphere/lr/lr_types.hpp index 5b15c5135..4a684470e 100644 --- a/libraries/libstratosphere/include/stratosphere/lr/lr_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/lr/lr_types.hpp @@ -56,6 +56,6 @@ namespace ams::lr { } }; - static_assert(std::is_pod::value && sizeof(Path) == fs::EntryNameLengthMax); + static_assert(util::is_pod::value && sizeof(Path) == fs::EntryNameLengthMax); } diff --git a/libraries/libstratosphere/include/stratosphere/mem/impl/mem_impl_common.hpp b/libraries/libstratosphere/include/stratosphere/mem/impl/mem_impl_common.hpp index ff0bbaf56..314a3d3b5 100644 --- a/libraries/libstratosphere/include/stratosphere/mem/impl/mem_impl_common.hpp +++ b/libraries/libstratosphere/include/stratosphere/mem/impl/mem_impl_common.hpp @@ -65,6 +65,6 @@ namespace ams::mem::impl { size_t alloc_size; size_t hash; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); } diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_info.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_info.hpp index c0fcd21f8..16f784289 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_info.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_info.hpp @@ -55,7 +55,7 @@ namespace ams::ncm { } }; - static_assert(sizeof(std::is_pod::value)); + static_assert(sizeof(util::is_pod::value)); static_assert(sizeof(ContentInfo) == 0x18); } diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_manager_impl.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_manager_impl.hpp index 9f4fd8ae2..244aa3ffb 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_manager_impl.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_manager_impl.hpp @@ -65,7 +65,7 @@ namespace ams::ncm { u32 flags; fs::SaveDataSpaceId space_id; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); class ContentManagerImpl final : public IContentManager { private: diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_program_location.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_program_location.hpp index 3e2e53567..097f83eb3 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_program_location.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_program_location.hpp @@ -27,7 +27,7 @@ namespace ams::ncm { return { .program_id = program_id, .storage_id = static_cast(storage_id), }; } }; - static_assert(sizeof(ProgramLocation) == 0x10 && std::is_pod::value); + static_assert(sizeof(ProgramLocation) == 0x10 && util::is_pod::value); static_assert(sizeof(ProgramLocation) == sizeof(::NcmProgramLocation) && alignof(ProgramLocation) == alignof(::NcmProgramLocation), "ProgramLocation Libnx Compatibility"); diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_rights_id.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_rights_id.hpp index 6806fa7f5..f025407c2 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_rights_id.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_rights_id.hpp @@ -25,7 +25,7 @@ namespace ams::ncm { u8 reserved[7]; }; static_assert(sizeof(RightsId) == 0x18); - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); inline bool operator==(const RightsId &lhs, const RightsId &rhs) { return std::tie(lhs.id, lhs.key_generation) == std::tie(rhs.id, rhs.key_generation); diff --git a/libraries/libstratosphere/include/stratosphere/os/os_rw_lock_types.hpp b/libraries/libstratosphere/include/stratosphere/os/os_rw_lock_types.hpp index 4d6acf17e..166d9de8d 100644 --- a/libraries/libstratosphere/include/stratosphere/os/os_rw_lock_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/os/os_rw_lock_types.hpp @@ -36,7 +36,7 @@ namespace ams::os { }; util::BitPack32 counter; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(std::is_trivial::value); union { diff --git a/libraries/libstratosphere/include/stratosphere/pgl/pgl_types.hpp b/libraries/libstratosphere/include/stratosphere/pgl/pgl_types.hpp index 08aceb8f8..3cbd21b2c 100644 --- a/libraries/libstratosphere/include/stratosphere/pgl/pgl_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/pgl/pgl_types.hpp @@ -52,6 +52,6 @@ namespace ams::pgl { }; } }; - static_assert(sizeof(ContentMetaInfo) == 0x10 && std::is_pod::value); + static_assert(sizeof(ContentMetaInfo) == 0x10 && util::is_pod::value); } diff --git a/libraries/libstratosphere/include/stratosphere/pm/pm_types.hpp b/libraries/libstratosphere/include/stratosphere/pm/pm_types.hpp index f433bddb4..a26fe88aa 100644 --- a/libraries/libstratosphere/include/stratosphere/pm/pm_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/pm/pm_types.hpp @@ -97,6 +97,6 @@ namespace ams::pm { u32 event; os::ProcessId process_id; }; - static_assert(sizeof(ProcessEventInfo) == 0x10 && std::is_pod::value, "ProcessEventInfo definition!"); + static_assert(sizeof(ProcessEventInfo) == 0x10 && util::is_pod::value, "ProcessEventInfo definition!"); } diff --git a/libraries/libstratosphere/include/stratosphere/reg.hpp b/libraries/libstratosphere/include/stratosphere/reg.hpp index 6321d53b8..6b5076f93 100644 --- a/libraries/libstratosphere/include/stratosphere/reg.hpp +++ b/libraries/libstratosphere/include/stratosphere/reg.hpp @@ -36,7 +36,7 @@ namespace ams::reg { } inline void SetBits(volatile u32 *reg, u32 mask) { - *reg |= mask; + *reg = *reg | mask; } inline void SetBits(uintptr_t reg, u32 mask) { @@ -44,7 +44,7 @@ namespace ams::reg { } inline void ClearBits(volatile u32 *reg, u32 mask) { - *reg &= ~mask; + *reg = *reg & ~mask; } inline void ClearBits(uintptr_t reg, u32 mask) { @@ -52,7 +52,7 @@ namespace ams::reg { } inline void MaskBits(volatile u32 *reg, u32 mask) { - *reg &= mask; + *reg = *reg & mask; } inline void MaskBits(uintptr_t reg, u32 mask) { diff --git a/libraries/libstratosphere/include/stratosphere/settings/factory/settings_device_certificate.hpp b/libraries/libstratosphere/include/stratosphere/settings/factory/settings_device_certificate.hpp index b9be05258..4c445a951 100644 --- a/libraries/libstratosphere/include/stratosphere/settings/factory/settings_device_certificate.hpp +++ b/libraries/libstratosphere/include/stratosphere/settings/factory/settings_device_certificate.hpp @@ -22,18 +22,18 @@ namespace ams::settings::factory { u8 data[0x180]; }; static_assert(sizeof(EccP256DeviceCertificate) == 0x180); - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); struct EccB233DeviceCertificate { u8 data[0x180]; }; static_assert(sizeof(EccB233DeviceCertificate) == 0x180); - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); struct Rsa2048DeviceCertificate { u8 data[0x240]; }; static_assert(sizeof(Rsa2048DeviceCertificate) == 0x240); - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); } diff --git a/libraries/libstratosphere/include/stratosphere/settings/factory/settings_serial_number.hpp b/libraries/libstratosphere/include/stratosphere/settings/factory/settings_serial_number.hpp index 068d7d655..301139cca 100644 --- a/libraries/libstratosphere/include/stratosphere/settings/factory/settings_serial_number.hpp +++ b/libraries/libstratosphere/include/stratosphere/settings/factory/settings_serial_number.hpp @@ -22,6 +22,6 @@ namespace ams::settings::factory { char str[0x18]; }; static_assert(sizeof(SerialNumber) == 0x18); - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); } diff --git a/libraries/libstratosphere/include/stratosphere/settings/settings_fwdbg_types.hpp b/libraries/libstratosphere/include/stratosphere/settings/settings_fwdbg_types.hpp index 461e36b0a..7fee0800c 100644 --- a/libraries/libstratosphere/include/stratosphere/settings/settings_fwdbg_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/settings/settings_fwdbg_types.hpp @@ -27,12 +27,12 @@ namespace ams::settings::fwdbg { char value[util::AlignUp(SettingsNameLengthMax + 1, alignof(u64))]; }; - static_assert(std::is_pod::value && sizeof(SettingsName) > SettingsNameLengthMax); + static_assert(util::is_pod::value && sizeof(SettingsName) > SettingsNameLengthMax); struct SettingsItemKey : sf::LargeData { char value[util::AlignUp(SettingsItemKeyLengthMax + 1, alignof(u64))]; }; - static_assert(std::is_pod::value && sizeof(SettingsItemKey) > SettingsItemKeyLengthMax); + static_assert(util::is_pod::value && sizeof(SettingsItemKey) > SettingsItemKeyLengthMax); } diff --git a/libraries/libstratosphere/include/stratosphere/settings/settings_types.hpp b/libraries/libstratosphere/include/stratosphere/settings/settings_types.hpp index 0b9600624..2930d1ffd 100644 --- a/libraries/libstratosphere/include/stratosphere/settings/settings_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/settings/settings_types.hpp @@ -152,7 +152,7 @@ namespace ams::settings { return impl::IsValidLanguageCode(lc, std::make_index_sequence{}); } - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(LanguageCode) == sizeof(u64)); /* Not an official type, but convenient. */ @@ -193,7 +193,7 @@ namespace ams::settings { } }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(FirmwareVersion) == sizeof(::SetSysFirmwareVersion)); constexpr inline bool operator==(const FirmwareVersion &lhs, const FirmwareVersion &rhs) { diff --git a/libraries/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_server_message_processor.hpp b/libraries/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_server_message_processor.hpp index 65dd2701d..f96c6fd49 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_server_message_processor.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_server_message_processor.hpp @@ -63,7 +63,7 @@ namespace ams::sf::cmif { } }; - static_assert(std::is_pod::value, "std::is_pod::value"); + static_assert(util::is_pod::value, "util::is_pod::value"); static_assert(sizeof(ServerMessageRuntimeMetadata) == sizeof(u64), "sizeof(ServerMessageRuntimeMetadata)"); class ServerMessageProcessor { diff --git a/libraries/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp b/libraries/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp index 44e35b4f7..cca03664c 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/cmif/sf_cmif_service_dispatch.hpp @@ -61,7 +61,7 @@ namespace ams::sf::cmif { return this->handler; } }; - static_assert(std::is_pod::value && sizeof(ServiceCommandMeta) == 0x18, "sizeof(ServiceCommandMeta)"); + static_assert(util::is_pod::value && sizeof(ServiceCommandMeta) == 0x18, "sizeof(ServiceCommandMeta)"); namespace impl { diff --git a/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp b/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp index 3ceb664d8..0f3a646ce 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/impl/sf_impl_command_serialization.hpp @@ -1042,7 +1042,7 @@ namespace ams::sf::impl { }; constexpr Result GetCmifOutHeaderPointer(CmifOutHeader **out_header_ptr, cmif::PointerAndSize &out_raw_data) { - CmifOutHeader *header = reinterpret_cast(out_raw_data.GetPointer()); + CmifOutHeader *header = static_cast(out_raw_data.GetPointer()); R_UNLESS(out_raw_data.GetSize() >= sizeof(*header), sf::cmif::ResultInvalidHeaderSize()); out_raw_data = cmif::PointerAndSize(out_raw_data.GetAddress() + sizeof(*header), out_raw_data.GetSize() - sizeof(*header)); *out_header_ptr = header; diff --git a/libraries/libstratosphere/source/ams/ams_environment.cpp b/libraries/libstratosphere/source/ams/ams_environment.cpp index 47babfb92..507b38435 100644 --- a/libraries/libstratosphere/source/ams/ams_environment.cpp +++ b/libraries/libstratosphere/source/ams/ams_environment.cpp @@ -182,6 +182,9 @@ extern "C" { /* Custom abort handler, so that std::abort will trigger these. */ void abort() { + static ams::os::Mutex abort_lock(true); + std::scoped_lock lk(abort_lock); + ams::AbortImpl(); __builtin_unreachable(); } diff --git a/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_work_memory.hpp b/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_work_memory.hpp index cf590c573..11b380882 100644 --- a/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_work_memory.hpp +++ b/libraries/libstratosphere/source/capsrv/server/decodersrv/decodersrv_decoder_work_memory.hpp @@ -23,6 +23,6 @@ namespace ams::capsrv::server { }; static_assert(sizeof(DecoderWorkMemory) == SoftwareJpegDecoderWorkMemorySize); static_assert(alignof(DecoderWorkMemory) == os::MemoryPageSize); - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); } diff --git a/libraries/libstratosphere/source/fs/fs_file_path_hash.hpp b/libraries/libstratosphere/source/fs/fs_file_path_hash.hpp index bbc580839..3fa00fbcb 100644 --- a/libraries/libstratosphere/source/fs/fs_file_path_hash.hpp +++ b/libraries/libstratosphere/source/fs/fs_file_path_hash.hpp @@ -23,7 +23,7 @@ namespace ams::fs::impl { struct FilePathHash : public Newable { u8 data[FilePathHashSize]; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); inline bool operator==(const FilePathHash &lhs, const FilePathHash &rhs) { return std::memcmp(lhs.data, rhs.data, FilePathHashSize) == 0; diff --git a/libraries/libstratosphere/source/fs/fsa/fs_mount_name.hpp b/libraries/libstratosphere/source/fs/fsa/fs_mount_name.hpp index 8f77d3fe2..de999277c 100644 --- a/libraries/libstratosphere/source/fs/fsa/fs_mount_name.hpp +++ b/libraries/libstratosphere/source/fs/fsa/fs_mount_name.hpp @@ -21,6 +21,6 @@ namespace ams::fs { struct MountName { char str[MountNameLengthMax + 1]; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); } diff --git a/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp b/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp index dc598e492..591c35a9d 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_partition_file_system_meta.cpp @@ -24,7 +24,7 @@ namespace ams::fssystem { u32 name_table_size; u32 reserved; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(sizeof(PartitionFileSystemMeta::PartitionFileSystemHeader) == 0x10); template diff --git a/libraries/libstratosphere/source/fssystem/fssystem_romfs_filesystem.cpp b/libraries/libstratosphere/source/fssystem/fssystem_romfs_filesystem.cpp index 93659d160..009c51d06 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_romfs_filesystem.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_romfs_filesystem.cpp @@ -37,7 +37,7 @@ namespace ams::fssystem { virtual ~RomFsFile() { /* ... */ } public: virtual Result ReadImpl(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override { - R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result { + R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result { size_t read_size = 0; R_TRY(this->DryRead(std::addressof(read_size), offset, size, option, fs::OpenMode_Read)); @@ -84,7 +84,7 @@ namespace ams::fssystem { operate_size = this->GetSize() - offset; } - R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result { + R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result { R_TRY(this->parent->GetBaseStorage()->OperateRange(dst, dst_size, op_id, this->start + offset, operate_size, src, src_size)); return ResultSuccess(); }, AMS_CURRENT_FUNCTION_NAME)); @@ -113,7 +113,7 @@ namespace ams::fssystem { virtual ~RomFsDirectory() override { /* ... */ } public: virtual Result ReadImpl(s64 *out_count, fs::DirectoryEntry *out_entries, s64 max_entries) { - R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result { + R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result { return this->ReadImpl(out_count, std::addressof(this->current_find), out_entries, max_entries); }, AMS_CURRENT_FUNCTION_NAME)); return ResultSuccess(); @@ -278,7 +278,7 @@ namespace ams::fssystem { } Result RomFsFileSystem::GetFileInfo(RomFileTable::FileInfo *out, const char *path) { - R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result { + R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result { R_TRY_CATCH(this->rom_file_table.OpenFile(out, path)) { R_CONVERT(fs::ResultDbmNotFound, fs::ResultPathNotFound()); } R_END_TRY_CATCH; @@ -325,7 +325,7 @@ namespace ams::fssystem { } Result RomFsFileSystem::GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) { - R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result { + R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result { RomDirectoryInfo dir_info; R_TRY_CATCH(this->rom_file_table.GetDirectoryInformation(std::addressof(dir_info), path)) { diff --git a/libraries/libstratosphere/source/kvdb/kvdb_archive.cpp b/libraries/libstratosphere/source/kvdb/kvdb_archive.cpp index f3f365752..e3819ff36 100644 --- a/libraries/libstratosphere/source/kvdb/kvdb_archive.cpp +++ b/libraries/libstratosphere/source/kvdb/kvdb_archive.cpp @@ -42,7 +42,7 @@ namespace ams::kvdb { return header; } }; - static_assert(sizeof(ArchiveHeader) == 0xC && std::is_pod::value, "ArchiveHeader definition!"); + static_assert(sizeof(ArchiveHeader) == 0xC && util::is_pod::value, "ArchiveHeader definition!"); struct ArchiveEntryHeader { u8 magic[sizeof(ArchiveEntryMagic)]; @@ -62,7 +62,7 @@ namespace ams::kvdb { return header; } }; - static_assert(sizeof(ArchiveEntryHeader) == 0xC && std::is_pod::value, "ArchiveEntryHeader definition!"); + static_assert(sizeof(ArchiveEntryHeader) == 0xC && util::is_pod::value, "ArchiveEntryHeader definition!"); } diff --git a/libraries/libstratosphere/source/mem/impl/heap/mem_impl_heap_tls_heap_static.hpp b/libraries/libstratosphere/source/mem/impl/heap/mem_impl_heap_tls_heap_static.hpp index eace75938..523aac2ed 100644 --- a/libraries/libstratosphere/source/mem/impl/heap/mem_impl_heap_tls_heap_static.hpp +++ b/libraries/libstratosphere/source/mem/impl/heap/mem_impl_heap_tls_heap_static.hpp @@ -160,7 +160,7 @@ namespace ams::mem::impl::heap { template static ALWAYS_INLINE T *AlignUpPage(T *ptr) { - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(util::IsAligned(PageSize, alignof(T))); return reinterpret_cast(AlignUpPage(reinterpret_cast(ptr))); } @@ -171,7 +171,7 @@ namespace ams::mem::impl::heap { template static ALWAYS_INLINE T *AlignDownPage(T *ptr) { - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(util::IsAligned(PageSize, alignof(T))); return reinterpret_cast(AlignDownPage(reinterpret_cast(ptr))); } @@ -182,7 +182,7 @@ namespace ams::mem::impl::heap { template static ALWAYS_INLINE T *AlignUpPhysicalPage(T *ptr) { - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(util::IsAligned(PhysicalPageSize, alignof(T))); return reinterpret_cast(AlignUpPhysicalPage(reinterpret_cast(ptr))); } @@ -193,7 +193,7 @@ namespace ams::mem::impl::heap { template static ALWAYS_INLINE T *AlignDownPhysicalPage(T *ptr) { - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(util::IsAligned(PhysicalPageSize, alignof(T))); return reinterpret_cast(AlignDownPhysicalPage(reinterpret_cast(ptr))); } diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp index 9ffbb85a1..633e28aec 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell.cpp @@ -27,7 +27,7 @@ namespace ams::pgl::srv { os::ProcessId process_id; u32 flags; }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); enum ProcessDataFlag : u32 { ProcessDataFlag_None = 0, diff --git a/libraries/libstratosphere/source/util/ini.c b/libraries/libstratosphere/source/util/ini.c index 426430c9b..501e9224f 100644 --- a/libraries/libstratosphere/source/util/ini.c +++ b/libraries/libstratosphere/source/util/ini.c @@ -70,7 +70,10 @@ static char* find_chars_or_comment(const char* s, const char* chars) /* Version of strncpy that ensures dest (size bytes) is null-terminated. */ static char* strncpy0(char* dest, const char* src, size_t size) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy(dest, src, size - 1); +#pragma GCC diagnostic pop dest[size - 1] = '\0'; return dest; } diff --git a/libraries/libvapours/include/vapours/defines.hpp b/libraries/libvapours/include/vapours/defines.hpp index 5f78e90fc..391640806 100644 --- a/libraries/libvapours/include/vapours/defines.hpp +++ b/libraries/libvapours/include/vapours/defines.hpp @@ -35,9 +35,6 @@ #define CONST_FOLD(x) (__builtin_constant_p(x) ? (x) : (x)) -#define WRAP_TEMPLATE_CONSTANT(...) ([] { using U = union { static constexpr auto GetValue() { return __VA_ARGS__; } }; return U{}; }()) -#define UNWRAP_TEMPLATE_CONSTANT(tpnm) (tpnm::GetValue()) - #define CONCATENATE_IMPL(s1, s2) s1##s2 #define CONCATENATE(s1, s2) CONCATENATE_IMPL(s1, s2) diff --git a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_code_generator.hpp b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_code_generator.hpp index 3cf0b73d4..88866a051 100644 --- a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_code_generator.hpp +++ b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_code_generator.hpp @@ -261,12 +261,11 @@ namespace ams::svc::codegen::impl { /* TODO */ }; - template - static ALWAYS_INLINE void GenerateCodeForMetaCode(MetaCodeHolder) { - constexpr auto MetaCode = UNWRAP_TEMPLATE_CONSTANT(MetaCodeHolder); + template + static ALWAYS_INLINE void GenerateCodeForMetaCode() { constexpr size_t NumOperations = MetaCode.GetNumOperations(); static_assert(NumOperations <= 64); - #define SVC_CODEGEN_HANDLER(n) do { if constexpr (n < NumOperations) { constexpr auto Operation = MetaCode.GetOperation(n); GenerateCodeForOperation(WRAP_TEMPLATE_CONSTANT(Operation)); } } while (0) + #define SVC_CODEGEN_HANDLER(n) do { if constexpr (n < NumOperations) { constexpr auto Operation = MetaCode.GetOperation(n); GenerateCodeForOperation(); } } while (0) SVC_CODEGEN_FOR_I_FROM_0_TO_64(SVC_CODEGEN_HANDLER) #undef SVC_CODEGEN_HANDLER } diff --git a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_common.hpp b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_common.hpp index 97f6f5d22..f1a7b2b63 100644 --- a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_common.hpp +++ b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_common.hpp @@ -143,7 +143,7 @@ namespace ams::svc::codegen::impl { template class RegisterAllocator { - private: + public: std::array map; public: constexpr explicit RegisterAllocator() : map() { /* ... */ } diff --git a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_kernel_svc_wrapper.hpp b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_kernel_svc_wrapper.hpp index 44f11b441..6872199b1 100644 --- a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_kernel_svc_wrapper.hpp +++ b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_kernel_svc_wrapper.hpp @@ -319,38 +319,43 @@ namespace ams::svc::codegen::impl { template struct TypeIndexFilter { - template - static constexpr auto GetFilteredTupleImpl(UseArrayHolder, std::tuple, std::index_sequence) { - constexpr auto UseArray = UNWRAP_TEMPLATE_CONSTANT(UseArrayHolder); - static_assert(sizeof...(TailType) == sizeof...(TailIndex)); - static_assert(HeadIndex <= UseArray.size()); - if constexpr (sizeof...(TailType) == 0) { - if constexpr (!UseArray[HeadIndex]) { - return std::tuple{}; - } else { - return std::tuple<>{}; - } - } else { - auto tail_tuple = GetFilteredTupleImpl(UseArrayHolder{}, std::tuple{}, std::index_sequence{}); - if constexpr (!UseArray[HeadIndex]) { - return std::tuple_cat(std::tuple{}, tail_tuple); - } else { - return std::tuple_cat(std::tuple<>{}, tail_tuple); - } - } - } + template + struct Helper; - template - static constexpr auto GetFilteredTuple(UseArrayHolder) { - return GetFilteredTupleImpl(UseArrayHolder{}, std::tuple{}, std::make_index_sequence()); - } + template + struct Helper, std::index_sequence> { + using Type = std::tuple<>; + }; + + template + struct Helper, std::index_sequence> { + + using LastHeadType = std::tuple; + using LastNullType = std::tuple<>; + + using LastType = typename std::conditional::type; + + using NextTailType = std::tuple; + using NextTailSequence = std::index_sequence; + + using NextType = typename std::conditional(), std::declval::Type>())), + decltype(std::tuple_cat(std::declval(), std::declval::Type>())) + >::type; + + using Type = typename std::conditional::type; + + }; + + template + using FilteredTupleType = typename Helper, decltype(std::make_index_sequence())>::Type; }; - template - static constexpr auto GetModifiedOperations(AllocatorHolder, std::tuple ops) { + template + static constexpr auto GetModifiedOperations(std::tuple ops) { constexpr size_t ModifyRegister = [] { - auto allocator = UNWRAP_TEMPLATE_CONSTANT(AllocatorHolder); + auto allocator = Allocator; return allocator.AllocateFirstFree(); }(); @@ -359,13 +364,13 @@ namespace ams::svc::codegen::impl { return std::tuple{}; } - template - static constexpr auto GenerateBeforeOperations(MetaCodeGenerator &mcg, AllocatorHolder, std::tuple ops) -> RegisterAllocator { + template + static constexpr auto GenerateBeforeOperations(MetaCodeGenerator &mcg, std::tuple ops) -> RegisterAllocator { constexpr size_t NumOperations = 1 + sizeof...(OtherOperations); using OperationsTuple = decltype(ops); using FilterHelper = TypeIndexFilter; - constexpr auto ProcessOperation = [](MetaCodeGenerator &pr_mcg, auto &allocator, Operation) { + constexpr auto ProcessOperation = [](MetaCodeGenerator &pr_mcg, auto &allocator) { if (Conversion::template CanGenerateCode(allocator)) { Conversion::template GenerateCode(pr_mcg, allocator); return true; @@ -373,12 +378,12 @@ namespace ams::svc::codegen::impl { return false; }; - constexpr auto ProcessResults = [ProcessOperation](std::tuple) { - auto allocator = UNWRAP_TEMPLATE_CONSTANT(AllocatorHolder); + constexpr auto ProcessResults = [](std::tuple) { + auto allocator = AllocatorVal; MetaCodeGenerator pr_mcg; - auto use_array = std::array{ ProcessOperation(pr_mcg, allocator, Operations{})... }; + auto use_array = std::array{ ProcessOp.template operator()(pr_mcg, allocator)... }; return std::make_tuple(use_array, allocator, pr_mcg); - }(OperationsTuple{}); + }.template operator()(OperationsTuple{}); constexpr auto CanGenerate = std::get<0>(ProcessResults); constexpr auto AfterAllocator = std::get<1>(ProcessResults); @@ -388,15 +393,15 @@ namespace ams::svc::codegen::impl { mcg.AddOperationDirectly(GeneratedCode.GetOperation(i)); } - constexpr auto FilteredOperations = FilterHelper::template GetFilteredTuple(WRAP_TEMPLATE_CONSTANT(CanGenerate)); - static_assert(std::tuple_size::value <= NumOperations); - if constexpr (std::tuple_size::value > 0) { - if constexpr (std::tuple_size::value != NumOperations) { - return GenerateBeforeOperations(mcg, WRAP_TEMPLATE_CONSTANT(AfterAllocator), FilteredOperations); + using FilteredOperations = typename FilterHelper::FilteredTupleType; + static_assert(std::tuple_size::value <= NumOperations); + if constexpr (std::tuple_size::value > 0) { + if constexpr (std::tuple_size::value != NumOperations) { + return GenerateBeforeOperations(mcg, FilteredOperations{}); } else { /* No progress was made, so we need to make a change. */ - constexpr auto ModifiedOperations = GetModifiedOperations(WRAP_TEMPLATE_CONSTANT(AfterAllocator), FilteredOperations); - return GenerateBeforeOperations(mcg, WRAP_TEMPLATE_CONSTANT(AfterAllocator), ModifiedOperations); + constexpr auto ModifiedOperations = GetModifiedOperations(FilteredOperations{}); + return GenerateBeforeOperations(mcg, ModifiedOperations); } } else { return AfterAllocator; @@ -433,7 +438,7 @@ namespace ams::svc::codegen::impl { /* Generate code for before operations. */ if constexpr (Conversion::NumBeforeOperations > 0) { - allocator = GenerateBeforeOperations(mcg, WRAP_TEMPLATE_CONSTANT(InitialAllocator), typename Conversion::BeforeOperations{}); + allocator = GenerateBeforeOperations(mcg, typename Conversion::BeforeOperations{}); } else { allocator = InitialAllocator; } @@ -527,8 +532,8 @@ namespace ams::svc::codegen::impl { static ALWAYS_INLINE void WrapSvcFunction() { /* Generate appropriate assembly. */ - GenerateCodeForMetaCode(WRAP_TEMPLATE_CONSTANT(BeforeMetaCode)); - ON_SCOPE_EXIT { GenerateCodeForMetaCode(WRAP_TEMPLATE_CONSTANT(AfterMetaCode)); }; + GenerateCodeForMetaCode(); + ON_SCOPE_EXIT { GenerateCodeForMetaCode(); }; return reinterpret_cast(Function)(); } 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 1f4eb0f0c..5edd6e1f9 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 @@ -24,7 +24,7 @@ namespace ams::svc::codegen::impl { static constexpr size_t MaxParameters = 8; private: static constexpr size_t InvalidIndex = std::numeric_limits::max(); - private: + public: /* ABI parameters. */ Abi abi; @@ -102,7 +102,7 @@ namespace ams::svc::codegen::impl { }; class ProcedureLayout { - private: + public: Abi abi; ParameterLayout input; ParameterLayout output; @@ -205,7 +205,7 @@ namespace ams::svc::codegen::impl { }; class SvcInvocationLayout { - private: + public: Abi abi; ParameterLayout input; ParameterLayout output; diff --git a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_layout_conversion.hpp b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_layout_conversion.hpp index bd0190c50..f15601790 100644 --- a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_layout_conversion.hpp +++ b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_layout_conversion.hpp @@ -304,9 +304,8 @@ namespace ams::svc::codegen::impl { static constexpr auto DetermineConversionOperations() { [[maybe_unused]] constexpr auto Procedure = LayoutForKernel; [[maybe_unused]] constexpr ParameterLayout Svc = Input ? LayoutForSvc.GetInputLayout() : LayoutForSvc.GetOutputLayout(); - [[maybe_unused]] constexpr std::array ParameterMap = [](SvcHolder){ + [[maybe_unused]] constexpr std::array ParameterMap = [](){ /* We want to iterate over the parameters in sorted order. */ - constexpr ParameterLayout CapturedSvc = UNWRAP_TEMPLATE_CONSTANT(SvcHolder); std::array map{}; const size_t num_parameters = CapturedSvc.GetNumParameters(); for (size_t i = 0; i < num_parameters; i++) { @@ -322,7 +321,7 @@ namespace ams::svc::codegen::impl { } } return map; - }(WRAP_TEMPLATE_CONSTANT(Svc)); + }.template operator()(); if constexpr (ParameterIndex >= Svc.GetNumParameters()) { /* Base case: we're done. */ @@ -378,15 +377,13 @@ namespace ams::svc::codegen::impl { constexpr size_t PassedSize = ProcedureParam.GetTypeSize(); /* TODO: C++20 templated lambdas. For now, use GCC extension syntax. */ - constexpr auto SvcIndexSequence = [](SvcParamWrapper, std::index_sequence) { - constexpr Parameter CapturedSvcParam = UNWRAP_TEMPLATE_CONSTANT(SvcParamWrapper); + constexpr auto SvcIndexSequence = [](std::index_sequence) { return std::index_sequence{}; - }(WRAP_TEMPLATE_CONSTANT(SvcParam), std::make_index_sequence()); + }.template operator()(std::make_index_sequence()); - constexpr auto OperationValue = [](ProcedureLocWrapper, std::index_sequence) { - constexpr Location CapturedProcedureLoc = UNWRAP_TEMPLATE_CONSTANT(ProcedureLocWrapper); + constexpr auto OperationValue = [](std::index_sequence) { return LayoutConversionBase::OperationScatter{}; - }(WRAP_TEMPLATE_CONSTANT(ProcedureLoc), SvcIndexSequence); + }.template operator()(SvcIndexSequence); constexpr auto cur_op = std::make_tuple(OperationValue); diff --git a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_meta_code.hpp b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_meta_code.hpp index 4b1b5d27f..8d84a6182 100644 --- a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_meta_code.hpp +++ b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_meta_code.hpp @@ -79,7 +79,7 @@ namespace ams::svc::codegen::impl { return op; } - private: + public: size_t num_operations; std::array operations; public: @@ -98,15 +98,13 @@ namespace ams::svc::codegen::impl { } }; - template + template static constexpr auto GetOperationParameterSequence() { - constexpr auto _Operation = UNWRAP_TEMPLATE_CONSTANT(_OperationHolder); - constexpr size_t NumParameters = _Operation.num_parameters; + constexpr size_t NumParameters = Operation.num_parameters; - return [](OperationHolder, std::index_sequence) { - constexpr auto Operation = UNWRAP_TEMPLATE_CONSTANT(OperationHolder); + return [](std::index_sequence) { return std::index_sequence{}; - }(_OperationHolder{}, std::make_index_sequence()); + }(std::make_index_sequence()); } template @@ -130,10 +128,9 @@ namespace ams::svc::codegen::impl { #undef META_CODE_OPERATION_KIND_GENERATE_CODE } - template - static ALWAYS_INLINE void GenerateCodeForOperation(OperationHolder) { - constexpr auto Operation = UNWRAP_TEMPLATE_CONSTANT(OperationHolder); - GenerateCodeForOperationImpl(GetOperationParameterSequence()); + template + static ALWAYS_INLINE void GenerateCodeForOperation() { + GenerateCodeForOperationImpl(GetOperationParameterSequence()); } class MetaCodeGenerator { diff --git a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_parameter.hpp b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_parameter.hpp index 76825f3e4..f077e30ba 100644 --- a/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_parameter.hpp +++ b/libraries/libvapours/include/vapours/svc/codegen/impl/svc_codegen_impl_parameter.hpp @@ -27,7 +27,7 @@ namespace ams::svc::codegen::impl { class Location { private: static constexpr size_t InvalidIndex = std::numeric_limits::max(); - private: + public: Storage storage; size_t index; public: @@ -75,7 +75,7 @@ namespace ams::svc::codegen::impl { static constexpr size_t MaxLocations = 8; static constexpr size_t IdentifierLengthMax = 0x40; class Identifier { - private: + public: char name[IdentifierLengthMax]; size_t index; public: @@ -99,7 +99,7 @@ namespace ams::svc::codegen::impl { return !(*this == rhs); } }; - private: + public: Identifier identifier; ArgumentType type; size_t type_size; diff --git a/libraries/libvapours/include/vapours/svc/ipc/svc_message_buffer.hpp b/libraries/libvapours/include/vapours/svc/ipc/svc_message_buffer.hpp index 9a979e874..1c379ca74 100644 --- a/libraries/libvapours/include/vapours/svc/ipc/svc_message_buffer.hpp +++ b/libraries/libvapours/include/vapours/svc/ipc/svc_message_buffer.hpp @@ -58,11 +58,11 @@ namespace ams::svc::ipc { private: util::BitPack32 header[2]; public: - constexpr ALWAYS_INLINE MessageHeader() : header({util::BitPack32{0}, util::BitPack32{0}}) { + constexpr ALWAYS_INLINE MessageHeader() : header{util::BitPack32{0}, util::BitPack32{0}} { this->header[0].Set(NullTag); } - constexpr ALWAYS_INLINE MessageHeader(u16 tag, bool special, s32 ptr, s32 send, s32 recv, s32 exch, s32 raw, s32 recv_list) : header({util::BitPack32{0}, util::BitPack32{0}}) { + constexpr ALWAYS_INLINE MessageHeader(u16 tag, bool special, s32 ptr, s32 send, s32 recv, s32 exch, s32 raw, s32 recv_list) : header{util::BitPack32{0}, util::BitPack32{0}} { this->header[0].Set(tag); this->header[0].Set(ptr); this->header[0].Set(send); @@ -74,11 +74,11 @@ namespace ams::svc::ipc { this->header[1].Set(special); } - ALWAYS_INLINE explicit MessageHeader(const MessageBuffer &buf) : header({util::BitPack32{0}, util::BitPack32{0}}) { + ALWAYS_INLINE explicit MessageHeader(const MessageBuffer &buf) : header{util::BitPack32{0}, util::BitPack32{0}} { buf.Get(0, this->header, util::size(this->header)); } - ALWAYS_INLINE explicit MessageHeader(const u32 *msg) : header({util::BitPack32{msg[0]}, util::BitPack32{msg[1]}}) { /* ... */ } + ALWAYS_INLINE explicit MessageHeader(const u32 *msg) : header{util::BitPack32{msg[0]}, util::BitPack32{msg[1]}} { /* ... */ } constexpr ALWAYS_INLINE u16 GetTag() const { return this->header[0].Get(); @@ -219,9 +219,9 @@ namespace ams::svc::ipc { private: util::BitPack32 data[3]; public: - constexpr ALWAYS_INLINE MapAliasDescriptor() : data({util::BitPack32{0}, util::BitPack32{0}, util::BitPack32{0}}) { /* ... */ } + constexpr ALWAYS_INLINE MapAliasDescriptor() : data{util::BitPack32{0}, util::BitPack32{0}, util::BitPack32{0}} { /* ... */ } - ALWAYS_INLINE MapAliasDescriptor(const void *buffer, size_t _size, Attribute attr = Attribute_Ipc) : data({util::BitPack32{0}, util::BitPack32{0}, util::BitPack32{0}}) { + ALWAYS_INLINE MapAliasDescriptor(const void *buffer, size_t _size, Attribute attr = Attribute_Ipc) : data{util::BitPack32{0}, util::BitPack32{0}, util::BitPack32{0}} { const u64 address = reinterpret_cast(buffer); const u64 size = static_cast(_size); this->data[0] = { static_cast(size) }; @@ -233,7 +233,7 @@ namespace ams::svc::ipc { this->data[2].Set(GetAddressHigh(address)); } - ALWAYS_INLINE MapAliasDescriptor(const MessageBuffer &buf, s32 index) : data({util::BitPack32{0}, util::BitPack32{0}, util::BitPack32{0}}) { + ALWAYS_INLINE MapAliasDescriptor(const MessageBuffer &buf, s32 index) : data{util::BitPack32{0}, util::BitPack32{0}, util::BitPack32{0}} { buf.Get(index, this->data, util::size(this->data)); } @@ -283,9 +283,9 @@ namespace ams::svc::ipc { private: util::BitPack32 data[2]; public: - constexpr ALWAYS_INLINE PointerDescriptor() : data({util::BitPack32{0}, util::BitPack32{0}}) { /* ... */ } + constexpr ALWAYS_INLINE PointerDescriptor() : data{util::BitPack32{0}, util::BitPack32{0}} { /* ... */ } - ALWAYS_INLINE PointerDescriptor(const void *buffer, size_t size, s32 index) : data({util::BitPack32{0}, util::BitPack32{0}}) { + ALWAYS_INLINE PointerDescriptor(const void *buffer, size_t size, s32 index) : data{util::BitPack32{0}, util::BitPack32{0}} { const u64 address = reinterpret_cast(buffer); this->data[0].Set(index); @@ -296,7 +296,7 @@ namespace ams::svc::ipc { this->data[1] = { static_cast(address) }; } - ALWAYS_INLINE PointerDescriptor(const MessageBuffer &buf, s32 index) : data({util::BitPack32{0}, util::BitPack32{0}}) { + ALWAYS_INLINE PointerDescriptor(const MessageBuffer &buf, s32 index) : data{util::BitPack32{0}, util::BitPack32{0}} { buf.Get(index, this->data, util::size(this->data)); } @@ -338,9 +338,9 @@ namespace ams::svc::ipc { private: util::BitPack32 data[2]; public: - constexpr ALWAYS_INLINE ReceiveListEntry() : data({util::BitPack32{0}, util::BitPack32{0}}) { /* ... */ } + constexpr ALWAYS_INLINE ReceiveListEntry() : data{util::BitPack32{0}, util::BitPack32{0}} { /* ... */ } - ALWAYS_INLINE ReceiveListEntry(const void *buffer, size_t size) : data({util::BitPack32{0}, util::BitPack32{0}}) { + ALWAYS_INLINE ReceiveListEntry(const void *buffer, size_t size) : data{util::BitPack32{0}, util::BitPack32{0}} { const u64 address = reinterpret_cast(buffer); this->data[0] = { static_cast(address) }; @@ -349,7 +349,7 @@ namespace ams::svc::ipc { this->data[1].Set(size); } - ALWAYS_INLINE ReceiveListEntry(u32 a, u32 b) : data({util::BitPack32{a}, util::BitPack32{b}}) { /* ... */ } + ALWAYS_INLINE ReceiveListEntry(u32 a, u32 b) : data{util::BitPack32{a}, util::BitPack32{b}} { /* ... */ } constexpr ALWAYS_INLINE uintptr_t GetAddress() { const u64 address = (static_cast(this->data[1].Get()) << AddressLow::Count) | this->data[0].Get(); diff --git a/libraries/libvapours/include/vapours/util.hpp b/libraries/libvapours/include/vapours/util.hpp index 3048f515a..867668f83 100644 --- a/libraries/libvapours/include/vapours/util.hpp +++ b/libraries/libvapours/include/vapours/util.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/libraries/libvapours/include/vapours/util/util_bitpack.hpp b/libraries/libvapours/include/vapours/util/util_bitpack.hpp index fac3c681a..c89058d61 100644 --- a/libraries/libvapours/include/vapours/util/util_bitpack.hpp +++ b/libraries/libvapours/include/vapours/util/util_bitpack.hpp @@ -50,7 +50,7 @@ namespace ams::util { static constexpr size_t Next = Index + Count; using BitPackType = BitPack; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); static_assert(Mask != 0); static_assert(std::is_integral::value || std::is_enum::value); @@ -84,10 +84,10 @@ namespace ams::util { using BitPack32 = impl::BitPack; using BitPack64 = impl::BitPack; - static_assert(std::is_pod::value); - static_assert(std::is_pod::value); - static_assert(std::is_pod::value); - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); + static_assert(util::is_pod::value); + static_assert(util::is_pod::value); + static_assert(util::is_pod::value); static_assert(std::is_trivially_destructible::value); static_assert(std::is_trivially_destructible::value); static_assert(std::is_trivially_destructible::value); diff --git a/libraries/libvapours/include/vapours/util/util_type_traits.hpp b/libraries/libvapours/include/vapours/util/util_type_traits.hpp new file mode 100644 index 000000000..146b41a46 --- /dev/null +++ b/libraries/libvapours/include/vapours/util/util_type_traits.hpp @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once +#include +#include + +namespace ams::util { + + template + using is_pod = std::bool_constant::value && std::is_trivial::value>; + +} diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_romfs.cpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_romfs.cpp index cebd406bd..5adadd40a 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_romfs.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_romfs.cpp @@ -40,7 +40,7 @@ namespace ams::mitm::fs { s64 file_table_size; s64 file_partition_ofs; }; - static_assert(std::is_pod
::value && sizeof(Header) == 0x50); + static_assert(util::is_pod
::value && sizeof(Header) == 0x50); struct DirectoryEntry { u32 parent; @@ -51,7 +51,7 @@ namespace ams::mitm::fs { u32 name_size; char name[]; }; - static_assert(std::is_pod::value && sizeof(DirectoryEntry) == 0x18); + static_assert(util::is_pod::value && sizeof(DirectoryEntry) == 0x18); struct FileEntry { u32 parent; @@ -62,7 +62,7 @@ namespace ams::mitm::fs { u32 name_size; char name[]; }; - static_assert(std::is_pod::value && sizeof(FileEntry) == 0x20); + static_assert(util::is_pod::value && sizeof(FileEntry) == 0x20); template class TableReader { diff --git a/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp b/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp index d52e582d5..1c11ef7d3 100644 --- a/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp @@ -42,7 +42,7 @@ namespace ams::settings::fwdbg { } }; - static_assert(std::is_pod::value); + static_assert(util::is_pod::value); constexpr inline bool operator==(const SdKeyValueStoreEntry &lhs, const SdKeyValueStoreEntry &rhs) { if (lhs.HasValue() != rhs.HasValue()) { diff --git a/stratosphere/boot2/source/boot2_main.cpp b/stratosphere/boot2/source/boot2_main.cpp index 2fa6c3b43..b7e7d4570 100644 --- a/stratosphere/boot2/source/boot2_main.cpp +++ b/stratosphere/boot2/source/boot2_main.cpp @@ -102,5 +102,7 @@ int main(int argc, char **argv) /* Launch all programs off of SYSTEM/the SD. */ boot2::LaunchPostSdCardBootPrograms(); + + return 0; } diff --git a/stratosphere/creport/source/creport_crash_report.cpp b/stratosphere/creport/source/creport_crash_report.cpp index c66a31aae..f04fc13b1 100644 --- a/stratosphere/creport/source/creport_crash_report.cpp +++ b/stratosphere/creport/source/creport_crash_report.cpp @@ -351,7 +351,7 @@ namespace ams::creport { } void CrashReport::SaveToFile(ScopedFile &file) { - file.WriteFormat(u8"Atmosphère Crash Report (v1.5):\n"); + file.WriteFormat("Atmosphère Crash Report (v1.5):\n"); file.WriteFormat("Result: 0x%X (2%03d-%04d)\n\n", this->result.GetValue(), this->result.GetModule(), this->result.GetDescription()); /* Process Info. */ diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp index 302dcb22f..324ea63aa 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp @@ -141,7 +141,7 @@ namespace ams::dmnt::cheat::impl { } /* Clear metadata. */ - static_assert(std::is_podcheat_process_metadata)>::value, "CheatProcessMetadata definition!"); + static_assert(util::is_podcheat_process_metadata)>::value, "CheatProcessMetadata definition!"); std::memset(&this->cheat_process_metadata, 0, sizeof(this->cheat_process_metadata)); /* Clear cheat list. */ diff --git a/stratosphere/dmnt/source/dmnt_service.hpp b/stratosphere/dmnt/source/dmnt_service.hpp index 27aa3f187..80ba6de55 100644 --- a/stratosphere/dmnt/source/dmnt_service.hpp +++ b/stratosphere/dmnt/source/dmnt_service.hpp @@ -55,7 +55,7 @@ namespace ams::dmnt { } }; - static_assert(std::is_pod::value && sizeof(TargetIOFileHandle) == sizeof(u64), "TargetIOFileHandle"); + static_assert(util::is_pod::value && sizeof(TargetIOFileHandle) == sizeof(u64), "TargetIOFileHandle"); class DebugMonitorService final : public sf::IServiceObject { private: diff --git a/stratosphere/fatal/source/fatal_config.cpp b/stratosphere/fatal/source/fatal_config.cpp index bbebe52a6..60e788b89 100644 --- a/stratosphere/fatal/source/fatal_config.cpp +++ b/stratosphere/fatal/source/fatal_config.cpp @@ -77,21 +77,21 @@ namespace ams::fatal::srv { /* Setup messages. */ { - this->error_msg = u8"Error Code: 2%03d-%04d (0x%x)\n"; + this->error_msg = "Error Code: 2%03d-%04d (0x%x)\n"; - this->error_desc = u8"An error has occured.\n\n" - u8"Please press the POWER Button to restart the console normally, or a VOL button\n" - u8"to reboot to a payload (or RCM, if none is present). If you are unable to\n" - u8"restart the console, hold the POWER Button for 12 seconds to turn the console off.\n\n" - u8"If the problem persists, refer to the Nintendo Support Website.\n" - u8"support.nintendo.com/switch/error\n"; + this->error_desc = "An error has occured.\n\n" + "Please press the POWER Button to restart the console normally, or a VOL button\n" + "to reboot to a payload (or RCM, if none is present). If you are unable to\n" + "restart the console, hold the POWER Button for 12 seconds to turn the console off.\n\n" + "If the problem persists, refer to the Nintendo Support Website.\n" + "support.nintendo.com/switch/error\n"; /* If you're running Atmosphere on a quest unit for some reason, talk to me on discord. */ - this->quest_desc = u8"Please call 1-800-875-1852 for service.\n\n" - u8"Also, please be aware that running Atmosphere on a Quest device is not fully\n" - u8"supported. Perhaps try booting your device without Atmosphere before calling\n" - u8"an official Nintendo service hotline. If you encounter further issues, please\n" - u8"contact SciresM#0524 on Discord, or via some other means.\n"; + this->quest_desc = "Please call 1-800-875-1852 for service.\n\n" + "Also, please be aware that running Atmosphere on a Quest device is not fully\n" + "supported. Perhaps try booting your device without Atmosphere before calling\n" + "an official Nintendo service hotline. If you encounter further issues, please\n" + "contact SciresM#0524 on Discord, or via some other means.\n"; /* TODO: Try to load dynamically? */ /* FsStorage message_storage; */ diff --git a/stratosphere/fatal/source/fatal_task_error_report.cpp b/stratosphere/fatal/source/fatal_task_error_report.cpp index 6744be8ec..512693d93 100644 --- a/stratosphere/fatal/source/fatal_task_error_report.cpp +++ b/stratosphere/fatal/source/fatal_task_error_report.cpp @@ -79,13 +79,13 @@ namespace ams::fatal::srv { std::snprintf(file_path, sizeof(file_path) - 1, "sdmc:/atmosphere/fatal_reports/%011lu_%016lx.log", timestamp, static_cast(this->context->program_id)); ScopedFile file(file_path); if (file.IsOpen()) { - file.WriteFormat(u8"Atmosphère Fatal Report (v1.1):\n"); + file.WriteFormat("Atmosphère Fatal Report (v1.1):\n"); file.WriteFormat("Result: 0x%X (2%03d-%04d)\n\n", this->context->result.GetValue(), this->context->result.GetModule(), this->context->result.GetDescription()); file.WriteFormat("Program ID: %016lx\n", static_cast(this->context->program_id)); if (strlen(this->context->proc_name)) { file.WriteFormat("Process Name: %s\n", this->context->proc_name); } - file.WriteFormat(u8"Firmware: %s (Atmosphère %u.%u.%u-%s)\n", GetFatalConfig().GetFirmwareVersion().display_version, ATMOSPHERE_RELEASE_VERSION, ams::GetGitRevision()); + file.WriteFormat("Firmware: %s (Atmosphère %u.%u.%u-%s)\n", GetFatalConfig().GetFirmwareVersion().display_version, ATMOSPHERE_RELEASE_VERSION, ams::GetGitRevision()); if (this->context->cpu_ctx.architecture == CpuContext::Architecture_Aarch32) { file.WriteFormat("General Purpose Registers:\n"); diff --git a/stratosphere/fatal/source/fatal_task_screen.cpp b/stratosphere/fatal/source/fatal_task_screen.cpp index dbd78690f..6ab3f08e8 100644 --- a/stratosphere/fatal/source/fatal_task_screen.cpp +++ b/stratosphere/fatal/source/fatal_task_screen.cpp @@ -213,18 +213,18 @@ namespace ams::fatal::srv { font::AddSpacingLines(0.5f); font::PrintFormatLine( "Program: %016lX", static_cast(this->context->program_id)); font::AddSpacingLines(0.5f); - font::PrintFormatLine(u8"Firmware: %s (Atmosphère %u.%u.%u-%s)", config.GetFirmwareVersion().display_version, ATMOSPHERE_RELEASE_VERSION, ams::GetGitRevision()); + font::PrintFormatLine("Firmware: %s (Atmosphère %u.%u.%u-%s)", config.GetFirmwareVersion().display_version, ATMOSPHERE_RELEASE_VERSION, ams::GetGitRevision()); font::AddSpacingLines(1.5f); if (!exosphere::ResultVersionMismatch::Includes(this->context->result)) { font::Print(config.GetErrorDescription()); } else { /* Print a special message for atmosphere version mismatch. */ - font::Print(u8"Atmosphère version mismatch detected.\n\n" - u8"Please press the POWER Button to restart the console normally, or a VOL button\n" - u8"to reboot to a payload (or RCM, if none is present). If you are unable to\n" - u8"restart the console, hold the POWER Button for 12 seconds to turn the console off.\n\n" - u8"Please ensure that all Atmosphère components are updated.\n" - u8"github.com/Atmosphere-NX/Atmosphere/releases\n"); + font::Print("Atmosphère version mismatch detected.\n\n" + "Please press the POWER Button to restart the console normally, or a VOL button\n" + "to reboot to a payload (or RCM, if none is present). If you are unable to\n" + "restart the console, hold the POWER Button for 12 seconds to turn the console off.\n\n" + "Please ensure that all Atmosphère components are updated.\n" + "github.com/Atmosphere-NX/Atmosphere/releases\n"); } /* Add a line. */ diff --git a/thermosphere/src/lib/ini.c b/thermosphere/src/lib/ini.c index 63626c72d..ccf4640d2 100644 --- a/thermosphere/src/lib/ini.c +++ b/thermosphere/src/lib/ini.c @@ -70,7 +70,10 @@ static char* find_chars_or_comment(const char* s, const char* chars) /* Version of strncpy that ensures dest (size bytes) is null-terminated. */ static char* strncpy0(char* dest, const char* src, size_t size) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy(dest, src, size - 1); +#pragma GCC diagnostic pop dest[size - 1] = '\0'; return dest; }