Re: [xml] Patch to guard #define WIN32_LEAN_AND_MEAN



On 11/9/2017 12:33 AM, Joel Hockey wrote:
I'm having errors in chromium doing a rollup to the latest code.
https://logs.chromium.org/v/?s=chromium%2Fbb%2Ftryserver.chromium.win%2Fwin7_chromium_rel_ng%2F39058%2F%2B%2Frecipes%2Fsteps%2Fcompile__with_patch_%2F0%2Fstdout

The error I get is because we already have WIN32_LEAN_AND_MEAN defined. 
The attached patch guards the definition.

 #if defined(_WIN32) && !defined(__CYGWIN__)

Testing for !defined(__CYGWIN__) here is meaningless.  _WIN32 isn't
defined in GCC with __CYGWIN__ defined and vice versa.

$ gcc -dM -E -x c /dev/null | grep WIN
#define __WINT_MAX__ 0xffffffffU
#define __WINT_MIN__ 0U
#define __SIZEOF_WINT_T__ 4
#define __CYGWIN__ 1
#define __WINT_TYPE__ unsigned int


+#ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
+#endif
 #include <windows.h>
 #endif

An alternative is:

 #if defined(_WIN32) && !defined(__CYGWIN__) &&
!defined(WIN32_LEAN_AND_MEAN)

This is probably better but remove the test for __CYGWIN__.

 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #endif


-- 
Earnie


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]