strat: build sysmodules with -Wextra/-Werror

This commit is contained in:
Michael Scire
2021-10-06 23:22:54 -07:00
parent e8f1efd01b
commit 6a53726833
61 changed files with 433 additions and 217 deletions

View File

@@ -34,10 +34,12 @@ namespace ams::ldr {
R_TRY(ldr::GetProgramInfo(out, &status, loc));
if (loc.storage_id != static_cast<u8>(ncm::StorageId::None) && loc.program_id != out->program_id) {
char path[FS_MAX_PATH];
char path[fs::EntryNameLengthMax];
const ncm::ProgramLocation new_loc = ncm::ProgramLocation::Make(out->program_id, static_cast<ncm::StorageId>(loc.storage_id));
R_TRY(ResolveContentPath(path, loc));
path[sizeof(path) - 1] = '\x00';
R_TRY(RedirectContentPath(path, new_loc));
const auto arg_info = args::Get(loc.program_id);
@@ -59,13 +61,16 @@ namespace ams::ldr {
Result LoaderService::CreateProcess(sf::OutMoveHandle out, PinId id, u32 flags, sf::CopyHandle &&reslimit_h) {
ncm::ProgramLocation loc;
cfg::OverrideStatus override_status;
char path[FS_MAX_PATH];
char path[fs::EntryNameLengthMax];
/* Get location and override status. */
R_TRY(ldr::ro::GetProgramLocationAndStatus(&loc, &override_status, id));
if (loc.storage_id != static_cast<u8>(ncm::StorageId::None)) {
R_TRY(ResolveContentPath(path, loc));
path[sizeof(path) - 1] = '\x00';
} else {
path[0] = '\x00';
}
/* Create the process. */

View File

@@ -60,6 +60,7 @@ namespace ams::ldr {
}
void Deallocate(void *p, size_t size) {
AMS_UNUSED(size);
return lmem::FreeToExpHeap(g_server_heap_handle, p);
}
@@ -159,11 +160,11 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
@@ -177,20 +178,26 @@ void operator delete(void *p) {
return ldr::Deallocate(p, 0);
}
void *__libnx_alloc(size_t size) {
void operator delete(void *p, size_t size) {
return ldr::Deallocate(p, size);
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Disable auto-abort in fs operations. */
fs::SetEnabledAutoAbort(false);

View File

@@ -123,6 +123,8 @@ namespace ams::ldr {
R_UNLESS(entries[i].version <= version, ResultInvalidVersion());
}
}
#else
AMS_UNUSED(program_id, version);
#endif
return ResultSuccess();
}
@@ -662,6 +664,7 @@ namespace ams::ldr {
{
/* Mount code. */
AMS_UNUSED(path);
ScopedCodeMount mount(loc, override_status);
R_TRY(mount.GetResult());