summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorAnsariel Hiller <Ansariel@users.noreply.github.com>2024-09-13 16:28:48 +0200
committerGitHub <noreply@github.com>2024-09-13 17:28:48 +0300
commit74205607b7e106f3b7566ef4a4b9c2fcdfa2f83e (patch)
tree593cc976564d355a31c364ed2f715e30c86784ef /indra/llcommon
parentc892ce9f5cf7582a1eb5ed27de117eedf3c2addc (diff)
Clean up Windows build (#2562)
* APR_DECLARE_STATIC and APU_DECLARE_STATIC gets already defined in APR.cmake * Move both _CRT_SECURE_NO_WARNINGS and _WINSOCK_DEPRECATED_NO_WARNINGS definitions to 00-Common.cmake * Always define WIN32_LEAN_AND_MEAN and include subset of Windows API by default * Remove llwin32headerslean.h and remove unnecessary WIN32_LEAN_AND_MEAN definition handling in llwin32headers.h * Clean up includes of Windows API headers * Get rid of workaround to link against IPHLPAPI.lib in lluuid.cpp - this seems to have been an issue in the past that has been fixed
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/CMakeLists.txt1
-rw-r--r--indra/llcommon/llapr.h2
-rw-r--r--indra/llcommon/llfile.cpp2
-rw-r--r--indra/llcommon/llpreprocessor.h16
-rw-r--r--indra/llcommon/llprocess.h3
-rw-r--r--indra/llcommon/llprocessor.cpp2
-rw-r--r--indra/llcommon/llsdutil.cpp3
-rw-r--r--indra/llcommon/llstacktrace.cpp2
-rw-r--r--indra/llcommon/llstring.cpp3
-rw-r--r--indra/llcommon/llsys.cpp2
-rw-r--r--indra/llcommon/lltimer.cpp2
-rw-r--r--indra/llcommon/lluuid.cpp3
-rw-r--r--indra/llcommon/llwin32headers.h11
-rw-r--r--indra/llcommon/llwin32headerslean.h40
14 files changed, 11 insertions, 81 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 437b8d0168..60549d9d11 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -240,7 +240,6 @@ set(llcommon_HEADER_FILES
lluriparser.h
lluuid.h
llwin32headers.h
- llwin32headerslean.h
llworkerthread.h
hbxxh.h
lockstatic.h
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index 00ff4d60b7..693cd7c01f 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -34,7 +34,7 @@
#endif
#include <boost/noncopyable.hpp>
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include "apr_thread_proc.h"
#include "apr_getopt.h"
#include "apr_signal.h"
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp
index ed94ef21ef..d0bc8f7652 100644
--- a/indra/llcommon/llfile.cpp
+++ b/indra/llcommon/llfile.cpp
@@ -34,7 +34,7 @@
#include "stringize.h"
#if LL_WINDOWS
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include <stdlib.h> // Windows errno
#include <vector>
#else
diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h
index a528cc7fd8..b499a9ce10 100644
--- a/indra/llcommon/llpreprocessor.h
+++ b/indra/llcommon/llpreprocessor.h
@@ -98,15 +98,6 @@
# define LL_THREAD_LOCAL __thread
#endif
-// Static linking with apr on windows needs to be declared.
-#if LL_WINDOWS && !LL_COMMON_LINK_SHARED
-#ifndef APR_DECLARE_STATIC
-#define APR_DECLARE_STATIC // For APR on Windows
-#endif
-#ifndef APU_DECLARE_STATIC
-#define APU_DECLARE_STATIC // For APR util on Windows
-#endif
-#endif
#if defined(LL_WINDOWS)
#define BOOST_REGEX_NO_LIB 1
@@ -119,13 +110,6 @@
// Deal with VC++ problems
#if LL_MSVC
-#ifndef _CRT_SECURE_NO_WARNINGS
-#define _CRT_SECURE_NO_WARNINGS // disable warnings for methods considered unsafe
-#endif
-#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
-#define _WINSOCK_DEPRECATED_NO_WARNINGS // disable deprecated WinSock API warnings
-#endif
-
// level 4 warnings that we need to disable:
#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h
index 39ed29c1b4..cc2d6566fc 100644
--- a/indra/llcommon/llprocess.h
+++ b/indra/llcommon/llprocess.h
@@ -29,7 +29,6 @@
#include "llinitparam.h"
#include "llsdparam.h"
-#include "llwin32headerslean.h"
#include "llexception.h"
#include "apr_thread_proc.h"
#include <boost/ptr_container/ptr_vector.hpp>
@@ -38,7 +37,7 @@
#include <iosfwd> // std::ostream
#if LL_WINDOWS
-#include "llwin32headerslean.h" // for HANDLE
+#include "llwin32headers.h" // for HANDLE
#elif LL_LINUX
#if defined(Status)
#undef Status
diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp
index 9d53b9be35..41ff369de2 100644
--- a/indra/llcommon/llprocessor.cpp
+++ b/indra/llcommon/llprocessor.cpp
@@ -34,7 +34,7 @@
//#include <memory>
#if LL_WINDOWS
-# include "llwin32headerslean.h"
+# include "llwin32headers.h"
# define _interlockedbittestandset _renamed_interlockedbittestandset
# define _interlockedbittestandreset _renamed_interlockedbittestandreset
# include <intrin.h>
diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp
index 12f67208c1..dbd89118c9 100644
--- a/indra/llcommon/llsdutil.cpp
+++ b/indra/llcommon/llsdutil.cpp
@@ -32,8 +32,7 @@
#include <sstream>
#if LL_WINDOWS
-# define WIN32_LEAN_AND_MEAN
-# include <winsock2.h> // for htonl
+# include "llwin32headers.h" // for htonl
#elif LL_LINUX
# include <netinet/in.h>
#elif LL_DARWIN
diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp
index ca8f4299d9..c223c26bb0 100644
--- a/indra/llcommon/llstacktrace.cpp
+++ b/indra/llcommon/llstacktrace.cpp
@@ -32,7 +32,7 @@
#include <iostream>
#include <sstream>
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include <dbghelp.h>
typedef USHORT NTAPI RtlCaptureStackBackTrace_Function(
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index 2c40ff3efd..07adf71d18 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -33,8 +33,7 @@
#include <vector>
#if LL_WINDOWS
-#include "llwin32headerslean.h"
-#include <winnls.h> // for WideCharToMultiByte
+#include "llwin32headers.h"
#endif
std::string ll_safe_string(const char* in)
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 79625ad9f8..3f33ad61c5 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -59,7 +59,7 @@
using namespace llsd;
#if LL_WINDOWS
-# include "llwin32headerslean.h"
+# include "llwin32headers.h"
# include <psapi.h> // GetPerformanceInfo() et al.
# include <VersionHelpers.h>
#elif LL_DARWIN
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index 28d6e4e4cc..f36d223100 100644
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -34,7 +34,7 @@
#include <thread>
#if LL_WINDOWS
-# include "llwin32headerslean.h"
+# include "llwin32headers.h"
#elif LL_LINUX || LL_DARWIN
# include <errno.h>
# include <sys/time.h>
diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index 7aeabc3c4a..b9bd27aa17 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -25,11 +25,8 @@
#include "linden_common.h"
- // We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
#if LL_WINDOWS
#include "llwin32headers.h"
-// ugh, this is ugly. We need to straighten out our linking for this library
-#pragma comment(lib, "IPHLPAPI.lib")
#include <iphlpapi.h>
#include <nb30.h>
#endif
diff --git a/indra/llcommon/llwin32headers.h b/indra/llcommon/llwin32headers.h
index f679adc200..df433deb7a 100644
--- a/indra/llcommon/llwin32headers.h
+++ b/indra/llcommon/llwin32headers.h
@@ -28,15 +28,8 @@
#define LL_LLWINDOWS_H
#ifdef LL_WINDOWS
-#ifndef NOMINMAX
-#define NOMINMAX
-#endif
-#undef WIN32_LEAN_AND_MEAN
-#include <winsock2.h>
-#include <windows.h>
-// reset to default, which is lean
-#define WIN32_LEAN_AND_MEAN
-#undef NOMINMAX
+#include <windows.h> // Does not include winsock.h because WIN32_LEAN_AND_MEAN is defined
+#include <winsock2.h> // Requires windows.h
#endif
#endif
diff --git a/indra/llcommon/llwin32headerslean.h b/indra/llcommon/llwin32headerslean.h
deleted file mode 100644
index 97c8edb8cf..0000000000
--- a/indra/llcommon/llwin32headerslean.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * @file llwin32headerslean.h
- * @brief sanitized include of windows header files
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLWINDOWS_H
-#define LL_LLWINDOWS_H
-
-#ifdef LL_WINDOWS
-#ifndef NOMINMAX
-#define NOMINMAX
-#endif
-#define WIN32_LEAN_AND_MEAN
-#include <winsock2.h>
-#include <windows.h>
-#undef NOMINMAX
-#endif
-
-#endif