Delegate WIN32_LEAN_AND_MEAN definition to the toolchain.

The macro WIN32_LEAN_AND_MEAN is always defined by the toolchain, see
the config //build/config/win:lean_and_mean [1].

This means that WebRTC should not define it in its source files, this
causes two problems:

1. rtc_base:rtc_base_generinc needs to use /wd4005 to avoid a compiler
   warning (because the macro is redefined without checking).
2. the macro is not consistently defined before including windows.h,
   which means that WebRTC already relies on the toolchain almost
   everywhere.

[1] - https://cs.chromium.org/chromium/src/build/config/win/BUILD.gn?l=514&rcl=54f7be95955c9b35e64569c1d40e0c3dd097359c

Bug: webrtc:9251
Change-Id: I2b0b3c16856023db2a38a38f7652bb849ff283c7
Reviewed-on: https://webrtc-review.googlesource.com/87582
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23889}
This commit is contained in:
Mirko Bonadei 2018-07-09 20:18:30 +02:00 committed by Commit Bot
parent 478313fa8e
commit 3e8cb4718b
6 changed files with 0 additions and 19 deletions

View file

@ -950,11 +950,6 @@ rtc_static_library("rtc_base_generic") {
"secur32.lib",
]
cflags += [
# Suppress warnings about WIN32_LEAN_AND_MEAN.
"/wd4005",
]
defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
}

View file

@ -9,9 +9,6 @@
*/
#if defined(WEBRTC_WIN)
#if !defined(WIN32_LEAN_AND_MEAN)
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#if _MSC_VER < 1900
#define snprintf _snprintf

View file

@ -32,7 +32,6 @@
#endif
#if defined(WEBRTC_WIN)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>

View file

@ -110,9 +110,6 @@
#define _SIGSLOT_SINGLE_THREADED
#elif defined(WEBRTC_WIN)
#define _SIGSLOT_HAS_WIN32_THREADS
#if !defined(WIN32_LEAN_AND_MEAN)
#define WIN32_LEAN_AND_MEAN
#endif
#include "rtc_base/win32.h"
#elif defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS)
#define _SIGSLOT_HAS_POSIX_THREADS

View file

@ -18,9 +18,6 @@
#endif
#if defined(WEBRTC_WIN)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
// clang-format off
// clang formatting would put <windows.h> last,
// which leads to compilation failure.

View file

@ -15,10 +15,6 @@
#error "Only #include this header in Windows builds"
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
// Make sure we don't get min/max macros
#ifndef NOMINMAX
#define NOMINMAX