cleanup our cmake and build warnings (#2876)

This commit is contained in:
Tyler Wilding 2023-08-08 18:53:16 -06:00 committed by GitHub
parent 59ac52721c
commit a06a6c6416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 136 additions and 118 deletions

View File

@ -30,9 +30,6 @@ if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json" )
endif()
# Setup compiler flags
# TODO - consider moving most of the configuration into presets
# - https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html
# - requires atleast CMake 3.19
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(STATUS "Clang Detected - Setting Defaults")
set(CMAKE_CXX_FLAGS
@ -167,33 +164,42 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CODE_COVERAGE)
message(STATUS "Code Coverage build is enabled!")
endif()
function(build_third_party_lib dir_name target_name)
add_subdirectory(third-party/${dir_name} EXCLUDE_FROM_ALL)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
# For Microsoft Visual C++ Compiler (MSVC)
target_compile_options(${target_name} PRIVATE /w)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
# For GNU Compiler Collection (GCC) or Clang
target_compile_options(${target_name} PRIVATE -w)
endif()
endfunction()
# Dependencies and Libraries
# includes relative to top level jak-project folder
include_directories(./)
# build templating engine library
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${THIRDPARTY_IGNORED_WARNINGS} ")
include_directories(SYSTEM third-party/inja)
# build repl library
add_subdirectory(third-party/replxx EXCLUDE_FROM_ALL)
build_third_party_lib(replxx replxx)
# SQLite - Jak 2/3's built in editor
add_definitions(-DHAVE_USLEEP=1)
add_definitions(-DSQLITE_THREADSAFE=1)
add_definitions(-DSQLITE_ENABLE_JSON1)
add_definitions(-DSQLITE_ENABLE_RTREE)
add_subdirectory(third-party/sqlite3)
build_third_party_lib(sqlite3 sqlite3)
# build tree-sitter parser
include_directories(third-party/tree-sitter/tree-sitter/lib/include)
include_directories(third-party/tree-sitter/tree-sitter-opengoal/include)
add_subdirectory(third-party/tree-sitter EXCLUDE_FROM_ALL)
build_third_party_lib(tree-sitter tree-sitter)
# native OS dialogs for error messages
add_subdirectory(third-party/libtinyfiledialogs)
string(REPLACE " ${THIRDPARTY_IGNORED_WARNINGS} " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
build_third_party_lib(libtinyfiledialogs libtinyfiledialogs)
# build common library
add_subdirectory(common)
@ -201,26 +207,24 @@ add_subdirectory(common)
# build decompiler
add_subdirectory(decompiler)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${THIRDPARTY_IGNORED_WARNINGS} ")
add_subdirectory(third-party/cubeb EXCLUDE_FROM_ALL)
# cubeb - audio
build_third_party_lib(cubeb cubeb)
# build LSP
add_subdirectory(lsp)
# build libco
add_subdirectory(third-party/libco)
add_subdirectory(third-party/zstd EXCLUDE_FROM_ALL)
# build libco and zstd
build_third_party_lib(libco libco)
build_third_party_lib(zstd libzstd_static)
# build SDL
include(SDLOptions)
add_subdirectory(third-party/SDL EXCLUDE_FROM_ALL)
build_third_party_lib(SDL SDL2)
# build imgui
include_directories(third-party/glad/include)
include_directories(third-party/SDL/include)
add_subdirectory(third-party/imgui EXCLUDE_FROM_ALL)
string(REPLACE " ${THIRDPARTY_IGNORED_WARNINGS} " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
build_third_party_lib(imgui imgui)
# build the game code in C++
add_subdirectory(game)
@ -236,28 +240,25 @@ if(WIN32)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${THIRDPARTY_IGNORED_WARNINGS} ")
add_subdirectory(third-party/googletest EXCLUDE_FROM_ALL)
build_third_party_lib(googletest gtest)
include(GoogleTest)
string(REPLACE " ${THIRDPARTY_IGNORED_WARNINGS} " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# build tests
include(test/CMakeLists.txt)
# build lzokay library
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${THIRDPARTY_IGNORED_WARNINGS} ")
add_subdirectory(third-party/lzokay EXCLUDE_FROM_ALL)
build_third_party_lib(lzokay lzokay)
# build format library
add_subdirectory(third-party/fmt EXCLUDE_FROM_ALL)
build_third_party_lib(fmt fmt)
add_subdirectory(third-party/stb_image EXCLUDE_FROM_ALL)
add_subdirectory(third-party/tiny_gltf EXCLUDE_FROM_ALL)
add_subdirectory(third-party/xdelta3 EXCLUDE_FROM_ALL)
build_third_party_lib(stb_image stb_image)
build_third_party_lib(tiny_gltf tiny_gltf)
build_third_party_lib(xdelta3 xdelta3)
# discord rich presence
include_directories(third-party/discord-rpc/include)
add_subdirectory(third-party/discord-rpc EXCLUDE_FROM_ALL)
build_third_party_lib(discord-rpc discord-rpc)
# build zydis third party library for disassembling x86
# TODO - Once under CMake 3.13's policy CMP0077, override with `set()` instead
@ -272,10 +273,9 @@ else()
option(ZYDIS_BUILD_SHARED_LIB "Zydis: Build shared library" ON)
endif()
add_subdirectory(third-party/zydis EXCLUDE_FROM_ALL)
build_third_party_lib(zydis Zydis)
# windows memory management lib
if(WIN32)
add_subdirectory(third-party/mman)
build_third_party_lib(mman mman)
endif()
string(REPLACE " ${THIRDPARTY_IGNORED_WARNINGS} " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

View File

@ -43,7 +43,7 @@ std::vector<s16> decode_adpcm(BinaryReader& reader) {
constexpr s32 f1[5] = {0, 60, 115, 98, 122};
constexpr s32 f2[5] = {0, 0, -52, -55, -60};
int block_idx = 0;
[[maybe_unused]] int block_idx = 0;
while (true) {
if (!reader.bytes_left()) {
break;

View File

@ -6,6 +6,7 @@
// clang-format off
#include "common/common_types.h"
#ifdef OS_POSIX
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <unistd.h>
@ -178,3 +179,13 @@ bool socket_timed_out() {
return err == WSAETIMEDOUT;
#endif
}
std::string address_to_string(const sockaddr_in& addr) {
char ip_str[INET_ADDRSTRLEN]; // Buffer to hold the IP address string
// Convert binary IP address to human-readable string using inet_ntop
if (inet_ntop(AF_INET, &(addr.sin_addr), ip_str, INET_ADDRSTRLEN) == nullptr) {
// Handle the error (e.g., log, throw an exception, etc.)
return "Error: Unable to convert IP address";
}
return ip_str;
}

View File

@ -44,3 +44,4 @@ int set_socket_timeout(int socket, long microSeconds);
int write_to_socket(int socket, const char* buf, int len);
int read_from_socket(int socket, char* buf, int len);
bool socket_timed_out();
std::string address_to_string(const sockaddr_in& addr);

View File

@ -3,6 +3,7 @@
#include <string>
#include "common/cross_sockets/XSocket.h"
#include "common/log/log.h"
// clang-format off
#ifdef _WIN32
@ -41,7 +42,11 @@ bool XSocketClient::connect() {
}
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr("127.0.0.1");
// Convert IP address from text to binary form using inet_pton()
if (inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr) <= 0) {
lg::error("inet_pton() failed");
return false;
}
addr.sin_port = htons(tcp_port);
// Connect to server

View File

@ -39,7 +39,7 @@ void ReplServer::ping_response(int socket) {
versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR);
auto resp = write_to_socket(socket, ping.c_str(), ping.size());
if (resp == -1) {
lg::warn("[nREPL:{}] Client Disconnected: {}", tcp_port, inet_ntoa(addr.sin_addr),
lg::warn("[nREPL:{}] Client Disconnected: {}", tcp_port, address_to_string(addr),
ntohs(addr.sin_port), socket);
close_socket(socket);
client_sockets.erase(socket);
@ -80,7 +80,7 @@ std::optional<std::string> ReplServer::get_msg() {
if (new_socket < 0) {
// TODO - handle error
} else {
lg::info("[nREPL:{}]: New socket connection: {}:{}:{}", tcp_port, inet_ntoa(addr.sin_addr),
lg::info("[nREPL:{}]: New socket connection: {}:{}:{}", tcp_port, address_to_string(addr),
ntohs(addr.sin_port), new_socket);
// Say hello
@ -110,7 +110,7 @@ std::optional<std::string> ReplServer::get_msg() {
// Socket disconnected
// TODO - add a queue of messages in the REPL::Wrapper so we can print _BEFORE_ the prompt
// is output
lg::warn("[nREPL:{}] Client Disconnected: {}", tcp_port, inet_ntoa(addr.sin_addr),
lg::warn("[nREPL:{}] Client Disconnected: {}", tcp_port, address_to_string(addr),
ntohs(addr.sin_port), sock);
// Cleanup the socket and remove it from our set

View File

@ -677,7 +677,7 @@ static void link_v3(LinkedObjectFile& f,
}
if (game_version == GameVersion::Jak2) {
bool adjusted = false;
[[maybe_unused]] bool adjusted = false;
while (segment_size % 4) {
segment_size++;
adjusted = true;

View File

@ -309,7 +309,7 @@ class ObjectFileDB {
void for_each_function(Func f) {
for_each_obj([&](ObjectFileData& data) {
for (int i = 0; i < int(data.linked_data.segments); i++) {
int fn = 0;
[[maybe_unused]] int fn = 0;
for (auto& goal_func : data.linked_data.functions_by_seg.at(i)) {
f(goal_func, i, data);
fn++;
@ -334,7 +334,7 @@ class ObjectFileDB {
template <typename Func>
void for_each_function_def_order_in_obj(ObjectFileData& data, Func f) {
for (int i = 0; i < int(data.linked_data.segments); i++) {
int fn = 0;
[[maybe_unused]] int fn = 0;
for (size_t j = data.linked_data.functions_by_seg.at(i).size(); j-- > 0;) {
f(data.linked_data.functions_by_seg.at(i).at(j), i);
fn++;
@ -357,7 +357,7 @@ class ObjectFileDB {
template <typename Func>
void for_each_function_in_seg_in_obj(int seg, ObjectFileData& data, Func f) {
int fn = 0;
[[maybe_unused]] int fn = 0;
if (data.linked_data.segments == 3) {
for (size_t j = data.linked_data.functions_by_seg.at(seg).size(); j-- > 0;) {
f(data.linked_data.functions_by_seg.at(seg).at(j));

View File

@ -249,7 +249,7 @@ void extract_collide_frags(const level_tools::DrawableTreeCollideFragment* tree,
*/
auto all_frags = build_all_frags_list(tree, ties);
u32 total_faces = 0;
[[maybe_unused]] u32 total_faces = 0;
for (auto& frag : all_frags) {
unpack_part1_collide_list_item(frag);
unpack_part2_collide_list_item(frag);

View File

@ -1368,8 +1368,8 @@ void create_modifiable_vertex_data(
// index into a per-effect modifiable vertex buffer, not the giant per-FR3 merc vertex buffer.
// some stats
int num_tris = 0; // all triangles
int mod_tris = 0; // triangles in mod draws
[[maybe_unused]] int num_tris = 0; // all triangles
[[maybe_unused]] int mod_tris = 0; // triangles in mod draws
// loop over models added from this art-group
for (size_t mi = first_out_model; mi < out.models.size(); mi++) {

View File

@ -1085,7 +1085,7 @@ std::vector<TFragDraw> emulate_tfrag_execution(const level_tools::TFragment& fra
vf24_stq_0.w() = 0; // set later.
// iaddiu vi11, vi00, 0x4000 | nop
u16 vi11 = 0x4000;
[[maybe_unused]] u16 vi11 = 0x4000;
// iaddiu vi11, vi11, 0x4000 | nop
vi11 += 0x4000;
@ -1677,7 +1677,7 @@ std::vector<TFragDraw> emulate_tfrag_execution(const level_tools::TFragment& fra
}
end:
int total_dvert = 0;
[[maybe_unused]] int total_dvert = 0;
for (auto& draw : all_draws) {
total_dvert += draw.verts.size();
draw.tfrag_id = frag.id;
@ -1994,7 +1994,7 @@ std::map<u32, std::vector<GroupedDraw>> make_draw_groups(std::vector<TFragDraw>&
}
}
int dc = 0;
[[maybe_unused]] int dc = 0;
for (auto& group_list : result) {
for (auto& group : group_list.second) {
(void)group;

View File

@ -232,7 +232,7 @@ void build_graph(std::vector<Node>& nodes,
}
// second pass: loop over shared edges
int shared_edge_count = 0;
[[maybe_unused]] int shared_edge_count = 0;
for (const auto& [edge, infos] : edge_info_map) {
// skip any edge that only shows up once.
if (infos.size() < 2) {

View File

@ -610,8 +610,8 @@ void run(Output& out, const Input& input) {
stack_slots);
// Run propagation, until we get through an iteration with no changes
int blocks_run = 0;
int outer_iterations = 0;
[[maybe_unused]] int blocks_run = 0;
[[maybe_unused]] int outer_iterations = 0;
bool needs_rerun = true;
bool hit_error = false;
while (needs_rerun) {

View File

@ -161,7 +161,7 @@ void SkyRenderer::render(DmaFollower& dma,
// mmag/mmin = 1
// clamp
// drawing.
int dma_idx = 0;
[[maybe_unused]] int dma_idx = 0;
while (dma.current_tag().kind == DmaTag::Kind::CNT) {
m_frame_stats.gif_packets++;
auto data = dma.read_and_advance();

View File

@ -1627,7 +1627,7 @@ bool TextureAnimator::set_up_opengl_for_shader(const ShaderContext& shader,
ASSERT_NOT_REACHED();
}
bool do_alpha_test = false;
[[maybe_unused]] bool do_alpha_test = false;
bool alpha_test_mask_alpha_trick = false;
bool alpha_test_mask_depth_trick = false;
@ -2432,4 +2432,4 @@ void TextureAnimator::setup_texture_anims() {
}
m_krew_holo_anim_array_idx = create_fixed_anim_array({def});
}
}
}

View File

@ -408,7 +408,7 @@ void TFragment::render_tree(int geom,
return;
}
auto& tree = m_cached_trees.at(geom).at(settings.tree_idx);
const auto* itimes = settings.camera.itimes;
[[maybe_unused]] const auto* itimes = settings.camera.itimes;
if (tree.freeze_itimes) {
itimes = tree.itimes_debug;

View File

@ -40,7 +40,7 @@ class FrameTimeRecorder {
class OpenGlDebugGui {
public:
OpenGlDebugGui(GameVersion version) : m_version(version) {}
OpenGlDebugGui() {}
void start_frame();
void finish_frame();
@ -86,6 +86,4 @@ class OpenGlDebugGui {
bool m_want_screenshot = false;
char m_screenshot_save_name[256] = "screenshot.png";
float target_fps_input = 60.f;
GameVersion m_version;
};

View File

@ -285,7 +285,7 @@ void Merc2::model_mod_draws(int num_effects,
// this lock is not ideal, and can block the rendering thread while blerc_execute runs,
// which can take up to 2ms on really blerc-heavy scenes
std::unique_lock<std::mutex> lk(g_merc_data_mutex);
int frags_done = 0;
[[maybe_unused]] int frags_done = 0;
auto p = scoped_prof("vert-math");
// loop over fragments
@ -1292,4 +1292,4 @@ void Merc2::do_draws(const Draw* draw_array,
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, lev->merc_indices);
glBindBuffer(GL_ARRAY_BUFFER, lev->merc_vertices);
}
}
}

View File

@ -115,7 +115,7 @@ void Shadow2::render(DmaFollower& dma, SharedRenderState* render_state, ScopedPr
// maybe the invert z thing
DmaFollower f = dma;
auto maybe_invert_z = f.read_and_advance();
bool invert_z = false;
[[maybe_unused]] bool invert_z = false;
if (maybe_invert_z.vif0() == 0 && maybe_invert_z.vifcode1().kind == VifCode::Kind::DIRECT &&
maybe_invert_z.vifcode1().immediate == 35) {
invert_z = true;

View File

@ -96,7 +96,7 @@ class TfragLoadStage : public LoaderStage {
constexpr u32 CHUNK_SIZE = 32768;
u32 uploaded_bytes = 0;
u32 unique_buffers = 0;
[[maybe_unused]] u32 unique_buffers = 0;
while (true) {
bool complete_tree;
@ -626,4 +626,4 @@ std::vector<std::unique_ptr<LoaderStage>> make_loader_stages() {
ret.push_back(std::make_unique<MercLoaderStage>());
ret.push_back(std::make_unique<StallLoaderStage>());
return ret;
}
}

View File

@ -83,7 +83,7 @@ struct GraphicsData {
file_util::get_jak_project_dir() / "out" / game_version_names[version] / "fr3",
fr3_level_count[version])),
ogl_renderer(texture_pool, loader, version),
debug_gui(version),
debug_gui(),
version(version) {}
};

View File

@ -525,7 +525,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
c->daddiu(sp, sp, -112); // daddiu sp, sp, -112
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sd(fp, 8, sp); // sd fp, 8(sp)
@ -808,7 +808,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
c->daddiu(sp, sp, -112); // daddiu sp, sp, -112
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sd(fp, 8, sp); // sd fp, 8(sp)

View File

@ -12,7 +12,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] 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)
@ -450,7 +450,7 @@ void sub_l16_b15(ExecutionContext* c) {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] 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)
@ -1008,4 +1008,4 @@ void link() {
}
} // namespace method_18_collide_edge_work
} // namespace Mips2C
} // namespace Mips2C

View File

@ -590,7 +590,7 @@ u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
get_fake_spad_addr(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
u32 madr, sadr, qwc;
c->daddiu(sp, sp, -128); // daddiu sp, sp, -128
c->sd(ra, 384, at); // sd ra, 384(at)

View File

@ -2157,7 +2157,7 @@ namespace calc_animation_from_spr {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
u32 madr, sadr, qwc;
c->mov64(v1, a1); // or v1, a1, r0
c->daddiu(sp, sp, -192); // daddiu sp, sp, -192
@ -2540,4 +2540,4 @@ namespace decompress_fixed_data_to_accumulator { extern void link(); }
namespace decompress_frame_data_to_accumulator { extern void link(); }
namespace decompress_frame_data_pair_to_accumulator { extern void link(); }
namespace decompress_frame_data_pair_to_accumulator { extern void link(); }

View File

@ -85,7 +85,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
// nop // sll r0, r0, 0
c->daddiu(sp, sp, -8); // daddiu sp, sp, -8
c->mov64(t6, s7); // or t6, s7, r0

View File

@ -746,7 +746,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
// nop // sll r0, r0, 0
c->daddiu(sp, sp, -8); // daddiu sp, sp, -8
// nop // sll r0, r0, 0
@ -1179,7 +1179,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
// nop // sll r0, r0, 0
c->daddiu(sp, sp, -8); // daddiu sp, sp, -8
// nop // sll r0, r0, 0

View File

@ -248,7 +248,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] 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)
@ -673,7 +673,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] 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)

View File

@ -1066,7 +1066,7 @@ void sub_l25_b27(ExecutionContext* c) {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] 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)
@ -1225,7 +1225,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] 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)

View File

@ -210,7 +210,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
// nop // sll r0, r0, 0
c->daddiu(sp, sp, -8); // daddiu sp, sp, -8
// nop // sll r0, r0, 0

View File

@ -2303,7 +2303,7 @@ u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 madr, sadr, qwc;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
c->daddiu(sp, sp, -32); // daddiu sp, sp, -32
c->sd(ra, 0, sp); // sd ra, 0(sp)
c->sq(gp, 16, sp); // sq gp, 16(sp)
@ -2466,7 +2466,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
u32 qwc = 0;
u32 madr = 0;
u32 sadr = 0;

View File

@ -2189,7 +2189,7 @@ u64 execute(void* ctxt) {
u32 sadr = 0;
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
c->daddiu(sp, sp, -16); // daddiu sp, sp, -16
c->sd(ra, 0, sp); // sd ra, 0(sp)
get_fake_spad_addr2(at, cache.fake_scratchpad_data, 0, c);// lui at, 28672

View File

@ -2157,7 +2157,7 @@ namespace calc_animation_from_spr {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
u32 madr, sadr, qwc;
c->mov64(v1, a1); // or v1, a1, r0
c->daddiu(sp, sp, -192); // daddiu sp, sp, -192

View File

@ -115,8 +115,8 @@ struct Cache {
} cache;
u64 execute(void* ctxt) {
bool hit18 = false;
bool hit19 = false;
[[maybe_unused]] bool hit18 = false;
[[maybe_unused]] bool hit19 = false;
auto pp = scoped_prof("blerc-exec");
std::unique_lock<std::mutex> lk(g_merc_data_mutex);
auto* c = (ExecutionContext*)ctxt;
@ -693,4 +693,4 @@ void link() {
}
} // namespace setup_blerc_chains_for_one_fragment
} // namespace Mips2C
} // namespace Mips2C

View File

@ -100,7 +100,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
// nop // sll r0, r0, 0
c->daddiu(sp, sp, -8); // daddiu sp, sp, -8
c->mov64(t6, s7); // or t6, s7, r0
@ -379,4 +379,4 @@ void link() {
}
} // namespace render_ocean_quad
} // namespace Mips2C
} // namespace Mips2C

View File

@ -672,7 +672,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
// nop // sll r0, r0, 0
c->daddiu(sp, sp, -8); // daddiu sp, sp, -8
// nop // sll r0, r0, 0

View File

@ -75,7 +75,7 @@ struct Cache {
u64 execute(void* ctxt) {
auto* c = (ExecutionContext*)ctxt;
bool bc = false;
u32 call_addr = 0;
[[maybe_unused]] u32 call_addr = 0;
// nop // sll r0, r0, 0
c->daddiu(sp, sp, -8); // daddiu sp, sp, -8
c->mov64(t6, s7); // or t6, s7, r0

View File

@ -189,7 +189,7 @@ VagCmd* SmartAllocVagCmd(VagCmd* cmd) {
}
void TerminateVAG(VagCmd* cmd, int param_2) {
int* piVar1;
[[maybe_unused]] int* piVar1;
int iVar2;
u32 uVar3;
VagCmd* pRVar4;

View File

@ -60,7 +60,7 @@ class SFXBlock : public SoundBank {
SndPlayParams& params) override;
private:
locator& m_locator;
[[maybe_unused]] locator& m_locator;
std::vector<SFX2> m_sounds;
};

View File

@ -106,7 +106,7 @@ class SFXBlock2 : public SoundBank {
};
private:
locator& m_locator;
[[maybe_unused]] locator& m_locator;
std::string m_name;
std::unordered_map<std::string, u32> m_names;
std::vector<SFX2> m_sounds;

View File

@ -330,7 +330,7 @@ SFXGrain_AddPB::SFXGrain_AddPB(SFXGrain2& grain, u8* data) : Grain(grain) {
}
s32 SFXGrain_AddPB::execute(blocksound_handler& handler) {
s32 new_pb = handler.m_cur_pb + 0x7fff * m_pb / 127;
std::clamp<s32>(new_pb, INT16_MIN, INT16_MAX);
new_pb = std::clamp<s32>(new_pb, INT16_MIN, INT16_MAX);
handler.set_pbend(new_pb);

View File

@ -87,9 +87,9 @@ class voice {
AllocationType m_Alloc;
bool m_Noise{false};
bool m_PitchMod{false};
bool m_KeyOn{false};
bool m_KeyOff{false};
[[maybe_unused]] bool m_PitchMod{false};
[[maybe_unused]] bool m_KeyOn{false};
[[maybe_unused]] bool m_KeyOff{false};
bool m_ENDX{false};
void DecodeSamples();
@ -101,7 +101,7 @@ class voice {
u32 m_Counter{0};
u16 m_Pitch{0};
s16 m_Out{0};
[[maybe_unused]] s16 m_Out{0};
u16* m_sample{nullptr};
u32 m_SSA{0};

View File

@ -105,7 +105,7 @@ u32 count_leaves(Node& root) {
void collapse1(Node& root) {
ASSERT(!root.children.empty());
u32 total_children_removed = 0;
u32 total_rgb_sum_moved_up = 0;
[[maybe_unused]] u32 total_rgb_sum_moved_up = 0;
bool started_as_leaf = root.rgb_sum_count;
for (auto& child : root.children) {
if (child.depth != 0xff) {

View File

@ -727,8 +727,8 @@ void extract(const Input& in,
CollideOutput& out,
const tinygltf::Model& model,
const std::vector<NodeWithTransform>& all_nodes) {
int mesh_count = 0;
int prim_count = 0;
[[maybe_unused]] int mesh_count = 0;
[[maybe_unused]] int prim_count = 0;
int suspicious_faces = 0;
for (const auto& n : all_nodes) {

View File

@ -156,6 +156,8 @@ std::optional<LSPSpec::Hover> hover_handler_ir(Workspace& workspace,
hover_resp.m_contents = markup;
return hover_resp;
}
return {};
}
std::string truncate_docstring(const std::string& docstring) {

View File

@ -327,7 +327,7 @@ WorkspaceIRFile::WorkspaceIRFile(const std::string& content) {
std::string::size_type prev = 0;
// TODO - i hate this assignment inside a conditional, get rid of it
while ((pos = content.find('\r\n', prev)) != std::string::npos) {
while ((pos = content.find("\r\n", prev)) != std::string::npos) {
std::string line = content.substr(prev, pos - prev);
m_lines.push_back(line);
// Run any checks on that line

View File

@ -62,7 +62,7 @@ class WorkspaceAllTypesFile {
WorkspaceAllTypesFile(const LSPSpec::DocumentUri& uri,
const GameVersion version,
const fs::path file_path)
: m_uri(uri), m_game_version(version), m_dts(m_game_version), m_file_path(file_path){};
: m_game_version(version), m_uri(uri), m_dts(m_game_version), m_file_path(file_path){};
GameVersion m_game_version;
LSPSpec::DocumentUri m_uri;

View File

@ -125,7 +125,7 @@ bool find_and_run_tests() {
try {
// Enumerate test files
const auto test_files = file_util::find_files_recursively(
file_util::get_file_path({"test/common/formatter/corpus"}), std::regex("^.*\.test.gc$"));
file_util::get_file_path({"test/common/formatter/corpus"}), std::regex("^.*\\.test.gc$"));
bool failed = false;
// First do a pass to see if any tests are meant to be prioritized for debugging
bool only_important_tests = false;

View File

@ -2168,7 +2168,7 @@ TEST(EmitterLoadsAndStores, store8_gpr64_gpr64_plus_gpr64) {
tester.emit(IGen::store8_gpr64_gpr64_plus_gpr64(RAX, RCX, RDX));
EXPECT_EQ(tester.dump_to_hex_string(), "88 14 01");
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;
@ -2230,7 +2230,7 @@ TEST(EmitterLoadsAndStores, store8_gpr64_gpr64_plus_gpr64_plus_s8) {
instr.emit(buff);
EXPECT_EQ(*(s8*)(buff + instr.offset_of_disp()), -3);
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;
@ -2293,7 +2293,7 @@ TEST(EmitterLoadsAndStores, store8_gpr64_gpr64_plus_gpr64_plus_s32) {
instr.emit(buff);
EXPECT_EQ(*(s32*)(buff + instr.offset_of_disp()), -3);
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;
@ -2351,7 +2351,7 @@ TEST(EmitterLoadsAndStores, store16_gpr64_gpr64_plus_gpr64) {
tester.emit(IGen::store16_gpr64_gpr64_plus_gpr64(RCX, RAX, R8));
EXPECT_EQ(tester.dump_to_hex_string(), "66 44 89 04 08");
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;
@ -2414,7 +2414,7 @@ TEST(EmitterLoadsAndStores, store16_gpr64_gpr64_plus_gpr64_plus_s8) {
instr.emit(buff);
EXPECT_EQ(*(s8*)(buff + instr.offset_of_disp()), -3);
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;
@ -2477,7 +2477,7 @@ TEST(EmitterLoadsAndStores, store16_gpr64_gpr64_plus_gpr64_plus_s32) {
instr.emit(buff);
EXPECT_EQ(*(s8*)(buff + instr.offset_of_disp()), -3);
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;
@ -2535,7 +2535,7 @@ TEST(EmitterLoadsAndStores, store32_gpr64_gpr64_plus_gpr64) {
tester.emit(IGen::store32_gpr64_gpr64_plus_gpr64(RCX, RAX, R8));
EXPECT_EQ(tester.dump_to_hex_string(), "44 89 04 08");
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;
@ -2598,7 +2598,7 @@ TEST(EmitterLoadsAndStores, store32_gpr64_gpr64_plus_gpr64_plus_s8) {
instr.emit(buff);
EXPECT_EQ(*(s8*)(buff + instr.offset_of_disp()), -3);
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;
@ -2661,7 +2661,7 @@ TEST(EmitterLoadsAndStores, store32_gpr64_gpr64_plus_gpr64_plus_s32) {
instr.emit(buff);
EXPECT_EQ(*(s8*)(buff + instr.offset_of_disp()), -3);
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;
@ -2719,7 +2719,7 @@ TEST(EmitterLoadsAndStores, store64_gpr64_gpr64_plus_gpr64) {
tester.emit(IGen::store64_gpr64_gpr64_plus_gpr64(RCX, RAX, R8));
EXPECT_EQ(tester.dump_to_hex_string(), "4c 89 04 08");
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;
@ -2782,7 +2782,7 @@ TEST(EmitterLoadsAndStores, store64_gpr64_gpr64_plus_gpr64_plus_s8) {
instr.emit(buff);
EXPECT_EQ(*(s8*)(buff + instr.offset_of_disp()), -3);
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;
@ -2845,7 +2845,7 @@ TEST(EmitterLoadsAndStores, store64_gpr64_gpr64_plus_gpr64_plus_s32) {
instr.emit(buff);
EXPECT_EQ(*(s8*)(buff + instr.offset_of_disp()), -3);
int iter = 0;
[[maybe_unused]] int iter = 0;
for (int i = 0; i < 16; i++) {
if (i == RSP) {
continue;

5
third-party/fpng/fpng.cpp generated vendored
View File

@ -1743,7 +1743,7 @@ do_literals:
// NOTE - Manual fix by us to support unicode....
std::wstring converted_path = utf8_string_to_wide_string(pFilename);
if (converted_path.empty()) {
printf("bad path - %s", converted_path.data());
printf("bad path - %ls", converted_path.data());
return false;
}
@ -1776,7 +1776,8 @@ do_literals:
memset(num_codes, 0, sizeof(num_codes));
for (uint32_t i = 0; i < num_syms; i++)
{
assert(pCode_sizes[i] <= FPNG_DECODER_TABLE_SIZE);
// Assertion is always true
// assert(pCode_sizes[i] <= FPNG_DECODER_TABLE_SIZE);
num_codes[pCode_sizes[i]]++;
}