libstrat: enable -Wextra, -Werror

This caught an embarrassingly large number of bugs.
This commit is contained in:
Michael Scire
2021-10-06 15:20:48 -07:00
parent e1fbf27398
commit 7ca83c9d3b
160 changed files with 691 additions and 152 deletions

View File

@@ -44,6 +44,8 @@ namespace ams::erpt::srv {
}
inline void DeallocateWithSize(void *p, size_t size) {
AMS_UNUSED(size);
return lmem::FreeToExpHeap(g_heap_handle, p);
}

View File

@@ -82,7 +82,7 @@ namespace ams::erpt::srv {
}
Result ContextImpl::SubmitMultipleCategoryContext(const MultipleCategoryContextEntry &ctx_entry, const ams::sf::InBuffer &str_buffer) {
R_UNLESS(0 <= ctx_entry.category_count && ctx_entry.category_count <= CategoriesPerMultipleCategoryContext, erpt::ResultInvalidArgument());
R_UNLESS(ctx_entry.category_count <= CategoriesPerMultipleCategoryContext, erpt::ResultInvalidArgument());
const u8 *str = reinterpret_cast<const u8 *>(str_buffer.GetPointer());
const u32 str_size = static_cast<u32>(str_buffer.GetSize());

View File

@@ -132,6 +132,7 @@ namespace ams::erpt::srv {
}
static Result End(Report *report) {
AMS_UNUSED(report);
return ResultSuccess();
}

View File

@@ -138,7 +138,9 @@ namespace ams::erpt::srv {
JournalRecord<AttachmentInfo> *JournalForAttachments::RetrieveRecord(AttachmentId attachment_id) {
for (auto it = s_attachment_list.begin(); it != s_attachment_list.end(); it++) {
return std::addressof(*it);
if (auto *record = std::addressof(*it); record->info.attachment_id == attachment_id) {
return record;
}
}
return nullptr;
}
@@ -213,6 +215,8 @@ namespace ams::erpt::srv {
R_TRY(StoreRecord(record));
}
*out = info.attachment_id;
return ResultSuccess();
}

View File

@@ -174,8 +174,11 @@ namespace ams::erpt::srv {
JournalRecord<ReportInfo> *JournalForReports::RetrieveRecord(ReportId report_id) {
for (auto it = s_record_list.begin(); it != s_record_list.end(); it++) {
return std::addressof(*it);
if (auto *record = std::addressof(*it); record->info.id == report_id) {
return record;
}
}
return nullptr;
}

View File

@@ -280,6 +280,7 @@ namespace ams::erpt::srv {
if (needs_save_syslog) {
/* Here nintendo sends a report to srepo:u (vtable offset 0xE8) with data report_id. */
/* We will not send report ids to srepo:u. */
AMS_UNUSED(report_id);
}
}
@@ -308,6 +309,7 @@ namespace ams::erpt::srv {
const auto program_id_len = program_id_entry->value_array.size;
AMS_ASSERT(16 <= program_id_len && program_id_len <= 17);
AMS_ASSERT(program_id_ofs + program_id_len <= data_size);
AMS_UNUSED(data_size);
/* Get the program id string. */
char program_id_str[17];