[compiler-rt] r343014 - [ASan] [Windows] Avoid including windows.h in asan_malloc_win.cc

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 25 12:50:36 PDT 2018


Author: mstorsjo
Date: Tue Sep 25 12:50:36 2018
New Revision: 343014

URL: http://llvm.org/viewvc/llvm-project?rev=343014&view=rev
Log:
[ASan] [Windows] Avoid including windows.h in asan_malloc_win.cc

Instead provide manual declarations of the used types, to avoid
pulling in conflicting declarations of some of the functions that
are to be overridden.

Differential Revision: https://reviews.llvm.org/D51914

Modified:
    compiler-rt/trunk/lib/asan/asan_malloc_win.cc

Modified: compiler-rt/trunk/lib/asan/asan_malloc_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_malloc_win.cc?rev=343014&r1=343013&r2=343014&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_malloc_win.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_malloc_win.cc Tue Sep 25 12:50:36 2018
@@ -14,8 +14,17 @@
 
 #include "sanitizer_common/sanitizer_platform.h"
 #if SANITIZER_WINDOWS
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+// Intentionally not including windows.h here, to avoid the risk of
+// pulling in conflicting declarations of these functions. (With mingw-w64,
+// there's a risk of windows.h pulling in stdint.h.)
+typedef int BOOL;
+typedef void *HANDLE;
+typedef const void *LPCVOID;
+typedef void *LPVOID;
+
+#define HEAP_ZERO_MEMORY           0x00000008
+#define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
+
 
 #include "asan_allocator.h"
 #include "asan_interceptors.h"




More information about the llvm-commits mailing list