From e1580e51cfa237b022f494d10e3f29ea3cca5d85 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 10 Feb 2025 09:42:35 +0100 Subject: [PATCH] build: Make ImHex fully compile with warnings enabled in MSVC --- cmake/build_helpers.cmake | 12 +++++++++- lib/external/pattern_language | 2 +- .../include/hex/api/content_registry.hpp | 2 +- lib/libimhex/include/hex/helpers/opengl.hpp | 10 ++++----- lib/libimhex/include/hex/helpers/utils.hpp | 2 +- lib/libimhex/include/hex/plugin.hpp | 2 +- lib/libimhex/source/helpers/opengl.cpp | 22 +++++++++---------- .../source/ui/imgui_imhex_extensions.cpp | 8 +++---- lib/third_party/yara/CMakeLists.txt | 2 ++ main/forwarder/source/main.cpp | 1 + main/gui/source/init/splash_window.cpp | 2 +- main/gui/source/window/window.cpp | 4 ++-- .../builtin/source/content/data_inspector.cpp | 2 +- .../data_processor_nodes/decode_nodes.cpp | 4 ++-- .../data_processor_nodes/other_nodes.cpp | 2 +- .../source/content/tools/ieee_decoder.cpp | 2 +- .../source/content/tools/math_eval.cpp | 4 ++-- plugins/builtin/source/content/ui_items.cpp | 2 +- .../builtin/source/content/welcome_screen.cpp | 6 ++--- plugins/diffing/CMakeLists.txt | 3 +++ .../source/content/views/view_diff.cpp | 2 +- plugins/disassembler/CMakeLists.txt | 2 ++ plugins/ui/source/ui/hex_editor.cpp | 3 +++ .../content/pl_visualizers/timestamp.cpp | 4 ++-- plugins/yara_rules/CMakeLists.txt | 3 +++ .../yara_rules/source/content/yara_rule.cpp | 5 +++++ 26 files changed, 70 insertions(+), 43 deletions(-) diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index a554fe42b..64d35ca7c 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -131,6 +131,7 @@ macro(detectOS) add_compile_definitions(WIN32_LEAN_AND_MEAN) add_compile_definitions(NOMINMAX) add_compile_definitions(UNICODE) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) elseif (APPLE) add_compile_definitions(OS_MACOS) set(CMAKE_INSTALL_BINDIR ".") @@ -626,7 +627,16 @@ macro(setupDebugCompressionFlag) endmacro() macro(setupCompilerFlags target) - if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + if (IMHEX_STRICT_WARNINGS) + addCommonFlag("/W4" ${target}) + addCommonFlag("/wd4242" ${target}) + addCommonFlag("/wd4244" ${target}) + addCommonFlag("/wd4267" ${target}) + addCommonFlag("/wd4996" ${target}) + addCommonFlag("/wd4127" ${target}) + endif() + elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") # Define strict compilation flags if (IMHEX_STRICT_WARNINGS) addCommonFlag("-Wall" ${target}) diff --git a/lib/external/pattern_language b/lib/external/pattern_language index da45d0c01..bc002793b 160000 --- a/lib/external/pattern_language +++ b/lib/external/pattern_language @@ -1 +1 @@ -Subproject commit da45d0c01757322e08e0f8b503082508178a2e8a +Subproject commit bc002793b0da4886f89b9bf230dff0d0226d21f3 diff --git a/lib/libimhex/include/hex/api/content_registry.hpp b/lib/libimhex/include/hex/api/content_registry.hpp index 09e838bf0..747bd3977 100644 --- a/lib/libimhex/include/hex/api/content_registry.hpp +++ b/lib/libimhex/include/hex/api/content_registry.hpp @@ -328,7 +328,7 @@ namespace hex { result = defaultValue; return result.get(); - } catch (const nlohmann::json::exception &e) { + } catch (const nlohmann::json::exception &) { return defaultValue; } } diff --git a/lib/libimhex/include/hex/helpers/opengl.hpp b/lib/libimhex/include/hex/helpers/opengl.hpp index 7525c3635..27b2e802c 100644 --- a/lib/libimhex/include/hex/helpers/opengl.hpp +++ b/lib/libimhex/include/hex/helpers/opengl.hpp @@ -400,8 +400,8 @@ namespace hex::gl { T Sx, Cx, Sy, Cy, Sz, Cz; Vector angles = ypr; - if(!radians) - angles *= std::numbers::pi / 180; + if (!radians) + angles *= std::numbers::pi_v / 180; Sx = -sin(angles[0]); Cx = cos(angles[0]); Sy = -sin(angles[1]); Cy = cos(angles[1]); @@ -814,11 +814,11 @@ namespace hex::gl { template void setUniform(std::string_view name, const Vector &value) { - if (N == 2) + if constexpr (N == 2) glUniform2f(getUniformLocation(name), value[0], value[1]); - else if (N == 3) + else if constexpr (N == 3) glUniform3f(getUniformLocation(name), value[0], value[1], value[2]); - else if (N == 4) + else if constexpr (N == 4) glUniform4f(getUniformLocation(name), value[0], value[1], value[2],value[3]); } diff --git a/lib/libimhex/include/hex/helpers/utils.hpp b/lib/libimhex/include/hex/helpers/utils.hpp index 42480e3b6..76333ed63 100644 --- a/lib/libimhex/include/hex/helpers/utils.hpp +++ b/lib/libimhex/include/hex/helpers/utils.hpp @@ -278,7 +278,7 @@ namespace hex { std::string result; for (i16 bit = hex::bit_width(number) - 1; bit >= 0; bit -= 1) - result += (number & (0b1 << bit)) == 0 ? '0' : '1'; + result += (number & (0b1LLU << bit)) == 0 ? '0' : '1'; return result; } diff --git a/lib/libimhex/include/hex/plugin.hpp b/lib/libimhex/include/hex/plugin.hpp index 184b9dd38..dcc97a441 100644 --- a/lib/libimhex/include/hex/plugin.hpp +++ b/lib/libimhex/include/hex/plugin.hpp @@ -15,7 +15,7 @@ #if defined(_MSC_VER) #include - #define PLUGIN_ENTRY_POINT extern "C" BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fwdReason, LPVOID lpReserved) { return TRUE; } + #define PLUGIN_ENTRY_POINT extern "C" BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID) { return TRUE; } #else #define PLUGIN_ENTRY_POINT #endif diff --git a/lib/libimhex/source/helpers/opengl.cpp b/lib/libimhex/source/helpers/opengl.cpp index c8756e3d2..01ce11e04 100644 --- a/lib/libimhex/source/helpers/opengl.cpp +++ b/lib/libimhex/source/helpers/opengl.cpp @@ -170,7 +170,7 @@ namespace hex::gl { m_buffer = other.m_buffer; m_size = other.m_size; m_type = other.m_type; - other.m_buffer = -1; + other.m_buffer = 0; } template @@ -178,7 +178,7 @@ namespace hex::gl { m_buffer = other.m_buffer; m_size = other.m_size; m_type = other.m_type; - other.m_buffer = -1; + other.m_buffer = 0; return *this; } @@ -231,12 +231,12 @@ namespace hex::gl { VertexArray::VertexArray(VertexArray &&other) noexcept { m_array = other.m_array; - other.m_array = -1; + other.m_array = 0; } VertexArray& VertexArray::operator=(VertexArray &&other) noexcept { m_array = other.m_array; - other.m_array = -1; + other.m_array = 0; return *this; } @@ -268,7 +268,7 @@ namespace hex::gl { Texture::Texture(Texture &&other) noexcept { m_texture = other.m_texture; - other.m_texture = -1; + other.m_texture = 0; m_width = other.m_width; m_height = other.m_height; @@ -276,7 +276,7 @@ namespace hex::gl { Texture& Texture::operator=(Texture &&other) noexcept { m_texture = other.m_texture; - other.m_texture = -1; + other.m_texture = 0; return *this; } @@ -302,7 +302,7 @@ namespace hex::gl { GLuint Texture::release() { auto copy = m_texture; - m_texture = -1; + m_texture = 0; return copy; } @@ -327,16 +327,16 @@ namespace hex::gl { FrameBuffer::FrameBuffer(FrameBuffer &&other) noexcept { m_frameBuffer = other.m_frameBuffer; - other.m_frameBuffer = -1; + other.m_frameBuffer = 0; m_renderBuffer = other.m_renderBuffer; - other.m_renderBuffer = -1; + other.m_renderBuffer = 0; } FrameBuffer& FrameBuffer::operator=(FrameBuffer &&other) noexcept { m_frameBuffer = other.m_frameBuffer; - other.m_frameBuffer = -1; + other.m_frameBuffer = 0; m_renderBuffer = other.m_renderBuffer; - other.m_renderBuffer = -1; + other.m_renderBuffer = 0; return *this; } diff --git a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp index 50fc6a64a..b20e81c15 100644 --- a/lib/libimhex/source/ui/imgui_imhex_extensions.cpp +++ b/lib/libimhex/source/ui/imgui_imhex_extensions.cpp @@ -667,10 +667,8 @@ namespace ImGuiExt { } ImVec2 GetCustomStyleVec2(ImGuiCustomStyle idx) { - switch (idx) { - default: - return { }; - } + std::ignore = idx; + return {}; } void StyleCustomColorsDark() { @@ -859,7 +857,7 @@ namespace ImGuiExt { : ImGuiCol_Button); RenderNavCursor(bb, id); RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); - RenderTextClipped(bb.Min + style.FramePadding * ImVec2(1.3, 1) + iconOffset, bb.Max - style.FramePadding, symbol, nullptr, &label_size, style.ButtonTextAlign, &bb); + RenderTextClipped(bb.Min + style.FramePadding * ImVec2(1.3F, 1) + iconOffset, bb.Max - style.FramePadding, symbol, nullptr, &label_size, style.ButtonTextAlign, &bb); PopStyleColor(); diff --git a/lib/third_party/yara/CMakeLists.txt b/lib/third_party/yara/CMakeLists.txt index b460d01d6..cb70e7f29 100644 --- a/lib/third_party/yara/CMakeLists.txt +++ b/lib/third_party/yara/CMakeLists.txt @@ -117,6 +117,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_compile_options(libyara PRIVATE -Wno-shift-count-overflow -Wno-stringop-overflow) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options(libyara PRIVATE -Wno-pointer-sign -Wno-tautological-constant-out-of-range-compare) +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + target_compile_options(libyara PRIVATE /wd4005) endif () target_include_directories( diff --git a/main/forwarder/source/main.cpp b/main/forwarder/source/main.cpp index 196c186ee..909ac8a68 100644 --- a/main/forwarder/source/main.cpp +++ b/main/forwarder/source/main.cpp @@ -27,6 +27,7 @@ #include #include +#include void setupConsoleWindow() { // Get the handle of the console window diff --git a/main/gui/source/init/splash_window.cpp b/main/gui/source/init/splash_window.cpp index 3df96d504..bb2f8f910 100644 --- a/main/gui/source/init/splash_window.cpp +++ b/main/gui/source/init/splash_window.cpp @@ -283,7 +283,7 @@ namespace hex::init { const auto highlightBytes = [&](ImVec2 start, size_t count, ImColor color, float opacity) { // Dimensions and number of bytes that are drawn. Taken from the splash screen image const auto hexSize = ImVec2(29, 18); - const auto hexSpacing = ImVec2(17.4, 15); + const auto hexSpacing = ImVec2(17.4F, 15); const auto hexStart = ImVec2(27, 127); constexpr auto HexCount = ImVec2(13, 7); diff --git a/main/gui/source/window/window.cpp b/main/gui/source/window/window.cpp index 938a0d65e..3003302c5 100644 --- a/main/gui/source/window/window.cpp +++ b/main/gui/source/window/window.cpp @@ -406,7 +406,7 @@ namespace hex { ImGuiExt::UnderlinedText("Plugin folders"); if (ImGui::BeginTable("plugins", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY | ImGuiTableFlags_SizingFixedFit, ImVec2(0, 100_scaled))) { ImGui::TableSetupScrollFreeze(0, 1); - ImGui::TableSetupColumn("Path", ImGuiTableColumnFlags_WidthStretch, 0.2); + ImGui::TableSetupColumn("Path", ImGuiTableColumnFlags_WidthStretch, 0.2F); ImGui::TableSetupColumn("Exists", ImGuiTableColumnFlags_WidthFixed, ImGui::GetTextLineHeight() * 3); ImGui::TableHeadersRow(); @@ -649,7 +649,7 @@ namespace hex { auto prevShadowOffset = style.WindowShadowOffsetDist; auto prevShadowAngle = style.WindowShadowOffsetAngle; style.WindowShadowOffsetDist = 12_scaled; - style.WindowShadowOffsetAngle = 0.5 * std::numbers::pi; + style.WindowShadowOffsetAngle = 0.5F * std::numbers::pi_v; ON_SCOPE_EXIT { style.WindowShadowOffsetDist = prevShadowOffset; style.WindowShadowOffsetAngle = prevShadowAngle; diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp index fe4db7e2e..0f1e7951f 100644 --- a/plugins/builtin/source/content/data_inspector.cpp +++ b/plugins/builtin/source/content/data_inspector.cpp @@ -91,7 +91,7 @@ namespace hex::plugin::builtin { T value = 0x00; std::memcpy(&value, buffer.data(), std::min(sizeof(T), Size)); value = hex::changeEndianness(value, Size, endian); - if (Size != sizeof(T)) + if constexpr (Size != sizeof(T)) value = T(hex::signExtend(Size * 8, value)); return value; diff --git a/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp b/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp index ea15cd734..b1b7d228f 100644 --- a/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp +++ b/plugins/builtin/source/content/data_processor_nodes/decode_nodes.cpp @@ -23,8 +23,8 @@ namespace hex::plugin::builtin { void drawNode() override { ImGui::PushItemWidth(100_scaled); - ImGui::Combo("hex.builtin.nodes.crypto.aes.mode"_lang, &m_mode, "ECB\0CBC\0CFB128\0CTR\0GCM\0CCM\0OFB\0"); - ImGui::Combo("hex.builtin.nodes.crypto.aes.key_length"_lang, &m_keyLength, "128 Bits\000192 Bits\000256 Bits\000"); + ImGui::Combo("hex.builtin.nodes.crypto.aes.mode"_lang, &m_mode, "ECB\x00""CBC\x00""CFB128\x00""CTR\x00""GCM\x00""CCM\x00""OFB\x00"); + ImGui::Combo("hex.builtin.nodes.crypto.aes.key_length"_lang, &m_keyLength, "128 Bits\x00""192 Bits\x00""256 Bits\x00"); ImGui::PopItemWidth(); } diff --git a/plugins/builtin/source/content/data_processor_nodes/other_nodes.cpp b/plugins/builtin/source/content/data_processor_nodes/other_nodes.cpp index 011710a8a..e6726d31e 100644 --- a/plugins/builtin/source/content/data_processor_nodes/other_nodes.cpp +++ b/plugins/builtin/source/content/data_processor_nodes/other_nodes.cpp @@ -351,7 +351,7 @@ namespace hex::plugin::builtin { private: std::vector m_data; ImGuiExt::Texture m_texture; - u32 m_width, m_height; + u32 m_width = 0, m_height = 0; }; class NodeVisualizerByteDistribution : public dp::Node { diff --git a/plugins/builtin/source/content/tools/ieee_decoder.cpp b/plugins/builtin/source/content/tools/ieee_decoder.cpp index 6139c5915..4bdadce36 100644 --- a/plugins/builtin/source/content/tools/ieee_decoder.cpp +++ b/plugins/builtin/source/content/tools/ieee_decoder.cpp @@ -375,7 +375,7 @@ namespace hex::plugin::builtin { if (inputType == InputType::Regular) { try { ieee754statics.resultFloat = stod(decimalFloatingPointNumberString); - } catch(const std::invalid_argument& _) { + } catch (const std::invalid_argument &) { inputType = InputType::Invalid; } } else if (inputType == InputType::Infinity) { diff --git a/plugins/builtin/source/content/tools/math_eval.cpp b/plugins/builtin/source/content/tools/math_eval.cpp index de1136ec3..d31aedcae 100644 --- a/plugins/builtin/source/content/tools/math_eval.cpp +++ b/plugins/builtin/source/content/tools/math_eval.cpp @@ -106,8 +106,8 @@ namespace hex::plugin::builtin { if (ImGui::BeginTable("##mathWrapper", 3)) { ImGui::TableSetupColumn("##keypad", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoResize); - ImGui::TableSetupColumn("##results", ImGuiTableColumnFlags_WidthStretch, 0.666); - ImGui::TableSetupColumn("##variables", ImGuiTableColumnFlags_WidthStretch, 0.666); + ImGui::TableSetupColumn("##results", ImGuiTableColumnFlags_WidthStretch, 0.666F); + ImGui::TableSetupColumn("##variables", ImGuiTableColumnFlags_WidthStretch, 0.666F); ImGui::TableNextRow(); ImGui::TableNextColumn(); diff --git a/plugins/builtin/source/content/ui_items.cpp b/plugins/builtin/source/content/ui_items.cpp index 9f6efe7cb..0e149a2c5 100644 --- a/plugins/builtin/source/content/ui_items.cpp +++ b/plugins/builtin/source/content/ui_items.cpp @@ -179,7 +179,7 @@ namespace hex::plugin::builtin { // Draw background { const ImVec2 margin = scaled({ 15, 15 }); - drawList->AddRectFilled(windowPos, windowPos + windowSize, ImGui::GetColorU32(ImGuiCol_WindowBg, 200.0/255.0)); + drawList->AddRectFilled(windowPos, windowPos + windowSize, ImGui::GetColorU32(ImGuiCol_WindowBg, 200.0F / 255.0F)); drawList->AddRect(windowPos + margin, (windowPos + windowSize) - margin, ImGuiExt::GetCustomColorU32(ImGuiCustomCol_Highlight), 10_scaled, ImDrawFlags_None, 7.5_scaled); } diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp index 2b9cab739..b7539b49b 100644 --- a/plugins/builtin/source/content/welcome_screen.cpp +++ b/plugins/builtin/source/content/welcome_screen.cpp @@ -490,9 +490,9 @@ namespace hex::plugin::builtin { if (ImGui::Begin("ImHexDockSpace", nullptr, ImGuiWindowFlags_NoBringToFrontOnFocus)) { if (!ImHexApi::Provider::isValid()) { static auto title = []{ - std::array title = {}; - ImFormatString(title.data(), title.size(), "%s/DockSpace_%08X", ImGui::GetCurrentWindowRead()->Name, ImGui::GetID("ImHexMainDock")); - return title; + std::array result = {}; + ImFormatString(result.data(), result.size(), "%s/DockSpace_%08X", ImGui::GetCurrentWindowRead()->Name, ImGui::GetID("ImHexMainDock")); + return result; }(); if (ImGui::Begin(title.data(), nullptr, ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBringToFrontOnFocus)) { diff --git a/plugins/diffing/CMakeLists.txt b/plugins/diffing/CMakeLists.txt index 0e93d9cd9..bb2469739 100644 --- a/plugins/diffing/CMakeLists.txt +++ b/plugins/diffing/CMakeLists.txt @@ -8,6 +8,9 @@ else() set(BUILD_TESTING OFF CACHE BOOL "" FORCE) add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/edlib ${CMAKE_CURRENT_BINARY_DIR}/edlib EXCLUDE_FROM_ALL) enableUnityBuild(edlib) + if (MSVC) + target_compile_options(edlib PRIVATE /wd4244) + endif () endif() add_imhex_plugin( diff --git a/plugins/diffing/source/content/views/view_diff.cpp b/plugins/diffing/source/content/views/view_diff.cpp index 7efe0b817..316c64c80 100644 --- a/plugins/diffing/source/content/views/view_diff.cpp +++ b/plugins/diffing/source/content/views/view_diff.cpp @@ -204,7 +204,7 @@ namespace hex::plugin::diffing { const auto availableSize = ImGui::GetContentRegionAvail(); auto diffingColumnSize = availableSize; - diffingColumnSize.y *= 3.5 / 5.0; + diffingColumnSize.y *= 3.5F / 5.0F; diffingColumnSize.y -= ImGui::GetTextLineHeightWithSpacing(); diffingColumnSize.y += height; diff --git a/plugins/disassembler/CMakeLists.txt b/plugins/disassembler/CMakeLists.txt index 4420e7ba8..fc8147280 100644 --- a/plugins/disassembler/CMakeLists.txt +++ b/plugins/disassembler/CMakeLists.txt @@ -10,6 +10,8 @@ if (NOT USE_SYSTEM_CAPSTONE) add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/capstone ${CMAKE_CURRENT_BINARY_DIR}/capstone EXCLUDE_FROM_ALL) if (NOT MSVC) target_compile_options(capstone PRIVATE -Wno-unused-function) + else() + target_compile_options(capstone PRIVATE /wd4005) endif() set(CAPSTONE_LIBRARY "capstone") set(CAPSTONE_INCLUDE_DIR ${THIRD_PARTY_LIBS_FOLDER}/capstone/include) diff --git a/plugins/ui/source/ui/hex_editor.cpp b/plugins/ui/source/ui/hex_editor.cpp index 343982833..b93a53633 100644 --- a/plugins/ui/source/ui/hex_editor.cpp +++ b/plugins/ui/source/ui/hex_editor.cpp @@ -304,6 +304,9 @@ namespace hex::ui { void HexEditor::drawCell(u64 address, u8 *data, size_t size, bool hovered, CellType cellType) { + ImGui::PushID(address + 1); + ON_SCOPE_EXIT { ImGui::PopID(); }; + static DataVisualizerAscii asciiVisualizer; if (m_shouldUpdateEditingValue && address == m_editingAddress) { diff --git a/plugins/visualizers/source/content/pl_visualizers/timestamp.cpp b/plugins/visualizers/source/content/pl_visualizers/timestamp.cpp index 9be992786..3d6faa6c7 100644 --- a/plugins/visualizers/source/content/pl_visualizers/timestamp.cpp +++ b/plugins/visualizers/source/content/pl_visualizers/timestamp.cpp @@ -83,8 +83,8 @@ namespace hex::plugin::visualizers { // Draw clock sections and numbers for (u8 i = 0; i < 12; ++i) { auto text = hex::format("{}", (((i + 2) % 12) + 1)); - drawList->AddLine(center + sectionPos(i) * size / 2.2, center + sectionPos(i) * size / 2, ImGui::GetColorU32(ImGuiCol_TextDisabled), 1_scaled); - drawList->AddText(center + sectionPos(i) * size / 3 - ImGui::CalcTextSize(text.c_str()) / 2, ImGui::GetColorU32(ImGuiCol_Text), text.c_str()); + drawList->AddLine(center + sectionPos(i) * size / 2.2F, center + sectionPos(i) * size / 2, ImGui::GetColorU32(ImGuiCol_TextDisabled), 1_scaled); + drawList->AddText(center + sectionPos(i) * size / 3.0F - ImGui::CalcTextSize(text.c_str()) / 2, ImGui::GetColorU32(ImGuiCol_Text), text.c_str()); } // Draw hour hand diff --git a/plugins/yara_rules/CMakeLists.txt b/plugins/yara_rules/CMakeLists.txt index fe3e81608..0f6135ca1 100644 --- a/plugins/yara_rules/CMakeLists.txt +++ b/plugins/yara_rules/CMakeLists.txt @@ -5,6 +5,9 @@ include(ImHexPlugin) if (NOT USE_SYSTEM_YARA) add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/yara ${CMAKE_CURRENT_BINARY_DIR}/yara EXCLUDE_FROM_ALL) set(YARA_LIBRARIES libyara) + if (MSVC) + target_compile_options(capstone PRIVATE /wd4005) + endif () else() find_package(Yara REQUIRED) endif() diff --git a/plugins/yara_rules/source/content/yara_rule.cpp b/plugins/yara_rules/source/content/yara_rule.cpp index adeae2b86..43888df9b 100644 --- a/plugins/yara_rules/source/content/yara_rule.cpp +++ b/plugins/yara_rules/source/content/yara_rule.cpp @@ -9,12 +9,17 @@ #if !defined(_MSC_VER) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" +#else + #pragma warning(push) + #pragma warning(disable: 4324) #endif #include #if !defined(_MSC_VER) #pragma GCC diagnostic pop +#else + #pragma warning(pop) #endif namespace hex::plugin::yara {