From 99fc16bfd02dc31f241ee4e45575a537ac868624 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 17 Mar 2022 14:02:02 -0700 Subject: [PATCH] strat: only include windows.h in translation units where actually needed --- libraries/libstratosphere/include/stratosphere.hpp | 4 ---- .../source/crypto/crypto_csrng.os.windows.cpp | 1 + .../source/diag/impl/diag_backtrace_impl.os.generic.cpp | 4 +++- .../source/diag/impl/diag_default_abort_observer.cpp | 4 ++++ .../source/diag/impl/diag_symbol_impl.os.windows.cpp | 1 + .../libstratosphere/source/fssrv/impl/fssrv_utility.cpp | 5 ++++- .../source/fssystem/fssystem_local_file_system.cpp | 1 + .../source/mem/impl/mem_impl_platform.os.windows.cpp | 1 + .../source/os/impl/os_debug_impl.os.windows.hpp | 1 + .../source/os/impl/os_giant_lock.os.windows.cpp | 1 + .../os/impl/os_inter_process_event_impl.os.windows.cpp | 1 + .../impl/os_internal_condition_variable_impl.os.windows.cpp | 1 + .../os/impl/os_internal_critical_section_impl.os.windows.cpp | 1 + .../source/os/impl/os_native_handle_impl.os.windows.hpp | 1 + .../source/os/impl/os_process_handle_impl.os.windows.hpp | 1 + .../source/os/impl/os_thread_manager_impl.os.windows.hpp | 2 +- .../source/os/impl/os_tick_manager_impl.os.windows.hpp | 5 +++++ 17 files changed, 28 insertions(+), 7 deletions(-) diff --git a/libraries/libstratosphere/include/stratosphere.hpp b/libraries/libstratosphere/include/stratosphere.hpp index d4666602a..bc5547f97 100644 --- a/libraries/libstratosphere/include/stratosphere.hpp +++ b/libraries/libstratosphere/include/stratosphere.hpp @@ -24,10 +24,6 @@ /* libvapours (pulls in util, svc, results). */ #include -#if defined(ATMOSPHERE_OS_WINDOWS) -#include -#endif - /* Libstratosphere diagnostics. */ #include diff --git a/libraries/libstratosphere/source/crypto/crypto_csrng.os.windows.cpp b/libraries/libstratosphere/source/crypto/crypto_csrng.os.windows.cpp index ef5707457..a75f0b60c 100644 --- a/libraries/libstratosphere/source/crypto/crypto_csrng.os.windows.cpp +++ b/libraries/libstratosphere/source/crypto/crypto_csrng.os.windows.cpp @@ -14,6 +14,7 @@ * along with this program. If not, see . */ #include +#include #include #include diff --git a/libraries/libstratosphere/source/diag/impl/diag_backtrace_impl.os.generic.cpp b/libraries/libstratosphere/source/diag/impl/diag_backtrace_impl.os.generic.cpp index 9cd49070a..db9a076af 100644 --- a/libraries/libstratosphere/source/diag/impl/diag_backtrace_impl.os.generic.cpp +++ b/libraries/libstratosphere/source/diag/impl/diag_backtrace_impl.os.generic.cpp @@ -15,7 +15,9 @@ */ #include -#if defined(ATMOSPHERE_OS_LINUX) || defined(ATMOSPHERE_OS_MACOS) +#if defined(ATMOSPHERE_OS_WINDOWS) +#include +#elif defined(ATMOSPHERE_OS_LINUX) || defined(ATMOSPHERE_OS_MACOS) #include #include #endif diff --git a/libraries/libstratosphere/source/diag/impl/diag_default_abort_observer.cpp b/libraries/libstratosphere/source/diag/impl/diag_default_abort_observer.cpp index 4c0224808..3e3817455 100644 --- a/libraries/libstratosphere/source/diag/impl/diag_default_abort_observer.cpp +++ b/libraries/libstratosphere/source/diag/impl/diag_default_abort_observer.cpp @@ -16,6 +16,10 @@ #include #include "diag_dump_stack_trace.hpp" +#if defined(ATMOSPHERE_OS_WINDOWS) +#include +#endif + namespace ams::diag::impl { #if defined(AMS_BUILD_FOR_DEBUGGING) || defined(AMS_BUILD_FOR_DEBUGGING) diff --git a/libraries/libstratosphere/source/diag/impl/diag_symbol_impl.os.windows.cpp b/libraries/libstratosphere/source/diag/impl/diag_symbol_impl.os.windows.cpp index 15d9ea6ae..20660f6b2 100644 --- a/libraries/libstratosphere/source/diag/impl/diag_symbol_impl.os.windows.cpp +++ b/libraries/libstratosphere/source/diag/impl/diag_symbol_impl.os.windows.cpp @@ -14,6 +14,7 @@ * along with this program. If not, see . */ #include +#include #include "diag_symbol_impl.hpp" #include diff --git a/libraries/libstratosphere/source/fssrv/impl/fssrv_utility.cpp b/libraries/libstratosphere/source/fssrv/impl/fssrv_utility.cpp index fe99a9288..d5489b4ea 100644 --- a/libraries/libstratosphere/source/fssrv/impl/fssrv_utility.cpp +++ b/libraries/libstratosphere/source/fssrv/impl/fssrv_utility.cpp @@ -16,7 +16,10 @@ #include #include "fssrv_utility.hpp" -#if defined(ATMOSPHERE_OS_LINUX) + +#if defined(ATMOSPHERE_OS_WINDOWS) +#include +#elif defined(ATMOSPHERE_OS_LINUX) #include #elif defined(ATMOSPHERE_OS_MACOS) #include diff --git a/libraries/libstratosphere/source/fssystem/fssystem_local_file_system.cpp b/libraries/libstratosphere/source/fssystem/fssystem_local_file_system.cpp index 256132691..6c258a890 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_local_file_system.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_local_file_system.cpp @@ -15,6 +15,7 @@ */ #include #if defined(ATMOSPHERE_OS_WINDOWS) +#include #include #include #elif defined(ATMOSPHERE_OS_LINUX) || defined(ATMOSPHERE_OS_MACOS) diff --git a/libraries/libstratosphere/source/mem/impl/mem_impl_platform.os.windows.cpp b/libraries/libstratosphere/source/mem/impl/mem_impl_platform.os.windows.cpp index 7f4424485..cfa31163f 100644 --- a/libraries/libstratosphere/source/mem/impl/mem_impl_platform.os.windows.cpp +++ b/libraries/libstratosphere/source/mem/impl/mem_impl_platform.os.windows.cpp @@ -14,6 +14,7 @@ * along with this program. If not, see . */ #include +#include #include #include "mem_impl_platform.hpp" diff --git a/libraries/libstratosphere/source/os/impl/os_debug_impl.os.windows.hpp b/libraries/libstratosphere/source/os/impl/os_debug_impl.os.windows.hpp index 7e596f36d..7d25d64a7 100644 --- a/libraries/libstratosphere/source/os/impl/os_debug_impl.os.windows.hpp +++ b/libraries/libstratosphere/source/os/impl/os_debug_impl.os.windows.hpp @@ -15,6 +15,7 @@ */ #pragma once #include +#include namespace ams::os::impl { diff --git a/libraries/libstratosphere/source/os/impl/os_giant_lock.os.windows.cpp b/libraries/libstratosphere/source/os/impl/os_giant_lock.os.windows.cpp index 2116689cc..1fb56adf0 100644 --- a/libraries/libstratosphere/source/os/impl/os_giant_lock.os.windows.cpp +++ b/libraries/libstratosphere/source/os/impl/os_giant_lock.os.windows.cpp @@ -14,6 +14,7 @@ * along with this program. If not, see . */ #include +#include #include "os_giant_lock.os.windows.hpp" namespace ams::os::impl { diff --git a/libraries/libstratosphere/source/os/impl/os_inter_process_event_impl.os.windows.cpp b/libraries/libstratosphere/source/os/impl/os_inter_process_event_impl.os.windows.cpp index dc7d2caed..7041d95c6 100644 --- a/libraries/libstratosphere/source/os/impl/os_inter_process_event_impl.os.windows.cpp +++ b/libraries/libstratosphere/source/os/impl/os_inter_process_event_impl.os.windows.cpp @@ -14,6 +14,7 @@ * along with this program. If not, see . */ #include +#include #include "os_inter_process_event.hpp" #include "os_inter_process_event_impl.os.windows.hpp" #include "os_giant_lock.hpp" diff --git a/libraries/libstratosphere/source/os/impl/os_internal_condition_variable_impl.os.windows.cpp b/libraries/libstratosphere/source/os/impl/os_internal_condition_variable_impl.os.windows.cpp index d683e9696..2ffcc89c2 100644 --- a/libraries/libstratosphere/source/os/impl/os_internal_condition_variable_impl.os.windows.cpp +++ b/libraries/libstratosphere/source/os/impl/os_internal_condition_variable_impl.os.windows.cpp @@ -14,6 +14,7 @@ * along with this program. If not, see . */ #include +#include #include "os_internal_critical_section_impl.os.windows.hpp" #include "os_timeout_helper.hpp" #include "os_thread_manager.hpp" diff --git a/libraries/libstratosphere/source/os/impl/os_internal_critical_section_impl.os.windows.cpp b/libraries/libstratosphere/source/os/impl/os_internal_critical_section_impl.os.windows.cpp index 2ede6cedf..7acb21936 100644 --- a/libraries/libstratosphere/source/os/impl/os_internal_critical_section_impl.os.windows.cpp +++ b/libraries/libstratosphere/source/os/impl/os_internal_critical_section_impl.os.windows.cpp @@ -14,6 +14,7 @@ * along with this program. If not, see . */ #include +#include #include "os_internal_critical_section_impl.os.windows.hpp" namespace ams::os::impl { diff --git a/libraries/libstratosphere/source/os/impl/os_native_handle_impl.os.windows.hpp b/libraries/libstratosphere/source/os/impl/os_native_handle_impl.os.windows.hpp index e181cb478..6451a4ca7 100644 --- a/libraries/libstratosphere/source/os/impl/os_native_handle_impl.os.windows.hpp +++ b/libraries/libstratosphere/source/os/impl/os_native_handle_impl.os.windows.hpp @@ -15,6 +15,7 @@ */ #pragma once #include +#include namespace ams::os::impl { diff --git a/libraries/libstratosphere/source/os/impl/os_process_handle_impl.os.windows.hpp b/libraries/libstratosphere/source/os/impl/os_process_handle_impl.os.windows.hpp index 5146698ca..78fa40479 100644 --- a/libraries/libstratosphere/source/os/impl/os_process_handle_impl.os.windows.hpp +++ b/libraries/libstratosphere/source/os/impl/os_process_handle_impl.os.windows.hpp @@ -15,6 +15,7 @@ */ #pragma once #include +#include namespace ams::os::impl { diff --git a/libraries/libstratosphere/source/os/impl/os_thread_manager_impl.os.windows.hpp b/libraries/libstratosphere/source/os/impl/os_thread_manager_impl.os.windows.hpp index b7a8ae4ad..1b47aae28 100644 --- a/libraries/libstratosphere/source/os/impl/os_thread_manager_impl.os.windows.hpp +++ b/libraries/libstratosphere/source/os/impl/os_thread_manager_impl.os.windows.hpp @@ -22,7 +22,7 @@ namespace ams::os::impl { NON_COPYABLE(ThreadManagerWindowsImpl); NON_MOVEABLE(ThreadManagerWindowsImpl); private: - DWORD m_tls_index; + u32 m_tls_index; public: explicit ThreadManagerWindowsImpl(ThreadType *main_thread); diff --git a/libraries/libstratosphere/source/os/impl/os_tick_manager_impl.os.windows.hpp b/libraries/libstratosphere/source/os/impl/os_tick_manager_impl.os.windows.hpp index e09ca29fd..88cccf0c6 100644 --- a/libraries/libstratosphere/source/os/impl/os_tick_manager_impl.os.windows.hpp +++ b/libraries/libstratosphere/source/os/impl/os_tick_manager_impl.os.windows.hpp @@ -15,6 +15,11 @@ */ #pragma once #include + +#if defined(ATMOSPHERE_OS_WINDOWS) +#include +#endif + #include namespace ams::os::impl {