From 633fa7213a735f1030e0a5960880666a992bd0ec Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 29 Aug 2021 22:15:18 +0200 Subject: [PATCH] sys: More compile time improvements --- external/ImGui/include/imgui_memory_editor.h | 4 +- include/helpers/plugin_manager.hpp | 2 +- include/views/view_bookmarks.hpp | 2 - include/views/view_hexeditor.hpp | 1 - include/window.hpp | 3 - .../content/command_palette_commands.cpp | 3 + .../builtin/source/content/data_inspector.cpp | 1 + .../source/content/data_processor_nodes.cpp | 1 + .../source/content/lang_builtin_functions.cpp | 5 +- .../builtin/source/content/tools_entries.cpp | 4 +- plugins/builtin/source/content/ui_items.cpp | 3 + plugins/libimhex/include/hex.hpp | 7 +- .../include/hex/api/content_registry.hpp | 3 +- .../libimhex/include/hex/api/imhex_api.hpp | 2 +- .../include/hex/data_processor/attribute.hpp | 1 + .../include/hex/data_processor/node.hpp | 1 - .../libimhex/include/hex/helpers/concepts.hpp | 148 +++++++++++++++ plugins/libimhex/include/hex/helpers/fmt.hpp | 19 ++ plugins/libimhex/include/hex/helpers/net.hpp | 2 + .../libimhex/include/hex/helpers/utils.hpp | 173 +----------------- .../libimhex/include/hex/lang/evaluator.hpp | 11 +- plugins/libimhex/include/hex/lang/parser.hpp | 3 +- .../include/hex/lang/pattern_data.hpp | 3 +- .../include/hex/lang/pattern_language.hpp | 2 +- plugins/libimhex/include/hex/lang/token.hpp | 2 - .../libimhex/source/api/content_registry.cpp | 1 + .../libimhex/source/data_processor/node.cpp | 2 + plugins/libimhex/source/helpers/utils.cpp | 2 + plugins/libimhex/source/lang/evaluator.cpp | 6 +- plugins/libimhex/source/lang/parser.cpp | 2 + plugins/libimhex/source/lang/preprocessor.cpp | 3 + plugins/libimhex/source/lang/validator.cpp | 4 +- .../libimhex/source/providers/provider.cpp | 1 + .../windows/source/content/footer_items.cpp | 3 + .../windows/source/views/view_tty_console.cpp | 2 + source/helpers/loader_script_handler.cpp | 2 +- source/helpers/patches.cpp | 4 +- source/helpers/plugin_manager.cpp | 4 +- source/init/splash_window.cpp | 5 +- source/init/tasks.cpp | 1 - source/main.cpp | 3 + source/providers/file_provider.cpp | 1 + source/views/view_bookmarks.cpp | 2 + source/views/view_constants.cpp | 3 + source/views/view_disassembler.cpp | 2 +- source/views/view_hashes.cpp | 1 - source/views/view_information.cpp | 1 + source/views/view_patches.cpp | 1 - source/views/view_pattern_editor.cpp | 3 +- source/views/view_strings.cpp | 1 - source/views/view_yara.cpp | 1 + source/window/win_window.cpp | 3 + source/window/window.cpp | 5 +- 53 files changed, 258 insertions(+), 217 deletions(-) create mode 100644 plugins/libimhex/include/hex/helpers/concepts.hpp create mode 100644 plugins/libimhex/include/hex/helpers/fmt.hpp diff --git a/external/ImGui/include/imgui_memory_editor.h b/external/ImGui/include/imgui_memory_editor.h index 3a98985bc..993a47fb5 100644 --- a/external/ImGui/include/imgui_memory_editor.h +++ b/external/ImGui/include/imgui_memory_editor.h @@ -46,8 +46,8 @@ #include // sprintf, scanf #include // uint8_t, etc. -#include +#include #include #include @@ -231,7 +231,7 @@ struct MemoryEditor if (ImGui::Begin(title, p_open, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNavInputs)) { if (DataPreviewAddr != DataPreviewAddrOld || DataPreviewAddrEnd != DataPreviewAddrEndOld) { - hex::Region selectionRegion = { std::min(DataPreviewAddr, DataPreviewAddrEnd) + base_display_addr, std::max(DataPreviewAddr, DataPreviewAddrEnd) - std::min(DataPreviewAddr, DataPreviewAddrEnd) }; + Region selectionRegion = { std::min(DataPreviewAddr, DataPreviewAddrEnd) + base_display_addr, std::max(DataPreviewAddr, DataPreviewAddrEnd) - std::min(DataPreviewAddr, DataPreviewAddrEnd) }; hex::EventManager::post(selectionRegion); } diff --git a/include/helpers/plugin_manager.hpp b/include/helpers/plugin_manager.hpp index 3b17d6420..b04c449c8 100644 --- a/include/helpers/plugin_manager.hpp +++ b/include/helpers/plugin_manager.hpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include diff --git a/include/views/view_bookmarks.hpp b/include/views/view_bookmarks.hpp index 4f5b74889..3593059d7 100644 --- a/include/views/view_bookmarks.hpp +++ b/include/views/view_bookmarks.hpp @@ -5,8 +5,6 @@ #include #include -#include - namespace hex { namespace prv { class Provider; } diff --git a/include/views/view_hexeditor.hpp b/include/views/view_hexeditor.hpp index 2154b2111..54a00c7d0 100644 --- a/include/views/view_hexeditor.hpp +++ b/include/views/view_hexeditor.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include "helpers/encoding_file.hpp" diff --git a/include/window.hpp b/include/window.hpp index 75b7a398d..37162857d 100644 --- a/include/window.hpp +++ b/include/window.hpp @@ -5,11 +5,8 @@ #include #include -#include #include -#include - struct GLFWwindow; struct ImGuiSettingsHandler; diff --git a/plugins/builtin/source/content/command_palette_commands.cpp b/plugins/builtin/source/content/command_palette_commands.cpp index fddcef8e6..e740b3204 100644 --- a/plugins/builtin/source/content/command_palette_commands.cpp +++ b/plugins/builtin/source/content/command_palette_commands.cpp @@ -1,5 +1,8 @@ #include +#include +#include + #include "math_evaluator.hpp" namespace hex::plugin::builtin { diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp index 317514cb3..e7a9f05b8 100644 --- a/plugins/builtin/source/content/data_inspector.cpp +++ b/plugins/builtin/source/content/data_inspector.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include diff --git a/plugins/builtin/source/content/data_processor_nodes.cpp b/plugins/builtin/source/content/data_processor_nodes.cpp index 7c743ff73..13fc08d64 100644 --- a/plugins/builtin/source/content/data_processor_nodes.cpp +++ b/plugins/builtin/source/content/data_processor_nodes.cpp @@ -3,6 +3,7 @@ #include #include +#include #include diff --git a/plugins/builtin/source/content/lang_builtin_functions.cpp b/plugins/builtin/source/content/lang_builtin_functions.cpp index 56f0ef0ad..727b5fd4b 100644 --- a/plugins/builtin/source/content/lang_builtin_functions.cpp +++ b/plugins/builtin/source/content/lang_builtin_functions.cpp @@ -1,11 +1,12 @@ #include +#include +#include + #include #include #include -#include - #include namespace hex::plugin::builtin { diff --git a/plugins/builtin/source/content/tools_entries.cpp b/plugins/builtin/source/content/tools_entries.cpp index 7143a3509..618ab0cbf 100644 --- a/plugins/builtin/source/content/tools_entries.cpp +++ b/plugins/builtin/source/content/tools_entries.cpp @@ -2,6 +2,8 @@ #include #include +#include +#include #include #include @@ -78,7 +80,7 @@ namespace hex::plugin::builtin { ImGui::Text("0x%02x", i + 32 * tablePart); ImGui::TableNextColumn(); - ImGui::Text("%s", makePrintable(i + 32 * tablePart).c_str()); + ImGui::Text("%s", hex::makePrintable(i + 32 * tablePart).c_str()); ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, ((rowCount % 2) == 0) ? 0xFF101010 : 0xFF303030); diff --git a/plugins/builtin/source/content/ui_items.cpp b/plugins/builtin/source/content/ui_items.cpp index d2be84458..f8fa059f4 100644 --- a/plugins/builtin/source/content/ui_items.cpp +++ b/plugins/builtin/source/content/ui_items.cpp @@ -1,6 +1,9 @@ #include #include +#include +#include + #include #include #include diff --git a/plugins/libimhex/include/hex.hpp b/plugins/libimhex/include/hex.hpp index e2fd51ead..461575023 100644 --- a/plugins/libimhex/include/hex.hpp +++ b/plugins/libimhex/include/hex.hpp @@ -1,10 +1,8 @@ #pragma once #include -#include #include -#include using namespace hex::lang_literals; constexpr static const auto ImHexApiURL = "https://api.werwolv.net/imhex"; @@ -22,6 +20,11 @@ using s32 = std::int32_t; using s64 = std::int64_t; using s128 = __int128_t; +struct Region { + u64 address; + size_t size; +}; + #ifdef OS_WINDOWS #define MAGIC_PATH_SEPARATOR ";" #else diff --git a/plugins/libimhex/include/hex/api/content_registry.hpp b/plugins/libimhex/include/hex/api/content_registry.hpp index f525cd938..b3ea4e252 100644 --- a/plugins/libimhex/include/hex/api/content_registry.hpp +++ b/plugins/libimhex/include/hex/api/content_registry.hpp @@ -1,8 +1,7 @@ #pragma once #include - -#include +#include #include #include diff --git a/plugins/libimhex/include/hex/api/imhex_api.hpp b/plugins/libimhex/include/hex/api/imhex_api.hpp index 32b82579b..c33bdd78b 100644 --- a/plugins/libimhex/include/hex/api/imhex_api.hpp +++ b/plugins/libimhex/include/hex/api/imhex_api.hpp @@ -1,9 +1,9 @@ #pragma once #include -#include #include +#include namespace hex { diff --git a/plugins/libimhex/include/hex/data_processor/attribute.hpp b/plugins/libimhex/include/hex/data_processor/attribute.hpp index f18b45192..65be69c5a 100644 --- a/plugins/libimhex/include/hex/data_processor/attribute.hpp +++ b/plugins/libimhex/include/hex/data_processor/attribute.hpp @@ -2,6 +2,7 @@ #include #include +#include namespace hex::dp { diff --git a/plugins/libimhex/include/hex/data_processor/node.hpp b/plugins/libimhex/include/hex/data_processor/node.hpp index 74a000a48..662c429ba 100644 --- a/plugins/libimhex/include/hex/data_processor/node.hpp +++ b/plugins/libimhex/include/hex/data_processor/node.hpp @@ -2,7 +2,6 @@ #include #include -#include #include #include diff --git a/plugins/libimhex/include/hex/helpers/concepts.hpp b/plugins/libimhex/include/hex/helpers/concepts.hpp new file mode 100644 index 000000000..5824d36d1 --- /dev/null +++ b/plugins/libimhex/include/hex/helpers/concepts.hpp @@ -0,0 +1,148 @@ +#pragma once + +#include + +namespace hex { + + template + struct is_integral_helper : public std::false_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template<> + struct is_integral_helper : public std::true_type { }; + + template + struct is_integral : public is_integral_helper>::type { }; + +template +struct is_signed_helper : public std::false_type { }; + +template<> +struct is_signed_helper : public std::true_type { }; + +template<> +struct is_signed_helper : public std::true_type { }; + +template<> +struct is_signed_helper : public std::true_type { }; + +template<> +struct is_signed_helper : public std::true_type { }; + +template<> +struct is_signed_helper : public std::true_type { }; + +template<> +struct is_signed_helper : public std::true_type { }; + +template<> +struct is_signed_helper : public std::true_type { }; + +template<> +struct is_signed_helper : public std::true_type { }; + +template<> +struct is_signed_helper : public std::true_type { }; + +template +struct is_signed : public is_signed_helper>::type { }; + +template +struct is_floating_point_helper : public std::false_type { }; + +template<> +struct is_floating_point_helper : public std::true_type { }; + +template<> +struct is_floating_point_helper : public std::true_type { }; + +template<> +struct is_floating_point_helper : public std::true_type { }; + +template +struct is_floating_point : public is_floating_point_helper>::type { }; + +} + +#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 12000 +#if __has_include() +// Make sure we break when derived_from is implemented in libc++. Then we can fix a compatibility version above +#include +#endif +// libcxx 12 still doesn't have many default concepts implemented, as a result we need to define it ourself using clang built-ins. +// [concept.derived] (patch from https://reviews.llvm.org/D74292) +namespace hex { +template +concept derived_from = + __is_base_of(_Bp, _Dp) && __is_convertible_to(const volatile _Dp*, const volatile _Bp*); +} + +#else +// Assume supported +#include +namespace hex { + using std::derived_from; +} +#endif + +// [concepts.arithmetic] +namespace hex { + template + concept integral = hex::is_integral::value; + + template + concept signed_integral = integral && hex::is_signed::value; + + template + concept unsigned_integral = integral && !signed_integral; + + template + concept floating_point = std::is_floating_point::value; +} + +template +struct always_false : std::false_type {}; \ No newline at end of file diff --git a/plugins/libimhex/include/hex/helpers/fmt.hpp b/plugins/libimhex/include/hex/helpers/fmt.hpp new file mode 100644 index 000000000..11b65b30a --- /dev/null +++ b/plugins/libimhex/include/hex/helpers/fmt.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include + +namespace hex { + + template + inline std::string format(std::string_view format, Args ... args) { + return fmt::format(fmt::runtime(format), args...); + } + + template + inline void print(std::string_view format, Args ... args) { + fmt::print(fmt::runtime(format), args...); + } + +} \ No newline at end of file diff --git a/plugins/libimhex/include/hex/helpers/net.hpp b/plugins/libimhex/include/hex/helpers/net.hpp index 17a1d7774..0ed369063 100644 --- a/plugins/libimhex/include/hex/helpers/net.hpp +++ b/plugins/libimhex/include/hex/helpers/net.hpp @@ -1,6 +1,8 @@ #pragma once #include + +#include #include #include #include diff --git a/plugins/libimhex/include/hex/helpers/utils.hpp b/plugins/libimhex/include/hex/helpers/utils.hpp index 96dba52ba..8cdc8e226 100644 --- a/plugins/libimhex/include/hex/helpers/utils.hpp +++ b/plugins/libimhex/include/hex/helpers/utils.hpp @@ -2,6 +2,8 @@ #include +#include + #include #include #include @@ -11,166 +13,15 @@ #include #include -#include -#include - -#ifdef __MINGW32__ -#include -#else -#include -#endif - #include -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(OS_MACOS) #define off64_t off_t #define fopen64 fopen #define fseeko64 fseek #define ftello64 ftell #endif -namespace hex { - - template - struct is_integral_helper : public std::false_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template<> - struct is_integral_helper : public std::true_type { }; - - template - struct is_integral : public is_integral_helper>::type { }; - - template - struct is_signed_helper : public std::false_type { }; - - template<> - struct is_signed_helper : public std::true_type { }; - - template<> - struct is_signed_helper : public std::true_type { }; - - template<> - struct is_signed_helper : public std::true_type { }; - - template<> - struct is_signed_helper : public std::true_type { }; - - template<> - struct is_signed_helper : public std::true_type { }; - - template<> - struct is_signed_helper : public std::true_type { }; - - template<> - struct is_signed_helper : public std::true_type { }; - - template<> - struct is_signed_helper : public std::true_type { }; - - template<> - struct is_signed_helper : public std::true_type { }; - - template - struct is_signed : public is_signed_helper>::type { }; - - template - struct is_floating_point_helper : public std::false_type { }; - - template<> - struct is_floating_point_helper : public std::true_type { }; - - template<> - struct is_floating_point_helper : public std::true_type { }; - - template<> - struct is_floating_point_helper : public std::true_type { }; - - template - struct is_floating_point : public is_floating_point_helper>::type { }; - -} - -#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 12000 -#if __has_include() -// Make sure we break when derived_from is implemented in libc++. Then we can fix a compatibility version above -#include -#endif -// libcxx 12 still doesn't have many default concepts implemented, as a result we need to define it ourself using clang built-ins. -// [concept.derived] (patch from https://reviews.llvm.org/D74292) -namespace hex { -template -concept derived_from = - __is_base_of(_Bp, _Dp) && __is_convertible_to(const volatile _Dp*, const volatile _Bp*); -} - -#else -// Assume supported -#include -namespace hex { - using std::derived_from; -} -#endif - -// [concepts.arithmetic] -namespace hex { -template -concept integral = hex::is_integral<_Tp>::value; - -template -concept signed_integral = integral<_Tp> && hex::is_signed<_Tp>::value; - -template -concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>; - -template -concept floating_point = std::is_floating_point<_Tp>::value; -} - #define TOKEN_CONCAT_IMPL(x, y) x ## y #define TOKEN_CONCAT(x, y) TOKEN_CONCAT_IMPL(x, y) #define ANONYMOUS_VARIABLE(prefix) TOKEN_CONCAT(prefix, __COUNTER__) @@ -186,16 +37,6 @@ namespace hex { void runCommand(const std::string &command); void openWebpage(std::string url); - template - inline std::string format(std::string_view format, Args ... args) { - return fmt::format(fmt::runtime(format), args...); - } - - template - inline void print(std::string_view format, Args ... args) { - fmt::print(fmt::runtime(format), args...); - } - [[nodiscard]] constexpr inline u64 extract(u8 from, u8 to, const hex::unsigned_integral auto &value) { using ValueType = std::remove_cvref_t; ValueType mask = (std::numeric_limits::max() >> (((sizeof(value) * 8) - 1) - (from - to))) << to; @@ -203,9 +44,6 @@ namespace hex { return (value & mask) >> to; } - template - struct always_false : std::false_type {}; - template struct overloaded : Ts... { using Ts::operator()...; }; template overloaded(Ts...) -> overloaded; @@ -416,9 +254,4 @@ namespace hex { } - struct Region { - u64 address; - size_t size; - }; - } diff --git a/plugins/libimhex/include/hex/lang/evaluator.hpp b/plugins/libimhex/include/hex/lang/evaluator.hpp index f2240afb1..51ace555e 100644 --- a/plugins/libimhex/include/hex/lang/evaluator.hpp +++ b/plugins/libimhex/include/hex/lang/evaluator.hpp @@ -2,20 +2,21 @@ #include -#include -#include -#include +#include #include #include #include -#include #include -#include +#include #include +namespace hex::prv { class Provider; } + namespace hex::lang { + class PatternData; + class Evaluator { public: Evaluator() = default; diff --git a/plugins/libimhex/include/hex/lang/parser.hpp b/plugins/libimhex/include/hex/lang/parser.hpp index c7ae65365..808160365 100644 --- a/plugins/libimhex/include/hex/lang/parser.hpp +++ b/plugins/libimhex/include/hex/lang/parser.hpp @@ -1,12 +1,11 @@ #pragma once #include +#include #include "token.hpp" #include "ast_node.hpp" -#include - #include #include #include diff --git a/plugins/libimhex/include/hex/lang/pattern_data.hpp b/plugins/libimhex/include/hex/lang/pattern_data.hpp index e3cac526e..3b6b4dcad 100644 --- a/plugins/libimhex/include/hex/lang/pattern_data.hpp +++ b/plugins/libimhex/include/hex/lang/pattern_data.hpp @@ -5,9 +5,10 @@ #include #include -#include #include #include +#include +#include #include #include diff --git a/plugins/libimhex/include/hex/lang/pattern_language.hpp b/plugins/libimhex/include/hex/lang/pattern_language.hpp index 348b340eb..306b99f19 100644 --- a/plugins/libimhex/include/hex/lang/pattern_language.hpp +++ b/plugins/libimhex/include/hex/lang/pattern_language.hpp @@ -8,7 +8,6 @@ #include #include -#include #include namespace hex::prv { class Provider; } @@ -20,6 +19,7 @@ namespace hex::lang { class Parser; class Validator; class Evaluator; + class PatternData; class PatternLanguage { public: diff --git a/plugins/libimhex/include/hex/lang/token.hpp b/plugins/libimhex/include/hex/lang/token.hpp index b8cb76bb6..bb9f74c41 100644 --- a/plugins/libimhex/include/hex/lang/token.hpp +++ b/plugins/libimhex/include/hex/lang/token.hpp @@ -2,8 +2,6 @@ #include -#include - #include #include #include diff --git a/plugins/libimhex/source/api/content_registry.cpp b/plugins/libimhex/source/api/content_registry.cpp index f34081f4a..504bf8813 100644 --- a/plugins/libimhex/source/api/content_registry.cpp +++ b/plugins/libimhex/source/api/content_registry.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include diff --git a/plugins/libimhex/source/data_processor/node.cpp b/plugins/libimhex/source/data_processor/node.cpp index 0ec5c0e1c..b48e10ba6 100644 --- a/plugins/libimhex/source/data_processor/node.cpp +++ b/plugins/libimhex/source/data_processor/node.cpp @@ -2,6 +2,8 @@ #include +#include + namespace hex::dp { Node::Node(std::string_view unlocalizedTitle, std::vector attributes) : m_id(SharedData::dataProcessorNodeIdCounter++), m_unlocalizedTitle(unlocalizedTitle), m_attributes(std::move(attributes)) { diff --git a/plugins/libimhex/source/helpers/utils.cpp b/plugins/libimhex/source/helpers/utils.cpp index aec6f62ce..adb987f82 100644 --- a/plugins/libimhex/source/helpers/utils.cpp +++ b/plugins/libimhex/source/helpers/utils.cpp @@ -5,6 +5,8 @@ #include #include +#include + #if defined(OS_WINDOWS) #include #include diff --git a/plugins/libimhex/source/lang/evaluator.cpp b/plugins/libimhex/source/lang/evaluator.cpp index ac98f77d7..e437852f3 100644 --- a/plugins/libimhex/source/lang/evaluator.cpp +++ b/plugins/libimhex/source/lang/evaluator.cpp @@ -1,8 +1,10 @@ #include -#include -#include #include +#include + +#include +#include #include #include diff --git a/plugins/libimhex/source/lang/parser.cpp b/plugins/libimhex/source/lang/parser.cpp index 6383bc6d4..03a1573d4 100644 --- a/plugins/libimhex/source/lang/parser.cpp +++ b/plugins/libimhex/source/lang/parser.cpp @@ -1,5 +1,7 @@ #include +#include + #include #define MATCHES(x) (begin() && x) diff --git a/plugins/libimhex/source/lang/preprocessor.cpp b/plugins/libimhex/source/lang/preprocessor.cpp index c515c7fe1..914788208 100644 --- a/plugins/libimhex/source/lang/preprocessor.cpp +++ b/plugins/libimhex/source/lang/preprocessor.cpp @@ -1,5 +1,8 @@ #include +#include +#include + #include namespace hex::lang { diff --git a/plugins/libimhex/source/lang/validator.cpp b/plugins/libimhex/source/lang/validator.cpp index a028de4c4..ceca514fb 100644 --- a/plugins/libimhex/source/lang/validator.cpp +++ b/plugins/libimhex/source/lang/validator.cpp @@ -1,10 +1,10 @@ #include +#include + #include #include -#include - namespace hex::lang { Validator::Validator() { diff --git a/plugins/libimhex/source/providers/provider.cpp b/plugins/libimhex/source/providers/provider.cpp index 0f5cd996e..b77e18d3b 100644 --- a/plugins/libimhex/source/providers/provider.cpp +++ b/plugins/libimhex/source/providers/provider.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include diff --git a/plugins/windows/source/content/footer_items.cpp b/plugins/windows/source/content/footer_items.cpp index af884a62d..355d2ccd2 100644 --- a/plugins/windows/source/content/footer_items.cpp +++ b/plugins/windows/source/content/footer_items.cpp @@ -1,5 +1,8 @@ #include +#include +#include + #include #include diff --git a/plugins/windows/source/views/view_tty_console.cpp b/plugins/windows/source/views/view_tty_console.cpp index 600e98a65..0e831e5c7 100644 --- a/plugins/windows/source/views/view_tty_console.cpp +++ b/plugins/windows/source/views/view_tty_console.cpp @@ -3,6 +3,8 @@ #include #include +#include + namespace hex::plugin::windows { ViewTTYConsole::ViewTTYConsole() : View("hex.windows.view.tty_console.name") { diff --git a/source/helpers/loader_script_handler.cpp b/source/helpers/loader_script_handler.cpp index f7e19f389..a6c90d769 100644 --- a/source/helpers/loader_script_handler.cpp +++ b/source/helpers/loader_script_handler.cpp @@ -1,7 +1,7 @@ #include "helpers/loader_script_handler.hpp" -#include #include +#include #include #define PY_SSIZE_T_CLEAN diff --git a/source/helpers/patches.cpp b/source/helpers/patches.cpp index 35bbe4293..0b13f9d22 100644 --- a/source/helpers/patches.cpp +++ b/source/helpers/patches.cpp @@ -1,11 +1,11 @@ #include "helpers/patches.hpp" +#include + #include #include #include -#include - namespace hex { static void pushBytesBack(std::vector &buffer, const char* bytes) { diff --git a/source/helpers/plugin_manager.cpp b/source/helpers/plugin_manager.cpp index 7ddf0886e..78167c209 100644 --- a/source/helpers/plugin_manager.cpp +++ b/source/helpers/plugin_manager.cpp @@ -1,5 +1,7 @@ #include "helpers/plugin_manager.hpp" +#include + #include namespace hex { @@ -17,7 +19,7 @@ namespace hex { this->m_handle = dlopen(path.data(), RTLD_LAZY); if (this->m_handle == nullptr) { - hex::log::error("dlopen failed: {}", dlerror()); + log::error("dlopen failed: {}", dlerror()); return; } diff --git a/source/init/splash_window.cpp b/source/init/splash_window.cpp index 6551d1a9f..470da287d 100644 --- a/source/init/splash_window.cpp +++ b/source/init/splash_window.cpp @@ -1,6 +1,8 @@ #include "init/splash_window.hpp" #include +#include +#include #include #include @@ -145,8 +147,7 @@ namespace hex::init { void WindowSplash::initGLFW() { glfwSetErrorCallback([](int error, const char *description) { - log::fatal("GLFW Error: {0} - {0}", error, description); - exit(EXIT_FAILURE); + log::error("GLFW Error [{}] : {}", error, desc); }); if (!glfwInit()) { diff --git a/source/init/tasks.cpp b/source/init/tasks.cpp index 65a28af3d..f05794c11 100644 --- a/source/init/tasks.cpp +++ b/source/init/tasks.cpp @@ -1,7 +1,6 @@ #include "init/tasks.hpp" #include -#include #include #include "views/view_hexeditor.hpp" diff --git a/source/main.cpp b/source/main.cpp index 1bb083072..2902b1000 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,5 +1,8 @@ #include +#include +#include + #include "window.hpp" #include "init/splash_window.hpp" diff --git a/source/providers/file_provider.cpp b/source/providers/file_provider.cpp index 4dbd72e57..154fad18d 100644 --- a/source/providers/file_provider.cpp +++ b/source/providers/file_provider.cpp @@ -3,6 +3,7 @@ #include #include +#include #include "helpers/project_file_handler.hpp" #if defined(OS_WINDOWS) diff --git a/source/views/view_bookmarks.cpp b/source/views/view_bookmarks.cpp index f69a3b027..fd871ddd7 100644 --- a/source/views/view_bookmarks.cpp +++ b/source/views/view_bookmarks.cpp @@ -1,6 +1,8 @@ #include "views/view_bookmarks.hpp" #include +#include + #include "helpers/project_file_handler.hpp" #include diff --git a/source/views/view_constants.cpp b/source/views/view_constants.cpp index 54ee23789..a16e49580 100644 --- a/source/views/view_constants.cpp +++ b/source/views/view_constants.cpp @@ -1,5 +1,8 @@ #include "views/view_constants.hpp" +#include +#include + #include #include #include diff --git a/source/views/view_disassembler.cpp b/source/views/view_disassembler.cpp index 8b88f0806..f5364736b 100644 --- a/source/views/view_disassembler.cpp +++ b/source/views/view_disassembler.cpp @@ -1,7 +1,7 @@ #include "views/view_disassembler.hpp" #include -#include +#include #include #include diff --git a/source/views/view_hashes.cpp b/source/views/view_hashes.cpp index ea9b1fa36..3a030e596 100644 --- a/source/views/view_hashes.cpp +++ b/source/views/view_hashes.cpp @@ -1,7 +1,6 @@ #include "views/view_hashes.hpp" #include -#include #include #include diff --git a/source/views/view_information.cpp b/source/views/view_information.cpp index a9133c62e..4290b1fb9 100644 --- a/source/views/view_information.cpp +++ b/source/views/view_information.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include diff --git a/source/views/view_patches.cpp b/source/views/view_patches.cpp index e6535a0d8..aeba58fec 100644 --- a/source/views/view_patches.cpp +++ b/source/views/view_patches.cpp @@ -2,7 +2,6 @@ #include -#include #include "helpers/project_file_handler.hpp" #include diff --git a/source/views/view_pattern_editor.cpp b/source/views/view_pattern_editor.cpp index f9b121545..ab99604fc 100644 --- a/source/views/view_pattern_editor.cpp +++ b/source/views/view_pattern_editor.cpp @@ -1,8 +1,9 @@ #include "views/view_pattern_editor.hpp" #include "helpers/project_file_handler.hpp" -#include #include +#include +#include #include diff --git a/source/views/view_strings.cpp b/source/views/view_strings.cpp index 2caff32af..c99775ddb 100644 --- a/source/views/view_strings.cpp +++ b/source/views/view_strings.cpp @@ -1,7 +1,6 @@ #include "views/view_strings.hpp" #include -#include #include #include diff --git a/source/views/view_yara.cpp b/source/views/view_yara.cpp index 8278abc4f..0fa2d4aca 100644 --- a/source/views/view_yara.cpp +++ b/source/views/view_yara.cpp @@ -1,6 +1,7 @@ #include "views/view_yara.hpp" #include +#include #include #include diff --git a/source/window/win_window.cpp b/source/window/win_window.cpp index 630442ac5..5a13b3420 100644 --- a/source/window/win_window.cpp +++ b/source/window/win_window.cpp @@ -1,7 +1,10 @@ #include "window.hpp" + #if defined(OS_WINDOWS) + #include + #include #include #include diff --git a/source/window/window.cpp b/source/window/window.cpp index 3f3528177..ddaf926b8 100644 --- a/source/window/window.cpp +++ b/source/window/window.cpp @@ -1,14 +1,15 @@ #include "window.hpp" #include -#include + #include +#include +#include #include #include #include #include -#include #include #include