diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f26b5a7..699c645 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,6 +32,6 @@ target_sources( UI/Disassembler.h ) -add_compile_options(-Wall -Wextra -Wpedantic -Werror) - -target_link_libraries(${PROJECT_NAME} PRIVATE vendor) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} PRIVATE vendor) +target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror) +target_link_options(${PROJECT_NAME} PRIVATE) \ No newline at end of file diff --git a/src/Graphics/Graphics.cpp b/src/Graphics/Graphics.cpp index 1ae63f9..73ddecf 100644 --- a/src/Graphics/Graphics.cpp +++ b/src/Graphics/Graphics.cpp @@ -96,4 +96,4 @@ void Graphics::end() const ImGui_ImplSDLRenderer3_RenderDrawData(ImGui::GetDrawData(), this->renderer.get()); SDL_RenderPresent(this->renderer.get()); -} \ No newline at end of file +} diff --git a/src/Interpreter/Interpreter.cpp b/src/Interpreter/Interpreter.cpp index 98da7aa..01575ce 100644 --- a/src/Interpreter/Interpreter.cpp +++ b/src/Interpreter/Interpreter.cpp @@ -219,7 +219,7 @@ std::vector Interpreter::disassembly() const { std::vector instructions(std::size(machine_state->memory) / 2); - for (auto address = 0; address < std::size(machine_state->memory); address += 2) + for (std::size_t address = 0; address < std::size(machine_state->memory); address += 2) { const auto word = this->get_word(address); instructions[address / 2] = (this->decode(word, address)); diff --git a/src/Machine.cpp b/src/Machine.cpp index 82835a4..7dbc717 100644 --- a/src/Machine.cpp +++ b/src/Machine.cpp @@ -20,11 +20,11 @@ Machine::Machine() : interpreter{std::make_unique(this->machine_state)}, ui_manager{std::make_unique(this->graphics, this->machine_state, this->callback_manager)}, - running{false}, ips{60}, last_update_time{0}, accumulator{0}, - target_cycle_time{1.0 / this->ips} + target_cycle_time{1.0 / this->ips}, + running{false} { this->register_callbacks(); this->callback_manager->trigger(this->callback_manager->ips_callback, this->ips); diff --git a/src/UI/ControlPanel.cpp b/src/UI/ControlPanel.cpp index 835d5fc..796b3c9 100644 --- a/src/UI/ControlPanel.cpp +++ b/src/UI/ControlPanel.cpp @@ -122,7 +122,7 @@ void ControlPanel::on_click_load_rom() ); } -void ControlPanel::on_callback_load_rom(void* self, const char* const* filelist, int filter) +void ControlPanel::on_callback_load_rom(void* self, const char* const* filelist, int) { const auto control_panel = static_cast(self); diff --git a/src/UI/Display.cpp b/src/UI/Display.cpp index ce9e7a9..28a73f6 100644 --- a/src/UI/Display.cpp +++ b/src/UI/Display.cpp @@ -64,7 +64,7 @@ void Display::update_texture() const ) ); - for (int i = 0; i < display.size(); i++) + for (std::size_t i = 0; i < display.size(); i++) { if (display[i]) { @@ -108,4 +108,4 @@ void Display::display_widget() const ImGui::Image(static_cast(reinterpret_cast(texture.get())), scaled_size); ImGui::End(); -} \ No newline at end of file +} diff --git a/src/UI/MemoryViewer.cpp b/src/UI/MemoryViewer.cpp index 86c2084..67e786d 100644 --- a/src/UI/MemoryViewer.cpp +++ b/src/UI/MemoryViewer.cpp @@ -42,7 +42,7 @@ void MemoryViewer::render() ImGui::End(); } -std::string MemoryViewer::get_memory_line(int line) const +std::string MemoryViewer::get_memory_line(const int line) const { auto& memory = this->machine_state->memory; @@ -58,9 +58,9 @@ std::string MemoryViewer::get_memory_line(int line) const << static_cast(i) << " | "; - for (auto j = 0; j < this->width; j++) + for (int j = 0; j < this->width; j++) { - if (i + j >= size) + if (static_cast(i + j) >= size) { text_builder << " "; } @@ -77,9 +77,9 @@ std::string MemoryViewer::get_memory_line(int line) const text_builder << "| "; - for (auto j = 0; j < this->width; j++) + for (int j = 0; j < this->width; j++) { - if (i + j >= size) + if (static_cast(i + j) >= size) { text_builder << "."; } diff --git a/src/main.cpp b/src/main.cpp index a24d7b4..62a07e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,7 +4,7 @@ #include #include "Machine.h" -SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[]) +SDL_AppResult SDL_AppInit(void** appstate, [[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) { auto machine = std::make_unique(); *appstate = machine.release(); @@ -33,7 +33,7 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) return SDL_APP_CONTINUE; } -void SDL_AppQuit(void* appstate, SDL_AppResult result) +void SDL_AppQuit(void* appstate, [[maybe_unused]] SDL_AppResult result) { std::unique_ptr chip8(static_cast(appstate)); -} \ No newline at end of file +}