From 3a1ccdd9198939152017e56bfe77f2ad7d4e3360 Mon Sep 17 00:00:00 2001 From: SciresM Date: Mon, 11 May 2020 15:02:10 -0700 Subject: [PATCH] Switch atmosphere's build target to C++20. (#952) * ams: update to build with gcc10/c++20 * remove mno-outline-atomics * ams: take care of most TODO C++20s * fusee/sept: update for gcc10 * whoosh, your code now uses pre-compiled headers * make: dependency fixes --- exosphere/Makefile | 2 + exosphere/src/mmu.h | 4 +- exosphere/src/my_libc.c | 24 +-- fusee/fusee-primary/Makefile | 2 +- fusee/fusee-primary/src/fs_utils.c | 21 +- fusee/fusee-primary/src/fs_utils.h | 6 +- fusee/fusee-primary/src/lib/ini.c | 3 + fusee/fusee-secondary/src/lib/ini.c | 3 + fusee/fusee-secondary/src/nxboot.c | 12 ++ libraries/config/common.mk | 2 +- libraries/libmesosphere/Makefile | 5 +- .../arm64/kern_k_interrupt_controller.hpp | 8 +- .../mesosphere/init/kern_init_layout.hpp | 2 +- .../include/mesosphere/kern_k_auto_object.hpp | 5 +- .../mesosphere/kern_k_capabilities.hpp | 4 +- .../mesosphere/kern_k_current_context.hpp | 4 +- .../mesosphere/kern_k_page_table_base.hpp | 2 +- .../mesosphere/kern_k_priority_queue.hpp | 51 ++--- .../include/mesosphere/kern_k_scheduler.hpp | 11 +- .../mesosphere/kern_k_scheduler_lock.hpp | 19 +- .../include/mesosphere/kern_k_scoped_lock.hpp | 17 +- .../svc/kern_svc_k_user_pointer.hpp | 85 ++++---- .../source/kern_k_address_space_info.cpp | 26 +-- .../source/kern_k_object_name.cpp | 5 +- libraries/libstratosphere/Makefile | 7 +- .../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 | 10 +- .../include/stratosphere/sf/sf_out.hpp | 4 +- .../source/ams/ams_emummc_api.cpp | 1 - .../source/ams/ams_environment.cpp | 4 +- .../source/ams/ams_exosphere_api.cpp | 1 - .../decodersrv_decoder_work_memory.hpp | 2 +- .../libstratosphere/source/cfg/cfg_flags.cpp | 1 - .../source/cfg/cfg_override.cpp | 1 - .../source/cfg/cfg_privileged_process.cpp | 1 - .../source/cfg/cfg_sd_card.cpp | 1 - .../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 | 5 +- .../source/kvdb/kvdb_file_key_value_store.cpp | 1 - .../libstratosphere/source/map/map_api.cpp | 1 - .../heap/mem_impl_heap_tls_heap_static.hpp | 8 +- .../ncm/ncm_content_meta_database_impl.cpp | 2 +- .../source/os/impl/os_resource_manager.cpp | 3 +- .../os/impl/os_waitable_manager_impl.cpp | 1 + .../libstratosphere/source/os/os_event.cpp | 1 + .../source/os/os_interrupt_event.cpp | 1 + .../source/os/os_message_queue.cpp | 1 + .../source/os/os_semaphore.cpp | 1 + .../source/pgl/srv/pgl_srv_shell.cpp | 2 +- .../libstratosphere/source/sm/sm_api.cpp | 1 + .../source/sm/sm_manager_api.cpp | 1 + .../libstratosphere/source/sm/sm_mitm_api.cpp | 1 + .../libstratosphere/source/sm/sm_utils.cpp | 1 + .../source/updater/updater_api.cpp | 2 - .../source/updater/updater_bis_management.cpp | 1 + .../source/updater/updater_bis_save.cpp | 1 + .../source/updater/updater_files.cpp | 1 + .../source/updater/updater_paths.cpp | 1 + libraries/libstratosphere/source/util/ini.c | 3 + .../crypto/crypto_rsa_oaep_decryptor.hpp | 2 +- .../crypto/crypto_rsa_oaep_encryptor.hpp | 2 +- .../crypto/crypto_rsa_pss_verifier.hpp | 2 +- .../crypto/impl/crypto_hash_function.hpp | 18 +- .../crypto/impl/crypto_rsa_oaep_impl.hpp | 2 +- .../crypto/impl/crypto_rsa_pss_impl.hpp | 2 +- .../crypto/impl/crypto_sha256_impl.hpp | 2 +- .../libvapours/include/vapours/defines.hpp | 3 - .../libvapours/include/vapours/includes.hpp | 3 + libraries/libvapours/include/vapours/span.hpp | 202 +----------------- .../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 | 12 +- .../svc_codegen_impl_layout_conversion.hpp | 22 +- .../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_bitutil.hpp | 42 ++-- .../include/vapours/util/util_endian.hpp | 30 +-- .../include/vapours/util/util_fourcc.hpp | 15 +- .../include/vapours/util/util_type_traits.hpp | 26 +++ .../source/kern_kernel_instantiations.cpp | 26 +-- sept/sept-secondary/src/fs_utils.c | 20 +- sept/sept-secondary/src/fs_utils.h | 6 +- sept/sept-secondary/src/lib/ini.c | 3 + stratosphere/ams_mitm/source/amsmitm_main.cpp | 1 + .../ams_mitm/source/amsmitm_module.hpp | 26 ++- .../source/amsmitm_module_management.cpp | 2 +- .../source/bpc_mitm/bpc_ams_module.cpp | 1 + .../source/bpc_mitm/bpc_ams_power_utils.cpp | 1 + .../source/bpc_mitm/bpc_ams_service.cpp | 1 + .../source/bpc_mitm/bpc_mitm_service.cpp | 1 + .../source/bpc_mitm/bpcmitm_module.cpp | 1 + .../source/fs_mitm/fs_mitm_service.cpp | 1 + .../source/fs_mitm/fsmitm_boot0storage.cpp | 1 + .../ams_mitm/source/fs_mitm/fsmitm_module.cpp | 1 + .../ams_mitm/source/fs_mitm/fsmitm_romfs.cpp | 6 +- .../source/fs_mitm/fsmitm_save_utils.cpp | 1 + .../source/hid_mitm/hid_mitm_service.cpp | 1 + .../source/hid_mitm/hidmitm_module.cpp | 1 + .../ams_mitm/source/ns_mitm/nsmitm_module.cpp | 1 + .../source/set_mitm/set_mitm_service.cpp | 1 + .../source/set_mitm/setmitm_module.cpp | 1 + .../source/set_mitm/setsys_mitm_service.cpp | 1 + .../source/set_mitm/settings_sd_kvs.cpp | 3 +- stratosphere/boot/Makefile | 2 + .../boot/source/boot_battery_driver.cpp | 1 + .../boot/source/boot_battery_icons.cpp | 1 + stratosphere/boot/source/boot_boot_reason.cpp | 1 + stratosphere/boot/source/boot_calibration.cpp | 1 + .../boot/source/boot_change_voltage.cpp | 1 + .../boot/source/boot_charger_driver.cpp | 1 + .../boot/source/boot_check_battery.cpp | 1 + stratosphere/boot/source/boot_check_clock.cpp | 1 + .../boot_clock_initial_configuration.cpp | 1 + stratosphere/boot/source/boot_display.cpp | 1 + stratosphere/boot/source/boot_fan_enable.cpp | 1 + stratosphere/boot/source/boot_i2c_utils.cpp | 1 + stratosphere/boot/source/boot_main.cpp | 1 + stratosphere/boot/source/boot_pcv.cpp | 1 + stratosphere/boot/source/boot_pmc_wrapper.cpp | 1 + stratosphere/boot/source/boot_pmic_driver.cpp | 1 + stratosphere/boot/source/boot_power_utils.cpp | 1 + .../boot/source/boot_repair_boot_images.cpp | 1 + stratosphere/boot/source/boot_rtc_driver.cpp | 1 + .../boot/source/boot_splash_screen.cpp | 1 + stratosphere/boot/source/boot_wake_pins.cpp | 1 + .../gpio/gpio_initial_configuration.cpp | 4 +- stratosphere/boot/source/gpio/gpio_utils.cpp | 4 +- .../boot/source/i2c/driver/i2c_api.cpp | 1 + .../i2c/driver/impl/i2c_bus_accessor.cpp | 1 + .../i2c/driver/impl/i2c_device_config.cpp | 1 + .../i2c/driver/impl/i2c_resource_manager.cpp | 1 + .../source/i2c/driver/impl/i2c_session.cpp | 1 + .../boot/source/i2c/i2c_command_list.cpp | 1 + .../pinmux/pinmux_initial_configuration.cpp | 1 + .../boot/source/pinmux/pinmux_utils.cpp | 1 + stratosphere/boot2/source/boot2_main.cpp | 2 + .../creport/source/creport_crash_report.cpp | 5 +- stratosphere/creport/source/creport_main.cpp | 1 + .../creport/source/creport_modules.cpp | 1 + .../creport/source/creport_scoped_file.cpp | 1 + .../creport/source/creport_threads.cpp | 1 + stratosphere/creport/source/creport_utils.cpp | 1 + .../dmnt/source/cheat/dmnt_cheat_service.cpp | 1 + .../dmnt/source/cheat/impl/dmnt_cheat_api.cpp | 3 +- .../impl/dmnt_cheat_debug_events_manager.cpp | 1 + .../dmnt/source/cheat/impl/dmnt_cheat_vm.cpp | 2 +- stratosphere/dmnt/source/dmnt_main.cpp | 1 + stratosphere/dmnt/source/dmnt_service.hpp | 2 +- .../dmnt/source/dmnt_service_debug.cpp | 1 + .../dmnt/source/dmnt_service_target_io.cpp | 1 + stratosphere/fatal/source/fatal_config.cpp | 25 +-- stratosphere/fatal/source/fatal_debug.cpp | 1 + .../fatal/source/fatal_event_manager.cpp | 1 + stratosphere/fatal/source/fatal_font.cpp | 1 + stratosphere/fatal/source/fatal_main.cpp | 1 + stratosphere/fatal/source/fatal_repair.cpp | 1 + .../fatal/source/fatal_scoped_file.cpp | 1 + stratosphere/fatal/source/fatal_service.cpp | 1 + stratosphere/fatal/source/fatal_task.cpp | 1 + .../fatal/source/fatal_task_clock.cpp | 1 + .../fatal/source/fatal_task_error_report.cpp | 7 +- .../fatal/source/fatal_task_power.cpp | 1 + .../fatal/source/fatal_task_screen.cpp | 15 +- .../fatal/source/fatal_task_sound.cpp | 1 + stratosphere/loader/source/ldr_arguments.cpp | 1 + .../loader/source/ldr_capabilities.cpp | 1 + .../loader/source/ldr_content_management.cpp | 1 + .../loader/source/ldr_development_manager.cpp | 1 + .../loader/source/ldr_launch_record.cpp | 1 + .../loader/source/ldr_loader_service.cpp | 1 + stratosphere/loader/source/ldr_main.cpp | 2 +- stratosphere/loader/source/ldr_meta.cpp | 1 + stratosphere/loader/source/ldr_patcher.cpp | 1 + stratosphere/loader/source/ldr_ro_manager.cpp | 1 + stratosphere/ncm/source/ncm_main.cpp | 1 - stratosphere/pgl/source/pgl_main.cpp | 2 +- .../pm/source/impl/pm_process_info.cpp | 1 + .../pm/source/impl/pm_process_manager.cpp | 1 + .../pm/source/impl/pm_resource_manager.cpp | 1 + .../pm/source/pm_boot_mode_service.cpp | 1 + .../pm/source/pm_debug_monitor_service.cpp | 1 + stratosphere/pm/source/pm_info_service.cpp | 1 + stratosphere/pm/source/pm_main.cpp | 1 + stratosphere/pm/source/pm_shell_service.cpp | 1 + stratosphere/ro/source/impl/ro_nro_utils.cpp | 1 + stratosphere/ro/source/impl/ro_nrr_utils.cpp | 1 + stratosphere/ro/source/impl/ro_patcher.cpp | 1 + .../ro/source/impl/ro_service_impl.cpp | 1 + stratosphere/ro/source/ro_debug_monitor.cpp | 1 + stratosphere/ro/source/ro_main.cpp | 1 + stratosphere/ro/source/ro_service.cpp | 1 + .../sm/source/impl/sm_service_manager.cpp | 1 + stratosphere/sm/source/sm_dmnt_service.cpp | 1 + stratosphere/sm/source/sm_main.cpp | 1 + stratosphere/sm/source/sm_manager_service.cpp | 1 + stratosphere/sm/source/sm_user_service.cpp | 1 + stratosphere/spl/source/spl_api_impl.cpp | 1 + .../spl/source/spl_crypto_service.cpp | 1 + stratosphere/spl/source/spl_ctr_drbg.cpp | 1 + .../spl/source/spl_deprecated_service.cpp | 1 + stratosphere/spl/source/spl_es_service.cpp | 1 + stratosphere/spl/source/spl_fs_service.cpp | 1 + .../spl/source/spl_general_service.cpp | 1 + stratosphere/spl/source/spl_main.cpp | 1 + stratosphere/spl/source/spl_manu_service.cpp | 1 + .../spl/source/spl_random_service.cpp | 1 + stratosphere/spl/source/spl_rsa_service.cpp | 1 + stratosphere/spl/source/spl_ssl_service.cpp | 1 + thermosphere/src/lib/ini.c | 3 + 258 files changed, 723 insertions(+), 804 deletions(-) create mode 100644 libraries/libvapours/include/vapours/util/util_type_traits.hpp diff --git a/exosphere/Makefile b/exosphere/Makefile index 09630e14d..14a03900d 100644 --- a/exosphere/Makefile +++ b/exosphere/Makefile @@ -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/fusee/fusee-primary/Makefile b/fusee/fusee-primary/Makefile index 98fa93e81..3124e7925 100644 --- a/fusee/fusee-primary/Makefile +++ b/fusee/fusee-primary/Makefile @@ -119,7 +119,7 @@ all: check_rebootstub $(BUILD) check_rebootstub: @$(MAKE) -C $(AMS)/exosphere/rebootstub all -$(BUILD): +$(BUILD): check_rebootstub @[ -d $@ ] || mkdir -p $@ @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile diff --git a/fusee/fusee-primary/src/fs_utils.c b/fusee/fusee-primary/src/fs_utils.c index 5b9b9f8fd..da561a266 100644 --- a/fusee/fusee-primary/src/fs_utils.c +++ b/fusee/fusee-primary/src/fs_utils.c @@ -23,13 +23,16 @@ FATFS sd_fs; static bool g_sd_mounted = false; static bool g_sd_initialized = false; static bool g_ahb_redirect_enabled = false; +sdmmc_t g_sd_sdmmc; +sdmmc_device_t g_sd_device; + bool mount_sd(void) { /* Already mounted. */ if (g_sd_mounted) return true; - + /* Enable AHB redirection if necessary. */ if (!g_ahb_redirect_enabled) { mc_enable_ahb_redirect(); @@ -41,7 +44,7 @@ bool mount_sd(void) if (sdmmc_device_sd_init(&g_sd_device, &g_sd_sdmmc, SDMMC_BUS_WIDTH_4BIT, SDMMC_SPEED_UHS_SDR104)) { g_sd_initialized = true; - + /* Mount SD. */ if (f_mount(&sd_fs, "", 1) == FR_OK) { print(SCREEN_LOG_LEVEL_INFO, "Mounted SD card!\n"); @@ -63,7 +66,7 @@ void unmount_sd(void) sdmmc_device_finish(&g_sd_device); g_sd_mounted = false; } - + /* Disable AHB redirection if necessary. */ if (g_ahb_redirect_enabled) { mc_disable_ahb_redirect(); @@ -81,13 +84,13 @@ uint32_t get_file_size(const char *filename) FIL f; if (f_open(&f, filename, FA_READ) != FR_OK) return 0; - + /* Get the file size. */ uint32_t file_size = f_size(&f); - + /* Close the file. */ f_close(&f); - + return file_size; } @@ -101,10 +104,10 @@ int read_from_file(void *dst, uint32_t dst_size, const char *filename) FIL f; if (f_open(&f, filename, FA_READ) != FR_OK) return 0; - + /* Sync. */ f_sync(&f); - + /* Read from file. */ UINT br = 0; int res = f_read(&f, dst, dst_size, &br); @@ -118,7 +121,7 @@ int write_to_file(void *src, uint32_t src_size, const char *filename) /* SD card hasn't been mounted yet. */ if (!g_sd_mounted) return 0; - + /* Open the file for writing. */ FIL f; if (f_open(&f, filename, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK) diff --git a/fusee/fusee-primary/src/fs_utils.h b/fusee/fusee-primary/src/fs_utils.h index 8cb0f326c..1e25b2b82 100644 --- a/fusee/fusee-primary/src/fs_utils.h +++ b/fusee/fusee-primary/src/fs_utils.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 FUSEE_FS_UTILS_H #define FUSEE_FS_UTILS_H @@ -23,8 +23,8 @@ #include "sdmmc/sdmmc.h" #include "utils.h" -sdmmc_t g_sd_sdmmc; -sdmmc_device_t g_sd_device; +extern sdmmc_t g_sd_sdmmc; +extern sdmmc_device_t g_sd_device; bool mount_sd(void); void unmount_sd(void); diff --git a/fusee/fusee-primary/src/lib/ini.c b/fusee/fusee-primary/src/lib/ini.c index 63626c72d..ccf4640d2 100644 --- a/fusee/fusee-primary/src/lib/ini.c +++ b/fusee/fusee-primary/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; } diff --git a/fusee/fusee-secondary/src/lib/ini.c b/fusee/fusee-secondary/src/lib/ini.c index 63626c72d..ccf4640d2 100644 --- a/fusee/fusee-secondary/src/lib/ini.c +++ b/fusee/fusee-secondary/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; } diff --git a/fusee/fusee-secondary/src/nxboot.c b/fusee/fusee-secondary/src/nxboot.c index 07974428f..d82b9b1eb 100644 --- a/fusee/fusee-secondary/src/nxboot.c +++ b/fusee/fusee-secondary/src/nxboot.c @@ -119,10 +119,16 @@ static int emummc_ini_handler(void *user, const char *section, const char *name, } else if (strcmp(name, EMUMMC_ID_KEY) == 0) { sscanf(value, "%lx", &emummc_cfg->id); } else if (strcmp(name, EMUMMC_PATH_KEY) == 0) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy(emummc_cfg->path, value, sizeof(emummc_cfg->path) - 1); +#pragma GCC diagnostic pop emummc_cfg->path[sizeof(emummc_cfg->path) - 1] = '\0'; } else if (strcmp(name, EMUMMC_NINTENDO_PATH_KEY) == 0) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy(emummc_cfg->nintendo_path, value, sizeof(emummc_cfg->nintendo_path) - 1); +#pragma GCC diagnostic pop emummc_cfg->nintendo_path[sizeof(emummc_cfg->nintendo_path) - 1] = '\0'; } else { return 0; @@ -356,7 +362,10 @@ static bool nxboot_configure_emummc(exo_emummc_config_t *exo_emummc_config) { /* Initialize values from emummc config. */ exo_emummc_config->base_cfg.id = emummc_cfg.id; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy(exo_emummc_config->emu_dir_path, emummc_cfg.nintendo_path, sizeof(exo_emummc_config->emu_dir_path)); +#pragma GCC diagnostic pop exo_emummc_config->emu_dir_path[sizeof(exo_emummc_config->emu_dir_path) - 1] = '\0'; if (emummc_cfg.enabled) { @@ -370,7 +379,10 @@ static bool nxboot_configure_emummc(exo_emummc_config_t *exo_emummc_config) { } } else if (is_valid_folder(emummc_cfg.path)) { exo_emummc_config->base_cfg.type = EMUMMC_TYPE_FILES; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy(exo_emummc_config->file_cfg.path, emummc_cfg.path, sizeof(exo_emummc_config->file_cfg.path)); +#pragma GCC diagnostic pop exo_emummc_config->file_cfg.path[sizeof(exo_emummc_config->file_cfg.path) - 1] = '\0'; int num_parts = 0; diff --git a/libraries/config/common.mk b/libraries/config/common.mk index 964a7d0aa..4d68b232e 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++20 export ATMOSPHERE_ASFLAGS := diff --git a/libraries/libmesosphere/Makefile b/libraries/libmesosphere/Makefile index c9c190e90..747fd2856 100644 --- a/libraries/libmesosphere/Makefile +++ b/libraries/libmesosphere/Makefile @@ -6,8 +6,7 @@ include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../config/common.mk #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- -#PRECOMPILED_HEADERS := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/include/mesosphere.hpp -PRECOMPILED_HEADERS := +PRECOMPILED_HEADERS := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/include/mesosphere.hpp DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -mgeneral-regs-only -ffixed-x18 -Werror -fno-non-call-exceptions @@ -122,6 +121,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_auto_object.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_auto_object.hpp index 2ffc28691..01648d3ec 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_auto_object.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_auto_object.hpp @@ -185,10 +185,7 @@ namespace ams::kern { T *obj; private: constexpr ALWAYS_INLINE void Swap(KScopedAutoObject &rhs) { - /* TODO: C++20 constexpr std::swap */ - T *tmp = rhs.obj; - rhs.obj = this->obj; - this->obj = tmp; + std::swap(this->obj, rhs.obj); } public: constexpr ALWAYS_INLINE KScopedAutoObject() : obj(nullptr) { /* ... */ } diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_capabilities.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_capabilities.hpp index bac44a218..72d48666a 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_capabilities.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_capabilities.hpp @@ -64,7 +64,7 @@ namespace ams::kern { static constexpr u32 GetCapabilityId(CapabilityType type) { const u32 flag = GetCapabilityFlag(type); - if (true /* C++20: std::is_constant_evaluated() */) { + if (std::is_constant_evaluated()) { return CountTrailingZero(flag); } else { return static_cast(__builtin_ctz(flag)); @@ -84,7 +84,7 @@ namespace ams::kern { template static constexpr inline u32 CapabilityId = []() -> u32 { const u32 flag = static_cast(Type) + 1; - if (true /* C++20: std::is_constant_evaluated() */) { + if (std::is_constant_evaluated()) { for (u32 i = 0; i < BITSIZEOF(u32); i++) { if (flag & (1u << i)) { return i; 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/include/mesosphere/kern_k_priority_queue.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_priority_queue.hpp index 3b471b4d0..033c59373 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_priority_queue.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_priority_queue.hpp @@ -18,39 +18,34 @@ namespace ams::kern { - /* - TODO: C++20 + template + concept KPriorityQueueAffinityMask = !std::is_reference::value && requires (T &t) { + { t.GetAffinityMask() } -> std::convertible_to; + { t.SetAffinityMask(std::declval()) }; - template - concept KPriorityQueueAffinityMask = !std::is_reference::value && requires (T &t) { - { t.GetAffinityMask() } -> std::convertible_to; - { t.SetAffinityMask(std::declval()) }; + { t.GetAffinity(std::declval()) } -> std::same_as; + { t.SetAffinity(std::declval(), std::declval()) }; + { t.SetAll() }; + }; - { t.GetAffinity(std::declval()) } -> std::same_as; - { t.SetAffinity(std::declval(), std::declval()) }; - { t.SetAll() }; - }; + template + concept KPriorityQueueMember = !std::is_reference::value && requires (T &t) { + { typename T::QueueEntry() }; + { (typename T::QueueEntry()).Initialize() }; + { (typename T::QueueEntry()).SetPrev(std::addressof(t)) }; + { (typename T::QueueEntry()).SetNext(std::addressof(t)) }; + { (typename T::QueueEntry()).GetNext() } -> std::same_as; + { (typename T::QueueEntry()).GetPrev() } -> std::same_as; + { t.GetPriorityQueueEntry(std::declval()) } -> std::same_as; - template - concept KPriorityQueueMember = !std::is_reference::value && requires (T &t) { - { typename T::QueueEntry() }; - { (typename T::QueueEntry()).Initialize() }; - { (typename T::QueueEntry()).SetPrev(std::addressof(t)) }; - { (typename T::QueueEntry()).SetNext(std::addressof(t)) }; - { (typename T::QueueEntry()).GetNext() } -> std::same_as; - { (typename T::QueueEntry()).GetPrev() } -> std::same_as; - { t.GetPriorityQueueEntry(std::declval()) } -> std::same_as; + { t.GetAffinityMask() }; + { typename std::remove_cvref::type() } -> KPriorityQueueAffinityMask; - { t.GetAffinityMask() }; - { typename std::remove_cvref::type() } -> KPriorityQueueAffinityMask; + { t.GetActiveCore() } -> std::convertible_to; + { t.GetPriority() } -> std::convertible_to; + }; - { t.GetActiveCore() } -> std::convertible_to; - { t.GetPriority() } -> std::convertible_to; - }; - */ - - - template /* TODO C++20: requires KPriorityQueueMember */ + template requires KPriorityQueueMember class KPriorityQueue { public: using AffinityMaskType = typename std::remove_cv().GetAffinityMask())>::type>::type; diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_scheduler.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_scheduler.hpp index 5fb57ad2f..2e8247f5a 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_scheduler.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_scheduler.hpp @@ -33,8 +33,6 @@ namespace ams::kern { NON_COPYABLE(KScheduler); NON_MOVEABLE(KScheduler); public: - using LockType = KAbstractSchedulerLock; - static constexpr s32 HighestCoreMigrationAllowedPriority = 2; static_assert(ams::svc::LowestThreadPriority >= HighestCoreMigrationAllowedPriority); static_assert(ams::svc::HighestThreadPriority <= HighestCoreMigrationAllowedPriority); @@ -50,9 +48,6 @@ namespace ams::kern { private: friend class KScopedSchedulerLock; friend class KScopedSchedulerLockAndSleep; - static bool s_scheduler_update_needed; - static LockType s_scheduler_lock; - static KSchedulerPriorityQueue s_priority_queue; private: SchedulingState state; bool is_active; @@ -160,6 +155,12 @@ namespace ams::kern { } NOINLINE u64 UpdateHighestPriorityThread(KThread *thread); + public: + using LockType = KAbstractSchedulerLock; + private: + static bool s_scheduler_update_needed; + static KSchedulerPriorityQueue s_priority_queue; + static LockType s_scheduler_lock; }; class KScopedSchedulerLock : KScopedLock { diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_scheduler_lock.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_scheduler_lock.hpp index 3be30f901..355719f13 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_scheduler_lock.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_scheduler_lock.hpp @@ -23,19 +23,14 @@ namespace ams::kern { class KThread; - /* - TODO: C++20 + template + concept KSchedulerLockable = !std::is_reference::value && requires(T) { + { T::DisableScheduling() } -> std::same_as; + { T::EnableScheduling(std::declval()) } -> std::same_as; + { T::UpdateHighestPriorityThreads() } -> std::convertible_to; + }; - template - concept KSchedulerLockable = !std::is_reference::value && requires { - { T::DisableScheduling() } -> std::same_as; - { T::EnableScheduling(std::declval()) } -> std::same_as; - { T::UpdateHighestPriorityThreads() } -> std::convertible_to; - }; - - */ - - template /* TODO C++20: requires KSchedulerLockable */ + template requires KSchedulerLockable class KAbstractSchedulerLock { private: KAlignedSpinLock spin_lock; diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_scoped_lock.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_scoped_lock.hpp index fd6756b2c..8ae0fecbc 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_scoped_lock.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_scoped_lock.hpp @@ -18,18 +18,13 @@ namespace ams::kern { - /* - TODO: C++20 + template + concept KLockable = !std::is_reference::value && requires (T &t) { + { t.Lock() } -> std::same_as; + { t.Unlock() } -> std::same_as; + }; - template - concept KLockable = !std::is_reference::value && requires (T &t) { - { t.Lock() } -> std::same_as; - { t.Unlock() } -> std::same_as; - }; - - */ - - template /* TODO C++20: requires KLockable */ + template requires KLockable class KScopedLock { NON_COPYABLE(KScopedLock); NON_MOVEABLE(KScopedLock); diff --git a/libraries/libmesosphere/include/mesosphere/svc/kern_svc_k_user_pointer.hpp b/libraries/libmesosphere/include/mesosphere/svc/kern_svc_k_user_pointer.hpp index fce28f594..5d707d52e 100644 --- a/libraries/libmesosphere/include/mesosphere/svc/kern_svc_k_user_pointer.hpp +++ b/libraries/libmesosphere/include/mesosphere/svc/kern_svc_k_user_pointer.hpp @@ -22,47 +22,35 @@ namespace ams::kern::svc { namespace impl { - /* TODO: C++20 - template - concept Pointer = std::is_pointer::value; - - template - concept NonConstPointer = Pointer && !std::is_const::type>::value; - - template - concept ConstPointer = Pointer && std::is_const::type>::value; - - template - concept AlignedNPointer = Pointer && alignof(typename std::remove_pointer::type) >= N && util::IsAligned(sizeof(typename std::remove_pointer::type), N); - - template - concept Aligned8Pointer = AlignedNPointer; - - template - concept Aligned16Pointer = AlignedNPointer && Aligned8; - - template - concept Aligned32Pointer = AlignedNPointer && Aligned16; - - template - concept Aligned64Pointer = AlignedNPointer && Aligned32; - */ + template + concept Pointer = std::is_pointer::value; template - constexpr inline bool IsPointer = std::is_pointer::value; + concept NonConstPointer = Pointer && !std::is_const::type>::value; template - constexpr inline bool IsConstPointer = IsPointer && std::is_const::type>::value; - - template - constexpr inline bool IsNonConstPointer = IsPointer && !std::is_const::type>::value; + concept ConstPointer = Pointer && std::is_const::type>::value; template - constexpr inline bool IsAlignedNPointer = IsPointer && alignof(typename std::remove_pointer::type) >= N && util::IsAligned(sizeof(typename std::remove_pointer::type), N); + concept AlignedNPointer = Pointer && alignof(typename std::remove_pointer::type) >= N && util::IsAligned(sizeof(typename std::remove_pointer::type), N); - template /* requires Aligned8Pointer<_T> */ - class KUserPointerImplTraits { - static_assert(IsAlignedNPointer<_T, sizeof(u8)>); + template + concept Aligned8Pointer = AlignedNPointer; + + template + concept Aligned16Pointer = AlignedNPointer && Aligned8Pointer; + + template + concept Aligned32Pointer = AlignedNPointer && Aligned16Pointer; + + template + concept Aligned64Pointer = AlignedNPointer && Aligned32Pointer; + + template + class KUserPointerImplTraits; + + template requires Aligned8Pointer<_T> + class KUserPointerImplTraits<_T> { public: using T = typename std::remove_const::type>::type; public: @@ -77,9 +65,8 @@ namespace ams::kern::svc { } }; - template /* requires Aligned32Pointer<_T> */ - class KUserPointerImplTraits<_T, typename std::enable_if && !IsAlignedNPointer<_T, sizeof(u64)>>::type> { - static_assert(IsAlignedNPointer<_T, sizeof(u32)>); + template requires Aligned32Pointer<_T> + class KUserPointerImplTraits<_T> { public: using T = typename std::remove_const::type>::type; public: @@ -94,9 +81,8 @@ namespace ams::kern::svc { } }; - template /* requires Aligned64Pointer<_T> */ - class KUserPointerImplTraits<_T, typename std::enable_if>::type> { - static_assert(IsAlignedNPointer<_T, sizeof(u64)>); + template requires Aligned64Pointer<_T> + class KUserPointerImplTraits<_T> { public: using T = typename std::remove_const::type>::type; public: @@ -111,8 +97,11 @@ namespace ams::kern::svc { } }; - template /* requires Aligned8Pointer<_T> */ - class KUserPointerImpl : impl::KUserPointerTag { + template + class KUserPointerImpl; + + template requires Aligned8Pointer<_T> + class KUserPointerImpl<_T> : impl::KUserPointerTag { private: using Traits = KUserPointerImplTraits<_T>; protected: @@ -170,11 +159,11 @@ namespace ams::kern::svc { } - template - class KUserPointer; + template + struct KUserPointer; - template /* requires impl::ConstPointer */ - struct KUserPointer>::type> : public impl::KUserPointerImpl { + template requires impl::ConstPointer + struct KUserPointer : public impl::KUserPointerImpl { public: static constexpr bool IsInput = true; public: @@ -186,8 +175,8 @@ namespace ams::kern::svc { using impl::KUserPointerImpl::GetUnsafePointer; }; - template /* requires impl::NonConstPointer */ - struct KUserPointer>::type> : public impl::KUserPointerImpl { + template requires impl::NonConstPointer + struct KUserPointer : public impl::KUserPointerImpl { public: static constexpr bool IsInput = false; 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/libmesosphere/source/kern_k_object_name.cpp b/libraries/libmesosphere/source/kern_k_object_name.cpp index 763122450..b5fd505a4 100644 --- a/libraries/libmesosphere/source/kern_k_object_name.cpp +++ b/libraries/libmesosphere/source/kern_k_object_name.cpp @@ -19,9 +19,8 @@ namespace ams::kern { namespace { - /* TODO: C++20 constinit */ - KLightLock g_object_list_lock; - KObjectName::List g_object_list; + constinit KLightLock g_object_list_lock; + constinit KObjectName::List g_object_list; } diff --git a/libraries/libstratosphere/Makefile b/libraries/libstratosphere/Makefile index 15aad5a6c..a87f062f5 100644 --- a/libraries/libstratosphere/Makefile +++ b/libraries/libstratosphere/Makefile @@ -15,6 +15,8 @@ include $(DEVKITPRO)/libnx/switch_rules #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- +PRECOMPILED_HEADERS := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/include/stratosphere.hpp + DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_STRATOSPHERE -D_GNU_SOURCE SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE) @@ -40,7 +42,7 @@ LIBDIRS := $(PORTLIBS) $(LIBNX) $(ATMOSPHERE_LIBRARIES_DIR)/libvapours ifneq ($(BUILD),$(notdir $(CURDIR))) #--------------------------------------------------------------------------------- -export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) CFILES := $(foreach dir,$(SOURCES),$(filter-out $(notdir $(wildcard $(dir)/*.arch.*.c)) $(notdir $(wildcard $(dir)/*.board.*.c)) $(notdir $(wildcard $(dir)/*.os.*.c)), \ @@ -77,6 +79,7 @@ endif export OFILES_BIN := $(addsuffix .o,$(BINFILES)) export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +export GCH_FILES := $(foreach hdr,$(PRECOMPILED_HEADERS:.hpp=.gch),$(notdir $(hdr))) export OFILES := $(OFILES_BIN) $(OFILES_SRC) export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) @@ -125,6 +128,8 @@ DEPENDS := $(OFILES:.o=.d) #--------------------------------------------------------------------------------- $(OUTPUT) : $(OFILES) +$(OFILES) : $(GCH_FILES) + $(OFILES_SRC) : $(HFILES_BIN) #--------------------------------------------------------------------------------- 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..2247d6de5 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 @@ -77,7 +77,7 @@ namespace ams::sf { class Out> : public impl::OutObjectTag { static_assert(std::is_base_of::value, "Out> requires ServiceObject base."); - template + template friend class Out; public: @@ -308,11 +308,7 @@ namespace ams::sf::impl { /* Use insertion sort, which is stable and optimal for small numbers of parameters. */ for (size_t i = 1; i < sizeof...(Ts); i++) { for (size_t j = i; j > 0 && values[map[j-1]] > values[map[j]]; j--) { - /* std::swap is not constexpr until c++20 :( */ - /* TODO: std::swap(map[j], map[j-1]); */ - const size_t tmp = map[j]; - map[j] = map[j-1]; - map[j-1] = tmp; + std::swap(map[j], map[j-1]); } } } @@ -1042,7 +1038,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/include/stratosphere/sf/sf_out.hpp b/libraries/libstratosphere/include/stratosphere/sf/sf_out.hpp index b5fb1e6f1..414c916da 100644 --- a/libraries/libstratosphere/include/stratosphere/sf/sf_out.hpp +++ b/libraries/libstratosphere/include/stratosphere/sf/sf_out.hpp @@ -33,9 +33,9 @@ namespace ams::sf { struct IsOutForceEnabled<::ams::Result> : public std::true_type{}; template - using IsOutEnabled = typename std::enable_if::value || IsOutForceEnabled::value>::type; + concept OutEnabled = (std::is_trivial::value || IsOutForceEnabled::value) && !std::is_pointer::value; - template> + template requires OutEnabled class Out : public impl::OutBaseTag { public: static constexpr size_t TypeSize = sizeof(T); diff --git a/libraries/libstratosphere/source/ams/ams_emummc_api.cpp b/libraries/libstratosphere/source/ams/ams_emummc_api.cpp index f00f86535..f1c1c8880 100644 --- a/libraries/libstratosphere/source/ams/ams_emummc_api.cpp +++ b/libraries/libstratosphere/source/ams/ams_emummc_api.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include namespace ams::emummc { diff --git a/libraries/libstratosphere/source/ams/ams_environment.cpp b/libraries/libstratosphere/source/ams/ams_environment.cpp index 47babfb92..7679570a1 100644 --- a/libraries/libstratosphere/source/ams/ams_environment.cpp +++ b/libraries/libstratosphere/source/ams/ams_environment.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include #include "ams_bpc.h" @@ -182,6 +181,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/ams/ams_exosphere_api.cpp b/libraries/libstratosphere/source/ams/ams_exosphere_api.cpp index 63243d66a..e964d3931 100644 --- a/libraries/libstratosphere/source/ams/ams_exosphere_api.cpp +++ b/libraries/libstratosphere/source/ams/ams_exosphere_api.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include #include #include 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/cfg/cfg_flags.cpp b/libraries/libstratosphere/source/cfg/cfg_flags.cpp index c607cbabc..abf078a09 100644 --- a/libraries/libstratosphere/source/cfg/cfg_flags.cpp +++ b/libraries/libstratosphere/source/cfg/cfg_flags.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include namespace ams::cfg { diff --git a/libraries/libstratosphere/source/cfg/cfg_override.cpp b/libraries/libstratosphere/source/cfg/cfg_override.cpp index c31cb16b4..9bd7fedb6 100644 --- a/libraries/libstratosphere/source/cfg/cfg_override.cpp +++ b/libraries/libstratosphere/source/cfg/cfg_override.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include namespace ams::cfg { diff --git a/libraries/libstratosphere/source/cfg/cfg_privileged_process.cpp b/libraries/libstratosphere/source/cfg/cfg_privileged_process.cpp index 1df518d00..0fe262a8b 100644 --- a/libraries/libstratosphere/source/cfg/cfg_privileged_process.cpp +++ b/libraries/libstratosphere/source/cfg/cfg_privileged_process.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include namespace ams::cfg { diff --git a/libraries/libstratosphere/source/cfg/cfg_sd_card.cpp b/libraries/libstratosphere/source/cfg/cfg_sd_card.cpp index a79a23fa7..cbf60a724 100644 --- a/libraries/libstratosphere/source/cfg/cfg_sd_card.cpp +++ b/libraries/libstratosphere/source/cfg/cfg_sd_card.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include namespace ams::cfg { 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..350704511 100644 --- a/libraries/libstratosphere/source/kvdb/kvdb_archive.cpp +++ b/libraries/libstratosphere/source/kvdb/kvdb_archive.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include namespace ams::kvdb { @@ -42,7 +41,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 +61,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/kvdb/kvdb_file_key_value_store.cpp b/libraries/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp index eb699b600..fbcea57ab 100644 --- a/libraries/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp +++ b/libraries/libstratosphere/source/kvdb/kvdb_file_key_value_store.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include namespace ams::kvdb { diff --git a/libraries/libstratosphere/source/map/map_api.cpp b/libraries/libstratosphere/source/map/map_api.cpp index 5c3bdf0f9..1c7a50b93 100644 --- a/libraries/libstratosphere/source/map/map_api.cpp +++ b/libraries/libstratosphere/source/map/map_api.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include namespace ams::map { 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/ncm/ncm_content_meta_database_impl.cpp b/libraries/libstratosphere/source/ncm/ncm_content_meta_database_impl.cpp index a9cad8536..30d5ac10d 100644 --- a/libraries/libstratosphere/source/ncm/ncm_content_meta_database_impl.cpp +++ b/libraries/libstratosphere/source/ncm/ncm_content_meta_database_impl.cpp @@ -451,7 +451,7 @@ namespace ams::ncm { /* Ensure this type of key has an owner. */ R_UNLESS(key.type == ContentMetaType::Application || key.type == ContentMetaType::Patch || key.type == ContentMetaType::AddOnContent, ncm::ResultInvalidContentMetaKey()); - + /* Applications are their own owner. */ if (key.type == ContentMetaType::Application) { out_id.SetValue({key.id}); diff --git a/libraries/libstratosphere/source/os/impl/os_resource_manager.cpp b/libraries/libstratosphere/source/os/impl/os_resource_manager.cpp index 6585ea6c4..6ff528a31 100644 --- a/libraries/libstratosphere/source/os/impl/os_resource_manager.cpp +++ b/libraries/libstratosphere/source/os/impl/os_resource_manager.cpp @@ -18,7 +18,6 @@ namespace ams::os::impl { - /* TODO: C++20 constinit */ - TYPED_STORAGE(OsResourceManager) ResourceManagerHolder::s_resource_manager_storage = {}; + constinit TYPED_STORAGE(OsResourceManager) ResourceManagerHolder::s_resource_manager_storage = {}; } diff --git a/libraries/libstratosphere/source/os/impl/os_waitable_manager_impl.cpp b/libraries/libstratosphere/source/os/impl/os_waitable_manager_impl.cpp index 4da762eb6..e5a2a48db 100644 --- a/libraries/libstratosphere/source/os/impl/os_waitable_manager_impl.cpp +++ b/libraries/libstratosphere/source/os/impl/os_waitable_manager_impl.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "os_waitable_manager_impl.hpp" #include "os_waitable_object_list.hpp" #include "os_tick_manager.hpp" diff --git a/libraries/libstratosphere/source/os/os_event.cpp b/libraries/libstratosphere/source/os/os_event.cpp index 372e6fd64..2350b8ae0 100644 --- a/libraries/libstratosphere/source/os/os_event.cpp +++ b/libraries/libstratosphere/source/os/os_event.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "impl/os_timeout_helper.hpp" #include "impl/os_waitable_object_list.hpp" #include "impl/os_waitable_holder_impl.hpp" diff --git a/libraries/libstratosphere/source/os/os_interrupt_event.cpp b/libraries/libstratosphere/source/os/os_interrupt_event.cpp index e98231930..e2bd5811f 100644 --- a/libraries/libstratosphere/source/os/os_interrupt_event.cpp +++ b/libraries/libstratosphere/source/os/os_interrupt_event.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "impl/os_interrupt_event_impl.hpp" #include "impl/os_waitable_object_list.hpp" diff --git a/libraries/libstratosphere/source/os/os_message_queue.cpp b/libraries/libstratosphere/source/os/os_message_queue.cpp index 795ecf4a9..b9bdb0255 100644 --- a/libraries/libstratosphere/source/os/os_message_queue.cpp +++ b/libraries/libstratosphere/source/os/os_message_queue.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "impl/os_waitable_object_list.hpp" #include "impl/os_timeout_helper.hpp" diff --git a/libraries/libstratosphere/source/os/os_semaphore.cpp b/libraries/libstratosphere/source/os/os_semaphore.cpp index e55691095..62fe78d24 100644 --- a/libraries/libstratosphere/source/os/os_semaphore.cpp +++ b/libraries/libstratosphere/source/os/os_semaphore.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "impl/os_waitable_object_list.hpp" #include "impl/os_timeout_helper.hpp" 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/sm/sm_api.cpp b/libraries/libstratosphere/source/sm/sm_api.cpp index 4a7b80cc0..ef7be4e54 100644 --- a/libraries/libstratosphere/source/sm/sm_api.cpp +++ b/libraries/libstratosphere/source/sm/sm_api.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "sm_utils.hpp" namespace ams::sm { diff --git a/libraries/libstratosphere/source/sm/sm_manager_api.cpp b/libraries/libstratosphere/source/sm/sm_manager_api.cpp index 383e02952..5072f3c5b 100644 --- a/libraries/libstratosphere/source/sm/sm_manager_api.cpp +++ b/libraries/libstratosphere/source/sm/sm_manager_api.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "sm_utils.hpp" #include "smm_ams.h" diff --git a/libraries/libstratosphere/source/sm/sm_mitm_api.cpp b/libraries/libstratosphere/source/sm/sm_mitm_api.cpp index 38bffd8f6..431c3b96c 100644 --- a/libraries/libstratosphere/source/sm/sm_mitm_api.cpp +++ b/libraries/libstratosphere/source/sm/sm_mitm_api.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "sm_utils.hpp" namespace ams::sm::mitm { diff --git a/libraries/libstratosphere/source/sm/sm_utils.cpp b/libraries/libstratosphere/source/sm/sm_utils.cpp index 62d79f3c1..2cfefc23c 100644 --- a/libraries/libstratosphere/source/sm/sm_utils.cpp +++ b/libraries/libstratosphere/source/sm/sm_utils.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "sm_utils.hpp" namespace ams::sm::impl { diff --git a/libraries/libstratosphere/source/updater/updater_api.cpp b/libraries/libstratosphere/source/updater/updater_api.cpp index 00894124f..014ea117e 100644 --- a/libraries/libstratosphere/source/updater/updater_api.cpp +++ b/libraries/libstratosphere/source/updater/updater_api.cpp @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include #include #include diff --git a/libraries/libstratosphere/source/updater/updater_bis_management.cpp b/libraries/libstratosphere/source/updater/updater_bis_management.cpp index 9e5879918..b643634bf 100644 --- a/libraries/libstratosphere/source/updater/updater_bis_management.cpp +++ b/libraries/libstratosphere/source/updater/updater_bis_management.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "updater_bis_management.hpp" namespace ams::updater { diff --git a/libraries/libstratosphere/source/updater/updater_bis_save.cpp b/libraries/libstratosphere/source/updater/updater_bis_save.cpp index 20618f49e..1ab76e0c4 100644 --- a/libraries/libstratosphere/source/updater/updater_bis_save.cpp +++ b/libraries/libstratosphere/source/updater/updater_bis_save.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "updater_bis_save.hpp" namespace ams::updater { diff --git a/libraries/libstratosphere/source/updater/updater_files.cpp b/libraries/libstratosphere/source/updater/updater_files.cpp index 3266862f9..3d6681816 100644 --- a/libraries/libstratosphere/source/updater/updater_files.cpp +++ b/libraries/libstratosphere/source/updater/updater_files.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "updater_files.hpp" namespace ams::updater { diff --git a/libraries/libstratosphere/source/updater/updater_paths.cpp b/libraries/libstratosphere/source/updater/updater_paths.cpp index 6ede7d00d..4fefa5dfc 100644 --- a/libraries/libstratosphere/source/updater/updater_paths.cpp +++ b/libraries/libstratosphere/source/updater/updater_paths.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "updater_paths.hpp" namespace ams::updater { 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/crypto/crypto_rsa_oaep_decryptor.hpp b/libraries/libvapours/include/vapours/crypto/crypto_rsa_oaep_decryptor.hpp index 73bbeacf3..86b3750b7 100644 --- a/libraries/libvapours/include/vapours/crypto/crypto_rsa_oaep_decryptor.hpp +++ b/libraries/libvapours/include/vapours/crypto/crypto_rsa_oaep_decryptor.hpp @@ -23,7 +23,7 @@ namespace ams::crypto { - template /* requires HashFunction */ + template requires impl::HashFunction class RsaOaepDecryptor { NON_COPYABLE(RsaOaepDecryptor); NON_MOVEABLE(RsaOaepDecryptor); diff --git a/libraries/libvapours/include/vapours/crypto/crypto_rsa_oaep_encryptor.hpp b/libraries/libvapours/include/vapours/crypto/crypto_rsa_oaep_encryptor.hpp index bd29e4e2a..bcda34713 100644 --- a/libraries/libvapours/include/vapours/crypto/crypto_rsa_oaep_encryptor.hpp +++ b/libraries/libvapours/include/vapours/crypto/crypto_rsa_oaep_encryptor.hpp @@ -23,7 +23,7 @@ namespace ams::crypto { - template /* requires HashFunction */ + template requires impl::HashFunction class RsaOaepEncryptor { NON_COPYABLE(RsaOaepEncryptor); NON_MOVEABLE(RsaOaepEncryptor); diff --git a/libraries/libvapours/include/vapours/crypto/crypto_rsa_pss_verifier.hpp b/libraries/libvapours/include/vapours/crypto/crypto_rsa_pss_verifier.hpp index bd7ddcea6..273854489 100644 --- a/libraries/libvapours/include/vapours/crypto/crypto_rsa_pss_verifier.hpp +++ b/libraries/libvapours/include/vapours/crypto/crypto_rsa_pss_verifier.hpp @@ -23,7 +23,7 @@ namespace ams::crypto { - template /* requires HashFunction */ + template requires impl::HashFunction class RsaPssVerifier { NON_COPYABLE(RsaPssVerifier); NON_MOVEABLE(RsaPssVerifier); diff --git a/libraries/libvapours/include/vapours/crypto/impl/crypto_hash_function.hpp b/libraries/libvapours/include/vapours/crypto/impl/crypto_hash_function.hpp index b598b46f6..68ca106a3 100644 --- a/libraries/libvapours/include/vapours/crypto/impl/crypto_hash_function.hpp +++ b/libraries/libvapours/include/vapours/crypto/impl/crypto_hash_function.hpp @@ -23,15 +23,13 @@ namespace ams::crypto::impl { - /* TODO: C++20 - template - concept HashFunction = requires(T &t, const void *cv, void *v, size_t sz) { - { T::HashSize } -> std::same_as; - { T::BlockSize } -> std::same_as; - { t.Initialize() } -> std::same_as; - { t.Update(cv, sz) } -> std::same_as; - { t.GetHash(v, sz) } -> std::same_as; - }; - */ + template + concept HashFunction = requires(T &t, const void *cv, void *v, size_t sz) { + { T::HashSize } -> std::convertible_to; + { T::BlockSize } -> std::convertible_to; + { t.Initialize() } -> std::same_as; + { t.Update(cv, sz) } -> std::same_as; + { t.GetHash(v, sz) } -> std::same_as; + }; } diff --git a/libraries/libvapours/include/vapours/crypto/impl/crypto_rsa_oaep_impl.hpp b/libraries/libvapours/include/vapours/crypto/impl/crypto_rsa_oaep_impl.hpp index d925f16a8..cc0e59563 100644 --- a/libraries/libvapours/include/vapours/crypto/impl/crypto_rsa_oaep_impl.hpp +++ b/libraries/libvapours/include/vapours/crypto/impl/crypto_rsa_oaep_impl.hpp @@ -22,7 +22,7 @@ namespace ams::crypto::impl { - template /* requires HashFunction */ + template requires HashFunction class RsaOaepImpl { NON_COPYABLE(RsaOaepImpl); NON_MOVEABLE(RsaOaepImpl); diff --git a/libraries/libvapours/include/vapours/crypto/impl/crypto_rsa_pss_impl.hpp b/libraries/libvapours/include/vapours/crypto/impl/crypto_rsa_pss_impl.hpp index 1ce73e726..3febb5aba 100644 --- a/libraries/libvapours/include/vapours/crypto/impl/crypto_rsa_pss_impl.hpp +++ b/libraries/libvapours/include/vapours/crypto/impl/crypto_rsa_pss_impl.hpp @@ -22,7 +22,7 @@ namespace ams::crypto::impl { - template /* requires HashFunction */ + template requires HashFunction class RsaPssImpl { NON_COPYABLE(RsaPssImpl); NON_MOVEABLE(RsaPssImpl); diff --git a/libraries/libvapours/include/vapours/crypto/impl/crypto_sha256_impl.hpp b/libraries/libvapours/include/vapours/crypto/impl/crypto_sha256_impl.hpp index bbd145efb..ab9b69710 100644 --- a/libraries/libvapours/include/vapours/crypto/impl/crypto_sha256_impl.hpp +++ b/libraries/libvapours/include/vapours/crypto/impl/crypto_sha256_impl.hpp @@ -66,6 +66,6 @@ namespace ams::crypto::impl { } }; - /* static_assert(HashFunction); */ + static_assert(HashFunction); } 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/includes.hpp b/libraries/libvapours/include/vapours/includes.hpp index 713d7d4c5..577e2c458 100644 --- a/libraries/libvapours/include/vapours/includes.hpp +++ b/libraries/libvapours/include/vapours/includes.hpp @@ -28,6 +28,7 @@ /* C++ headers. */ #include +#include #include #include #include @@ -38,6 +39,8 @@ #include #include #include +#include +#include /* Stratosphere wants additional libstdc++ headers, others do not. */ #ifdef ATMOSPHERE_IS_STRATOSPHERE diff --git a/libraries/libvapours/include/vapours/span.hpp b/libraries/libvapours/include/vapours/span.hpp index ee0a07a2d..dc94f5f31 100644 --- a/libraries/libvapours/include/vapours/span.hpp +++ b/libraries/libvapours/include/vapours/span.hpp @@ -19,207 +19,7 @@ namespace ams { - /* TODO C++20 switch to template using Span = std::span */ - - namespace impl { - - template - class SpanConstIterator; - - template - class SpanIteratorImpl { - public: - friend class SpanConstIterator; - - using index_type = typename Span::index_type; - using difference_type = typename Span::difference_type; - using value_type = typename std::remove_cv::type; - using pointer = typename std::add_pointer::type; - using reference = Reference; - using iterator_category = std::random_access_iterator_tag; - private: - const Span *span = nullptr; - index_type index = 0; - public: - constexpr ALWAYS_INLINE SpanIteratorImpl() = default; - constexpr ALWAYS_INLINE SpanIteratorImpl(const Span *s, index_type idx) : span(s), index(idx) { /* ... */ } - - constexpr ALWAYS_INLINE pointer operator->() const { - return this->span->data() + this->index; - } - - constexpr ALWAYS_INLINE reference operator*() const { - return *this->operator->(); - } - - constexpr ALWAYS_INLINE Derived operator++(int) { - auto prev = static_cast(*this); - ++(*this); - return prev; - } - - constexpr ALWAYS_INLINE Derived operator--(int) { - auto prev = static_cast(*this); - --(*this); - return prev; - } - - constexpr ALWAYS_INLINE Derived &operator++() { ++this->index; return static_cast(*this); } - constexpr ALWAYS_INLINE Derived &operator--() { --this->index; return static_cast(*this); } - - constexpr ALWAYS_INLINE Derived &operator+=(difference_type n) { this->index += n; return static_cast(*this); } - constexpr ALWAYS_INLINE Derived &operator-=(difference_type n) { this->index -= n; return static_cast(*this); } - - constexpr ALWAYS_INLINE Derived operator+(difference_type n) const { auto r = static_cast(*this); return r += n; } - constexpr ALWAYS_INLINE Derived operator-(difference_type n) const { auto r = static_cast(*this); return r -= n; } - - constexpr ALWAYS_INLINE friend Derived operator+(difference_type n, Derived it) { return it + n; } - constexpr ALWAYS_INLINE difference_type operator-(Derived rhs) const { AMS_ASSERT(this->span == rhs.span); return this->index - rhs.index; } - - constexpr ALWAYS_INLINE reference operator[](difference_type n) const { return *(*this + n); } - - constexpr ALWAYS_INLINE friend bool operator==(Derived lhs, Derived rhs) { - return lhs.span == rhs.span && lhs.index == rhs.index; - } - - constexpr ALWAYS_INLINE friend bool operator<(Derived lhs, Derived rhs) { - AMS_ASSERT(lhs.span == rhs.span); - return lhs.index < rhs.index; - } - - constexpr ALWAYS_INLINE friend bool operator!=(Derived lhs, Derived rhs) { return !(lhs == rhs); } - - constexpr ALWAYS_INLINE friend bool operator>(Derived lhs, Derived rhs) { return rhs < lhs; } - - constexpr ALWAYS_INLINE friend bool operator<=(Derived lhs, Derived rhs) { return !(lhs > rhs); } - constexpr ALWAYS_INLINE friend bool operator>=(Derived lhs, Derived rhs) { return !(lhs < rhs); } - }; - - template - class SpanIterator : public SpanIteratorImpl, typename Span::element_type&> { - public: - using SpanIteratorImpl, typename Span::element_type&>::SpanIteratorImpl; - }; - - template - class SpanConstIterator : public SpanIteratorImpl, const typename Span::element_type&> { - public: - using SpanIteratorImpl, const typename Span::element_type&>::SpanIteratorImpl; - - constexpr ALWAYS_INLINE SpanConstIterator() = default; - constexpr ALWAYS_INLINE SpanConstIterator(const SpanIterator &rhs) : SpanConstIterator(rhs.span, rhs.index) { /* ... */ } - }; - - } - template - class Span { - public: - using element_type = T; - using value_type = typename std::remove_cv::type; - using index_type = std::ptrdiff_t; - using difference_type = std::ptrdiff_t; - using pointer = element_type *; - using reference = element_type &; - using iterator = ::ams::impl::SpanIterator; - using const_iterator = ::ams::impl::SpanConstIterator; - using reverse_iterator = std::reverse_iterator; - using const_reverse_iterator = std::reverse_iterator; - private: - T *ptr; - index_type num_elements; - public: - constexpr ALWAYS_INLINE Span() : ptr(), num_elements() { /* ... */ } - - constexpr ALWAYS_INLINE Span(T *p, index_type size) : ptr(p), num_elements(size) { - AMS_ASSERT(this->num_elements > 0 || this->ptr == nullptr); - } - - constexpr ALWAYS_INLINE Span(T *start, T *end) : Span(start, end - start) { /* ... */ } - - template - constexpr ALWAYS_INLINE Span(T (&arr)[Size]) : Span(static_cast(arr), static_cast(Size)) { /* ... */ } - - template - constexpr ALWAYS_INLINE Span(std::array &arr) : Span(arr.data(), static_cast(Size)) { /* ... */ } - - template - constexpr ALWAYS_INLINE Span(const std::array &arr) : Span(arr.data(), static_cast(Size)) { /* ... */ } - - template::value>::type> - constexpr ALWAYS_INLINE Span(const Span &rhs) : Span(rhs.data(), rhs.size()) { /* ... */ } - public: - constexpr ALWAYS_INLINE iterator begin() const { return { this, 0 }; } - constexpr ALWAYS_INLINE iterator end() const { return { this, this->num_elements }; } - - constexpr ALWAYS_INLINE const_iterator cbegin() const { return { this, 0 }; } - constexpr ALWAYS_INLINE const_iterator cend() const { return { this, this->num_elements }; } - - constexpr ALWAYS_INLINE reverse_iterator rbegin() const { return reverse_iterator(this->end()); } - constexpr ALWAYS_INLINE reverse_iterator rend() const { return reverse_iterator(this->begin()); } - - constexpr ALWAYS_INLINE const_reverse_iterator crbegin() const { return reverse_iterator(this->cend()); } - constexpr ALWAYS_INLINE const_reverse_iterator crend() const { return reverse_iterator(this->cbegin()); } - - constexpr ALWAYS_INLINE pointer data() const { return this->ptr; } - - constexpr ALWAYS_INLINE index_type size() const { return this->num_elements; } - constexpr ALWAYS_INLINE index_type size_bytes() const { return this->size() * sizeof(T); } - - constexpr ALWAYS_INLINE bool empty() const { return this->size() == 0; } - - constexpr ALWAYS_INLINE T &operator[](index_type idx) const { - AMS_ASSERT(idx < this->size()); - return this->ptr[idx]; - } - - constexpr ALWAYS_INLINE T &operator()(index_type idx) const { return (*this)[idx]; } - - constexpr ALWAYS_INLINE Span first(index_type size) const { - AMS_ASSERT(size <= this->size()); - return { this->ptr, size }; - } - - constexpr ALWAYS_INLINE Span last(index_type size) const { - AMS_ASSERT(size <= this->size()); - return { this->ptr + (this->size() - size), size }; - } - - constexpr ALWAYS_INLINE Span subspan(index_type idx, index_type size) const { - AMS_ASSERT(size <= this->size()); - AMS_ASSERT(this->size() - size >= idx); - return { this->ptr + idx, size }; - } - - constexpr ALWAYS_INLINE Span subspan(index_type idx) const { - AMS_ASSERT(idx <= this->size()); - return { this->ptr + idx, this->size() - idx }; - } - }; - - template - constexpr ALWAYS_INLINE Span MakeSpan(T *start, T *end) { - return { start, end }; - } - - template - constexpr ALWAYS_INLINE Span MakeSpan(T *p, typename Span::index_type size) { - return { p, size }; - } - - template - constexpr ALWAYS_INLINE Span MakeSpan(T (&arr)[Size]) { - return Span(arr); - } - - template - constexpr ALWAYS_INLINE Span MakeSpan(std::array &arr) { - return Span(arr); - } - - template - constexpr ALWAYS_INLINE Span MakeSpan(const std::array &arr) { - return Span(arr); - } + using Span = std::span; } 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..4a6adadd8 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; @@ -220,11 +220,7 @@ namespace ams::svc::codegen::impl { } for (size_t i = 1; i < num_parameters; i++) { for (size_t j = i; j > 0 && param_layout.GetParameter(map[j-1]).GetLocation(0) > param_layout.GetParameter(map[j]).GetLocation(0); j--) { - /* std::swap is not constexpr until c++20 :( */ - /* TODO: std::swap(map[j], map[j-1]); */ - const size_t tmp = map[j]; - map[j] = map[j-1]; - map[j-1] = tmp; + std::swap(map[j], map[j-1]); } } 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..1b0189925 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++) { @@ -314,15 +313,11 @@ namespace ams::svc::codegen::impl { } for (size_t i = 1; i < num_parameters; i++) { for (size_t j = i; j > 0 && CapturedSvc.GetParameter(map[j-1]).GetLocation(0) > CapturedSvc.GetParameter(map[j]).GetLocation(0); j--) { - /* std::swap is not constexpr until c++20 :( */ - /* TODO: std::swap(map[j], map[j-1]); */ - const size_t tmp = map[j]; - map[j] = map[j-1]; - map[j-1] = tmp; + std::swap(map[j], map[j-1]); } } return map; - }(WRAP_TEMPLATE_CONSTANT(Svc)); + }.template operator()(); if constexpr (ParameterIndex >= Svc.GetNumParameters()) { /* Base case: we're done. */ @@ -377,16 +372,13 @@ namespace ams::svc::codegen::impl { constexpr size_t RegisterSize = SvcAbiType::RegisterSize; 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_bitutil.hpp b/libraries/libvapours/include/vapours/util/util_bitutil.hpp index de8e78983..cf974f62d 100644 --- a/libraries/libvapours/include/vapours/util/util_bitutil.hpp +++ b/libraries/libvapours/include/vapours/util/util_bitutil.hpp @@ -30,11 +30,9 @@ namespace ams::util { } - template + template requires std::integral class BitsOf { private: - static_assert(std::is_integral::value); - static constexpr ALWAYS_INLINE int GetLsbPos(T v) { return __builtin_ctzll(static_cast(v)); } @@ -78,69 +76,68 @@ namespace ams::util { } }; - template + template requires std::integral constexpr ALWAYS_INLINE T CombineBits(Args... args) { return (... | (T(1u) << args)); } - template + template requires std::integral constexpr ALWAYS_INLINE T ResetLeastSignificantOneBit(T x) { return x & (x - 1); } - template + template requires std::integral constexpr ALWAYS_INLINE T SetLeastSignificantZeroBit(T x) { return x | (x + 1); } - template + template requires std::integral constexpr ALWAYS_INLINE T LeastSignificantOneBit(T x) { return x & ~(x - 1); } - template + template requires std::integral constexpr ALWAYS_INLINE T LeastSignificantZeroBit(T x) { return ~x & (x + 1); } - template + template requires std::integral constexpr ALWAYS_INLINE T ResetTrailingOnes(T x) { return x & (x + 1); } - template + template requires std::integral constexpr ALWAYS_INLINE T SetTrailingZeros(T x) { return x | (x - 1); } - template + template requires std::integral constexpr ALWAYS_INLINE T MaskTrailingZeros(T x) { return (~x) & (x - 1); } - template + template requires std::integral constexpr ALWAYS_INLINE T MaskTrailingOnes(T x) { return ~((~x) | (x + 1)); } - template + template requires std::integral constexpr ALWAYS_INLINE T MaskTrailingZerosAndLeastSignificantOneBit(T x) { return x ^ (x - 1); } - template + template requires std::integral constexpr ALWAYS_INLINE T MaskTrailingOnesAndLeastSignificantZeroBit(T x) { return x ^ (x + 1); } - template + template requires std::integral constexpr ALWAYS_INLINE int PopCount(T x) { /* TODO: C++20 std::bit_cast */ using U = typename std::make_unsigned::type; U u = static_cast(x); - /* TODO: C++20 std::is_constant_evaluated */ - if (false) { + if (std::is_constant_evaluated()) { /* https://en.wikipedia.org/wiki/Hamming_weight */ constexpr U m1 = U(-1) / 0x03; constexpr U m2 = U(-1) / 0x05; @@ -168,10 +165,9 @@ namespace ams::util { } } - template + template requires std::integral constexpr ALWAYS_INLINE int CountLeadingZeros(T x) { - /* TODO: C++20 std::is_constant_evaluated */ - if (false) { + if (std::is_constant_evaluated()) { for (size_t i = 0; i < impl::Log2; ++i) { const size_t shift = (0x1 << i); x |= x >> shift; @@ -195,18 +191,18 @@ namespace ams::util { } } - template + template requires std::integral constexpr ALWAYS_INLINE bool IsPowerOfTwo(T x) { return x > 0 && ResetLeastSignificantOneBit(x) == 0; } - template + template requires std::integral constexpr ALWAYS_INLINE T CeilingPowerOfTwo(T x) { AMS_ASSERT(x > 0); return T(1) << (BITSIZEOF(T) - CountLeadingZeros(T(x - 1))); } - template + template requires std::integral constexpr ALWAYS_INLINE T FloorPowerOfTwo(T x) { AMS_ASSERT(x > 0); return T(1) << (BITSIZEOF(T) - CountLeadingZeros(x) - 1); diff --git a/libraries/libvapours/include/vapours/util/util_endian.hpp b/libraries/libvapours/include/vapours/util/util_endian.hpp index fcf294baf..19844f202 100644 --- a/libraries/libvapours/include/vapours/util/util_endian.hpp +++ b/libraries/libvapours/include/vapours/util/util_endian.hpp @@ -20,27 +20,17 @@ namespace ams::util { - /* TODO: C++20 std::endian */ - constexpr bool IsLittleEndian() { - #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - return true; - #else - return false; - #endif + return std::endian::native == std::endian::little; } constexpr bool IsBigEndian() { - #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - return true; - #else - return false; - #endif + return std::endian::native == std::endian::big; } static_assert(IsLittleEndian() ^ IsBigEndian()); - template /* requires unsigned_integral */ + template requires std::unsigned_integral constexpr ALWAYS_INLINE U SwapBytes(const U u) { static_assert(BITSIZEOF(u8) == 8); constexpr U ByteMask = 0xFFu; @@ -85,14 +75,14 @@ namespace ams::util { ((u & (ByteMask << 0)) << 40); } - template /* requires integral */ + template requires std::integral constexpr ALWAYS_INLINE void SwapBytes(T *ptr) { using U = typename std::make_unsigned::type; *ptr = static_cast(SwapBytes(static_cast(*ptr))); } - template /* requires integral */ + template requires std::integral constexpr ALWAYS_INLINE T ConvertToBigEndian(const T val) { using U = typename std::make_unsigned::type; @@ -104,7 +94,7 @@ namespace ams::util { } } - template /* requires integral */ + template requires std::integral constexpr ALWAYS_INLINE T ConvertToLittleEndian(const T val) { using U = typename std::make_unsigned::type; @@ -116,7 +106,7 @@ namespace ams::util { } } - template /* requires integral */ + template requires std::integral constexpr ALWAYS_INLINE T ConvertToBigEndian48(const T val) { using U = typename std::make_unsigned::type; static_assert(sizeof(T) == sizeof(u64)); @@ -130,7 +120,7 @@ namespace ams::util { } } - template /* requires integral */ + template requires std::integral constexpr ALWAYS_INLINE T ConvertToLittleEndian48(const T val) { using U = typename std::make_unsigned::type; static_assert(sizeof(T) == sizeof(u64)); @@ -144,12 +134,12 @@ namespace ams::util { } } - template /* requires integral */ + template requires std::integral constexpr ALWAYS_INLINE T LoadBigEndian(T *ptr) { return ConvertToBigEndian(*ptr); } - template /* requires integral */ + template requires std::integral constexpr ALWAYS_INLINE T LoadLittleEndian(T *ptr) { return ConvertToLittleEndian(*ptr); } diff --git a/libraries/libvapours/include/vapours/util/util_fourcc.hpp b/libraries/libvapours/include/vapours/util/util_fourcc.hpp index 5b805e03b..08e8b3c08 100644 --- a/libraries/libvapours/include/vapours/util/util_fourcc.hpp +++ b/libraries/libvapours/include/vapours/util/util_fourcc.hpp @@ -17,16 +17,14 @@ #pragma once #include #include +#include namespace ams::util { template struct FourCC { - /* TODO: C++20 std::endian */ - static constexpr u32 Code = (static_cast(A) << 0x00) | - (static_cast(B) << 0x08) | - (static_cast(C) << 0x10) | - (static_cast(D) << 0x18); + static constexpr u32 Code = IsLittleEndian() ? ((static_cast(A) << 0x00) | (static_cast(B) << 0x08) | (static_cast(C) << 0x10) | (static_cast(D) << 0x18)) + : ((static_cast(A) << 0x18) | (static_cast(B) << 0x10) | (static_cast(C) << 0x08) | (static_cast(D) << 0x00)); static constexpr const char String[] = {A, B, C, D}; @@ -36,11 +34,8 @@ namespace ams::util { template struct ReverseFourCC { - /* TODO: C++20 std::endian */ - static constexpr u32 Code = (static_cast(A) << 0x18) | - (static_cast(B) << 0x10) | - (static_cast(C) << 0x08) | - (static_cast(D) << 0x00); + static constexpr u32 Code = IsLittleEndian() ? ((static_cast(A) << 0x18) | (static_cast(B) << 0x10) | (static_cast(C) << 0x08) | (static_cast(D) << 0x00)) + : ((static_cast(A) << 0x00) | (static_cast(B) << 0x08) | (static_cast(C) << 0x10) | (static_cast(D) << 0x18)); static constexpr const char String[] = {D, C, B, A}; 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/mesosphere/kernel/source/kern_kernel_instantiations.cpp b/mesosphere/kernel/source/kern_kernel_instantiations.cpp index 743dc5596..5bed676ec 100644 --- a/mesosphere/kernel/source/kern_kernel_instantiations.cpp +++ b/mesosphere/kernel/source/kern_kernel_instantiations.cpp @@ -18,22 +18,22 @@ namespace ams::kern { /* Declare kernel data members in kernel TU. */ - Kernel::State Kernel::s_state = Kernel::State::Invalid; - KResourceLimit Kernel::s_system_resource_limit; - KMemoryManager Kernel::s_memory_manager; - KPageTableManager Kernel::s_page_table_manager; - KMemoryBlockSlabManager Kernel::s_app_memory_block_manager; - KMemoryBlockSlabManager Kernel::s_sys_memory_block_manager; - KBlockInfoManager Kernel::s_block_info_manager; - KSupervisorPageTable Kernel::s_supervisor_page_table; - KSynchronization Kernel::s_synchronization; - KUnsafeMemory Kernel::s_unsafe_memory; - KWorkerTaskManager Kernel::s_worker_task_managers[KWorkerTaskManager::WorkerType_Count]; + constinit Kernel::State Kernel::s_state = Kernel::State::Invalid; + constinit KResourceLimit Kernel::s_system_resource_limit; + KMemoryManager Kernel::s_memory_manager; + constinit KPageTableManager Kernel::s_page_table_manager; + constinit KMemoryBlockSlabManager Kernel::s_app_memory_block_manager; + constinit KMemoryBlockSlabManager Kernel::s_sys_memory_block_manager; + constinit KBlockInfoManager Kernel::s_block_info_manager; + constinit KSupervisorPageTable Kernel::s_supervisor_page_table; + constinit KSynchronization Kernel::s_synchronization; + constinit KUnsafeMemory Kernel::s_unsafe_memory; + constinit KWorkerTaskManager Kernel::s_worker_task_managers[KWorkerTaskManager::WorkerType_Count]; namespace { - /* TODO: C++20 constinit */ std::array g_main_threads; - /* TODO: C++20 constinit */ std::array g_idle_threads; + constinit std::array g_main_threads; + constinit std::array g_idle_threads; } KThread &Kernel::GetMainThread(s32 core_id) { return g_main_threads[core_id]; } diff --git a/sept/sept-secondary/src/fs_utils.c b/sept/sept-secondary/src/fs_utils.c index 5b9b9f8fd..6426f67e5 100644 --- a/sept/sept-secondary/src/fs_utils.c +++ b/sept/sept-secondary/src/fs_utils.c @@ -23,13 +23,15 @@ FATFS sd_fs; static bool g_sd_mounted = false; static bool g_sd_initialized = false; static bool g_ahb_redirect_enabled = false; +sdmmc_t g_sd_sdmmc; +sdmmc_device_t g_sd_device; bool mount_sd(void) { /* Already mounted. */ if (g_sd_mounted) return true; - + /* Enable AHB redirection if necessary. */ if (!g_ahb_redirect_enabled) { mc_enable_ahb_redirect(); @@ -41,7 +43,7 @@ bool mount_sd(void) if (sdmmc_device_sd_init(&g_sd_device, &g_sd_sdmmc, SDMMC_BUS_WIDTH_4BIT, SDMMC_SPEED_UHS_SDR104)) { g_sd_initialized = true; - + /* Mount SD. */ if (f_mount(&sd_fs, "", 1) == FR_OK) { print(SCREEN_LOG_LEVEL_INFO, "Mounted SD card!\n"); @@ -63,7 +65,7 @@ void unmount_sd(void) sdmmc_device_finish(&g_sd_device); g_sd_mounted = false; } - + /* Disable AHB redirection if necessary. */ if (g_ahb_redirect_enabled) { mc_disable_ahb_redirect(); @@ -81,13 +83,13 @@ uint32_t get_file_size(const char *filename) FIL f; if (f_open(&f, filename, FA_READ) != FR_OK) return 0; - + /* Get the file size. */ uint32_t file_size = f_size(&f); - + /* Close the file. */ f_close(&f); - + return file_size; } @@ -101,10 +103,10 @@ int read_from_file(void *dst, uint32_t dst_size, const char *filename) FIL f; if (f_open(&f, filename, FA_READ) != FR_OK) return 0; - + /* Sync. */ f_sync(&f); - + /* Read from file. */ UINT br = 0; int res = f_read(&f, dst, dst_size, &br); @@ -118,7 +120,7 @@ int write_to_file(void *src, uint32_t src_size, const char *filename) /* SD card hasn't been mounted yet. */ if (!g_sd_mounted) return 0; - + /* Open the file for writing. */ FIL f; if (f_open(&f, filename, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK) diff --git a/sept/sept-secondary/src/fs_utils.h b/sept/sept-secondary/src/fs_utils.h index 8cb0f326c..1e25b2b82 100644 --- a/sept/sept-secondary/src/fs_utils.h +++ b/sept/sept-secondary/src/fs_utils.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 FUSEE_FS_UTILS_H #define FUSEE_FS_UTILS_H @@ -23,8 +23,8 @@ #include "sdmmc/sdmmc.h" #include "utils.h" -sdmmc_t g_sd_sdmmc; -sdmmc_device_t g_sd_device; +extern sdmmc_t g_sd_sdmmc; +extern sdmmc_device_t g_sd_device; bool mount_sd(void); void unmount_sd(void); diff --git a/sept/sept-secondary/src/lib/ini.c b/sept/sept-secondary/src/lib/ini.c index 63626c72d..ccf4640d2 100644 --- a/sept/sept-secondary/src/lib/ini.c +++ b/sept/sept-secondary/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; } diff --git a/stratosphere/ams_mitm/source/amsmitm_main.cpp b/stratosphere/ams_mitm/source/amsmitm_main.cpp index 154166eb9..9de2611db 100644 --- a/stratosphere/ams_mitm/source/amsmitm_main.cpp +++ b/stratosphere/ams_mitm/source/amsmitm_main.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "amsmitm_initialization.hpp" #include "amsmitm_module_management.hpp" #include "bpc_mitm/bpc_ams_power_utils.hpp" diff --git a/stratosphere/ams_mitm/source/amsmitm_module.hpp b/stratosphere/ams_mitm/source/amsmitm_module.hpp index 75333f47b..1c68f3200 100644 --- a/stratosphere/ams_mitm/source/amsmitm_module.hpp +++ b/stratosphere/ams_mitm/source/amsmitm_module.hpp @@ -19,21 +19,25 @@ namespace ams::mitm { /* TODO: C++20 Concepts will make this a lot less stupid. */ - class ModuleBase {}; + template + concept IsModule = requires(T, void *arg) { + { T::ThreadPriority } -> std::convertible_to; + { T::StackSize } -> std::convertible_to; + { T::Stack } -> std::convertible_to; + { T::ThreadFunction(arg) } -> std::same_as; + }; - #define DEFINE_MITM_MODULE_CLASS(ss, prio) class MitmModule : public ::ams::mitm::ModuleBase { \ - public: \ - static constexpr s32 ThreadPriority = prio; \ - static constexpr size_t StackSize = ss; \ - alignas(os::ThreadStackAlignment) static inline u8 Stack[StackSize]; \ - public: \ - static void ThreadFunction(void *); \ + #define DEFINE_MITM_MODULE_CLASS(ss, prio) class MitmModule { \ + public: \ + static constexpr s32 ThreadPriority = prio; \ + static constexpr size_t StackSize = ss; \ + alignas(os::ThreadStackAlignment) static inline u8 Stack[StackSize]; \ + public: \ + static void ThreadFunction(void *); \ } - template + template requires IsModule struct ModuleTraits { - static_assert(std::is_base_of::value, "Mitm Modules must inherit from ams::mitm::Module"); - static constexpr void *Stack = &M::Stack[0]; static constexpr size_t StackSize = M::StackSize; diff --git a/stratosphere/ams_mitm/source/amsmitm_module_management.cpp b/stratosphere/ams_mitm/source/amsmitm_module_management.cpp index e139c557a..ffa792fb9 100644 --- a/stratosphere/ams_mitm/source/amsmitm_module_management.cpp +++ b/stratosphere/ams_mitm/source/amsmitm_module_management.cpp @@ -54,7 +54,7 @@ namespace ams::mitm { .main = Traits::ThreadFunction, .stack_mem = Traits::Stack, .priority = Traits::ThreadPriority, - .stack_size = Traits::StackSize, + .stack_size = static_cast(Traits::StackSize), }; } diff --git a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_module.cpp b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_module.cpp index 9eb29bab5..e2733d18f 100644 --- a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_module.cpp +++ b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_module.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "../amsmitm_initialization.hpp" #include "bpc_ams_module.hpp" #include "bpc_ams_service.hpp" diff --git a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp index cc15f63f8..727cc61bc 100644 --- a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp +++ b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "bpc_ams_power_utils.hpp" #include "../amsmitm_fs_utils.hpp" diff --git a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_service.cpp b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_service.cpp index 79d6c27e1..ad88aa1c1 100644 --- a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_service.cpp +++ b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "../amsmitm_initialization.hpp" #include "bpc_ams_service.hpp" #include "bpc_ams_power_utils.hpp" diff --git a/stratosphere/ams_mitm/source/bpc_mitm/bpc_mitm_service.cpp b/stratosphere/ams_mitm/source/bpc_mitm/bpc_mitm_service.cpp index 24e804c89..bf410a993 100644 --- a/stratosphere/ams_mitm/source/bpc_mitm/bpc_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/bpc_mitm/bpc_mitm_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "bpc_mitm_service.hpp" #include "bpc_ams_power_utils.hpp" diff --git a/stratosphere/ams_mitm/source/bpc_mitm/bpcmitm_module.cpp b/stratosphere/ams_mitm/source/bpc_mitm/bpcmitm_module.cpp index f3d757bd4..36f3934a0 100644 --- a/stratosphere/ams_mitm/source/bpc_mitm/bpcmitm_module.cpp +++ b/stratosphere/ams_mitm/source/bpc_mitm/bpcmitm_module.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "../amsmitm_initialization.hpp" #include "bpcmitm_module.hpp" #include "bpc_mitm_service.hpp" diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.cpp b/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.cpp index 380f12748..60aec454e 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "../amsmitm_fs_utils.hpp" #include "../amsmitm_initialization.hpp" #include "fs_shim.h" diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.cpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.cpp index 5b16af1d3..d30758196 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_boot0storage.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fsmitm_boot0storage.hpp" namespace ams::mitm::fs { diff --git a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_module.cpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_module.cpp index 3d27f0d84..a8a709287 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_module.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_module.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fsmitm_module.hpp" #include "fs_mitm_service.hpp" 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/fs_mitm/fsmitm_save_utils.cpp b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_save_utils.cpp index 65be46822..589fca44a 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fsmitm_save_utils.cpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fsmitm_save_utils.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fsmitm_save_utils.hpp" namespace ams::mitm::fs { diff --git a/stratosphere/ams_mitm/source/hid_mitm/hid_mitm_service.cpp b/stratosphere/ams_mitm/source/hid_mitm/hid_mitm_service.cpp index 176fef43d..d516ab733 100644 --- a/stratosphere/ams_mitm/source/hid_mitm/hid_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/hid_mitm/hid_mitm_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "hid_mitm_service.hpp" #include "hid_shim.h" diff --git a/stratosphere/ams_mitm/source/hid_mitm/hidmitm_module.cpp b/stratosphere/ams_mitm/source/hid_mitm/hidmitm_module.cpp index 3423f0efc..c40d39b56 100644 --- a/stratosphere/ams_mitm/source/hid_mitm/hidmitm_module.cpp +++ b/stratosphere/ams_mitm/source/hid_mitm/hidmitm_module.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "../amsmitm_initialization.hpp" #include "hidmitm_module.hpp" #include "hid_mitm_service.hpp" diff --git a/stratosphere/ams_mitm/source/ns_mitm/nsmitm_module.cpp b/stratosphere/ams_mitm/source/ns_mitm/nsmitm_module.cpp index 30699c6e8..33db54be5 100644 --- a/stratosphere/ams_mitm/source/ns_mitm/nsmitm_module.cpp +++ b/stratosphere/ams_mitm/source/ns_mitm/nsmitm_module.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "../amsmitm_initialization.hpp" #include "nsmitm_module.hpp" #include "ns_am_mitm_service.hpp" diff --git a/stratosphere/ams_mitm/source/set_mitm/set_mitm_service.cpp b/stratosphere/ams_mitm/source/set_mitm/set_mitm_service.cpp index 25becb56f..4c12ff57c 100644 --- a/stratosphere/ams_mitm/source/set_mitm/set_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/set_mitm_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "set_mitm_service.hpp" namespace ams::mitm::settings { diff --git a/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp b/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp index 7b386ea2e..26637a092 100644 --- a/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/setmitm_module.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "../amsmitm_initialization.hpp" #include "setmitm_module.hpp" #include "set_mitm_service.hpp" diff --git a/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp b/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp index b10131814..130314ce0 100644 --- a/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/setsys_mitm_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "setsys_mitm_service.hpp" #include "settings_sd_kvs.hpp" 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..79f7374a9 100644 --- a/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/settings_sd_kvs.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "../amsmitm_debug.hpp" #include "../amsmitm_fs_utils.hpp" #include "settings_sd_kvs.hpp" @@ -42,7 +43,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/boot/Makefile b/stratosphere/boot/Makefile index 8fa028c65..d7e1a1e7a 100644 --- a/stratosphere/boot/Makefile +++ b/stratosphere/boot/Makefile @@ -121,6 +121,8 @@ $(OUTPUT).kip : $(OUTPUT).elf $(OUTPUT).elf : $(OFILES) +boot_power_utils.o: fusee_primary.bin.o fusee_primary_bin.h + #--------------------------------------------------------------------------------- # you need a rule like this for each extension you use as binary data #--------------------------------------------------------------------------------- diff --git a/stratosphere/boot/source/boot_battery_driver.cpp b/stratosphere/boot/source/boot_battery_driver.cpp index bd013cead..ae6a5b776 100644 --- a/stratosphere/boot/source/boot_battery_driver.cpp +++ b/stratosphere/boot/source/boot_battery_driver.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_battery_driver.hpp" #include "boot_calibration.hpp" #include "boot_i2c_utils.hpp" diff --git a/stratosphere/boot/source/boot_battery_icons.cpp b/stratosphere/boot/source/boot_battery_icons.cpp index 8809e17b0..af7b0e425 100644 --- a/stratosphere/boot/source/boot_battery_icons.cpp +++ b/stratosphere/boot/source/boot_battery_icons.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_battery_icons.hpp" #include "boot_display.hpp" diff --git a/stratosphere/boot/source/boot_boot_reason.cpp b/stratosphere/boot/source/boot_boot_reason.cpp index 2d2a05733..6cb6cb863 100644 --- a/stratosphere/boot/source/boot_boot_reason.cpp +++ b/stratosphere/boot/source/boot_boot_reason.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_boot_reason.hpp" #include "boot_pmic_driver.hpp" #include "boot_rtc_driver.hpp" diff --git a/stratosphere/boot/source/boot_calibration.cpp b/stratosphere/boot/source/boot_calibration.cpp index 8ae084e52..6257609f3 100644 --- a/stratosphere/boot/source/boot_calibration.cpp +++ b/stratosphere/boot/source/boot_calibration.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_calibration.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_change_voltage.cpp b/stratosphere/boot/source/boot_change_voltage.cpp index 88853dfd7..b73f38b8f 100644 --- a/stratosphere/boot/source/boot_change_voltage.cpp +++ b/stratosphere/boot/source/boot_change_voltage.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_change_voltage.hpp" #include "boot_pmc_wrapper.hpp" diff --git a/stratosphere/boot/source/boot_charger_driver.cpp b/stratosphere/boot/source/boot_charger_driver.cpp index 69f4e193d..695d1be9a 100644 --- a/stratosphere/boot/source/boot_charger_driver.cpp +++ b/stratosphere/boot/source/boot_charger_driver.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_charger_driver.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_check_battery.cpp b/stratosphere/boot/source/boot_check_battery.cpp index 3add32c54..63b6627e4 100644 --- a/stratosphere/boot/source/boot_check_battery.cpp +++ b/stratosphere/boot/source/boot_check_battery.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_battery_driver.hpp" #include "boot_battery_icons.hpp" #include "boot_boot_reason.hpp" diff --git a/stratosphere/boot/source/boot_check_clock.cpp b/stratosphere/boot/source/boot_check_clock.cpp index a3076e2ba..4ca02d079 100644 --- a/stratosphere/boot/source/boot_check_clock.cpp +++ b/stratosphere/boot/source/boot_check_clock.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_check_clock.hpp" #include "boot_power_utils.hpp" diff --git a/stratosphere/boot/source/boot_clock_initial_configuration.cpp b/stratosphere/boot/source/boot_clock_initial_configuration.cpp index b88dd0914..4dd90a83f 100644 --- a/stratosphere/boot/source/boot_clock_initial_configuration.cpp +++ b/stratosphere/boot/source/boot_clock_initial_configuration.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_clock_initial_configuration.hpp" #include "boot_pmc_wrapper.hpp" #include "boot_registers_pmc.hpp" diff --git a/stratosphere/boot/source/boot_display.cpp b/stratosphere/boot/source/boot_display.cpp index 1ade06ae7..9b1a2b346 100644 --- a/stratosphere/boot/source/boot_display.cpp +++ b/stratosphere/boot/source/boot_display.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_display.hpp" #include "boot_i2c_utils.hpp" #include "boot_pmc_wrapper.hpp" diff --git a/stratosphere/boot/source/boot_fan_enable.cpp b/stratosphere/boot/source/boot_fan_enable.cpp index adc3e78ea..26d0cf8a4 100644 --- a/stratosphere/boot/source/boot_fan_enable.cpp +++ b/stratosphere/boot/source/boot_fan_enable.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_fan_enable.hpp" #include "gpio/gpio_utils.hpp" diff --git a/stratosphere/boot/source/boot_i2c_utils.cpp b/stratosphere/boot/source/boot_i2c_utils.cpp index 8d5a8f9a5..541761b23 100644 --- a/stratosphere/boot/source/boot_i2c_utils.cpp +++ b/stratosphere/boot/source/boot_i2c_utils.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_i2c_utils.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_main.cpp b/stratosphere/boot/source/boot_main.cpp index 5a3713262..a6688f24d 100644 --- a/stratosphere/boot/source/boot_main.cpp +++ b/stratosphere/boot/source/boot_main.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_boot_reason.hpp" #include "boot_change_voltage.hpp" #include "boot_check_battery.hpp" diff --git a/stratosphere/boot/source/boot_pcv.cpp b/stratosphere/boot/source/boot_pcv.cpp index 73a56e757..59212a9aa 100644 --- a/stratosphere/boot/source/boot_pcv.cpp +++ b/stratosphere/boot/source/boot_pcv.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "i2c/i2c_types.hpp" #include "i2c/driver/impl/i2c_pcv.hpp" #include "i2c/driver/impl/i2c_registers.hpp" diff --git a/stratosphere/boot/source/boot_pmc_wrapper.cpp b/stratosphere/boot/source/boot_pmc_wrapper.cpp index e88a0ae8f..9003009d4 100644 --- a/stratosphere/boot/source/boot_pmc_wrapper.cpp +++ b/stratosphere/boot/source/boot_pmc_wrapper.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_pmc_wrapper.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_pmic_driver.cpp b/stratosphere/boot/source/boot_pmic_driver.cpp index 846bc09c1..8dbe39365 100644 --- a/stratosphere/boot/source/boot_pmic_driver.cpp +++ b/stratosphere/boot/source/boot_pmic_driver.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_i2c_utils.hpp" #include "boot_pmic_driver.hpp" diff --git a/stratosphere/boot/source/boot_power_utils.cpp b/stratosphere/boot/source/boot_power_utils.cpp index 9c140421b..3b18807b0 100644 --- a/stratosphere/boot/source/boot_power_utils.cpp +++ b/stratosphere/boot/source/boot_power_utils.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_power_utils.hpp" #include "fusee-primary_bin.h" diff --git a/stratosphere/boot/source/boot_repair_boot_images.cpp b/stratosphere/boot/source/boot_repair_boot_images.cpp index 16095aa73..9c7047418 100644 --- a/stratosphere/boot/source/boot_repair_boot_images.cpp +++ b/stratosphere/boot/source/boot_repair_boot_images.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_power_utils.hpp" #include "boot_repair_boot_images.hpp" diff --git a/stratosphere/boot/source/boot_rtc_driver.cpp b/stratosphere/boot/source/boot_rtc_driver.cpp index e01e80d0b..33fb6fd98 100644 --- a/stratosphere/boot/source/boot_rtc_driver.cpp +++ b/stratosphere/boot/source/boot_rtc_driver.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_rtc_driver.hpp" namespace ams::boot { diff --git a/stratosphere/boot/source/boot_splash_screen.cpp b/stratosphere/boot/source/boot_splash_screen.cpp index ebffc543d..01b45aed5 100644 --- a/stratosphere/boot/source/boot_splash_screen.cpp +++ b/stratosphere/boot/source/boot_splash_screen.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_boot_reason.hpp" #include "boot_display.hpp" #include "boot_splash_screen.hpp" diff --git a/stratosphere/boot/source/boot_wake_pins.cpp b/stratosphere/boot/source/boot_wake_pins.cpp index f4921d051..ccfc94700 100644 --- a/stratosphere/boot/source/boot_wake_pins.cpp +++ b/stratosphere/boot/source/boot_wake_pins.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "boot_pmc_wrapper.hpp" #include "boot_wake_pins.hpp" diff --git a/stratosphere/boot/source/gpio/gpio_initial_configuration.cpp b/stratosphere/boot/source/gpio/gpio_initial_configuration.cpp index 20d8eb7de..984c4423d 100644 --- a/stratosphere/boot/source/gpio/gpio_initial_configuration.cpp +++ b/stratosphere/boot/source/gpio/gpio_initial_configuration.cpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include - +#include #include "gpio_initial_configuration.hpp" #include "gpio_utils.hpp" diff --git a/stratosphere/boot/source/gpio/gpio_utils.cpp b/stratosphere/boot/source/gpio/gpio_utils.cpp index cba922c16..9f933e365 100644 --- a/stratosphere/boot/source/gpio/gpio_utils.cpp +++ b/stratosphere/boot/source/gpio/gpio_utils.cpp @@ -13,9 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include - +#include #include "gpio_utils.hpp" namespace ams::gpio { diff --git a/stratosphere/boot/source/i2c/driver/i2c_api.cpp b/stratosphere/boot/source/i2c/driver/i2c_api.cpp index 06565597e..df9a1bda4 100644 --- a/stratosphere/boot/source/i2c/driver/i2c_api.cpp +++ b/stratosphere/boot/source/i2c/driver/i2c_api.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "i2c_api.hpp" #include "impl/i2c_resource_manager.hpp" diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.cpp b/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.cpp index f1bcf3dd7..fb419af32 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.cpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_bus_accessor.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "i2c_pcv.hpp" #include "i2c_bus_accessor.hpp" diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_device_config.cpp b/stratosphere/boot/source/i2c/driver/impl/i2c_device_config.cpp index e1affe153..d6b3f1a5f 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_device_config.cpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_device_config.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "i2c_driver_types.hpp" namespace ams::i2c::driver::impl { diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.cpp b/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.cpp index db93a3dfd..627ab3c26 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.cpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_resource_manager.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "i2c_pcv.hpp" #include "i2c_resource_manager.hpp" diff --git a/stratosphere/boot/source/i2c/driver/impl/i2c_session.cpp b/stratosphere/boot/source/i2c/driver/impl/i2c_session.cpp index 5c2ad5ad6..8e982ec6e 100644 --- a/stratosphere/boot/source/i2c/driver/impl/i2c_session.cpp +++ b/stratosphere/boot/source/i2c/driver/impl/i2c_session.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "i2c_session.hpp" namespace ams::i2c::driver::impl { diff --git a/stratosphere/boot/source/i2c/i2c_command_list.cpp b/stratosphere/boot/source/i2c/i2c_command_list.cpp index dc2cd6e8a..9b44658b4 100644 --- a/stratosphere/boot/source/i2c/i2c_command_list.cpp +++ b/stratosphere/boot/source/i2c/i2c_command_list.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "i2c_types.hpp" #include "i2c_command_list.hpp" diff --git a/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp b/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp index d9a651b12..521dbe835 100644 --- a/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp +++ b/stratosphere/boot/source/pinmux/pinmux_initial_configuration.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "pinmux_initial_configuration.hpp" #include "pinmux_utils.hpp" diff --git a/stratosphere/boot/source/pinmux/pinmux_utils.cpp b/stratosphere/boot/source/pinmux/pinmux_utils.cpp index 8c9b0433d..17ce295f8 100644 --- a/stratosphere/boot/source/pinmux/pinmux_utils.cpp +++ b/stratosphere/boot/source/pinmux/pinmux_utils.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "pinmux_utils.hpp" namespace ams::pinmux { 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..173d8c88f 100644 --- a/stratosphere/creport/source/creport_crash_report.cpp +++ b/stratosphere/creport/source/creport_crash_report.cpp @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include -#include +#include #include "creport_crash_report.hpp" #include "creport_utils.hpp" @@ -351,7 +350,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/creport/source/creport_main.cpp b/stratosphere/creport/source/creport_main.cpp index 3eb716049..fdd824efe 100644 --- a/stratosphere/creport/source/creport_main.cpp +++ b/stratosphere/creport/source/creport_main.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "creport_crash_report.hpp" #include "creport_utils.hpp" diff --git a/stratosphere/creport/source/creport_modules.cpp b/stratosphere/creport/source/creport_modules.cpp index 5370aa453..49694ee9a 100644 --- a/stratosphere/creport/source/creport_modules.cpp +++ b/stratosphere/creport/source/creport_modules.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "creport_modules.hpp" #include "creport_utils.hpp" diff --git a/stratosphere/creport/source/creport_scoped_file.cpp b/stratosphere/creport/source/creport_scoped_file.cpp index d2c067801..916d7be56 100644 --- a/stratosphere/creport/source/creport_scoped_file.cpp +++ b/stratosphere/creport/source/creport_scoped_file.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "creport_scoped_file.hpp" namespace ams::creport { diff --git a/stratosphere/creport/source/creport_threads.cpp b/stratosphere/creport/source/creport_threads.cpp index 175c2d49b..0a3373ac7 100644 --- a/stratosphere/creport/source/creport_threads.cpp +++ b/stratosphere/creport/source/creport_threads.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "creport_threads.hpp" #include "creport_modules.hpp" diff --git a/stratosphere/creport/source/creport_utils.cpp b/stratosphere/creport/source/creport_utils.cpp index 6ec66eac3..ee54a4e68 100644 --- a/stratosphere/creport/source/creport_utils.cpp +++ b/stratosphere/creport/source/creport_utils.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "creport_utils.hpp" namespace ams::creport { diff --git a/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp b/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp index 316fc3291..b3856f441 100644 --- a/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp +++ b/stratosphere/dmnt/source/cheat/dmnt_cheat_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "dmnt_cheat_service.hpp" #include "impl/dmnt_cheat_api.hpp" diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp index 302dcb22f..6369937ef 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_api.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "dmnt_cheat_api.hpp" #include "dmnt_cheat_vm.hpp" #include "dmnt_cheat_debug_events_manager.hpp" @@ -141,7 +142,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/cheat/impl/dmnt_cheat_debug_events_manager.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.cpp index 54ad300c8..3cc7dd057 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_debug_events_manager.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "dmnt_cheat_debug_events_manager.hpp" /* WORKAROUND: This design prevents a kernel deadlock from occurring on 6.0.0+ */ diff --git a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp index ea03e95c5..f3bb39036 100644 --- a/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp +++ b/stratosphere/dmnt/source/cheat/impl/dmnt_cheat_vm.cpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include +#include #include "dmnt_cheat_vm.hpp" #include "dmnt_cheat_api.hpp" diff --git a/stratosphere/dmnt/source/dmnt_main.cpp b/stratosphere/dmnt/source/dmnt_main.cpp index d321fbbde..12aded756 100644 --- a/stratosphere/dmnt/source/dmnt_main.cpp +++ b/stratosphere/dmnt/source/dmnt_main.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "dmnt_service.hpp" #include "cheat/dmnt_cheat_service.hpp" #include "cheat/impl/dmnt_cheat_api.hpp" 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/dmnt/source/dmnt_service_debug.cpp b/stratosphere/dmnt/source/dmnt_service_debug.cpp index 8b32b1d07..06a5e7351 100644 --- a/stratosphere/dmnt/source/dmnt_service_debug.cpp +++ b/stratosphere/dmnt/source/dmnt_service_debug.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "dmnt_service.hpp" namespace ams::dmnt { diff --git a/stratosphere/dmnt/source/dmnt_service_target_io.cpp b/stratosphere/dmnt/source/dmnt_service_target_io.cpp index 8274596dc..b4ecb1d62 100644 --- a/stratosphere/dmnt/source/dmnt_service_target_io.cpp +++ b/stratosphere/dmnt/source/dmnt_service_target_io.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "dmnt_service.hpp" namespace std { diff --git a/stratosphere/fatal/source/fatal_config.cpp b/stratosphere/fatal/source/fatal_config.cpp index bbebe52a6..38889fb2e 100644 --- a/stratosphere/fatal/source/fatal_config.cpp +++ b/stratosphere/fatal/source/fatal_config.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_config.hpp" namespace ams::fatal::srv { @@ -77,21 +78,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_debug.cpp b/stratosphere/fatal/source/fatal_debug.cpp index 60007e35e..7f4188c55 100644 --- a/stratosphere/fatal/source/fatal_debug.cpp +++ b/stratosphere/fatal/source/fatal_debug.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_debug.hpp" #include "fatal_config.hpp" diff --git a/stratosphere/fatal/source/fatal_event_manager.cpp b/stratosphere/fatal/source/fatal_event_manager.cpp index b5e02602f..8a8cbb2f3 100644 --- a/stratosphere/fatal/source/fatal_event_manager.cpp +++ b/stratosphere/fatal/source/fatal_event_manager.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_event_manager.hpp" namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_font.cpp b/stratosphere/fatal/source/fatal_font.cpp index 1a1cfe892..67752e9d4 100644 --- a/stratosphere/fatal/source/fatal_font.cpp +++ b/stratosphere/fatal/source/fatal_font.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_config.hpp" #include "fatal_font.hpp" diff --git a/stratosphere/fatal/source/fatal_main.cpp b/stratosphere/fatal/source/fatal_main.cpp index af942d211..f1708ba51 100644 --- a/stratosphere/fatal/source/fatal_main.cpp +++ b/stratosphere/fatal/source/fatal_main.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_service.hpp" #include "fatal_config.hpp" #include "fatal_repair.hpp" diff --git a/stratosphere/fatal/source/fatal_repair.cpp b/stratosphere/fatal/source/fatal_repair.cpp index ffd353398..bc57fe698 100644 --- a/stratosphere/fatal/source/fatal_repair.cpp +++ b/stratosphere/fatal/source/fatal_repair.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_repair.hpp" #include "fatal_service_for_self.hpp" diff --git a/stratosphere/fatal/source/fatal_scoped_file.cpp b/stratosphere/fatal/source/fatal_scoped_file.cpp index 4b47a2813..4f3359255 100644 --- a/stratosphere/fatal/source/fatal_scoped_file.cpp +++ b/stratosphere/fatal/source/fatal_scoped_file.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_scoped_file.hpp" namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_service.cpp b/stratosphere/fatal/source/fatal_service.cpp index d3a886fed..0e86883b6 100644 --- a/stratosphere/fatal/source/fatal_service.cpp +++ b/stratosphere/fatal/source/fatal_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_config.hpp" #include "fatal_debug.hpp" #include "fatal_service.hpp" diff --git a/stratosphere/fatal/source/fatal_task.cpp b/stratosphere/fatal/source/fatal_task.cpp index 3354118d5..00195b946 100644 --- a/stratosphere/fatal/source/fatal_task.cpp +++ b/stratosphere/fatal/source/fatal_task.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_task.hpp" #include "fatal_task_error_report.hpp" diff --git a/stratosphere/fatal/source/fatal_task_clock.cpp b/stratosphere/fatal/source/fatal_task_clock.cpp index 933ef6a22..1b253a184 100644 --- a/stratosphere/fatal/source/fatal_task_clock.cpp +++ b/stratosphere/fatal/source/fatal_task_clock.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_task_clock.hpp" namespace ams::fatal::srv { diff --git a/stratosphere/fatal/source/fatal_task_error_report.cpp b/stratosphere/fatal/source/fatal_task_error_report.cpp index 6744be8ec..8247ac02d 100644 --- a/stratosphere/fatal/source/fatal_task_error_report.cpp +++ b/stratosphere/fatal/source/fatal_task_error_report.cpp @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include -#include +#include #include "fatal_config.hpp" #include "fatal_task_error_report.hpp" #include "fatal_scoped_file.hpp" @@ -79,13 +78,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_power.cpp b/stratosphere/fatal/source/fatal_task_power.cpp index b543a89df..69d84ef46 100644 --- a/stratosphere/fatal/source/fatal_task_power.cpp +++ b/stratosphere/fatal/source/fatal_task_power.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_config.hpp" #include "fatal_task_power.hpp" diff --git a/stratosphere/fatal/source/fatal_task_screen.cpp b/stratosphere/fatal/source/fatal_task_screen.cpp index dbd78690f..327904f9d 100644 --- a/stratosphere/fatal/source/fatal_task_screen.cpp +++ b/stratosphere/fatal/source/fatal_task_screen.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_task_screen.hpp" #include "fatal_config.hpp" #include "fatal_font.hpp" @@ -213,18 +214,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/stratosphere/fatal/source/fatal_task_sound.cpp b/stratosphere/fatal/source/fatal_task_sound.cpp index 5210722a0..cc235b7d5 100644 --- a/stratosphere/fatal/source/fatal_task_sound.cpp +++ b/stratosphere/fatal/source/fatal_task_sound.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "fatal_task_sound.hpp" namespace ams::fatal::srv { diff --git a/stratosphere/loader/source/ldr_arguments.cpp b/stratosphere/loader/source/ldr_arguments.cpp index 6127454c3..0c4452cce 100644 --- a/stratosphere/loader/source/ldr_arguments.cpp +++ b/stratosphere/loader/source/ldr_arguments.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ldr_arguments.hpp" namespace ams::ldr::args { diff --git a/stratosphere/loader/source/ldr_capabilities.cpp b/stratosphere/loader/source/ldr_capabilities.cpp index 7e3198097..6c170863c 100644 --- a/stratosphere/loader/source/ldr_capabilities.cpp +++ b/stratosphere/loader/source/ldr_capabilities.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ldr_capabilities.hpp" namespace ams::ldr::caps { diff --git a/stratosphere/loader/source/ldr_content_management.cpp b/stratosphere/loader/source/ldr_content_management.cpp index 3fa6a766f..9a622d639 100644 --- a/stratosphere/loader/source/ldr_content_management.cpp +++ b/stratosphere/loader/source/ldr_content_management.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ldr_content_management.hpp" namespace ams::ldr { diff --git a/stratosphere/loader/source/ldr_development_manager.cpp b/stratosphere/loader/source/ldr_development_manager.cpp index bb48a635b..cf15a3e3f 100644 --- a/stratosphere/loader/source/ldr_development_manager.cpp +++ b/stratosphere/loader/source/ldr_development_manager.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ldr_launch_record.hpp" namespace ams::ldr { diff --git a/stratosphere/loader/source/ldr_launch_record.cpp b/stratosphere/loader/source/ldr_launch_record.cpp index fc7e48e9c..ec97f813c 100644 --- a/stratosphere/loader/source/ldr_launch_record.cpp +++ b/stratosphere/loader/source/ldr_launch_record.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ldr_launch_record.hpp" namespace ams::ldr { diff --git a/stratosphere/loader/source/ldr_loader_service.cpp b/stratosphere/loader/source/ldr_loader_service.cpp index 65954ac78..9b3a0e1c0 100644 --- a/stratosphere/loader/source/ldr_loader_service.cpp +++ b/stratosphere/loader/source/ldr_loader_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ldr_arguments.hpp" #include "ldr_content_management.hpp" #include "ldr_development_manager.hpp" diff --git a/stratosphere/loader/source/ldr_main.cpp b/stratosphere/loader/source/ldr_main.cpp index 5d1c16ebf..c22308e6f 100644 --- a/stratosphere/loader/source/ldr_main.cpp +++ b/stratosphere/loader/source/ldr_main.cpp @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - +#include #include "ldr_development_manager.hpp" #include "ldr_loader_service.hpp" diff --git a/stratosphere/loader/source/ldr_meta.cpp b/stratosphere/loader/source/ldr_meta.cpp index 0da9a3338..bb8255b32 100644 --- a/stratosphere/loader/source/ldr_meta.cpp +++ b/stratosphere/loader/source/ldr_meta.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ldr_capabilities.hpp" #include "ldr_content_management.hpp" #include "ldr_development_manager.hpp" diff --git a/stratosphere/loader/source/ldr_patcher.cpp b/stratosphere/loader/source/ldr_patcher.cpp index 2209b111b..a9b14da9d 100644 --- a/stratosphere/loader/source/ldr_patcher.cpp +++ b/stratosphere/loader/source/ldr_patcher.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ldr_patcher.hpp" namespace ams::ldr { diff --git a/stratosphere/loader/source/ldr_ro_manager.cpp b/stratosphere/loader/source/ldr_ro_manager.cpp index 901d22137..d96cd6bdc 100644 --- a/stratosphere/loader/source/ldr_ro_manager.cpp +++ b/stratosphere/loader/source/ldr_ro_manager.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ldr_ro_manager.hpp" namespace ams::ldr::ro { diff --git a/stratosphere/ncm/source/ncm_main.cpp b/stratosphere/ncm/source/ncm_main.cpp index 7b6465655..8bb8760e2 100644 --- a/stratosphere/ncm/source/ncm_main.cpp +++ b/stratosphere/ncm/source/ncm_main.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - #include extern "C" { diff --git a/stratosphere/pgl/source/pgl_main.cpp b/stratosphere/pgl/source/pgl_main.cpp index 03a75f246..bd56bebc1 100644 --- a/stratosphere/pgl/source/pgl_main.cpp +++ b/stratosphere/pgl/source/pgl_main.cpp @@ -64,7 +64,7 @@ namespace ams::pgl { constexpr sm::ServiceName ShellServiceName = sm::ServiceName::Encode("pgl"); constexpr size_t ShellMaxSessions = 8; /* Official maximum is 8. */ - /* TODO: C++20 constinit */ pgl::srv::ShellInterface g_shell_interface; + constinit pgl::srv::ShellInterface g_shell_interface; ALWAYS_INLINE std::shared_ptr GetSharedPointerToShellInterface() { return ams::sf::ServiceObjectTraits::SharedPointerHelper::GetEmptyDeleteSharedPointer(std::addressof(g_shell_interface)); diff --git a/stratosphere/pm/source/impl/pm_process_info.cpp b/stratosphere/pm/source/impl/pm_process_info.cpp index 7965a9384..a8252eab5 100644 --- a/stratosphere/pm/source/impl/pm_process_info.cpp +++ b/stratosphere/pm/source/impl/pm_process_info.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "pm_process_info.hpp" namespace ams::pm::impl { diff --git a/stratosphere/pm/source/impl/pm_process_manager.cpp b/stratosphere/pm/source/impl/pm_process_manager.cpp index 3d761ca9d..7a761817a 100644 --- a/stratosphere/pm/source/impl/pm_process_manager.cpp +++ b/stratosphere/pm/source/impl/pm_process_manager.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "pm_process_manager.hpp" #include "pm_resource_manager.hpp" diff --git a/stratosphere/pm/source/impl/pm_resource_manager.cpp b/stratosphere/pm/source/impl/pm_resource_manager.cpp index aeedc11ab..a9ba8277e 100644 --- a/stratosphere/pm/source/impl/pm_resource_manager.cpp +++ b/stratosphere/pm/source/impl/pm_resource_manager.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "pm_resource_manager.hpp" namespace ams::pm::resource { diff --git a/stratosphere/pm/source/pm_boot_mode_service.cpp b/stratosphere/pm/source/pm_boot_mode_service.cpp index 8c2df555b..e185ddf0a 100644 --- a/stratosphere/pm/source/pm_boot_mode_service.cpp +++ b/stratosphere/pm/source/pm_boot_mode_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "pm_boot_mode_service.hpp" namespace ams::pm::bm { diff --git a/stratosphere/pm/source/pm_debug_monitor_service.cpp b/stratosphere/pm/source/pm_debug_monitor_service.cpp index 4430fee73..a42156a55 100644 --- a/stratosphere/pm/source/pm_debug_monitor_service.cpp +++ b/stratosphere/pm/source/pm_debug_monitor_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "pm_debug_monitor_service.hpp" #include "impl/pm_process_manager.hpp" diff --git a/stratosphere/pm/source/pm_info_service.cpp b/stratosphere/pm/source/pm_info_service.cpp index 5626c3ff4..d6e34e30b 100644 --- a/stratosphere/pm/source/pm_info_service.cpp +++ b/stratosphere/pm/source/pm_info_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "pm_info_service.hpp" #include "impl/pm_process_manager.hpp" diff --git a/stratosphere/pm/source/pm_main.cpp b/stratosphere/pm/source/pm_main.cpp index f25586032..3efc9cabc 100644 --- a/stratosphere/pm/source/pm_main.cpp +++ b/stratosphere/pm/source/pm_main.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "pm_boot_mode_service.hpp" #include "pm_debug_monitor_service.hpp" #include "pm_info_service.hpp" diff --git a/stratosphere/pm/source/pm_shell_service.cpp b/stratosphere/pm/source/pm_shell_service.cpp index 9b471707a..939066dea 100644 --- a/stratosphere/pm/source/pm_shell_service.cpp +++ b/stratosphere/pm/source/pm_shell_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "pm_shell_service.hpp" #include "impl/pm_process_manager.hpp" diff --git a/stratosphere/ro/source/impl/ro_nro_utils.cpp b/stratosphere/ro/source/impl/ro_nro_utils.cpp index 90de057e9..aee7d153f 100644 --- a/stratosphere/ro/source/impl/ro_nro_utils.cpp +++ b/stratosphere/ro/source/impl/ro_nro_utils.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ro_nro_utils.hpp" namespace ams::ro::impl { diff --git a/stratosphere/ro/source/impl/ro_nrr_utils.cpp b/stratosphere/ro/source/impl/ro_nrr_utils.cpp index 46b124531..f4cbfc7a1 100644 --- a/stratosphere/ro/source/impl/ro_nrr_utils.cpp +++ b/stratosphere/ro/source/impl/ro_nrr_utils.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ro_nrr_utils.hpp" #include "ro_service_impl.hpp" diff --git a/stratosphere/ro/source/impl/ro_patcher.cpp b/stratosphere/ro/source/impl/ro_patcher.cpp index 992d27f4a..0b9242521 100644 --- a/stratosphere/ro/source/impl/ro_patcher.cpp +++ b/stratosphere/ro/source/impl/ro_patcher.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ro_patcher.hpp" namespace ams::ro::impl { diff --git a/stratosphere/ro/source/impl/ro_service_impl.cpp b/stratosphere/ro/source/impl/ro_service_impl.cpp index 784900667..3fde492fa 100644 --- a/stratosphere/ro/source/impl/ro_service_impl.cpp +++ b/stratosphere/ro/source/impl/ro_service_impl.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ro_nrr_utils.hpp" #include "ro_nro_utils.hpp" #include "ro_patcher.hpp" diff --git a/stratosphere/ro/source/ro_debug_monitor.cpp b/stratosphere/ro/source/ro_debug_monitor.cpp index 78bcd26a3..2cb4aa8ee 100644 --- a/stratosphere/ro/source/ro_debug_monitor.cpp +++ b/stratosphere/ro/source/ro_debug_monitor.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ro_debug_monitor.hpp" #include "impl/ro_service_impl.hpp" diff --git a/stratosphere/ro/source/ro_main.cpp b/stratosphere/ro/source/ro_main.cpp index 0f10add7f..aa0a1e912 100644 --- a/stratosphere/ro/source/ro_main.cpp +++ b/stratosphere/ro/source/ro_main.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ro_debug_monitor.hpp" #include "ro_service.hpp" diff --git a/stratosphere/ro/source/ro_service.cpp b/stratosphere/ro/source/ro_service.cpp index 05654587e..96d38519f 100644 --- a/stratosphere/ro/source/ro_service.cpp +++ b/stratosphere/ro/source/ro_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "ro_service.hpp" #include "impl/ro_service_impl.hpp" diff --git a/stratosphere/sm/source/impl/sm_service_manager.cpp b/stratosphere/sm/source/impl/sm_service_manager.cpp index 82302a8e3..33812ddb3 100644 --- a/stratosphere/sm/source/impl/sm_service_manager.cpp +++ b/stratosphere/sm/source/impl/sm_service_manager.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "sm_service_manager.hpp" namespace ams::sm::impl { diff --git a/stratosphere/sm/source/sm_dmnt_service.cpp b/stratosphere/sm/source/sm_dmnt_service.cpp index 584bc5928..7ee32f363 100644 --- a/stratosphere/sm/source/sm_dmnt_service.cpp +++ b/stratosphere/sm/source/sm_dmnt_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "sm_dmnt_service.hpp" #include "impl/sm_service_manager.hpp" diff --git a/stratosphere/sm/source/sm_main.cpp b/stratosphere/sm/source/sm_main.cpp index c4e9720fd..eb2c56dfc 100644 --- a/stratosphere/sm/source/sm_main.cpp +++ b/stratosphere/sm/source/sm_main.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "sm_user_service.hpp" #include "sm_manager_service.hpp" #include "sm_dmnt_service.hpp" diff --git a/stratosphere/sm/source/sm_manager_service.cpp b/stratosphere/sm/source/sm_manager_service.cpp index 230bf9e8b..0bc806933 100644 --- a/stratosphere/sm/source/sm_manager_service.cpp +++ b/stratosphere/sm/source/sm_manager_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "sm_manager_service.hpp" #include "impl/sm_service_manager.hpp" diff --git a/stratosphere/sm/source/sm_user_service.cpp b/stratosphere/sm/source/sm_user_service.cpp index 56ed8b878..f36c661e7 100644 --- a/stratosphere/sm/source/sm_user_service.cpp +++ b/stratosphere/sm/source/sm_user_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "sm_user_service.hpp" #include "impl/sm_service_manager.hpp" diff --git a/stratosphere/spl/source/spl_api_impl.cpp b/stratosphere/spl/source/spl_api_impl.cpp index d21497229..49592e8b1 100644 --- a/stratosphere/spl/source/spl_api_impl.cpp +++ b/stratosphere/spl/source/spl_api_impl.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_api_impl.hpp" #include "spl_ctr_drbg.hpp" diff --git a/stratosphere/spl/source/spl_crypto_service.cpp b/stratosphere/spl/source/spl_crypto_service.cpp index f358764b3..4bd5bbe06 100644 --- a/stratosphere/spl/source/spl_crypto_service.cpp +++ b/stratosphere/spl/source/spl_crypto_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_api_impl.hpp" #include "spl_crypto_service.hpp" diff --git a/stratosphere/spl/source/spl_ctr_drbg.cpp b/stratosphere/spl/source/spl_ctr_drbg.cpp index e8ebbbca5..0be399815 100644 --- a/stratosphere/spl/source/spl_ctr_drbg.cpp +++ b/stratosphere/spl/source/spl_ctr_drbg.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_ctr_drbg.hpp" namespace ams::spl { diff --git a/stratosphere/spl/source/spl_deprecated_service.cpp b/stratosphere/spl/source/spl_deprecated_service.cpp index ead676cd4..545c6a2b5 100644 --- a/stratosphere/spl/source/spl_deprecated_service.cpp +++ b/stratosphere/spl/source/spl_deprecated_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_api_impl.hpp" #include "spl_deprecated_service.hpp" diff --git a/stratosphere/spl/source/spl_es_service.cpp b/stratosphere/spl/source/spl_es_service.cpp index 723e1db9c..4c9e08952 100644 --- a/stratosphere/spl/source/spl_es_service.cpp +++ b/stratosphere/spl/source/spl_es_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_api_impl.hpp" #include "spl_es_service.hpp" diff --git a/stratosphere/spl/source/spl_fs_service.cpp b/stratosphere/spl/source/spl_fs_service.cpp index 8e201b9ae..8d3c9ce8b 100644 --- a/stratosphere/spl/source/spl_fs_service.cpp +++ b/stratosphere/spl/source/spl_fs_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_api_impl.hpp" #include "spl_fs_service.hpp" diff --git a/stratosphere/spl/source/spl_general_service.cpp b/stratosphere/spl/source/spl_general_service.cpp index 58c60b922..cb87c37fb 100644 --- a/stratosphere/spl/source/spl_general_service.cpp +++ b/stratosphere/spl/source/spl_general_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_api_impl.hpp" #include "spl_general_service.hpp" diff --git a/stratosphere/spl/source/spl_main.cpp b/stratosphere/spl/source/spl_main.cpp index fe0df90b2..6ffc5a290 100644 --- a/stratosphere/spl/source/spl_main.cpp +++ b/stratosphere/spl/source/spl_main.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_api_impl.hpp" #include "spl_random_service.hpp" diff --git a/stratosphere/spl/source/spl_manu_service.cpp b/stratosphere/spl/source/spl_manu_service.cpp index 0c1c80066..17cc8bcce 100644 --- a/stratosphere/spl/source/spl_manu_service.cpp +++ b/stratosphere/spl/source/spl_manu_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_api_impl.hpp" #include "spl_manu_service.hpp" diff --git a/stratosphere/spl/source/spl_random_service.cpp b/stratosphere/spl/source/spl_random_service.cpp index 3b1e52ac7..6eae44a8f 100644 --- a/stratosphere/spl/source/spl_random_service.cpp +++ b/stratosphere/spl/source/spl_random_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_api_impl.hpp" #include "spl_random_service.hpp" diff --git a/stratosphere/spl/source/spl_rsa_service.cpp b/stratosphere/spl/source/spl_rsa_service.cpp index 1bb41f13c..c14d01834 100644 --- a/stratosphere/spl/source/spl_rsa_service.cpp +++ b/stratosphere/spl/source/spl_rsa_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_api_impl.hpp" #include "spl_rsa_service.hpp" diff --git a/stratosphere/spl/source/spl_ssl_service.cpp b/stratosphere/spl/source/spl_ssl_service.cpp index 860f00715..b6c8eeb44 100644 --- a/stratosphere/spl/source/spl_ssl_service.cpp +++ b/stratosphere/spl/source/spl_ssl_service.cpp @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include "spl_api_impl.hpp" #include "spl_ssl_service.hpp" 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; }