From dd7e4375cfcf017a28a824d365e93339b40a5f68 Mon Sep 17 00:00:00 2001 From: Lioncache Date: Fri, 5 Sep 2025 13:24:15 -0400 Subject: [PATCH 1/9] Config: Add missing includes --- Source/Common/Config.cpp | 2 ++ Source/Common/Config.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Source/Common/Config.cpp b/Source/Common/Config.cpp index 9d840f98b..7409faa3c 100644 --- a/Source/Common/Config.cpp +++ b/Source/Common/Config.cpp @@ -12,10 +12,12 @@ #include #include +#include #ifndef _WIN32 #include #include #endif +#include #include #include diff --git a/Source/Common/Config.h b/Source/Common/Config.h index 13e9cc47c..e0eaea5e0 100644 --- a/Source/Common/Config.h +++ b/Source/Common/Config.h @@ -1,7 +1,13 @@ // SPDX-License-Identifier: MIT #pragma once + #include +#include #include +#include +#include + +#include namespace FEX::ArgLoader { class ArgLoader; From 1f59accb4e09300818af2a5bfd281f3847079994 Mon Sep 17 00:00:00 2001 From: Lioncache Date: Fri, 5 Sep 2025 13:28:02 -0400 Subject: [PATCH 2/9] CPUInfo: Remove unused header --- Source/Common/CPUInfo.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Common/CPUInfo.h b/Source/Common/CPUInfo.h index 9e56a7d1f..10cda7cbb 100644 --- a/Source/Common/CPUInfo.h +++ b/Source/Common/CPUInfo.h @@ -1,6 +1,5 @@ // SPDX-License-Identifier: MIT #pragma once -#include #include From 248ecd54e43faaac370b7c5a4392be930d3ab0af Mon Sep 17 00:00:00 2001 From: Lioncache Date: Fri, 5 Sep 2025 13:30:09 -0400 Subject: [PATCH 3/9] FDUtils: Remove unused headers --- Source/Common/FDUtils.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Source/Common/FDUtils.h b/Source/Common/FDUtils.h index 9081281cd..f4e1d6bb4 100644 --- a/Source/Common/FDUtils.h +++ b/Source/Common/FDUtils.h @@ -1,15 +1,10 @@ // SPDX-License-Identifier: MIT #pragma once -#include -#include #include -#include #include -#include #include -#include #include namespace FEX { From 62f16a3c4b961a3f6c447edda4b068e96efbc54b Mon Sep 17 00:00:00 2001 From: Lioncache Date: Fri, 5 Sep 2025 13:41:09 -0400 Subject: [PATCH 4/9] FEXServerClient: Remove unnecessary includes from header We can reduce includes, such as logging by specifying a concrete size for logging levels, allowing the enum to be forward declared. We can also move FillHeader into the cpp file, allowing the syscalls header to be removed. --- FEXCore/include/FEXCore/Utils/LogManager.h | 2 +- Source/Common/FEXServerClient.cpp | 12 +++++++++++ Source/Common/FEXServerClient.h | 24 +++++++++------------- Source/Tools/FEXServer/SquashFS.cpp | 2 ++ 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/FEXCore/include/FEXCore/Utils/LogManager.h b/FEXCore/include/FEXCore/Utils/LogManager.h index 3b74a693f..64093db8b 100644 --- a/FEXCore/include/FEXCore/Utils/LogManager.h +++ b/FEXCore/include/FEXCore/Utils/LogManager.h @@ -9,7 +9,7 @@ #include namespace LogMan { -enum DebugLevels { +enum DebugLevels : uint32_t { NONE = 0, ///< Expect zero messages ASSERT = 1, ///< Assert throwing ERROR = 2, ///< Only Errors printed diff --git a/Source/Common/FEXServerClient.cpp b/Source/Common/FEXServerClient.cpp index 6582d6c07..f77c5eb3d 100644 --- a/Source/Common/FEXServerClient.cpp +++ b/Source/Common/FEXServerClient.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -27,6 +28,17 @@ #include namespace FEXServerClient { +Logging::PacketHeader Logging::FillHeader(PacketTypes Type) { + Logging::PacketHeader Msg { + .PacketType = Type, + .PID = ::getpid(), + .TID = FHU::Syscalls::gettid(), + }; + clock_gettime(CLOCK_MONOTONIC, &Msg.Timestamp); + + return Msg; +} + int RequestPIDFDPacket(int ServerSocket, PacketType Type) { fasio::tcp_socket Socket {ServerSocket}; FEXServerRequestPacket Req { diff --git a/Source/Common/FEXServerClient.h b/Source/Common/FEXServerClient.h index 095885043..5bf30dde1 100644 --- a/Source/Common/FEXServerClient.h +++ b/Source/Common/FEXServerClient.h @@ -1,9 +1,16 @@ // SPDX-License-Identifier: MIT #pragma once -#include #include -#include + +#include +#include +#include +#include + +namespace LogMan { +enum DebugLevels : uint32_t; +} namespace FEXServerClient { enum class PacketType { @@ -134,18 +141,7 @@ namespace Logging { static_assert(sizeof(PacketHeader) == 32, "Wrong size"); - [[maybe_unused]] - static PacketHeader FillHeader(Logging::PacketTypes Type) { - - Logging::PacketHeader Msg { - .PacketType = Type, - .PID = ::getpid(), - .TID = FHU::Syscalls::gettid(), - }; - clock_gettime(CLOCK_MONOTONIC, &Msg.Timestamp); - - return Msg; - } + PacketHeader FillHeader(PacketTypes Type); } // namespace Logging void MsgHandler(int FD, LogMan::DebugLevels Level, const char* Message); diff --git a/Source/Tools/FEXServer/SquashFS.cpp b/Source/Tools/FEXServer/SquashFS.cpp index f6af78dd6..3d140586b 100644 --- a/Source/Tools/FEXServer/SquashFS.cpp +++ b/Source/Tools/FEXServer/SquashFS.cpp @@ -5,10 +5,12 @@ #include #include #include +#include #include #include #include +#include #include #include From bac7148d690610b0093b38c8bb6d9dc106d01014 Mon Sep 17 00:00:00 2001 From: Lioncache Date: Fri, 5 Sep 2025 13:52:03 -0400 Subject: [PATCH 5/9] JSONPool: Remove unnecessary include This isn't used in this header. --- Source/Common/JSONPool.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Common/JSONPool.h b/Source/Common/JSONPool.h index 952943485..c78258cab 100644 --- a/Source/Common/JSONPool.h +++ b/Source/Common/JSONPool.h @@ -1,6 +1,5 @@ // SPDX-License-Identifier: MIT -#include #include #include From 62e481a6085316b0cfec06277fe2b4394636966b Mon Sep 17 00:00:00 2001 From: Lioncache Date: Fri, 5 Sep 2025 13:54:22 -0400 Subject: [PATCH 6/9] JSONPool: Remove unnecessary bounds check Given the generic context here, we should just use std::data --- Source/Common/JSONPool.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Common/JSONPool.h b/Source/Common/JSONPool.h index c78258cab..0653e9e9c 100644 --- a/Source/Common/JSONPool.h +++ b/Source/Common/JSONPool.h @@ -2,6 +2,7 @@ #include +#include #include namespace FEX::JSON { @@ -13,10 +14,10 @@ struct JsonAllocator : jsonPool_t { template const json_t* CreateJSON(T& Container, JsonAllocator& Allocator) { - if (Container.empty()) { + if (std::empty(Container)) { return nullptr; } - return json_createWithPool(&Container.at(0), &Allocator); + return json_createWithPool(std::data(Container), &Allocator); } } // namespace FEX::JSON From ea39d80e839f5f23e0509850ea8bfba4c07688f4 Mon Sep 17 00:00:00 2001 From: Lioncache Date: Fri, 5 Sep 2025 13:55:31 -0400 Subject: [PATCH 7/9] StringUtil: Move algorithm header to cpp file The header doesn't make any direct use of it. --- Source/Common/StringUtil.cpp | 2 ++ Source/Common/StringUtil.h | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Common/StringUtil.cpp b/Source/Common/StringUtil.cpp index 5533fe37f..9b0ea8238 100644 --- a/Source/Common/StringUtil.cpp +++ b/Source/Common/StringUtil.cpp @@ -1,6 +1,8 @@ // SPDX-License-Identifier: MIT #include "Common/StringUtil.h" +#include + namespace FEX::StringUtil { void ltrim(fextl::string& s) { s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) { return !std::isspace(ch); })); diff --git a/Source/Common/StringUtil.h b/Source/Common/StringUtil.h index 62c2eddda..357c6f218 100644 --- a/Source/Common/StringUtil.h +++ b/Source/Common/StringUtil.h @@ -1,8 +1,7 @@ // SPDX-License-Identifier: MIT #pragma once -#include -#include +#include namespace FEX::StringUtil { void ltrim(fextl::string& s); From 7869d8007376890b93539cfa2f3e5aa4db057b8f Mon Sep 17 00:00:00 2001 From: Lioncache Date: Fri, 5 Sep 2025 13:58:21 -0400 Subject: [PATCH 8/9] VolatileMetadata: Add missing include --- Source/Common/VolatileMetadata.cpp | 4 ++++ Source/Common/VolatileMetadata.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Source/Common/VolatileMetadata.cpp b/Source/Common/VolatileMetadata.cpp index d334e2ecf..52de3b9fb 100644 --- a/Source/Common/VolatileMetadata.cpp +++ b/Source/Common/VolatileMetadata.cpp @@ -1,6 +1,10 @@ // SPDX-License-Identifier: MIT #include "Common/VolatileMetadata.h" +#include + +#include + #include #include diff --git a/Source/Common/VolatileMetadata.h b/Source/Common/VolatileMetadata.h index 21df597c6..e131e9dc2 100644 --- a/Source/Common/VolatileMetadata.h +++ b/Source/Common/VolatileMetadata.h @@ -1,10 +1,13 @@ // SPDX-License-Identifier: MIT #pragma once + #include #include #include #include +#include + namespace FEX::VolatileMetadata { struct ExtendedVolatileMetadata { FEXCore::IntervalList VolatileValidRanges; From 831b21cd395eaad46fed1cebe47bcfe8f6e89a8e Mon Sep 17 00:00:00 2001 From: Lioncache Date: Fri, 5 Sep 2025 14:27:47 -0400 Subject: [PATCH 9/9] JitSymbols: Remove unused includes Reduces header dependencies (and clarifies existing ones). --- FEXCore/Source/Common/JitSymbols.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/FEXCore/Source/Common/JitSymbols.h b/FEXCore/Source/Common/JitSymbols.h index 3fc2502f5..a688b2f7b 100644 --- a/FEXCore/Source/Common/JitSymbols.h +++ b/FEXCore/Source/Common/JitSymbols.h @@ -2,12 +2,10 @@ #pragma once #include -#include #include +#include #include -#include -#include #include namespace FEXCore {