fix c++ compiler warnings, extract_merc assert (#3488)

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
pull/3507/head
water111 2024-05-03 12:29:18 -04:00 committed by GitHub
parent cf79ca04e9
commit 807ca7465f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 38 additions and 58 deletions

View File

@ -15,6 +15,6 @@ void register_screen_shot_settings(ScreenShotSettings* settings) {
g_screen_shot_settings = settings;
}
const char* const get_screen_shot_name() {
const char* get_screen_shot_name() {
return g_screen_shot_settings->name;
}

View File

@ -24,4 +24,4 @@ extern ScreenShotSettings* g_screen_shot_settings;
extern bool g_want_screenshot;
void register_screen_shot_settings(ScreenShotSettings* settings);
const char* const get_screen_shot_name();
const char* get_screen_shot_name();

View File

@ -640,7 +640,7 @@ s32 pc_sr_mode_get_practice_entries_amount() {
g_speedrun_practice_entries = *file_contents;
for (int i = 0; i < g_speedrun_practice_entries.size(); i++) {
for (size_t i = 0; i < g_speedrun_practice_entries.size(); i++) {
const auto& entry = g_speedrun_practice_entries.at(i);
s32 last_session_id = -1;
s32 total_attempts = 0;
@ -679,7 +679,7 @@ s32 pc_sr_mode_get_practice_entries_amount() {
void pc_sr_mode_get_practice_entry_name(s32 entry_index, u32 name_str_ptr) {
std::string name = "";
if (entry_index < g_speedrun_practice_entries.size()) {
if (entry_index < (int)g_speedrun_practice_entries.size()) {
name = g_speedrun_practice_entries.at(entry_index).name;
}
strcpy(Ptr<String>(name_str_ptr).c()->data(), name.c_str());
@ -687,7 +687,7 @@ void pc_sr_mode_get_practice_entry_name(s32 entry_index, u32 name_str_ptr) {
void pc_sr_mode_get_practice_entry_continue_point(s32 entry_index, u32 name_str_ptr) {
std::string name = "";
if (entry_index < g_speedrun_practice_entries.size()) {
if (entry_index < (int)g_speedrun_practice_entries.size()) {
name = g_speedrun_practice_entries.at(entry_index).continue_point_name;
}
strcpy(Ptr<String>(name_str_ptr).c()->data(), name.c_str());
@ -757,7 +757,7 @@ u64 pc_sr_mode_record_practice_entry_attempt(s32 entry_index, u32 success_bool,
}
void pc_sr_mode_init_practice_info(s32 entry_index, u32 speedrun_practice_obj_ptr) {
if (entry_index >= g_speedrun_practice_entries.size()) {
if (entry_index >= (int)g_speedrun_practice_entries.size()) {
return;
}
@ -864,7 +864,7 @@ s32 pc_sr_mode_get_custom_category_amount() {
void pc_sr_mode_get_custom_category_name(s32 entry_index, u32 name_str_ptr) {
std::string name = "";
if (entry_index < g_speedrun_custom_categories.size()) {
if (entry_index < (int)g_speedrun_custom_categories.size()) {
name = g_speedrun_custom_categories.at(entry_index).name;
}
strcpy(Ptr<String>(name_str_ptr).c()->data(), name.c_str());
@ -872,14 +872,14 @@ void pc_sr_mode_get_custom_category_name(s32 entry_index, u32 name_str_ptr) {
void pc_sr_mode_get_custom_category_continue_point(s32 entry_index, u32 name_str_ptr) {
std::string name = "";
if (entry_index < g_speedrun_custom_categories.size()) {
if (entry_index < (int)g_speedrun_custom_categories.size()) {
name = g_speedrun_custom_categories.at(entry_index).continue_point_name;
}
strcpy(Ptr<String>(name_str_ptr).c()->data(), name.c_str());
}
void pc_sr_mode_init_custom_category_info(s32 entry_index, u32 speedrun_custom_category_ptr) {
if (entry_index >= g_speedrun_custom_categories.size()) {
if (entry_index >= (int)g_speedrun_custom_categories.size()) {
return;
}

View File

@ -267,7 +267,6 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -16); // daddiu sp, sp, -16
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sd(fp, 8, sp); // sd fp, 8(sp)
@ -307,7 +306,7 @@ block_2:
c->load_symbol2(t9, cache.format); // lw t9, format(s7)
c->addiu(a0, r0, 0); // addiu a0, r0, 0
// daddiu a1, fp, L185 // daddiu a1, fp, L185
call_addr = c->gprs[t9].du32[0]; // function call:
// call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
// c->jalr(call_addr); // jalr ra, t9
printf("ERROR: Exceeded max number of collide-cache prims!\n");
@ -693,7 +692,6 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -16); // daddiu sp, sp, -16
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sd(fp, 8, sp); // sd fp, 8(sp)
@ -733,7 +731,7 @@ block_2:
c->load_symbol2(t9, cache.format); // lw t9, format(s7)
c->addiu(a0, r0, 0); // addiu a0, r0, 0
// daddiu a1, fp, L185 // daddiu a1, fp, L185
call_addr = c->gprs[t9].du32[0]; // function call:
// call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
// c->jalr(call_addr); // jalr ra, t9
printf("ERROR: Exceeded max number of collide-cache prims!\n");
@ -1729,7 +1727,6 @@ namespace method_10_collide_puss_work {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->lwu(v1, 116, a2); // lwu v1, 116(a2)

View File

@ -9,7 +9,6 @@ namespace method_10_collide_edge_hold_list {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
// bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
// nop // sll r0, r0, 0
c->daddiu(a2, a0, 1552); // daddiu a2, a0, 1552
@ -831,7 +830,6 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
c->daddiu(sp, sp, -32); // daddiu sp, sp, -32
c->sd(ra, 0, sp); // sd ra, 0(sp)
@ -979,7 +977,7 @@ block_15:
c->load_symbol2(t9, cache.format); // lw t9, format(s7)
c->addiu(a0, r0, 0); // addiu a0, r0, 0
// daddiu a1, fp, L119 // daddiu a1, fp, L119
call_addr = c->gprs[t9].du32[0]; // function call:
// call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
// c->jalr(call_addr); // jalr ra, t9
printf("ERROR: Exceeded max # of grabbable tris!\n");
@ -1275,7 +1273,6 @@ block_40:
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
// bool cop1_bc = false;
c->daddiu(sp, sp, -16); // daddiu sp, sp, -16
c->sd(ra, 0, sp); // sd ra, 0(sp)
@ -1380,7 +1377,7 @@ block_41:
c->load_symbol2(t9, cache.format); // lw t9, format(s7)
c->addiu(a0, r0, 0); // addiu a0, r0, 0
// daddiu a1, fp, L118 // daddiu a1, fp, L118
call_addr = c->gprs[t9].du32[0]; // function call:
// call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
// c->jalr(call_addr); // jalr ra, t9
printf("ERROR: Too many edge verts found in edge grab!\n");
@ -1393,7 +1390,7 @@ block_42:
c->load_symbol2(t9, cache.format); // lw t9, format(s7)
c->addiu(a0, r0, 0); // addiu a0, r0, 0
// daddiu a1, fp, L117 // daddiu a1, fp, L117
call_addr = c->gprs[t9].du32[0]; // function call:
// call_addr = c->gprs[t9].du32[0]; // function call:
c->sll(v0, ra, 0); // sll v0, ra, 0
// c->jalr(call_addr); // jalr ra, t9
printf("ERROR: Too many edges found in edge grab!\n");

View File

@ -12,7 +12,6 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -96); // daddiu sp, sp, -96
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s2, 16, sp); // sq s2, 16(sp)
@ -268,7 +267,6 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -112); // daddiu sp, sp, -112
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s1, 16, sp); // sq s1, 16(sp)

View File

@ -214,7 +214,6 @@ namespace method_14_collide_mesh {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->lwu(v1, 12, a0); // lwu v1, 12(a0)
@ -419,7 +418,6 @@ namespace method_15_collide_mesh {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->lwu(v1, 12, a0); // lwu v1, 12(a0)

View File

@ -13,7 +13,6 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
float acc;
get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672
@ -348,7 +347,6 @@ static_assert(sizeof(MercBucketInfo) == 0x27c);
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -128); // daddiu sp, sp, -128
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s0, 16, sp); // sq s0, 16(sp)
@ -714,7 +712,7 @@ block_1:
goto block_4;
}
block_3:
//block_3:
c->dsll(a0, s4, 3); // dsll a0, s4, 3
c->daddu(v1, v1, a0); // daddu v1, v1, a0
c->lbu(v1, 128, v1); // lbu v1, 128(v1)
@ -1002,7 +1000,7 @@ block_35:
goto block_40;
}
block_37:
//block_37:
c->lhu(a0, 4, gp); // lhu a0, 4(gp)
c->andi(a0, a0, 2048); // andi a0, a0, 2048
if (((s64)c->sgpr64(a0)) == ((s64)0)) { // beql a0, r0, L137
@ -1010,7 +1008,7 @@ block_37:
goto block_40;
}
block_39:
//block_39:
c->daddiu(a0, s7, 4); // daddiu a0, s7, 4
c->lbu(a1, 17, s2); // lbu a1, 17(s2)
c->andi(a1, a1, 64); // andi a1, a1, 64
@ -1034,7 +1032,7 @@ block_42:
goto block_45;
}
block_44:
//block_44:
c->daddiu(a0, s7, 4); // daddiu a0, s7, 4
c->dsll(a1, s4, 5); // dsll a1, s4, 5
c->daddu(a1, s5, a1); // daddu a1, s5, a1
@ -1106,14 +1104,14 @@ block_54:
goto block_59;
}
block_56:
//block_56:
c->lwu(v1, 80, gp); // lwu v1, 80(gp)
if (((s64)c->sgpr64(s7)) == ((s64)c->sgpr64(v1))) {// beql s7, v1, L145
c->mov64(v1, v1); // or v1, v1, r0
goto block_59;
}
block_58:
//block_58:
c->lwu(v1, 80, gp); // lwu v1, 80(gp)
c->lwu(v1, 28, v1); // lwu v1, 28(v1)
@ -1200,7 +1198,7 @@ block_68:
goto block_71;
}
block_70:
//block_70:
c->daddiu(a0, s7, 4); // daddiu a0, s7, 4
c->lwu(a1, 28, s2); // lwu a1, 28(s2)
c->lbu(a1, 1, a1); // lbu a1, 1(a1)

View File

@ -3172,7 +3172,7 @@ block_64:
goto block_67;
}
block_66:
// block_66:
c->daddiu(v1, s7, 4); // daddiu v1, s7, 4
get_fake_spad_addr2(a0, cache.fake_scratchpad_data, 0, c);// lui a0, 28672
c->lbu(a0, 6852, a0); // lbu a0, 6852(a0)
@ -3204,7 +3204,7 @@ block_69:
goto block_72;
}
block_71:
// block_71:
get_fake_spad_addr2(v1, cache.fake_scratchpad_data, 0, c);// lui v1, 28672
c->lbu(v1, 6858, v1); // lbu v1, 6858(v1)
c->daddiu(a0, v1, -1); // daddiu a0, v1, -1
@ -3287,7 +3287,7 @@ block_75:
//
// c->gprs[t0].du64[0] = 0; // or t0, r0, r0
block_79:
// block_79:
c->dsll(t0, a0, 4); // dsll t0, a0, 4
// c->sw(a3, 128, a2); // sw a3, 128(a2)
sadr = c->sgpr64(a3);
@ -3362,7 +3362,7 @@ block_80:
c->gprs[t0].du64[0] = 0; // or t0, r0, r0
block_84:
// block_84:
c->dsll(t0, a0, 4); // dsll t0, a0, 4
// c->sw(a3, 128, a2); // sw a3, 128(a2)
sadr = c->sgpr64(a3);

View File

@ -230,7 +230,7 @@ struct Cache {
} cache;
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
// bool bc = false;
c->lwu(a2, 0, a1); // lwu a2, 0(a1)
c->lwu(v1, 4, a1); // lwu v1, 4(a1)
c->lwu(a0, 8, a1); // lwu a0, 8(a1)

View File

@ -12,7 +12,6 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -336); // daddiu sp, sp, -336
c->mov64(t0, a1); // or t0, a1, r0
c->lwu(a3, 108, t0); // lwu a3, 108(t0)
@ -624,7 +623,6 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -112); // daddiu sp, sp, -112
c->mov64(t1, a1); // or t1, a1, r0
c->lwu(a0, 108, t1); // lwu a0, 108(t1)

View File

@ -33,7 +33,6 @@ namespace clip_polygon_against_positive_hyperplane {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
// nop // sll r0, r0, 0
c->mov64(t1, t0); // or t1, t0, r0
@ -321,7 +320,6 @@ namespace clip_polygon_against_negative_hyperplane {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
bool cop1_bc = false;
// nop // sll r0, r0, 0
c->mov64(t1, t0); // or t1, t0, r0

View File

@ -13,7 +13,6 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->mov64(v1, a0); // or v1, a0, r0
c->mov64(v1, a2); // or v1, a2, r0
c->mov64(v1, a3); // or v1, a3, r0

View File

@ -9,7 +9,6 @@ namespace method_18_grid_hash {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->lh(v1, 10, a0); // lh v1, 10(a0)
c->lb(a3, 24, a0); // lb a3, 24(a0)
c->mult3(a3, a3, v1); // mult3 a3, a3, v1
@ -118,7 +117,6 @@ namespace method_19_grid_hash {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->lh(v1, 10, a0); // lh v1, 10(a0)
c->lb(a3, 24, a0); // lb a3, 24(a0)
c->mult3(a3, a3, v1); // mult3 a3, a3, v1
@ -227,7 +225,6 @@ namespace method_20_grid_hash {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
c->daddiu(sp, sp, -48); // daddiu sp, sp, -48
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(s5, 16, sp); // sq s5, 16(sp)
@ -358,7 +355,6 @@ namespace method_22_grid_hash {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
// bool bc = false;
u32 call_addr = 0;
// nop // sll r0, r0, 0
// nop // sll r0, r0, 0
c->lq(v1, 0, a2); // lq v1, 0(a2)

View File

@ -51,7 +51,7 @@ block_2:
goto block_10;
}
block_4:
// block_4:
c->lwc1(f0, 20, s4); // lwc1 f0, 20(s4)
c->mtc1(f1, r0); // mtc1 f1, r0
cop1_bc = c->fprs[f0] == c->fprs[f1]; // c.eq.s f0, f1
@ -67,7 +67,7 @@ block_6:
goto block_10;
}
block_8:
// block_8:
c->lwc1(f0, 24, s4); // lwc1 f0, 24(s4)
c->mtc1(f1, r0); // mtc1 f1, r0
cop1_bc = c->fprs[f0] == c->fprs[f1]; // c.eq.s f0, f1
@ -83,7 +83,7 @@ block_10:
goto block_13;
}
block_12:
// block_12:
c->load_symbol2(t9, cache.transform_point_qword); // lw t9, transform-point-qword!(s7)
c->daddiu(a0, s5, 32); // daddiu a0, s5, 32
c->daddu(a1, r0, s5); // daddu a1, r0, s5

View File

@ -39,6 +39,7 @@ void MouseDevice::poll_state(std::shared_ptr<PadData> data) {
int curr_mouse_relx;
int curr_mouse_rely;
const auto mouse_state_rel = SDL_GetRelativeMouseState(&curr_mouse_relx, &curr_mouse_rely);
(void)mouse_state_rel;
if (m_mouse_moved_x && m_last_xcoord == curr_mouse_x && curr_mouse_relx == 0) {
data->analog_data.at(2) = 127;
m_mouse_moved_x = false;

View File

@ -1,7 +1,7 @@
#include "initialize.h"
namespace lsp_handlers {
std::optional<json> initialize(Workspace& workspace, int id, json params) {
std::optional<json> initialize(Workspace& /*workspace*/, int /*id*/, json /*params*/) {
json text_document_sync{
{"openClose", true},
{"change", 1}, // Full sync

View File

@ -88,7 +88,7 @@ std::optional<json> document_color(Workspace& workspace, int /*id*/, json raw_pa
float green = 0.0f;
float blue = 0.0f;
float alpha = 0.0f;
int token_idx = 0;
unsigned int token_idx = 0;
while (token_idx < result.tokens.size()) {
const auto& token = result.tokens[token_idx];
// in OpenGOAL -- 255 is equal to 128, so we double every value and subtract 1

View File

@ -8,7 +8,7 @@
#include "lsp/state/workspace.h"
namespace lsp_handlers {
std::optional<json> formatting(Workspace& workspace, int id, json raw_params) {
std::optional<json> formatting(Workspace& workspace, int /*id*/, json raw_params) {
auto params = raw_params.get<LSPSpec::DocumentFormattingParams>();
const auto file_type = workspace.determine_filetype_from_uri(params.textDocument.m_uri);

View File

@ -153,7 +153,7 @@ std::optional<std::pair<TypeSpec, Type*>> Workspace::get_symbol_typeinfo(
}
std::optional<symbol_info::DefinitionLocation> Workspace::get_symbol_def_location(
const WorkspaceOGFile& file,
const WorkspaceOGFile& /*file*/,
const symbol_info::SymbolInfo* symbol_info) {
const auto& def_loc = symbol_info->m_def_location;
if (!def_loc) {
@ -553,7 +553,7 @@ WorkspaceIRFile::WorkspaceIRFile(const std::string& content) {
m_lines = str_util::split_string(content, line_ending);
bool in_opengoal_block = false;
for (int i = 0; i < m_lines.size(); i++) {
for (size_t i = 0; i < m_lines.size(); i++) {
const auto& line = m_lines.at(i);
if (m_all_types_uri == "") {
find_all_types_path(line);
@ -631,7 +631,7 @@ void WorkspaceIRFile::find_function_symbol(const uint32_t line_num_zero_based,
void WorkspaceIRFile::identify_diagnostics(const uint32_t line_num_zero_based,
const std::string& line,
const bool in_opengoal_block) {
const bool /*in_opengoal_block*/) {
std::regex info_regex(";; INFO: (.*)");
std::regex warn_regex(";; WARN: (.*)");
std::regex error_regex(";; ERROR: (.*)");

View File

@ -113,14 +113,14 @@ std::vector<std::future<OfflineTestThreadResult>> distribute_work(
for (const auto& [dgo, work] : work_colls) {
total_files += work.source_files.size();
}
int divisor = (total_files + work_groups.size() - 1) / work_groups.size();
// int divisor = (total_files + work_groups.size() - 1) / work_groups.size();
// Divide up the work
int file_idx = 0;
for (const auto& [dgo, work] : work_colls) {
// source files
for (auto& source_file : work.source_files) {
auto& wg = work_groups.at(file_idx / divisor);
auto& wg = work_groups.at(file_idx % work_groups.size());
wg.dgo_set.insert(dgo);
wg.work_collection.source_files.push_back(source_file);
file_idx++;