Skip to content

Commit

Permalink
Switch to GCC and fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Feb 23, 2025
1 parent 6a4705b commit 777e2a5
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(IMGUI_DIR "${VENDOR_DIR}/imgui")
set(DCIMGUI_DIR "${LIB_DIR}/dcimgui")
set(DEARBINDINGS_DIR "${VENDOR_DIR}/dear_bindings")

# Export Clang DB
# Export compilation DB
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
file(CREATE_LINK "${CMAKE_CURRENT_BINARY_DIR}" "${BUILD_DIR}/current" SYMBOLIC)

Expand Down
8 changes: 4 additions & 4 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++"
}
},
{
Expand All @@ -24,8 +24,8 @@
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
"CMAKE_C_COMPILER": "gcc",
"CMAKE_CXX_COMPILER": "g++"
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ If your distro does not support `/usr/local/bin/` in PATH, try `/usr/bin/` inste

### Build Requirements

- Clang
- GCC
- CMake 3.20+
- GNU Make
- Python 3.10+ (for dear_bindings and GLAD generation)
Expand Down Expand Up @@ -78,7 +78,7 @@ cmake --build -j $(nproc) --preset debug -t gdb

### IDE Support

Configuration files are provided for VS Code
Configuration files are provided for VS Code and they rely on `clangd`

You will need to run a full build process atleast once before `clangd` picks up the compile DB

Expand Down
3 changes: 0 additions & 3 deletions lib/dcimgui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,5 @@ add_library(dcimgui STATIC "${sources}")
target_include_directories(dcimgui PUBLIC "${DCIMGUI_DIR}" "${DCIMGUI_DIR}/backends")
target_include_directories(dcimgui PUBLIC "${IMGUI_DIR}" "${IMGUI_DIR}/backends")

# Disable unavoidable warnings
target_compile_options(dcimgui PRIVATE -Wno-macro-redefined)

# Custom imconfig.h
target_compile_definitions(dcimgui PUBLIC IMGUI_USER_CONFIG="dcimconfig.h")
7 changes: 5 additions & 2 deletions lib/dcimgui/dcimconfig.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#pragma once

#include <glad/gl.h>

// 32-bit characters for drawing
#define IMGUI_USE_WCHAR32 1

// Don't provide barebones OpenGL definitions from ImGui
#define IMGUI_IMPL_OPENGL_LOADER_CUSTOM 1

// Remove imgui.h defines before dcimgui.h re-defines them
#undef IMGUI_CHECKVERSION
#undef IM_ALLOC
#undef IM_FREE
2 changes: 1 addition & 1 deletion src/gui/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ static void gui_window_draw_addresses_pane(Gui* gui, ImVec2 size) {
ImGui_TableNextColumn();
ImVec2 text_pos = ImGui_GetCursorScreenPos();
ImVec2 rect_pos = text_pos;
ImGui_Text("");
ImGui_TextUnformatted("");
const char* text = "Too many results, no live updates!";
ImVec2 text_size = ImGui_CalcTextSize(text);
ImDrawList* foreground = ImGui_GetWindowDrawList();
Expand Down
6 changes: 4 additions & 2 deletions src/memory/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void memory_search_set_params(MemorySearch* memory_search, MemorySearchParams pa
params.region_flags = memory_search->params.region_flags;
}

params.type = CLAMP(params.type, MemoryTypeMAX - 1, 0);
params.type = CLAMP(params.type, MemoryTypeMAX - 1u, 0u);
params.alignment = MAX(params.alignment, 1);
params.deviation = ABS(params.deviation);
if(params.type <= MemoryTypeInteger) {
Expand Down Expand Up @@ -310,7 +310,7 @@ static void* memory_search_begin_callback(Thread* self, void* context) {
MemoryAddress chunk_addr = 0;
MemoryAddress chunk_end = 0;
MemoryAddress chunk_end_max_type_margin = 0;
void* chunk_cur;
void* chunk_cur = chunk_buf;
while(addr < region->end) {
if(addr > chunk_end_max_type_margin) {
thread_self_quit_if_canceled(self);
Expand Down Expand Up @@ -956,6 +956,8 @@ MemorySearchResultBase* memory_search_get_result_base(MemorySearchResultSet* set
return &set->results_128[i].base;
}
}

return NULL;
}

static MemorySearchValueDisplay
Expand Down

0 comments on commit 777e2a5

Please sign in to comment.