From 8f1efcd8a38fe1f484d416f1eaf18182307c006e Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 25 Jun 2023 17:44:06 -0700 Subject: [PATCH] remove need to ignore warnings for dfhack-dependent targets --- library/CMakeLists.txt | 3 --- library/Debug.cpp | 1 + library/include/Core.h | 2 -- library/include/Export.h | 14 ++++++++++++++ library/include/PluginManager.h | 2 -- library/include/RemoteClient.h | 11 ----------- library/include/modules/Buildings.h | 8 +++++++- plugins/channel-safely/channel-manager.cpp | 4 ++-- plugins/channel-safely/include/inlines.h | 2 +- plugins/confirm.cpp | 2 +- plugins/hotkeys.cpp | 2 +- 11 files changed, 27 insertions(+), 24 deletions(-) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 48ebdb986..8681c9c90 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -377,9 +377,6 @@ if(WIN32) set_target_properties(dfhack-client PROPERTIES COMPILE_FLAGS "/FI\"Export.h\"" ) else() set_target_properties(dfhack PROPERTIES COMPILE_FLAGS "-include Export.h" ) - # required because of transitively-included protobuf headers - target_compile_options(dfhack - INTERFACE -Wno-deprecated-declarations -Wno-restrict) set_target_properties(dfhack-client PROPERTIES COMPILE_FLAGS "-include Export.h" ) add_library(dfhooks SHARED Hooks.cpp) target_link_libraries(dfhooks dfhack) diff --git a/library/Debug.cpp b/library/Debug.cpp index 9b13af168..dafbeb5ce 100644 --- a/library/Debug.cpp +++ b/library/Debug.cpp @@ -26,6 +26,7 @@ redistribute it freely, subject to the following restrictions: #include "Debug.h" #include "DebugManager.h" +#include #include #include #include diff --git a/library/include/Core.h b/library/include/Core.h index 696be4ead..c9f49cbb3 100644 --- a/library/include/Core.h +++ b/library/include/Core.h @@ -40,8 +40,6 @@ distribution. #include #include -#include "RemoteClient.h" - #define DFH_MOD_SHIFT 1 #define DFH_MOD_CTRL 2 #define DFH_MOD_ALT 4 diff --git a/library/include/Export.h b/library/include/Export.h index 9e2a78d4b..ad2b4ceec 100644 --- a/library/include/Export.h +++ b/library/include/Export.h @@ -69,3 +69,17 @@ distribution. #else #define Wformat(type, fmtstr, vararg) #endif + +namespace DFHack +{ + enum command_result + { + CR_LINK_FAILURE = -3, // RPC call failed due to I/O or protocol error + CR_NEEDS_CONSOLE = -2, // Attempt to call interactive command without console + CR_NOT_IMPLEMENTED = -1, // Command not implemented, or plugin not loaded + CR_OK = 0, // Success + CR_FAILURE = 1, // Failure + CR_WRONG_USAGE = 2, // Wrong arguments or ui state + CR_NOT_FOUND = 3 // Target object not found (for RPC mainly) + }; +} diff --git a/library/include/PluginManager.h b/library/include/PluginManager.h index 78c5e5dc8..f67023f93 100644 --- a/library/include/PluginManager.h +++ b/library/include/PluginManager.h @@ -35,8 +35,6 @@ distribution. #include "Core.h" #include "DataFuncs.h" -#include "RemoteClient.h" - typedef struct lua_State lua_State; namespace tthread diff --git a/library/include/RemoteClient.h b/library/include/RemoteClient.h index e71b985cd..17e296a2e 100644 --- a/library/include/RemoteClient.h +++ b/library/include/RemoteClient.h @@ -39,17 +39,6 @@ namespace DFHack using dfproto::IntMessage; using dfproto::StringMessage; - enum command_result - { - CR_LINK_FAILURE = -3, // RPC call failed due to I/O or protocol error - CR_NEEDS_CONSOLE = -2, // Attempt to call interactive command without console - CR_NOT_IMPLEMENTED = -1, // Command not implemented, or plugin not loaded - CR_OK = 0, // Success - CR_FAILURE = 1, // Failure - CR_WRONG_USAGE = 2, // Wrong arguments or ui state - CR_NOT_FOUND = 3 // Target object not found (for RPC mainly) - }; - enum DFHackReplyCode : int16_t { RPC_REPLY_RESULT = -1, RPC_REPLY_FAIL = -2, diff --git a/library/include/modules/Buildings.h b/library/include/modules/Buildings.h index 78163108e..22dbb0370 100644 --- a/library/include/modules/Buildings.h +++ b/library/include/modules/Buildings.h @@ -237,7 +237,7 @@ DFHACK_EXPORT std::string getRoomDescription(df::building *building, df::unit *u * starting at the top left and moving right, row by row, * the block's items are checked for anything on the ground within that stockpile. */ -class DFHACK_EXPORT StockpileIterator : public std::iterator +class DFHACK_EXPORT StockpileIterator { df::building_stockpilest* stockpile; df::map_block* block; @@ -245,6 +245,12 @@ class DFHACK_EXPORT StockpileIterator : public std::iteratorblock_events) { if (auto evT = virtual_cast(event)) { // we want to let the user keep some designations free of being managed - auto b = max(0, cavein_candidates[pos] - least_access); + auto b = std::max(0, cavein_candidates[pos] - least_access); auto v = 1000 + (b * 1700); DEBUG(manager).print("(" COORD ") 1000+1000(%d) -> %d {least-access: %d}\n",COORDARGS(pos), b, v, least_access); evT->priority[Coord(local)] = v; diff --git a/plugins/channel-safely/include/inlines.h b/plugins/channel-safely/include/inlines.h index a29f5a04d..362fd927a 100644 --- a/plugins/channel-safely/include/inlines.h +++ b/plugins/channel-safely/include/inlines.h @@ -23,7 +23,7 @@ namespace CSP { inline uint32_t calc_distance(df::coord p1, df::coord p2) { // calculate chebyshev (chessboard) distance uint32_t distance = abs(p2.z - p1.z); - distance += max(abs(p2.x - p1.x), abs(p2.y - p1.y)); + distance += std::max(abs(p2.x - p1.x), abs(p2.y - p1.y)); return distance; } diff --git a/plugins/confirm.cpp b/plugins/confirm.cpp index 1dfb6809d..bd6e41b64 100644 --- a/plugins/confirm.cpp +++ b/plugins/confirm.cpp @@ -411,7 +411,7 @@ public: Screen::paintTile(corner_ur, x2, y1); Screen::paintTile(corner_dl, x1, y2); Screen::paintTile(corner_dr, x2, y2); - string title = " " + get_title() + " "; + string title = ' ' + get_title() + ' '; Screen::paintString(Screen::Pen(' ', COLOR_DARKGREY, COLOR_BLACK), x2 - 6, y1, "DFHack"); Screen::paintString(Screen::Pen(' ', COLOR_BLACK, COLOR_GREY), diff --git a/plugins/hotkeys.cpp b/plugins/hotkeys.cpp index 136ad7a9d..ef2ca9422 100644 --- a/plugins/hotkeys.cpp +++ b/plugins/hotkeys.cpp @@ -103,7 +103,7 @@ static void find_active_keybindings(color_ostream &out, df::viewscreen *screen, } for (int i = 1; i <= 12; i++) { - valid_keys.push_back("F" + int_to_string(i)); + valid_keys.push_back('F' + int_to_string(i)); } valid_keys.push_back("`");