aboutsummaryrefslogtreecommitdiff
path: root/lib/curl_setup.h
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2017-07-10 14:56:11 +0200
committerMarcel Raad <Marcel.Raad@teamviewer.com>2017-07-11 11:57:00 +0200
commitbeb08481d01a07a8b10938b1078a5e298b1c2912 (patch)
tree4c364e4fc65c73822597fbecedf333014dea2be0 /lib/curl_setup.h
parentc5e87fdb7a60c1c4ef158a876e730b25be7a0894 (diff)
curl_setup: always define WIN32_LEAN_AND_MEAN on Windows
Make sure to always define WIN32_LEAN_AND_MEAN before including any Windows headers to avoid pulling in unnecessary headers. This avoids unnecessary macro clashes and compiler warnings. Ref: https://github.com/curl/curl/issues/1562 Closes https://github.com/curl/curl/pull/1672
Diffstat (limited to 'lib/curl_setup.h')
-rw-r--r--lib/curl_setup.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/curl_setup.h b/lib/curl_setup.h
index eb4f038dd..fc597d75d 100644
--- a/lib/curl_setup.h
+++ b/lib/curl_setup.h
@@ -31,6 +31,17 @@
#define WIN32
#endif
+#ifdef WIN32
+/*
+ * Don't include unneeded stuff in Windows headers to avoid compiler
+ * warnings and macro clashes.
+ * Make sure to define this macro before including any Windows headers.
+ */
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+#endif
+
/*
* Include configuration script results or hand-crafted
* configuration file for platforms which lack config tool.
@@ -237,9 +248,6 @@
# if defined(_UNICODE) && !defined(UNICODE)
# define UNICODE
# endif
-# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-# endif
# include <windows.h>
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h>