From 7f75706584161d0bd2499343be5778944fc84bb2 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 14 Dec 2024 21:35:54 +0100 Subject: [PATCH] impr: Replace hex::unused with std::ignore --- lib/libimhex/include/hex.hpp | 1 - .../include/hex/data_processor/node.hpp | 5 +- .../hex/helpers/http_requests_emscripten.hpp | 7 ++- .../include/hex/helpers/intrinsics.hpp | 9 --- lib/libimhex/include/hex/plugin.hpp | 2 +- .../include/hex/providers/provider.hpp | 2 +- lib/libimhex/source/api/imhex_api.cpp | 2 +- lib/libimhex/source/api/plugin_manager.cpp | 6 +- lib/libimhex/source/api/task_manager.cpp | 2 +- lib/libimhex/source/helpers/default_paths.cpp | 2 +- lib/libimhex/source/helpers/fs.cpp | 16 +++--- .../helpers/http_requests_emscripten.cpp | 10 +++- lib/libimhex/source/helpers/patches.cpp | 6 +- lib/libimhex/source/helpers/utils.cpp | 8 +-- main/gui/source/init/run/cli.cpp | 2 +- main/gui/source/init/run/web.cpp | 4 +- main/gui/source/messaging/linux.cpp | 5 +- main/gui/source/messaging/macos.cpp | 5 +- main/gui/source/messaging/web.cpp | 5 +- main/gui/source/window/window.cpp | 2 +- .../content/providers/null_provider.hpp | 14 ++++- .../undo_operations/operation_bookmark.hpp | 4 +- .../content/views/view_pattern_editor.hpp | 2 +- .../builtin/source/content/achievements.cpp | 2 +- .../source/content/command_line_interface.cpp | 4 +- .../content/data_information_sections.cpp | 2 +- .../builtin/source/content/data_inspector.cpp | 54 ++++++++++-------- .../source/content/data_visualizers.cpp | 56 +++++++++++-------- plugins/builtin/source/content/events.cpp | 4 +- .../content/providers/intel_hex_provider.cpp | 4 +- .../providers/process_memory_provider.cpp | 4 +- .../source/content/tools/math_eval.cpp | 2 +- .../source/content/views/view_bookmarks.cpp | 4 +- .../source/content/views/view_find.cpp | 6 +- .../source/content/views/view_patches.cpp | 2 +- .../content/views/view_pattern_editor.cpp | 8 ++- .../builtin/source/content/welcome_screen.cpp | 2 +- .../source/content/pl_functions.cpp | 15 +++-- .../source/content/views/view_hashes.cpp | 2 +- plugins/ui/source/ui/hex_editor.cpp | 7 ++- plugins/ui/source/ui/pattern_drawer.cpp | 2 +- .../windows/source/views/view_tty_console.cpp | 8 +-- .../yara_rules/source/content/yara_rule.cpp | 3 +- 43 files changed, 173 insertions(+), 139 deletions(-) delete mode 100644 lib/libimhex/include/hex/helpers/intrinsics.hpp diff --git a/lib/libimhex/include/hex.hpp b/lib/libimhex/include/hex.hpp index 4a1d299ef..c1e553612 100644 --- a/lib/libimhex/include/hex.hpp +++ b/lib/libimhex/include/hex.hpp @@ -1,4 +1,3 @@ #pragma once #include -#include \ No newline at end of file diff --git a/lib/libimhex/include/hex/data_processor/node.hpp b/lib/libimhex/include/hex/data_processor/node.hpp index e9bc297dc..6a869cedb 100644 --- a/lib/libimhex/include/hex/data_processor/node.hpp +++ b/lib/libimhex/include/hex/data_processor/node.hpp @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -47,8 +46,8 @@ namespace hex::dp { virtual void process() = 0; virtual void reset() { } - virtual void store(nlohmann::json &j) const { hex::unused(j); } - virtual void load(const nlohmann::json &j) { hex::unused(j); } + virtual void store(nlohmann::json &j) const { std::ignore = j; } + virtual void load(const nlohmann::json &j) { std::ignore = j; } struct NodeError { Node *node; diff --git a/lib/libimhex/include/hex/helpers/http_requests_emscripten.hpp b/lib/libimhex/include/hex/helpers/http_requests_emscripten.hpp index 7098dec69..94ba005c6 100644 --- a/lib/libimhex/include/hex/helpers/http_requests_emscripten.hpp +++ b/lib/libimhex/include/hex/helpers/http_requests_emscripten.hpp @@ -25,13 +25,16 @@ template std::future> HttpRequest::uploadFile(const std::fs::path &path, const std::string &mimeName) { - hex::unused(path, mimeName); + std::ignore = path; + std::ignore = mimeName; throw std::logic_error("Not implemented"); } template std::future> HttpRequest::uploadFile(std::vector data, const std::string &mimeName, const std::fs::path &fileName) { - hex::unused(data, mimeName, fileName); + std::ignore = data; + std::ignore = mimeName; + std::ignore = fileName; throw std::logic_error("Not implemented"); } diff --git a/lib/libimhex/include/hex/helpers/intrinsics.hpp b/lib/libimhex/include/hex/helpers/intrinsics.hpp deleted file mode 100644 index d09db4801..000000000 --- a/lib/libimhex/include/hex/helpers/intrinsics.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -namespace hex { - - void unused(auto && ... x) { - ((void)x, ...); - } - -} \ No newline at end of file diff --git a/lib/libimhex/include/hex/plugin.hpp b/lib/libimhex/include/hex/plugin.hpp index 4e1cfd32f..1be3eb832 100644 --- a/lib/libimhex/include/hex/plugin.hpp +++ b/lib/libimhex/include/hex/plugin.hpp @@ -70,7 +70,7 @@ void* PluginSubCommandsFunctionHelper::getSubCommands() { #define IMHEX_LIBRARY_SETUP(name) IMHEX_LIBRARY_SETUP_IMPL(name) #define IMHEX_LIBRARY_SETUP_IMPL(name) \ - namespace { static struct EXIT_HANDLER { ~EXIT_HANDLER() { hex::log::debug("Unloaded library '{}'", name); } } HANDLER; } \ + namespace { static struct EXIT_HANDLER { ~EXIT_HANDLER() { hex::log::info("Unloaded library '{}'", name); } } HANDLER; } \ IMHEX_PLUGIN_VISIBILITY_PREFIX void WOLV_TOKEN_CONCAT(initializeLibrary_, IMHEX_PLUGIN_NAME)(); \ IMHEX_PLUGIN_VISIBILITY_PREFIX const char *WOLV_TOKEN_CONCAT(getLibraryName_, IMHEX_PLUGIN_NAME)() { return name; } \ IMHEX_PLUGIN_VISIBILITY_PREFIX void WOLV_TOKEN_CONCAT(setImGuiContext_, IMHEX_PLUGIN_NAME)(ImGuiContext *ctx) { \ diff --git a/lib/libimhex/include/hex/providers/provider.hpp b/lib/libimhex/include/hex/providers/provider.hpp index 90da1c4c4..9a63c5a31 100644 --- a/lib/libimhex/include/hex/providers/provider.hpp +++ b/lib/libimhex/include/hex/providers/provider.hpp @@ -165,7 +165,7 @@ namespace hex::prv { void insert(u64 offset, u64 size); void remove(u64 offset, u64 size); - virtual void resizeRaw(u64 newSize) { hex::unused(newSize); } + virtual void resizeRaw(u64 newSize) { std::ignore = newSize; } virtual void insertRaw(u64 offset, u64 size); virtual void removeRaw(u64 offset, u64 size); diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index 2233c14d8..83611e2a5 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -815,7 +815,7 @@ namespace hex { return std::string(GIT_COMMIT_HASH_LONG).substr(0, 7); } #else - hex::unused(longHash); + std::ignore = longHash; return "Unknown"; #endif } diff --git a/lib/libimhex/source/api/plugin_manager.cpp b/lib/libimhex/source/api/plugin_manager.cpp index 884fff3cf..ecb6fd0bb 100644 --- a/lib/libimhex/source/api/plugin_manager.cpp +++ b/lib/libimhex/source/api/plugin_manager.cpp @@ -112,10 +112,6 @@ namespace hex { } Plugin::~Plugin() { - if (isLoaded()) { - log::info("Trying to unload plugin '{}'", getPluginName()); - } - unloadLibrary(m_handle, m_path); } @@ -335,7 +331,7 @@ namespace hex { void PluginManager::initializeNewPlugins() { for (const auto &plugin : getPlugins()) { if (!plugin.isLoaded()) - hex::unused(plugin.initializePlugin()); + std::ignore = plugin.initializePlugin(); } } diff --git a/lib/libimhex/source/api/task_manager.cpp b/lib/libimhex/source/api/task_manager.cpp index 10e9521b5..717f920cd 100644 --- a/lib/libimhex/source/api/task_manager.cpp +++ b/lib/libimhex/source/api/task_manager.cpp @@ -490,7 +490,7 @@ namespace hex { #elif defined(OS_LINUX) pthread_setname_np(pthread_self(), name.c_str()); #elif defined(OS_WEB) - hex::unused(name); + std::ignore = name; #elif defined(OS_MACOS) pthread_setname_np(name.c_str()); #endif diff --git a/lib/libimhex/source/helpers/default_paths.cpp b/lib/libimhex/source/helpers/default_paths.cpp index 27e006d1b..7f437a0de 100644 --- a/lib/libimhex/source/helpers/default_paths.cpp +++ b/lib/libimhex/source/helpers/default_paths.cpp @@ -79,7 +79,7 @@ namespace hex::paths { #elif defined(OS_MACOS) return getDataPaths(includeSystemFolders); #elif defined(OS_LINUX) || defined(OS_WEB) - hex::unused(includeSystemFolders); + std::ignore = includeSystemFolders; return {xdg::ConfigHomeDir() / "imhex"}; #endif } diff --git a/lib/libimhex/source/helpers/fs.cpp b/lib/libimhex/source/helpers/fs.cpp index caf39c33b..cbe5a0cf7 100644 --- a/lib/libimhex/source/helpers/fs.cpp +++ b/lib/libimhex/source/helpers/fs.cpp @@ -51,13 +51,11 @@ namespace hex::fs { } #if defined(OS_WINDOWS) - hex::unused( - ShellExecuteW(nullptr, L"open", filePath.c_str(), nullptr, nullptr, SW_SHOWNORMAL) - ); + std::ignore = ShellExecuteW(nullptr, L"open", filePath.c_str(), nullptr, nullptr, SW_SHOWNORMAL); #elif defined(OS_MACOS) - hex::unused(system( + std::ignore = system( hex::format("open {}", wolv::util::toUTF8String(filePath)).c_str() - )); + ); #elif defined(OS_LINUX) executeCmd({"xdg-open", wolv::util::toUTF8String(filePath)}); #endif @@ -73,9 +71,9 @@ namespace hex::fs { auto args = fmt::format(L"\"{}\"", dirPath.c_str()); ShellExecuteW(nullptr, L"open", L"explorer.exe", args.c_str(), nullptr, SW_SHOWNORMAL); #elif defined(OS_MACOS) - hex::unused(system( + std::ignore = system( hex::format("open {}", wolv::util::toUTF8String(dirPath)).c_str() - )); + ); #elif defined(OS_LINUX) executeCmd({"xdg-open", wolv::util::toUTF8String(dirPath)}); #endif @@ -91,12 +89,12 @@ namespace hex::fs { auto args = fmt::format(L"/select,\"{}\"", selectedFilePath.c_str()); ShellExecuteW(nullptr, L"open", L"explorer.exe", args.c_str(), nullptr, SW_SHOWNORMAL); #elif defined(OS_MACOS) - hex::unused(system( + std::ignore = system( hex::format( R"(osascript -e 'tell application "Finder" to reveal POSIX file "{}"')", wolv::util::toUTF8String(selectedFilePath) ).c_str() - )); + ); system(R"(osascript -e 'tell application "Finder" to activate')"); #elif defined(OS_LINUX) // Fallback to only opening the folder for now diff --git a/lib/libimhex/source/helpers/http_requests_emscripten.cpp b/lib/libimhex/source/helpers/http_requests_emscripten.cpp index 42b8b2d84..094d4dcf2 100644 --- a/lib/libimhex/source/helpers/http_requests_emscripten.cpp +++ b/lib/libimhex/source/helpers/http_requests_emscripten.cpp @@ -41,17 +41,21 @@ namespace hex { } void HttpRequest::setProxyUrl(std::string proxy) { - hex::unused(proxy); + std::ignore = proxy; } void HttpRequest::setProxyState(bool state) { - hex::unused(state); + std::ignore = state; } void HttpRequest::checkProxyErrors() { } int HttpRequest::progressCallback(void *contents, curl_off_t dlTotal, curl_off_t dlNow, curl_off_t ulTotal, curl_off_t ulNow) { - hex::unused(contents, dlTotal, dlNow, ulTotal, ulNow); + std::ignore = contents; + std::ignore = dlTotal; + std::ignore = dlNow; + std::ignore = ulTotal; + std::ignore = ulNow; return -1; } } diff --git a/lib/libimhex/source/helpers/patches.cpp b/lib/libimhex/source/helpers/patches.cpp index f60a03286..5fb2073e8 100644 --- a/lib/libimhex/source/helpers/patches.cpp +++ b/lib/libimhex/source/helpers/patches.cpp @@ -28,7 +28,9 @@ namespace hex { void close() override { } void readRaw(u64 offset, void *buffer, size_t size) override { - hex::unused(offset, buffer, size); + std::ignore = offset; + std::ignore = buffer; + std::ignore = size; } void writeRaw(u64 offset, const void *buffer, size_t size) override { @@ -44,7 +46,7 @@ namespace hex { } void resizeRaw(u64 newSize) override { - hex::unused(newSize); + std::ignore = newSize; } void insertRaw(u64 offset, u64 size) override { diff --git a/lib/libimhex/source/helpers/utils.cpp b/lib/libimhex/source/helpers/utils.cpp index b8edbc445..afef81b35 100644 --- a/lib/libimhex/source/helpers/utils.cpp +++ b/lib/libimhex/source/helpers/utils.cpp @@ -336,13 +336,13 @@ namespace hex { void startProgram(const std::string &command) { #if defined(OS_WINDOWS) - hex::unused(system(hex::format("start {0}", command).c_str())); + std::ignore = system(hex::format("start {0}", command).c_str()); #elif defined(OS_MACOS) - hex::unused(system(hex::format("open {0}", command).c_str())); + std::ignore = system(hex::format("open {0}", command).c_str()); #elif defined(OS_LINUX) executeCmd({"xdg-open", command}); #elif defined(OS_WEB) - hex::unused(command); + std::ignore = command; #endif } @@ -839,7 +839,7 @@ namespace hex { return dlopen(info.dli_fname, RTLD_LAZY); #else - hex::unused(symbol); + std::ignore = symbol; return nullptr; #endif } diff --git a/main/gui/source/init/run/cli.cpp b/main/gui/source/init/run/cli.cpp index 4090b9d9f..e227af9f2 100644 --- a/main/gui/source/init/run/cli.cpp +++ b/main/gui/source/init/run/cli.cpp @@ -35,7 +35,7 @@ namespace hex::init { std::vector args; #if defined (OS_WINDOWS) - hex::unused(argv); + std::ignore = argv; // On Windows, argv contains UTF-16 encoded strings, so we need to convert them to UTF-8 auto convertedCommandLine = ::CommandLineToArgvW(::GetCommandLineW(), &argc); diff --git a/main/gui/source/init/run/web.cpp b/main/gui/source/init/run/web.cpp index 41c7c5241..ac9ef0abf 100644 --- a/main/gui/source/init/run/web.cpp +++ b/main/gui/source/init/run/web.cpp @@ -43,7 +43,9 @@ // Clean up everything after the main window is closed emscripten_set_beforeunload_callback(nullptr, [](int eventType, const void *reserved, void *userData) { - hex::unused(eventType, reserved, userData); + std::ignore = eventType; + std::ignore = reserved; + std::ignore = userData; emscripten_cancel_main_loop(); diff --git a/main/gui/source/messaging/linux.cpp b/main/gui/source/messaging/linux.cpp index bf3b3fafc..a7ddafe62 100644 --- a/main/gui/source/messaging/linux.cpp +++ b/main/gui/source/messaging/linux.cpp @@ -2,7 +2,6 @@ #include -#include #include #include "messaging.hpp" @@ -10,8 +9,8 @@ namespace hex::messaging { void sendToOtherInstance(const std::string &eventName, const std::vector &args) { - hex::unused(eventName); - hex::unused(args); + std::ignore = eventName; + std::ignore = args; log::error("Unimplemented function 'sendToOtherInstance()' called"); } diff --git a/main/gui/source/messaging/macos.cpp b/main/gui/source/messaging/macos.cpp index 45e7df00f..c484bc79e 100644 --- a/main/gui/source/messaging/macos.cpp +++ b/main/gui/source/messaging/macos.cpp @@ -2,7 +2,6 @@ #include -#include #include #include "messaging.hpp" @@ -10,8 +9,8 @@ namespace hex::messaging { void sendToOtherInstance(const std::string &eventName, const std::vector &args) { - hex::unused(eventName); - hex::unused(args); + std::ignore = eventName; + std::ignore = args; log::error("Unimplemented function 'sendToOtherInstance()' called"); } diff --git a/main/gui/source/messaging/web.cpp b/main/gui/source/messaging/web.cpp index 24954b7ef..4e338f13a 100644 --- a/main/gui/source/messaging/web.cpp +++ b/main/gui/source/messaging/web.cpp @@ -2,7 +2,6 @@ #include -#include #include #include "messaging.hpp" @@ -10,8 +9,8 @@ namespace hex::messaging { void sendToOtherInstance(const std::string &eventName, const std::vector &args) { - hex::unused(eventName); - hex::unused(args); + std::ignore = eventName; + std::ignore = args; log::error("Unimplemented function 'sendToOtherInstance()' called"); } diff --git a/main/gui/source/window/window.cpp b/main/gui/source/window/window.cpp index 31ff78958..00f2f234e 100644 --- a/main/gui/source/window/window.cpp +++ b/main/gui/source/window/window.cpp @@ -883,7 +883,7 @@ namespace hex { // Register key press callback glfwSetInputMode(m_window, GLFW_LOCK_KEY_MODS, GLFW_TRUE); glfwSetKeyCallback(m_window, [](GLFWwindow *window, int key, int scanCode, int action, int mods) { - hex::unused(mods); + std::ignore = mods; // Handle A-Z keys using their ASCII value instead of the keycode diff --git a/plugins/builtin/include/content/providers/null_provider.hpp b/plugins/builtin/include/content/providers/null_provider.hpp index 675a8abaa..8a7f901d6 100644 --- a/plugins/builtin/include/content/providers/null_provider.hpp +++ b/plugins/builtin/include/content/providers/null_provider.hpp @@ -29,14 +29,22 @@ namespace hex::plugin::builtin { [[nodiscard]] bool open() override { return true; } void close() override { } - void readRaw(u64 offset, void *buffer, size_t size) override { hex::unused(offset, buffer, size); } - void writeRaw(u64 offset, const void *buffer, size_t size) override { hex::unused(offset, buffer, size); } + void readRaw(u64 offset, void *buffer, size_t size) override { + std::ignore = offset; + std::ignore = buffer; + std::ignore = size; + } + void writeRaw(u64 offset, const void *buffer, size_t size) override { + std::ignore = offset; + std::ignore = buffer; + std::ignore = size; + } [[nodiscard]] u64 getActualSize() const override { return 0x00; } [[nodiscard]] std::string getName() const override { return "None"; } [[nodiscard]] std::vector getDataDescription() const override { return { }; } - void loadSettings(const nlohmann::json &settings) override { hex::unused(settings); } + void loadSettings(const nlohmann::json &settings) override { std::ignore = settings; } [[nodiscard]] nlohmann::json storeSettings(nlohmann::json settings) const override { return settings; } [[nodiscard]] std::string getTypeName() const override { diff --git a/plugins/builtin/include/content/providers/undo_operations/operation_bookmark.hpp b/plugins/builtin/include/content/providers/undo_operations/operation_bookmark.hpp index 4751cb8c5..08572f7af 100644 --- a/plugins/builtin/include/content/providers/undo_operations/operation_bookmark.hpp +++ b/plugins/builtin/include/content/providers/undo_operations/operation_bookmark.hpp @@ -12,13 +12,13 @@ namespace hex::plugin::builtin::undo { m_entry(std::move(entry)) { } void undo(prv::Provider *provider) override { - hex::unused(provider); + std::ignore = provider; ImHexApi::Bookmarks::remove(m_entry.id); } void redo(prv::Provider *provider) override { - hex::unused(provider); + std::ignore = provider; auto &[region, name, comment, color, locked, id] = m_entry; diff --git a/plugins/builtin/include/content/views/view_pattern_editor.hpp b/plugins/builtin/include/content/views/view_pattern_editor.hpp index 703b0d471..38747bb52 100644 --- a/plugins/builtin/include/content/views/view_pattern_editor.hpp +++ b/plugins/builtin/include/content/views/view_pattern_editor.hpp @@ -363,7 +363,7 @@ namespace hex::plugin::builtin { }); wolv::io::File file(path, wolv::io::File::Mode::Read); - hex::unused(runtime.preprocessString(file.readString(), pl::api::Source::DefaultSource)); + std::ignore = runtime.preprocessString(file.readString(), pl::api::Source::DefaultSource); return m_patternNames[path]; }, diff --git a/plugins/builtin/source/content/achievements.cpp b/plugins/builtin/source/content/achievements.cpp index e8d34bd76..4806863d0 100644 --- a/plugins/builtin/source/content/achievements.cpp +++ b/plugins/builtin/source/content/achievements.cpp @@ -212,7 +212,7 @@ namespace hex::plugin::builtin { // Clear temporary achievements when the last provider is closed EventProviderChanged::subscribe([](hex::prv::Provider *oldProvider, const hex::prv::Provider *newProvider) { - hex::unused(oldProvider); + std::ignore = oldProvider; if (newProvider == nullptr) { AchievementManager::clearTemporary(); } diff --git a/plugins/builtin/source/content/command_line_interface.cpp b/plugins/builtin/source/content/command_line_interface.cpp index bfc1bdd85..4ce83f106 100644 --- a/plugins/builtin/source/content/command_line_interface.cpp +++ b/plugins/builtin/source/content/command_line_interface.cpp @@ -28,7 +28,7 @@ namespace hex::plugin::builtin { using namespace hex::literals; void handleVersionCommand(const std::vector &args) { - hex::unused(args); + std::ignore = args; hex::log::print(std::string(romfs::get("logo.ans").string()), ImHexApi::System::getImHexVersion(), @@ -40,7 +40,7 @@ namespace hex::plugin::builtin { } void handleHelpCommand(const std::vector &args) { - hex::unused(args); + std::ignore = args; hex::log::print( "ImHex - A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.\n" diff --git a/plugins/builtin/source/content/data_information_sections.cpp b/plugins/builtin/source/content/data_information_sections.cpp index 734210d73..11fc96320 100644 --- a/plugins/builtin/source/content/data_information_sections.cpp +++ b/plugins/builtin/source/content/data_information_sections.cpp @@ -19,7 +19,7 @@ namespace hex::plugin::builtin { ~InformationProvider() override = default; void process(Task &task, prv::Provider *provider, Region region) override { - hex::unused(task); + std::ignore = task; m_provider = provider; m_region = region; diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp index 97219242f..922c3f40e 100644 --- a/plugins/builtin/source/content/data_inspector.cpp +++ b/plugins/builtin/source/content/data_inspector.cpp @@ -129,7 +129,8 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.binary", sizeof(u8), [](auto buffer, auto endian, auto style) { - hex::unused(endian, style); + std::ignore = endian; + std::ignore = style; std::string binary = hex::format("0b{:08b}", buffer[0]); @@ -138,7 +139,7 @@ namespace hex::plugin::builtin { return binary; }; }, [](const std::string &value, std::endian endian) -> std::vector { - hex::unused(endian); + std::ignore = endian; std::string binary = value; if (binary.starts_with("0b")) @@ -269,7 +270,7 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.sleb128", 1, (sizeof(i128) * 8 / 7) + 1, [](auto buffer, auto endian, auto style) { - hex::unused(endian); + std::ignore = endian; auto format = (style == Style::Decimal) ? "{0}{1:d}" : ((style == Style::Hexadecimal) ? "{0}0x{1:X}" : "{0}0o{1:o}"); @@ -281,7 +282,7 @@ namespace hex::plugin::builtin { return [value] { ImGui::TextUnformatted(value.c_str()); return value; }; }, [](const std::string &value, std::endian endian) -> std::vector { - hex::unused(endian); + std::ignore = endian; return hex::crypt::encodeSleb128(std::strtoll(value.c_str(), nullptr, 0)); } @@ -289,7 +290,7 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.uleb128", 1, (sizeof(u128) * 8 / 7) + 1, [](auto buffer, auto endian, auto style) { - hex::unused(endian); + std::ignore = endian; auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? "0x{0:X}" : "0o{0:o}"); @@ -298,7 +299,7 @@ namespace hex::plugin::builtin { return [value] { ImGui::TextUnformatted(value.c_str()); return value; }; }, [](const std::string &value, std::endian endian) -> std::vector { - hex::unused(endian); + std::ignore = endian; return hex::crypt::encodeUleb128(std::strtoull(value.c_str(), nullptr, 0)); } @@ -306,7 +307,8 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.bool", sizeof(bool), [](auto buffer, auto endian, auto style) { - hex::unused(endian, style); + std::ignore = endian; + std::ignore = style; std::string value = [buffer] { switch (buffer[0]) { @@ -325,13 +327,14 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.ascii", sizeof(char8_t), [](auto buffer, auto endian, auto style) { - hex::unused(endian, style); + std::ignore = endian; + std::ignore = style; auto value = makePrintable(*reinterpret_cast(buffer.data())); return [value] { ImGuiExt::TextFormatted("'{0}'", value.c_str()); return value; }; }, [](const std::string &value, std::endian endian) -> std::vector { - hex::unused(endian); + std::ignore = endian; if (value.length() > 1) return { }; @@ -341,7 +344,7 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.wide", sizeof(wchar_t), [](auto buffer, auto endian, auto style) { - hex::unused(style); + std::ignore = style; wchar_t wideChar = '\x00'; std::memcpy(&wideChar, buffer.data(), std::min(sizeof(wchar_t), buffer.size())); @@ -369,7 +372,8 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.utf8", sizeof(char8_t) * 4, [](auto buffer, auto endian, auto style) { - hex::unused(endian, style); + std::ignore = endian; + std::ignore = style; char utf8Buffer[5] = { 0 }; char codepointString[5] = { 0 }; @@ -391,7 +395,9 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.string", 1, [](auto buffer, auto endian, auto style) { - hex::unused(buffer, endian, style); + std::ignore = buffer; + std::ignore = endian; + std::ignore = style; auto currSelection = ImHexApi::HexEditor::getSelection(); @@ -416,7 +422,7 @@ namespace hex::plugin::builtin { return [value, copyValue] { ImGuiExt::TextFormatted("\"{0}\"", value.c_str()); return copyValue; }; }, [](const std::string &value, std::endian endian) -> std::vector { - hex::unused(endian); + std::ignore = endian; return hex::decodeByteString(value); } @@ -424,7 +430,9 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.string16", 2, [](auto buffer, auto endian, auto style) { - hex::unused(buffer, endian, style); + std::ignore = buffer; + std::ignore = endian; + std::ignore = style; auto currSelection = ImHexApi::HexEditor::getSelection(); @@ -456,7 +464,7 @@ namespace hex::plugin::builtin { return [value, copyValue] { ImGuiExt::TextFormatted("L\"{0}\"", value.c_str()); return copyValue; }; }, [](const std::string &value, std::endian endian) -> std::vector { - hex::unused(endian); + std::ignore = endian; return hex::decodeByteString(value); } @@ -465,7 +473,7 @@ namespace hex::plugin::builtin { #if defined(OS_WINDOWS) ContentRegistry::DataInspector::add("hex.builtin.inspector.time32", sizeof(u32), [](auto buffer, auto endian, auto style) { - hex::unused(style); + std::ignore = style; auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); @@ -480,7 +488,7 @@ namespace hex::plugin::builtin { }); ContentRegistry::DataInspector::add("hex.builtin.inspector.time64", sizeof(u64), [](auto buffer, auto endian, auto style) { - hex::unused(style); + std::ignore = style; auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); @@ -497,7 +505,7 @@ namespace hex::plugin::builtin { #else ContentRegistry::DataInspector::add("hex.builtin.inspector.time", sizeof(time_t), [](auto buffer, auto endian, auto style) { - hex::unused(style); + std::ignore = style; auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); @@ -526,7 +534,7 @@ namespace hex::plugin::builtin { }; ContentRegistry::DataInspector::add("hex.builtin.inspector.dos_date", sizeof(DOSDate), [](auto buffer, auto endian, auto style) { - hex::unused(style); + std::ignore = style; DOSDate date = { }; std::memcpy(&date, buffer.data(), sizeof(DOSDate)); @@ -538,7 +546,7 @@ namespace hex::plugin::builtin { }); ContentRegistry::DataInspector::add("hex.builtin.inspector.dos_time", sizeof(DOSTime), [](auto buffer, auto endian, auto style) { - hex::unused(style); + std::ignore = style; DOSTime time = { }; std::memcpy(&time, buffer.data(), sizeof(DOSTime)); @@ -550,7 +558,7 @@ namespace hex::plugin::builtin { }); ContentRegistry::DataInspector::add("hex.builtin.inspector.guid", sizeof(GUID), [](auto buffer, auto endian, auto style) { - hex::unused(style); + std::ignore = style; GUID guid = { }; std::memcpy(&guid, buffer.data(), sizeof(GUID)); @@ -572,7 +580,7 @@ namespace hex::plugin::builtin { }); ContentRegistry::DataInspector::add("hex.builtin.inspector.rgba8", sizeof(u32), [](auto buffer, auto endian, auto style) { - hex::unused(style); + std::ignore = style; ImColor value(hex::changeEndianness(*reinterpret_cast(buffer.data()), endian)); @@ -585,7 +593,7 @@ namespace hex::plugin::builtin { }); ContentRegistry::DataInspector::add("hex.builtin.inspector.rgb565", sizeof(u16), [](auto buffer, auto endian, auto style) { - hex::unused(style); + std::ignore = style; auto value = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); ImColor color((value & 0x1F) << 3, ((value >> 5) & 0x3F) << 2, ((value >> 11) & 0x1F) << 3, 0xFF); diff --git a/plugins/builtin/source/content/data_visualizers.cpp b/plugins/builtin/source/content/data_visualizers.cpp index 1810938d6..d4fb5ccd9 100644 --- a/plugins/builtin/source/content/data_visualizers.cpp +++ b/plugins/builtin/source/content/data_visualizers.cpp @@ -16,7 +16,7 @@ namespace hex::plugin::builtin { explicit DataVisualizerHexadecimal(const std::string &name) : DataVisualizer(name, ByteCount, CharCount) { } void draw(u64 address, const u8 *data, size_t size, bool upperCase) override { - hex::unused(address); + std::ignore = address; if (size == ByteCount) ImGuiExt::TextFormatted(upperCase ? "{:0{}X}" : "{:0{}x}", *reinterpret_cast(data), sizeof(T) * 2); @@ -25,7 +25,8 @@ namespace hex::plugin::builtin { } bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override { - hex::unused(address, startedEditing); + std::ignore = address; + std::ignore = startedEditing; if (size == ByteCount) { return drawDefaultScalarEditingTextBox(address, getFormatString(upperCase), ImGuiExt::getImGuiDataType(), data, ImGuiInputTextFlags_CharsHexadecimal); @@ -35,8 +36,8 @@ namespace hex::plugin::builtin { } private: - constexpr static inline auto ByteCount = sizeof(T); - constexpr static inline auto CharCount = ByteCount * 2; + constexpr static auto ByteCount = sizeof(T); + constexpr static auto CharCount = ByteCount * 2; const static inline auto FormattingUpperCase = hex::format("%0{}{}X", CharCount, ImGuiExt::getFormatLengthSpecifier()); const static inline auto FormattingLowerCase = hex::format("%0{}{}x", CharCount, ImGuiExt::getFormatLengthSpecifier()); @@ -54,7 +55,7 @@ namespace hex::plugin::builtin { DataVisualizerHexii() : DataVisualizer("hex.builtin.visualizer.hexii", ByteCount, CharCount) { } void draw(u64 address, const u8 *data, size_t size, bool upperCase) override { - hex::unused(address); + std::ignore = address; if (size == ByteCount) { const u8 c = data[0]; @@ -78,7 +79,8 @@ namespace hex::plugin::builtin { } bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override { - hex::unused(address, startedEditing); + std::ignore = address; + std::ignore = startedEditing; if (size == ByteCount) { return drawDefaultScalarEditingTextBox(address, getFormatString(upperCase), ImGuiExt::getImGuiDataType(), data, ImGuiInputTextFlags_CharsHexadecimal); @@ -108,7 +110,8 @@ namespace hex::plugin::builtin { explicit DataVisualizerDecimal(const std::string &name) : DataVisualizer(name, ByteCount, CharCount) { } void draw(u64 address, const u8 *data, size_t size, bool upperCase) override { - hex::unused(address, upperCase); + std::ignore = address; + std::ignore = upperCase; if (size == ByteCount) { if (std::is_signed_v) @@ -121,7 +124,9 @@ namespace hex::plugin::builtin { } bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override { - hex::unused(address, upperCase, startedEditing); + std::ignore = address; + std::ignore = upperCase; + std::ignore = startedEditing; if (size == ByteCount) { return drawDefaultScalarEditingTextBox(address, FormatString.c_str(), ImGuiExt::getImGuiDataType(), data, ImGuiInputTextFlags_None); @@ -131,8 +136,8 @@ namespace hex::plugin::builtin { } private: - constexpr static inline auto ByteCount = sizeof(T); - constexpr static inline auto CharCount = std::numeric_limits::digits10 + 2; + constexpr static auto ByteCount = sizeof(T); + constexpr static auto CharCount = std::numeric_limits::digits10 + 2; const static inline auto FormatString = hex::format("%{}{}{}", CharCount, ImGuiExt::getFormatLengthSpecifier(), std::is_signed_v ? "d" : "u"); @@ -149,7 +154,7 @@ namespace hex::plugin::builtin { explicit DataVisualizerFloatingPoint(const std::string &name) : DataVisualizer(name, ByteCount, CharCount) { } void draw(u64 address, const u8 *data, size_t size, bool upperCase) override { - hex::unused(address); + std::ignore = address; if (size == ByteCount) ImGui::Text(getFormatString(upperCase), *reinterpret_cast(data)); @@ -158,7 +163,9 @@ namespace hex::plugin::builtin { } bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override { - hex::unused(address, upperCase, startedEditing); + std::ignore = address; + std::ignore = upperCase; + std::ignore = startedEditing; if (size == ByteCount) { return drawDefaultScalarEditingTextBox(address, getFormatString(upperCase), ImGuiExt::getImGuiDataType(), data, ImGuiInputTextFlags_CharsScientific); @@ -188,7 +195,7 @@ namespace hex::plugin::builtin { explicit DataVisualizerFloatingPoint(const std::string &name) : DataVisualizer(name, ByteCount, CharCount) { } void draw(u64 address, const u8 *data, size_t size, bool upperCase) override { - hex::unused(address); + std::ignore = address; if (size == ByteCount) ImGui::Text(getFormatString(upperCase), hex::float16ToFloat32(*reinterpret_cast(data))); @@ -197,15 +204,15 @@ namespace hex::plugin::builtin { } bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override { - hex::unused(startedEditing); + std::ignore = startedEditing; this->draw(address, data, size, upperCase); return false; } private: - constexpr static inline auto ByteCount = sizeof(Float16); - constexpr static inline auto CharCount = 14; + constexpr static auto ByteCount = sizeof(Float16); + constexpr static auto CharCount = 14; const static inline auto FormatStringUpperCase = hex::format("%{}G", CharCount); const static inline auto FormatStringLowerCase = hex::format("%{}g", CharCount); @@ -223,7 +230,8 @@ namespace hex::plugin::builtin { DataVisualizerRGBA8() : DataVisualizer("hex.builtin.visualizer.rgba8", 4, 2) { } void draw(u64 address, const u8 *data, size_t size, bool upperCase) override { - hex::unused(address, upperCase); + std::ignore = address; + std::ignore = upperCase; if (size == 4) ImGui::ColorButton("##color", ImColor(data[0], data[1], data[2], data[3]), ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoDragDrop, ImVec2(ImGui::GetColumnWidth(), ImGui::GetTextLineHeight())); @@ -232,7 +240,10 @@ namespace hex::plugin::builtin { } bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override { - hex::unused(address, data, size, upperCase); + std::ignore = address; + std::ignore = data; + std::ignore = size; + std::ignore = upperCase; m_currColor = { float(data[0]) / 0xFF, float(data[1]) / 0xFF, float(data[2]) / 0xFF, float(data[3]) / 0xFF }; if (startedEditing) { @@ -254,8 +265,8 @@ namespace hex::plugin::builtin { return false; } - std::array m_currColor = { 0 }; - + private: + std::array m_currColor = { }; }; class DataVisualizerBinary : public hex::ContentRegistry::HexEditor::DataVisualizer { @@ -263,14 +274,15 @@ namespace hex::plugin::builtin { DataVisualizerBinary() : DataVisualizer("hex.builtin.visualizer.binary", 1, 8) { } void draw(u64 address, const u8 *data, size_t size, bool) override { - hex::unused(address); + std::ignore = address; if (size == 1) ImGuiExt::TextFormatted("{:08b}", *data); } bool drawEditing(u64 address, u8 *data, size_t, bool, bool startedEditing) override { - hex::unused(address, startedEditing); + std::ignore = address; + std::ignore = startedEditing; if (startedEditing) { m_inputBuffer = hex::format("{:08b}", *data); diff --git a/plugins/builtin/source/content/events.cpp b/plugins/builtin/source/content/events.cpp index 05e942b7e..2eb78045f 100644 --- a/plugins/builtin/source/content/events.cpp +++ b/plugins/builtin/source/content/events.cpp @@ -110,8 +110,8 @@ namespace hex::plugin::builtin { }); EventProviderChanged::subscribe([](hex::prv::Provider *oldProvider, hex::prv::Provider *newProvider) { - hex::unused(oldProvider); - hex::unused(newProvider); + std::ignore = oldProvider; + std::ignore = newProvider; RequestUpdateWindowTitle::post(); }); diff --git a/plugins/builtin/source/content/providers/intel_hex_provider.cpp b/plugins/builtin/source/content/providers/intel_hex_provider.cpp index 631d786c7..9adc1c5a5 100644 --- a/plugins/builtin/source/content/providers/intel_hex_provider.cpp +++ b/plugins/builtin/source/content/providers/intel_hex_provider.cpp @@ -185,7 +185,9 @@ namespace hex::plugin::builtin { } void IntelHexProvider::writeRaw(u64 offset, const void *buffer, size_t size) { - hex::unused(offset, buffer, size); + std::ignore = offset; + std::ignore = buffer; + std::ignore = size; } u64 IntelHexProvider::getActualSize() const { diff --git a/plugins/builtin/source/content/providers/process_memory_provider.cpp b/plugins/builtin/source/content/providers/process_memory_provider.cpp index a02451ce8..9797c2903 100644 --- a/plugins/builtin/source/content/providers/process_memory_provider.cpp +++ b/plugins/builtin/source/content/providers/process_memory_provider.cpp @@ -81,7 +81,7 @@ namespace hex::plugin::builtin { }; auto read = process_vm_readv(m_processId, &local, 1, &remote, 1, 0); - hex::unused(read); + std::ignore = read; #endif } void ProcessMemoryProvider::writeRaw(u64 address, const void *buffer, size_t size) { @@ -107,7 +107,7 @@ namespace hex::plugin::builtin { }; auto write = process_vm_writev(m_processId, &local, 1, &remote, 1, 0); - hex::unused(write); + std::ignore = write; #endif } diff --git a/plugins/builtin/source/content/tools/math_eval.cpp b/plugins/builtin/source/content/tools/math_eval.cpp index e1f46a4d6..de1136ec3 100644 --- a/plugins/builtin/source/content/tools/math_eval.cpp +++ b/plugins/builtin/source/content/tools/math_eval.cpp @@ -28,7 +28,7 @@ namespace hex::plugin::builtin { evaluator.setFunction( "clear", [&](auto args) -> std::optional { - hex::unused(args); + std::ignore = args; mathHistory.clear(); lastMathError.clear(); diff --git a/plugins/builtin/source/content/views/view_bookmarks.cpp b/plugins/builtin/source/content/views/view_bookmarks.cpp index 7100cc784..568460689 100644 --- a/plugins/builtin/source/content/views/view_bookmarks.cpp +++ b/plugins/builtin/source/content/views/view_bookmarks.cpp @@ -60,7 +60,7 @@ namespace hex::plugin::builtin { // Draw hex editor background highlights for bookmarks ImHexApi::HexEditor::addBackgroundHighlightingProvider([this](u64 address, const u8* data, size_t size, bool) -> std::optional { - hex::unused(data); + std::ignore = data; // Check all bookmarks for potential overlaps with the current address for (const auto &bookmark : *m_bookmarks) { @@ -73,7 +73,7 @@ namespace hex::plugin::builtin { // Draw hex editor tooltips for bookmarks ImHexApi::HexEditor::addTooltipProvider([this](u64 address, const u8 *data, size_t size) { - hex::unused(data); + std::ignore = data; // Loop over all bookmarks for (const auto &[bookmark, editor] : *m_bookmarks) { diff --git a/plugins/builtin/source/content/views/view_find.cpp b/plugins/builtin/source/content/views/view_find.cpp index ed479609e..a67b9a39a 100644 --- a/plugins/builtin/source/content/views/view_find.cpp +++ b/plugins/builtin/source/content/views/view_find.cpp @@ -21,7 +21,8 @@ namespace hex::plugin::builtin { const static auto HighlightColor = [] { return (ImGuiExt::GetCustomColorU32(ImGuiCustomCol_FindHighlight) & 0x00FFFFFF) | 0x70000000; }; ImHexApi::HexEditor::addBackgroundHighlightingProvider([this](u64 address, const u8* data, size_t size, bool) -> std::optional { - hex::unused(data, size); + std::ignore = data; + std::ignore = size; if (m_searchTask.isRunning()) return { }; @@ -33,7 +34,8 @@ namespace hex::plugin::builtin { }); ImHexApi::HexEditor::addTooltipProvider([this](u64 address, const u8* data, size_t size) { - hex::unused(data, size); + std::ignore = data; + std::ignore = size; if (m_searchTask.isRunning()) return; diff --git a/plugins/builtin/source/content/views/view_patches.cpp b/plugins/builtin/source/content/views/view_patches.cpp index a4bb8b1a0..97e30b755 100644 --- a/plugins/builtin/source/content/views/view_patches.cpp +++ b/plugins/builtin/source/content/views/view_patches.cpp @@ -44,7 +44,7 @@ namespace hex::plugin::builtin { }); ImHexApi::HexEditor::addForegroundHighlightingProvider([this](u64 offset, const u8* buffer, size_t, bool) -> std::optional { - hex::unused(buffer); + std::ignore = buffer; if (!ImHexApi::Provider::isValid()) return std::nullopt; diff --git a/plugins/builtin/source/content/views/view_pattern_editor.cpp b/plugins/builtin/source/content/views/view_pattern_editor.cpp index 7ff20ecdc..b09c6d3ac 100644 --- a/plugins/builtin/source/content/views/view_pattern_editor.cpp +++ b/plugins/builtin/source/content/views/view_pattern_editor.cpp @@ -1535,7 +1535,7 @@ namespace hex::plugin::builtin { auto mimeType = magic::getMIMEType(provider, 0, 100_KiB, true); runtime.addPragma("MIME", [&mimeType, &foundCorrectType](const pl::PatternLanguage &runtime, const std::string &value) { - hex::unused(runtime); + std::ignore = runtime; if (!magic::isValidMIMEType(value)) return false; @@ -2191,7 +2191,8 @@ namespace hex::plugin::builtin { }); ImHexApi::HexEditor::addBackgroundHighlightingProvider([this](u64 address, const u8 *data, size_t size, bool) -> std::optional { - hex::unused(data, size); + std::ignore = data; + std::ignore = size; if (m_runningEvaluators != 0) return std::nullopt; @@ -2232,7 +2233,8 @@ namespace hex::plugin::builtin { }); ImHexApi::HexEditor::addTooltipProvider([this](u64 address, const u8 *data, size_t size) { - hex::unused(data, size); + std::ignore = data; + std::ignore = size; if (TRY_LOCK(ContentRegistry::PatternLanguage::getRuntimeLock())) { const auto &runtime = ContentRegistry::PatternLanguage::getRuntime(); diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp index 90df0a661..b77ce556f 100644 --- a/plugins/builtin/source/content/welcome_screen.cpp +++ b/plugins/builtin/source/content/welcome_screen.cpp @@ -538,7 +538,7 @@ namespace hex::plugin::builtin { // Clear project context if we go back to the welcome screen EventProviderChanged::subscribe([](const hex::prv::Provider *oldProvider, const hex::prv::Provider *newProvider) { - hex::unused(oldProvider); + std::ignore = oldProvider; if (newProvider == nullptr) { ProjectFile::clearPath(); RequestUpdateWindowTitle::post(); diff --git a/plugins/decompress/source/content/pl_functions.cpp b/plugins/decompress/source/content/pl_functions.cpp index 87388be39..d6bc01c4f 100644 --- a/plugins/decompress/source/content/pl_functions.cpp +++ b/plugins/decompress/source/content/pl_functions.cpp @@ -93,7 +93,8 @@ namespace hex::plugin::decompress { return true; #else - hex::unused(evaluator, params); + std::ignore = evaluator; + std::ignore = params; err::E0012.throwError("hex::dec::zlib_decompress is not available. Please recompile ImHex with zlib support."); #endif }); @@ -140,7 +141,8 @@ namespace hex::plugin::decompress { return true; #else - hex::unused(evaluator, params); + std::ignore = evaluator; + std::ignore = params; err::E0012.throwError("hex::dec::bzlib_decompress is not available. Please recompile ImHex with bzip2 support."); #endif @@ -195,7 +197,8 @@ namespace hex::plugin::decompress { return true; #else - hex::unused(evaluator, params); + std::ignore = evaluator; + std::ignore = params; err::E0012.throwError("hex::dec::lzma_decompress is not available. Please recompile ImHex with liblzma support."); #endif }); @@ -263,7 +266,8 @@ namespace hex::plugin::decompress { return true; #else - hex::unused(evaluator, params); + std::ignore = evaluator; + std::ignore = params; err::E0012.throwError("hex::dec::zstd_decompress is not available. Please recompile ImHex with zstd support."); #endif }); @@ -324,7 +328,8 @@ namespace hex::plugin::decompress { return true; #else - hex::unused(evaluator, params); + std::ignore = evaluator; + std::ignore = params; err::E0012.throwError("hex::dec::lz4_decompress is not available. Please recompile ImHex with liblz4 support."); #endif }); diff --git a/plugins/hashes/source/content/views/view_hashes.cpp b/plugins/hashes/source/content/views/view_hashes.cpp index 139ec633d..a1662c653 100644 --- a/plugins/hashes/source/content/views/view_hashes.cpp +++ b/plugins/hashes/source/content/views/view_hashes.cpp @@ -63,7 +63,7 @@ namespace hex::plugin::hashes { }); ImHexApi::HexEditor::addTooltipProvider([this](u64 address, const u8 *data, size_t size) { - hex::unused(data); + std::ignore = data; auto selection = ImHexApi::HexEditor::getSelection(); diff --git a/plugins/ui/source/ui/hex_editor.cpp b/plugins/ui/source/ui/hex_editor.cpp index 6fb754bab..a51bd44a5 100644 --- a/plugins/ui/source/ui/hex_editor.cpp +++ b/plugins/ui/source/ui/hex_editor.cpp @@ -21,7 +21,8 @@ namespace hex::ui { DataVisualizerAscii() : DataVisualizer("ASCII", 1, 1) { } void draw(u64 address, const u8 *data, size_t size, bool upperCase) override { - hex::unused(address, upperCase); + std::ignore = address; + std::ignore = upperCase; if (size == 1) { const char c = char(data[0]); @@ -37,7 +38,9 @@ namespace hex::ui { } bool drawEditing(u64 address, u8 *data, size_t size, bool upperCase, bool startedEditing) override { - hex::unused(address, startedEditing, upperCase); + std::ignore = address; + std::ignore = startedEditing; + std::ignore = upperCase; if (size == 1) { struct UserData { diff --git a/plugins/ui/source/ui/pattern_drawer.cpp b/plugins/ui/source/ui/pattern_drawer.cpp index 2f451f9dc..8a4f7551c 100644 --- a/plugins/ui/source/ui/pattern_drawer.cpp +++ b/plugins/ui/source/ui/pattern_drawer.cpp @@ -747,7 +747,7 @@ namespace hex::ui { void PatternDrawer::visit(pl::ptrn::PatternPadding& pattern) { // Do nothing - hex::unused(pattern); + std::ignore = pattern; } void PatternDrawer::visit(pl::ptrn::PatternPointer& pattern) { diff --git a/plugins/windows/source/views/view_tty_console.cpp b/plugins/windows/source/views/view_tty_console.cpp index 6b38676bb..ca5f472ac 100644 --- a/plugins/windows/source/views/view_tty_console.cpp +++ b/plugins/windows/source/views/view_tty_console.cpp @@ -43,7 +43,7 @@ namespace hex::plugin::windows { ImGui::Combo( "hex.windows.view.tty_console.baud"_lang, &m_selectedBaudRate, [](void *data, int idx) { - hex::unused(data); + std::ignore = data; return ViewTTYConsole::BaudRates[idx]; }, @@ -52,7 +52,7 @@ namespace hex::plugin::windows { ImGui::Combo( "hex.windows.view.tty_console.num_bits"_lang, &m_selectedNumBits, [](void *data, int idx) { - hex::unused(data); + std::ignore = data; return ViewTTYConsole::NumBits[idx]; }, @@ -61,7 +61,7 @@ namespace hex::plugin::windows { ImGui::Combo( "hex.windows.view.tty_console.stop_bits"_lang, &m_selectedStopBits, [](void *data, int idx) { - hex::unused(data); + std::ignore = data; return ViewTTYConsole::StopBits[idx]; }, @@ -70,7 +70,7 @@ namespace hex::plugin::windows { ImGui::Combo( "hex.windows.view.tty_console.parity_bits"_lang, &m_selectedParityBits, [](void *data, int idx) { - hex::unused(data); + std::ignore = data; return ViewTTYConsole::ParityBits[idx]; }, diff --git a/plugins/yara_rules/source/content/yara_rule.cpp b/plugins/yara_rules/source/content/yara_rule.cpp index f6e64f950..bcabffd91 100644 --- a/plugins/yara_rules/source/content/yara_rule.cpp +++ b/plugins/yara_rules/source/content/yara_rule.cpp @@ -115,7 +115,8 @@ namespace hex::plugin::yara { return context->includeBuffer.c_str(); }, [](const char *ptr, void *userData) { - hex::unused(ptr, userData); + std::ignore = ptr; + std::ignore = userData; }, &resultContext );