From 98df2edd597789130b8c67d2aac3ce635038970b Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Wed, 7 Apr 2021 03:06:40 -0400 Subject: [PATCH] Windows header cleanup for faster compilation --- indra/llcommon/StackWalker.h | 2 +- indra/llcommon/llapp.cpp | 2 +- indra/llcommon/llmemory.cpp | 1 + indra/llcommon/llprocess.h | 6 ++---- indra/llcommon/llprocinfo.cpp | 5 ++--- indra/llcommon/llsdutil.cpp | 3 +-- indra/llcommon/llwin32headers.h | 8 ++++++-- indra/llcommon/llwin32headerslean.h | 6 ++++++ indra/llmath/llsdutil_math.cpp | 3 +-- indra/llmessage/llcoproceduremanager.cpp | 2 +- indra/llmessage/llfiltersd2xmlrpc.cpp | 3 +++ indra/llmessage/llhost.cpp | 3 +-- indra/llmessage/llpacketring.cpp | 2 +- indra/llmessage/llpumpio.h | 1 + indra/llmessage/message.h | 2 +- indra/newview/llappviewerwin32.cpp | 2 +- indra/newview/llfilepicker.h | 2 +- indra/newview/llmeshrepository.cpp | 4 ---- indra/newview/llviewerprecompiledheaders.h | 2 +- indra/viewer_components/login/lllogin.cpp | 4 +++- 20 files changed, 35 insertions(+), 28 deletions(-) diff --git a/indra/llcommon/StackWalker.h b/indra/llcommon/StackWalker.h index 4634765d0b1..e2a257f6344 100644 --- a/indra/llcommon/StackWalker.h +++ b/indra/llcommon/StackWalker.h @@ -43,7 +43,7 @@ // so we need not to check the version (because we only support _MSC_VER >= 1100)! #pragma once -#include <windows.h> +#include "llwin32headerslean.h" // special defines for VC5/6 (if no actual PSDK is installed): #if _MSC_VER < 1300 diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index cf1ade454fe..a2df383d4f6 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -57,7 +57,7 @@ // Windows uses structured exceptions, so it's handled a bit differently. // #if LL_WINDOWS -#include "windows.h" +#include "llwin32headerslean.h" LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop); BOOL ConsoleCtrlHandler(DWORD fdwCtrlType); diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index f80bb5001af..0dd433f1b7c 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -30,6 +30,7 @@ #include "llthread.h" #if defined(LL_WINDOWS) +#include "llwin32headerslean.h" # include <psapi.h> #elif defined(LL_DARWIN) # include <sys/types.h> diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 0a0b6f0a3f8..0c3b4b02ea8 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -29,7 +29,7 @@ #include "llinitparam.h" #include "llsdparam.h" -#include "llwin32headerslean.h" +#include "llwin32headerslean.h" // for HANDLE #include "llexception.h" #include "apr_thread_proc.h" #include <boost/shared_ptr.hpp> @@ -38,9 +38,7 @@ #include <boost/noncopyable.hpp> #include <iosfwd> // std::ostream -#if LL_WINDOWS -#include "llwin32headerslean.h" // for HANDLE -#elif LL_LINUX +#if LL_LINUX #if defined(Status) #undef Status #endif diff --git a/indra/llcommon/llprocinfo.cpp b/indra/llcommon/llprocinfo.cpp index c00f979b0b2..1d0dfe315ee 100644 --- a/indra/llcommon/llprocinfo.cpp +++ b/indra/llcommon/llprocinfo.cpp @@ -30,9 +30,8 @@ #if LL_WINDOWS -#define PSAPI_VERSION 1 -#include "windows.h" -#include "psapi.h" +#include "llwin32headerslean.h" +#include <psapi.h> #elif LL_DARWIN diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index f53e7981e2b..0d893023d80 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -31,8 +31,7 @@ #include "llsdutil.h" #if LL_WINDOWS -# define WIN32_LEAN_AND_MEAN -# include <winsock2.h> // for htonl +#include "llwin32headerslean.h" #elif LL_LINUX || LL_SOLARIS # include <netinet/in.h> #elif LL_DARWIN diff --git a/indra/llcommon/llwin32headers.h b/indra/llcommon/llwin32headers.h index 176efd2c11b..84571b1ddfb 100644 --- a/indra/llcommon/llwin32headers.h +++ b/indra/llcommon/llwin32headers.h @@ -31,10 +31,14 @@ #ifndef NOMINMAX #define NOMINMAX #endif +#ifndef PSAPI_VERSION +#define PSAPI_VERSION 2 +#endif #undef WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <windows.h> +#include <WinSock2.h> +#include <Windows.h> #include <Ws2ipdef.h> +#include <Psapi.h> // reset to default, which is lean #define WIN32_LEAN_AND_MEAN #undef NOMINMAX diff --git a/indra/llcommon/llwin32headerslean.h b/indra/llcommon/llwin32headerslean.h index 083d28c38bd..5defc6b1401 100644 --- a/indra/llcommon/llwin32headerslean.h +++ b/indra/llcommon/llwin32headerslean.h @@ -31,10 +31,16 @@ #ifndef NOMINMAX #define NOMINMAX #endif +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif +#ifndef PSAPI_VERSION +#define PSAPI_VERSION 2 +#endif #include <winsock2.h> #include <windows.h> #include <Ws2ipdef.h> +#include <psapi.h> #undef NOMINMAX #endif diff --git a/indra/llmath/llsdutil_math.cpp b/indra/llmath/llsdutil_math.cpp index 591f7fde360..208374c6876 100644 --- a/indra/llmath/llsdutil_math.cpp +++ b/indra/llmath/llsdutil_math.cpp @@ -38,8 +38,7 @@ #include "v4color.h" #if LL_WINDOWS -# define WIN32_LEAN_AND_MEAN -# include <winsock2.h> // for htonl +#include "llwin32headerslean.h" #elif LL_LINUX || LL_SOLARIS # include <netinet/in.h> #elif LL_DARWIN diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index c348d274b16..35f82b3a275 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -25,7 +25,7 @@ * $/LicenseInfo$ */ -#include "llwin32headers.h" +#include "llwin32headerslean.h" #include "linden_common.h" diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp index d3e195789bf..47e82557c6c 100644 --- a/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -71,6 +71,9 @@ */ #include "linden_common.h" + +#include "llwin32headerslean.h" + #include "llfiltersd2xmlrpc.h" #include <sstream> diff --git a/indra/llmessage/llhost.cpp b/indra/llmessage/llhost.cpp index 00b32a676ab..8d1747d47c3 100644 --- a/indra/llmessage/llhost.cpp +++ b/indra/llmessage/llhost.cpp @@ -31,8 +31,7 @@ #include "llerror.h" #if LL_WINDOWS - #define WIN32_LEAN_AND_MEAN - #include <winsock2.h> + #include "llwin32headerslean.h" #else #include <netdb.h> #include <netinet/in.h> // ntonl() diff --git a/indra/llmessage/llpacketring.cpp b/indra/llmessage/llpacketring.cpp index 687212ea106..a23d6c9fb6b 100644 --- a/indra/llmessage/llpacketring.cpp +++ b/indra/llmessage/llpacketring.cpp @@ -29,7 +29,7 @@ #include "llpacketring.h" #if LL_WINDOWS - #include <winsock2.h> + #include "llwin32headerslean.h" #else #include <sys/socket.h> #include <netinet/in.h> diff --git a/indra/llmessage/llpumpio.h b/indra/llmessage/llpumpio.h index b9eabee710f..1d656e15fff 100644 --- a/indra/llmessage/llpumpio.h +++ b/indra/llmessage/llpumpio.h @@ -34,6 +34,7 @@ #include <sys/param.h> #endif +#include "llwin32headerslean.h" #include "apr_pools.h" #include "llbuffer.h" #include "llframetimer.h" diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 5a07085a24b..4d4f5ad7cc5 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -40,7 +40,7 @@ #endif #if LL_WINDOWS -#include "winsock2.h" // htons etc. +#include "llwin32headerslean.h" // htons etc. #endif #include "llerror.h" diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index f2f1f38bfb6..418d6cc18c9 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -29,7 +29,7 @@ #ifdef INCLUDE_VLD #include "vld.h" #endif -#include "llwin32headers.h" +#include "llwin32headerslean.h" #include "llwindowwin32.h" // *FIX: for setting gIconResource. diff --git a/indra/newview/llfilepicker.h b/indra/newview/llfilepicker.h index 4647ca94985..cdf5af45276 100644 --- a/indra/newview/llfilepicker.h +++ b/indra/newview/llfilepicker.h @@ -49,7 +49,7 @@ // Need commdlg.h for OPENFILENAMEA #ifdef LL_WINDOWS -#include "llwin32headers.h" +#include "llwin32headerslean.h" #include <commdlg.h> #endif diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 08733f64d44..a8e291f5b8d 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -26,10 +26,6 @@ #include "llviewerprecompiledheaders.h" -#include "llapr.h" -#include "apr_portable.h" -#include "apr_pools.h" -#include "apr_dso.h" #include "llhttpconstants.h" #include "llmeshrepository.h" diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 6801d5e54ab..6696891835e 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -29,7 +29,7 @@ #ifndef LL_LLVIEWERPRECOMPILEDHEADERS_H #define LL_LLVIEWERPRECOMPILEDHEADERS_H -#include "llwin32headers.h" +#include "llwin32headerslean.h" // This file MUST be the first one included by each .cpp file // in viewer. diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp index 4909526d4b6..438e3b18dcb 100644 --- a/indra/viewer_components/login/lllogin.cpp +++ b/indra/viewer_components/login/lllogin.cpp @@ -23,8 +23,10 @@ * $/LicenseInfo$ */ -#include "llwin32headers.h" #include "linden_common.h" + +#include "llwin32headerslean.h" + #include "llsd.h" #include "llsdutil.h" -- GitLab